|
@@ -278,7 +278,8 @@ class iassign {
|
|
|
'overwrite' => '$this->get_answer();',
|
|
|
'stats_student' => '$this->stats_students();',
|
|
|
'download_answer' => '$this->export_file_answer();',
|
|
|
- 'download_all_answer' => '$this->export_package_answer();');
|
|
|
+ 'download_all_answer' => '$this->export_package_answer();',
|
|
|
+ 'notifications' => '$this->view_notifications();');
|
|
|
|
|
|
$action_iassign_limit = array(
|
|
|
'view' => '$this->view_iassign_current();',
|
|
@@ -691,6 +692,8 @@ class iassign {
|
|
|
|
|
|
print $OUTPUT->header();
|
|
|
|
|
|
+ $this->print_main_menu();
|
|
|
+
|
|
|
$id = $this->cm->id;
|
|
|
$param_aux = "id=" . $id . "&userid_iassign=" . $USER->id;
|
|
|
$enderecoPOST = "" . $CFG->wwwroot . "/mod/iassign/view.php?" . $param_aux;
|
|
@@ -755,7 +758,7 @@ class iassign {
|
|
|
$iassignid = optional_param('iassignid', NULL, PARAM_TEXT);
|
|
|
$exercises_list = $DB->get_records("iassign_statement", array("iassignid" => $iassignid));
|
|
|
|
|
|
- print '<h2 class="m-b-2">' . get_string('all_submissions_manager', 'iassign') . '';
|
|
|
+ print '<h2 class="m-b-2 mt-5">' . get_string('all_submissions_manager', 'iassign') . '';
|
|
|
print '<i onclick="download_submission(\'block\', 0, 0, '.$iassignid.')" class="fa fa-download" style="float: right; color: #1fa67a; font-size: 1.5rem; cursor: pointer; margin-left: 1rem; margin-top: .2rem;" aria-hidden="true"></i> </h2>';
|
|
|
|
|
|
// Get list of enrolled students:
|
|
@@ -870,7 +873,9 @@ class iassign {
|
|
|
|
|
|
print $OUTPUT->header();
|
|
|
|
|
|
- print '<div><div>' . get_string('auto_evaluate_select', 'iassign') . '</div>';
|
|
|
+ $this->print_main_menu();
|
|
|
+
|
|
|
+ print '<div class="mt-5 mb-4"><div>' . get_string('auto_evaluate_select', 'iassign') . '</div>';
|
|
|
print '<ul style="list-style-type: none; margin: 1em;">';
|
|
|
foreach ($exercises_list as $exercise) {
|
|
|
$matches = [];
|
|
@@ -905,7 +910,7 @@ class iassign {
|
|
|
</div>
|
|
|
</center>'; // close "
|
|
|
|
|
|
- print ' </div>' + "\n";
|
|
|
+ print ' </div>';
|
|
|
print ' <script>';
|
|
|
print '// #submissions = ' . count($exercises_list) . "\n"; //Debug
|
|
|
print ' var submissions = [';
|
|
@@ -1352,36 +1357,43 @@ var exercises = [ '; // '
|
|
|
|
|
|
$context_file = $DB->get_record_sql('SELECT * FROM {context} WHERE instanceid="' . $course_module_info->id . '" AND path like "'.$path_module->path.'%"');
|
|
|
|
|
|
+ $course_module = get_coursemodule_from_instance('iassign', $iassign_destiny);
|
|
|
+
|
|
|
if ($context_file) {
|
|
|
+
|
|
|
$id_context = $context_file->id;
|
|
|
|
|
|
$iassign_statement = $DB->get_record("iassign_statement", array("id" => $iassign_id));
|
|
|
$fs = get_file_storage(); // Get reference to all files in Moodle data
|
|
|
+
|
|
|
+ $context = context_module::instance($USER->cm);
|
|
|
|
|
|
- $files = $fs->get_area_files(context_module::instance($this->cm->id)->id, 'mod_iassign', 'exercise', $iassign_statement->filesid);
|
|
|
+ $files = $fs->get_area_files($context->id, 'mod_iassign', 'exercise', $iassign_statement->filesid);
|
|
|
|
|
|
foreach ($files as $value) {
|
|
|
-
|
|
|
+
|
|
|
if ($value->get_filename() != ".") {
|
|
|
|
|
|
- $last_id = $DB->get_record_sql('SELECT itemid FROM {files} WHERE component="mod_iassign" ORDER BY itemid DESC LIMIT 1')->itemid;
|
|
|
-
|
|
|
- $newfile = $fs->create_file_from_storedfile(array('contextid' => $id_context, 'component' => 'mod_iassign', 'filearea' => 'exercise', 'itemid' => $iassign_id), $value);
|
|
|
+ $fs->delete_area_files(context_module::instance($this->cm->id)->id, 'mod_iassign', 'exercise', $value->get_itemid());
|
|
|
|
|
|
+ $newfile = null;
|
|
|
+
|
|
|
+ $destiny_context = context_module::instance($course_module->id);
|
|
|
+ $newfile = $fs->create_file_from_string(array('contextid' => $destiny_context->id, 'component' => 'mod_iassign', 'filearea' => 'exercise', 'itemid' => $iassign_id, 'filepath' => '/', 'filename' => $value->get_filename()), $value->get_content());
|
|
|
+
|
|
|
$updateentry = new stdClass();
|
|
|
$updateentry->id = $iassign_id;
|
|
|
$updateentry->filesid = $newfile->get_itemid();
|
|
|
|
|
|
$DB->update_record("iassign_statement", $updateentry);
|
|
|
|
|
|
- $fs->delete_area_files(context_module::instance($this->cm->id)->id, 'mod_iassign', 'exercise', $value->get_itemid());
|
|
|
-
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- $this->return_home_course('moved_activity');
|
|
|
+
|
|
|
+ $destiny_url = new moodle_url('/mod/iassign/view.php', array('id' => $course_module->id));
|
|
|
+ redirect($this->return, get_string('moved_activity', 'iassign').' <a href="'.$destiny_url.'">' . get_string('move_activity_access', 'iassign') . '\'' . $course_module->name . '\'</a>', null, \core\output\notification::NOTIFY_SUCCESS);
|
|
|
exit;
|
|
|
}
|
|
|
|
|
@@ -1402,6 +1414,9 @@ var exercises = [ '; // '
|
|
|
// Remove the current id of activity
|
|
|
$iassign_statement->id=0;
|
|
|
|
|
|
+ // Include prefix (Copy of ...)
|
|
|
+ $iassign_statement->name = get_string('duplicate_iassign_prefix', 'iassign') . ' ' . $iassign_statement->name;
|
|
|
+
|
|
|
// Get the information about current author, and add this information in author_modified field
|
|
|
$author = $DB->get_record("user", array('id' => $USER->id));
|
|
|
$iassign_statement->author_modified_name = $author->firstname . ' ' . $author->lastname;
|
|
@@ -1578,7 +1593,7 @@ var exercises = [ '; // '
|
|
|
|
|
|
// other teachers receive also: (excepts the sender)
|
|
|
foreach ($teachers as $teacher) {
|
|
|
- if ($teacher->id != $USER->id)
|
|
|
+ if ($teacher->id != $USER->id) {
|
|
|
email_to_user(
|
|
|
$teacher,
|
|
|
$USER->firstname . " " . $USER->lastname . " (via " . $SITE->shortname . ")",
|
|
@@ -1591,21 +1606,60 @@ var exercises = [ '; // '
|
|
|
$userfrom->email,
|
|
|
'Não responda a esta mensagem'
|
|
|
);
|
|
|
+
|
|
|
+ $message = new \core\message\message();
|
|
|
+ $message->component = 'mod_iassign';
|
|
|
+ $message->name = 'message';
|
|
|
+ $message->userfrom = core_user::get_noreply_user();
|
|
|
+ $message->userto = $teacher;
|
|
|
+ $message->subject = $subject;
|
|
|
+ $message->fullmessage = $text;
|
|
|
+ $message->fullmessageformat = FORMAT_MARKDOWN;
|
|
|
+ $message->fullmessagehtml = $text;
|
|
|
+ $message->smallmessage = $subject;
|
|
|
+ $message->notification = 1;
|
|
|
+ $message->contexturl = $url_submissao . '#comments';
|
|
|
+ $message->contexturlname = $this->activity->get_activity()->name;
|
|
|
+ $messageid = message_send($message);
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
// and student:
|
|
|
$student = $DB->get_record('user', array('id' => $student_id));
|
|
|
+ $formated_text = str_replace("viewsubmission", "view", $text);
|
|
|
email_to_user(
|
|
|
$student,
|
|
|
$USER->firstname . " " . $USER->lastname . " (via " . $SITE->shortname . ")",
|
|
|
$subject,
|
|
|
"",
|
|
|
- str_replace("viewsubmission", "view", $text),
|
|
|
+ $formated_text,
|
|
|
'',
|
|
|
'',
|
|
|
false,
|
|
|
$userfrom->email,
|
|
|
'Não responda a esta mensagem'
|
|
|
);
|
|
|
+
|
|
|
+ $url_student = new moodle_url('/mod/iassign/view.php',
|
|
|
+ array(
|
|
|
+ 'id' => $this->cm->id,
|
|
|
+ 'action' => 'view',
|
|
|
+ 'iassign_current' => $this->activity->get_activity()->id));
|
|
|
+
|
|
|
+ $message = new \core\message\message();
|
|
|
+ $message->component = 'mod_iassign';
|
|
|
+ $message->name = 'message';
|
|
|
+ $message->userfrom = core_user::get_noreply_user();
|
|
|
+ $message->userto = $student;
|
|
|
+ $message->subject = $subject;
|
|
|
+ $message->fullmessage = $formated_text;
|
|
|
+ $message->fullmessageformat = FORMAT_MARKDOWN;
|
|
|
+ $message->fullmessagehtml = $formated_text;
|
|
|
+ $message->smallmessage = $subject;
|
|
|
+ $message->notification = 1;
|
|
|
+ $message->contexturl = $url_student . '#comments';
|
|
|
+ $message->contexturlname = $this->activity->get_activity()->name;
|
|
|
+ $messageid = message_send($message);
|
|
|
|
|
|
|
|
|
} else { // a student has sent the comment:
|
|
@@ -1623,6 +1677,21 @@ var exercises = [ '; // '
|
|
|
$userfrom->email,
|
|
|
'Não responda a esta mensagem'
|
|
|
);
|
|
|
+
|
|
|
+ $message = new \core\message\message();
|
|
|
+ $message->component = 'mod_iassign';
|
|
|
+ $message->name = 'message';
|
|
|
+ $message->userfrom = core_user::get_noreply_user();
|
|
|
+ $message->userto = $teacher;
|
|
|
+ $message->subject = $subject;
|
|
|
+ $message->fullmessage = $text;
|
|
|
+ $message->fullmessageformat = FORMAT_MARKDOWN;
|
|
|
+ $message->fullmessagehtml = $text;
|
|
|
+ $message->smallmessage = $subject;
|
|
|
+ $message->notification = 1;
|
|
|
+ $message->contexturl = $url_submissao . '#comments';
|
|
|
+ $message->contexturlname = $this->activity->get_activity()->name;
|
|
|
+ $messageid = message_send($message);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2555,43 +2624,19 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
else
|
|
|
print '<table width=100%><tr>';
|
|
|
print '<td >';
|
|
|
- if ($this->action != 'print')
|
|
|
- print $OUTPUT->help_icon('legend', 'iassign');
|
|
|
-
|
|
|
- // helpbutton('legend', get_string('legend', 'iassign'), 'iassign', $image = true, $linktext = false, $text = '', $return = false,
|
|
|
- // $imagetext = '');
|
|
|
- print '<strong>' . get_string('legend', 'iassign') . '</strong>';
|
|
|
- print ' ' . iassign_icons::insert('correct') . ' ' . get_string('correct', 'iassign');
|
|
|
- print ' ' . iassign_icons::insert('incorrect') . ' ' . get_string('incorrect', 'iassign');
|
|
|
- print ' ' . iassign_icons::insert('post') . ' ' . get_string('post', 'iassign');
|
|
|
- print ' ' . iassign_icons::insert('not_post') . ' ' . get_string('not_post', 'iassign');
|
|
|
- print ' ' . iassign_icons::insert('comment_unread') . ' ' . get_string('comment_unread', 'iassign');
|
|
|
|
|
|
if (has_capability('mod/iassign:viewreport', $this->context, $USER->id) && $this->action == 'report') {
|
|
|
- print ' ' . iassign_icons::insert('comment_read') . ' ' . get_string('comment_read', 'iassign');
|
|
|
- print '</td>' . "\n";
|
|
|
+
|
|
|
if ($this->action != 'print') {
|
|
|
$link_print = "<a href='" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=print&iassignid=" . $this->iassign->id . "'>" . iassign_icons::insert('print') . ' ' . get_string('print', 'iassign') . "</a>";
|
|
|
- $link_stats = "<a href='" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=stats&iassignid=" . $this->iassign->id . "'>" . iassign_icons::insert('results') . ' ' . get_string('graphic', 'iassign') . "</a>";
|
|
|
+
|
|
|
$link_export = "<a href='" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=export_csv&iassignid=" . $this->iassign->id . "'>" . iassign_icons::insert('export_ilm') . ' ' . get_string('export_csv', 'iassign') . "</a>";
|
|
|
- $link_auto_evaluate = "<a href='" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=auto_evaluate&iassignid=" . $this->iassign->id . "'>" . iassign_icons::insert('correct') . ' ' . get_string('auto_evaluate_reprocess', 'iassign') . "</a>";
|
|
|
-
|
|
|
- $link_all_submissions_manager = "<a href='" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=all_submissions&iassignid=" . $this->iassign->id . "'><i class='fa fa-files-o' aria-hidden='true' style='color: red'></i> " . get_string('all_submissions_manager', 'iassign') . "</a>";
|
|
|
-
|
|
|
- print '<td width=10% align="right">' . $link_stats . '</td>' . "\n";
|
|
|
+
|
|
|
print '<td width=10% align="right">' . $link_export . '</td>' . "\n";
|
|
|
- print '<td width=15% align="right">' . $link_auto_evaluate . '</td>' . "\n";
|
|
|
- print '<td width=16% align="right">' . $link_all_submissions_manager . '</td>' . "\n";
|
|
|
print '<td width=15% align="right">' . $link_print . '</td>' . "\n";
|
|
|
} // if ($this->action != 'print')
|
|
|
print '</tr></table>' . "\n";
|
|
|
} // if (has_capability('mod/iassign:viewreport', $this->context, $USER->id) && $this->action == 'report')
|
|
|
- elseif (has_capability('mod/iassign:submitiassign', $this->context, $USER->id)) {
|
|
|
- $link_stats = "<a href='" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=stats_student&iassignid=" . $this->iassign->id . "'>" . iassign_icons::insert('results') . ' ' . get_string('results', 'iassign') . "</a>";
|
|
|
- print '<td width=15% align="right">' . $link_stats . '</td>' . "\n";
|
|
|
- print '</tr></table>' . "\n";
|
|
|
- } // elseif (has_capability('mod/iassign:submitiassign', $this->context, $USER->id))
|
|
|
- else
|
|
|
print '</td></tr></table>' . "\n";
|
|
|
} // function view_legend_icons()
|
|
|
|
|
@@ -3394,17 +3439,19 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
$title = get_string('report', 'iassign');
|
|
|
print $OUTPUT->header();
|
|
|
} // if ($this->action != 'print')
|
|
|
+
|
|
|
+ $this->print_main_menu();
|
|
|
+
|
|
|
print $OUTPUT->box_start();
|
|
|
|
|
|
$this->view_legend_icons();
|
|
|
- print '<p>' . get_string('ps_experiment', 'iassign') . '</p>';
|
|
|
- print '<p>' . get_string('ps_comment', 'iassign') . '</p>';
|
|
|
+
|
|
|
print $OUTPUT->box_end();
|
|
|
|
|
|
if ($this->action == 'print')
|
|
|
print '<table border=1 width="100%">' . "\n";
|
|
|
else
|
|
|
- print '<table id="outlinetable" class="generaltable boxaligncenter table table-hover table-striped" width="100%">' . "\n";
|
|
|
+ print '<table id="outlinetable" class="generaltable boxaligncenter table table-hover table-striped mt-5" width="100%">' . "\n";
|
|
|
print '<tr><th colspan=2 class="header c1">' . iassign_utils::remove_code_message($this->iassign->name) . '</th></tr>' . "\n";
|
|
|
// $num = array();
|
|
|
$i = 1;
|
|
@@ -3688,6 +3735,9 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
}
|
|
|
print "</table>\n";
|
|
|
|
|
|
+ print '<p class="mt-5">' . get_string('ps_experiment', 'iassign') . '</p>';
|
|
|
+ print '<p>' . get_string('ps_comment', 'iassign') . '</p>';
|
|
|
+
|
|
|
if ($this->action != 'print')
|
|
|
print $OUTPUT->footer();
|
|
|
die();
|
|
@@ -3782,9 +3832,11 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
} // for ($i = 1; $i < $j; $i++)
|
|
|
} // if ($i > 1)
|
|
|
|
|
|
+ print $OUTPUT->header();
|
|
|
+ $this->print_main_menu();
|
|
|
+
|
|
|
if ($this->action != 'printstats') {
|
|
|
$title = get_string('graphic', 'iassign');
|
|
|
- print $OUTPUT->header();
|
|
|
$link_report = "<a href='" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=report&iassignid=" . $this->iassign->id . "'>" . iassign_icons::insert('view_report') . ' ' . get_string('report', 'iassign') . "</a>";
|
|
|
$link_print_stats = "<a href='" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=printstats&&iassignid=" . $this->iassign->id . "'>" . iassign_icons::insert('print') . ' ' . get_string('print', 'iassign') . "</a>";
|
|
|
print '<table width=100%><tr>';
|
|
@@ -4056,13 +4108,12 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
} // if ($sum_nopost > 0)
|
|
|
|
|
|
print $OUTPUT->header();
|
|
|
- $link_return = " <a href='" . $this->return . "'>" . iassign_icons::insert('home') . get_string('activities_page', 'iassign') . "</a>";
|
|
|
- print '<table width=100%><tr>';
|
|
|
- print '<td align="right">' . $link_return . '</td>' . "\n";
|
|
|
- print '</td></tr></table>' . "\n";
|
|
|
|
|
|
+ $this->print_main_menu();
|
|
|
+
|
|
|
+
|
|
|
print "<br/><br/>\n";
|
|
|
- print '<table id="outlinetable" class="generaltable box aligncenter" cellpadding="5" width="100%">' . "\n";
|
|
|
+ print '<table id="outlinetable" class="generaltable box aligncenter mt-5" cellpadding="5" width="100%">' . "\n";
|
|
|
|
|
|
print '<tr><th colspan=3 class="header c1">' . "\n";
|
|
|
// helpbutton('legend', get_string('legend', 'iassign'), 'iassign', $image = true, $linktext = false, $text = '', $return = false,
|
|
@@ -4126,55 +4177,113 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
die();
|
|
|
} // function stats_students()
|
|
|
|
|
|
+ function get_total_notifications () {
|
|
|
+ global $DB, $USER, $COURSE;
|
|
|
+
|
|
|
+ $params = array('userid' => $USER->id, 'course' => $COURSE->id);
|
|
|
+
|
|
|
+ $total_messages = $DB->get_record_sql("SELECT COUNT(*) AS total FROM {iassign_submission_comment} AS c, {iassign_submission} AS s, {iassign_statement} AS st, {iassign} AS ias "
|
|
|
+ . " WHERE c.return_status=0 AND c.receiver=:userid AND c.iassign_submissionid=s.id AND s.iassign_statementid=st.id AND st.iassignid=ias.id AND ias.course=:course", $params);
|
|
|
|
|
|
- /// Display page of iAssign's activity
|
|
|
- function view_iassigns () {
|
|
|
- global $USER, $CFG, $COURSE, $DB, $OUTPUT;
|
|
|
- $id = $this->cm->id;
|
|
|
+ return $total_messages->total;
|
|
|
+ }
|
|
|
|
|
|
- $iassign_list = $DB->get_records_list('iassign_statement', 'iassignid', array('iassignid' => $this->iassign->id), 'position ASC');
|
|
|
+ function view_notifications () {
|
|
|
+ global $OUTPUT;
|
|
|
+
|
|
|
+ print $OUTPUT->header();
|
|
|
|
|
|
- $notice = optional_param('notice', '', PARAM_TEXT);
|
|
|
- if (strpos($notice, 'error'))
|
|
|
- print($OUTPUT->notification(get_string($notice, 'iassign'), 'notifyproblem'));
|
|
|
- else if ($notice != '')
|
|
|
- print($OUTPUT->notification(get_string($notice, 'iassign'), 'notifysuccess'));
|
|
|
+ $this->print_main_menu();
|
|
|
|
|
|
- print $OUTPUT->box_start();
|
|
|
+
|
|
|
|
|
|
- print '<table width=100% border=0><tr>' . "\n";
|
|
|
- $url_help = new moodle_url('/mod/iassign/settings_ilm.php', array('action' => 'list', 'ilm_id' => 1));
|
|
|
- $action_help = new popup_action('click', $url_help, 'iplookup', array('title' => get_string('help_ilm', 'iassign'), 'width' => 1200, 'height' => 700));
|
|
|
+ print $OUTPUT->footer();
|
|
|
+ }
|
|
|
|
|
|
- $link_help = $OUTPUT->action_link($url_help, iassign_icons::insert('help_ilm') . get_string('help_ilm', 'iassign'), $action_help);
|
|
|
- $link_add = "<a href='" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=add&iassignid=" . $this->iassign->id . "'>" . iassign_icons::insert('add_iassign') . get_string('add_iassign', 'iassign') . "</a>";
|
|
|
- $link_report = "<a href='" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=report&iassignid=" . $this->iassign->id . "'>" . iassign_icons::insert('view_report') . get_string('report', 'iassign') . "</a>";
|
|
|
+ function print_main_menu () {
|
|
|
+ $id = $this->cm->id;
|
|
|
|
|
|
+ $actual_action = optional_param('action', '', PARAM_TEXT);
|
|
|
+
|
|
|
+ $url_help = new moodle_url('/mod/iassign/settings_ilm.php', array('action' => 'list', 'ilm_id' => 1));
|
|
|
+ $url_report = new moodle_url('/mod/iassign/view.php', array('action' => 'report', 'id' => $id, 'iassignid' => $this->iassign->id));
|
|
|
+ $url_add = new moodle_url('/mod/iassign/view.php', array('id' => $id, 'action' => 'add', 'iassignid' => $this->iassign->id));
|
|
|
+ $url_stats = new moodle_url('/mod/iassign/view.php', array('id' => $id, 'action' => 'stats_student', 'iassignid' => $this->iassign->id));
|
|
|
+ $url_home = new moodle_url('/mod/iassign/view.php', array('id' => $id));
|
|
|
+ $url_notifications = new moodle_url('/mod/iassign/view.php', array('id' => $id, 'action' => 'notifications', 'iassignid' => $this->iassign->id));
|
|
|
+ $url_auto_evaluate = new moodle_url('/mod/iassign/view.php', array('id' => $id, 'action' => 'auto_evaluate', 'iassignid' => $this->iassign->id));
|
|
|
+ $url_sub_stats = new moodle_url('/mod/iassign/view.php', array('id' => $id, 'action' => 'stats', 'iassignid' => $this->iassign->id));
|
|
|
+ $url_all_submissions = new moodle_url('/mod/iassign/view.php', array('id' => $id, 'action' => 'all_submissions', 'iassignid' => $this->iassign->id));
|
|
|
+
|
|
|
+ print '<div class="btn-group" role="group" aria-label="">';
|
|
|
+
|
|
|
+ print '<a href="'.$url_home.'" class="btn btn-outline-primary '.($actual_action == '' ? 'active' : '').'">
|
|
|
+ <i class="fa fa-home" aria-hidden="true"></i> '.get_string('activities_page', 'iassign').'
|
|
|
+ </a>';
|
|
|
+
|
|
|
// TODO: esta consulta esta sendo feita novamente na linha +/- 2258
|
|
|
if (has_capability('mod/iassign:viewiassignall', $this->context, $USER->id)) {
|
|
|
// could be "has_capability('mod/iassign:viewiassignall', $this->context, $USER->id)"
|
|
|
// Has capability to see "report": teacher or up
|
|
|
- print '<td width=10% align="left">' . "\n";
|
|
|
- print $link_help;
|
|
|
- print '</td>' . "\n";
|
|
|
- print '<td width=10% align="left">' . "\n";
|
|
|
- print $link_report;
|
|
|
- print '</td>' . "\n";
|
|
|
+ print '<a href="'.$url_help.'" class="btn btn-outline-primary"><i class="fa fa-question-circle" aria-hidden="true"></i> '.get_string('help_ilm', 'iassign').'</a>';
|
|
|
+
|
|
|
+ print '<div class="btn-group">
|
|
|
+ <a href="'.$url_report.'" class="btn btn-outline-primary '.($actual_action == 'report' || $actual_action == 'stats' || $actual_action == 'all_submissions' ? 'active' : '').' dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
|
+ <i class="fa fa-bar-chart" aria-hidden="true"></i> '.get_string('report', 'iassign').'</a>
|
|
|
+ <div class="dropdown-menu">
|
|
|
+ <a href="'.$url_report.'" class=" '.($actual_action == 'report' ? 'active' : ''). ' dropdown-item"><i class="fa fa-bar-chart" aria-hidden="true"></i> '.get_string('home', 'iassign').'</a>
|
|
|
+ <div class="dropdown-divider"></div>
|
|
|
+ <a href="'.$url_sub_stats.'" class="dropdown-item '.($actual_action == 'stats' ? 'active' : '').'"><i class="fa fa-pie-chart" aria-hidden="true"></i> '.get_string('graphic', 'iassign') .'</a>
|
|
|
+ <div class="dropdown-divider"></div>
|
|
|
+ <a href="'.$url_all_submissions.'" class="dropdown-item '.($actual_action == 'all_submissions' ? 'active' : '').'"><i class="fa fa-files-o" aria-hidden="true"></i> '.get_string('all_submissions_manager', 'iassign') .'</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ';
|
|
|
+
|
|
|
+ print '<a href="'.$url_stats.'" class="btn btn-outline-primary '.($actual_action == 'stats_student' ? 'active' : '').'"><i class="fa fa-list" aria-hidden="true"></i> '.get_string('results', 'iassign').'</a>';
|
|
|
+
|
|
|
+ print '<a href="'.$url_auto_evaluate.'" class="btn btn-outline-primary '.($actual_action == 'auto_evaluate' ? 'active' : '').'"><i class="fa fa-check-square-o" aria-hidden="true"></i> '.get_string('auto_evaluate_name_config', 'iassign').'</a>';
|
|
|
+
|
|
|
} // if (has_capability('mod/iassign:viewiassignall', $this->context, $USER->id))
|
|
|
+
|
|
|
+ $notifications = $this->get_total_notifications();
|
|
|
+
|
|
|
+ print '<a href="'.$url_notifications.'" class="btn btn-outline-primary '.($actual_action == 'notifications' ? 'active' : '').'">
|
|
|
+ <i class="fa fa-bell" aria-hidden="true"></i> '.get_string('notifications', 'iassign');
|
|
|
+
|
|
|
+ if ($notifications > 0)
|
|
|
+ print ' <span class="badge bg-danger rounded-pill" style="color: white; font-size: .9rem;">'.$notifications.'</span>';
|
|
|
+
|
|
|
+ print '</a>';
|
|
|
+
|
|
|
if (has_capability('mod/iassign:editiassign', $this->context, $USER->id)) {
|
|
|
- print '<td width=15% align="left">' . "\n";
|
|
|
- print $link_add;
|
|
|
- print "</td>\n";
|
|
|
+ print '<a href="'.$url_add.'" class="btn btn-success"><i class="fa fa-plus" aria-hidden="true"></i> '.get_string('add_iassign', 'iassign').'</a>';
|
|
|
} // if (has_capability('mod/iassign:editiassign', $this->context, $USER->id))
|
|
|
|
|
|
- //print '</tr></table>' . "\n";
|
|
|
+ print '</div>' . "\n";
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /// Display page of iAssign's activity
|
|
|
+ function view_iassigns () {
|
|
|
+ global $USER, $CFG, $COURSE, $DB, $OUTPUT;
|
|
|
+ $id = $this->cm->id;
|
|
|
+
|
|
|
+ $iassign_list = $DB->get_records_list('iassign_statement', 'iassignid', array('iassignid' => $this->iassign->id), 'position ASC');
|
|
|
|
|
|
+ $notice = optional_param('notice', '', PARAM_TEXT);
|
|
|
+ if (strpos($notice, 'error'))
|
|
|
+ print($OUTPUT->notification(get_string($notice, 'iassign'), 'notifyproblem'));
|
|
|
+ else if ($notice != '')
|
|
|
+ print($OUTPUT->notification(get_string($notice, 'iassign'), 'notifysuccess'));
|
|
|
+
|
|
|
+ $this->print_main_menu();
|
|
|
+
|
|
|
+ print $OUTPUT->box_start();
|
|
|
|
|
|
- print '<div style="float: right;">';
|
|
|
if (has_capability('mod/iassign:editiassign', $this->context, $USER->id)) {
|
|
|
+ print '<div class="border float-right">';
|
|
|
if ($iassign_list) {
|
|
|
- print '<td align="right">' . "\n";
|
|
|
-
|
|
|
// $USER->iassignEdit == 0 view 'Turn editing off'
|
|
|
// $USER->iassignEdit == 1 view 'Turn editing on'
|
|
|
if (!isset($USER->iassignEdit))
|
|
@@ -4190,12 +4299,11 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
} // elseif ($USER->iassignEdit == 1)
|
|
|
$editPost = "" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&botton=" . $botton;
|
|
|
print "\n<form name='formEditPost' id='formEditPost' method='post' action='$editPost' enctype='multipart/form-data'>\n";
|
|
|
- print " <input type=submit value='$bottonEdit_message'/>\n";
|
|
|
+ print " <input class='btn btn-primary' type=submit value='$bottonEdit_message'/>\n";
|
|
|
print "</form>\n";
|
|
|
- print "</td>\n";
|
|
|
} // if ($iassign_list)
|
|
|
+ print '</div>';
|
|
|
}
|
|
|
- print '</tr></table>' . "\n";
|
|
|
|
|
|
// if (has_capability('mod/iassign:submitiassign', $this->context, $USER->id))
|
|
|
// $this->view_legend_icons();
|
|
@@ -4277,8 +4385,8 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
} // if (has_capability('mod/iassign:editiassign', $this->context, $USER->id))
|
|
|
} // if (count($iassign_list) > 5 && !(has_capability('mod/iassign:submitiassign', $this->context, $USER->id)))
|
|
|
|
|
|
- if (has_capability('mod/iassign:submitiassign', $this->context, $USER->id))
|
|
|
- $this->view_legend_icons();
|
|
|
+ // if (has_capability('mod/iassign:submitiassign', $this->context, $USER->id))
|
|
|
+ // $this->view_legend_icons();
|
|
|
} // function view_iassigns()
|
|
|
|
|
|
|
|
@@ -4323,6 +4431,10 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
document.getElementById('move_dest').classList.remove('alert-danger');
|
|
|
}
|
|
|
|
|
|
+ function closeModal() {
|
|
|
+ modal.style.display = 'none';
|
|
|
+ }
|
|
|
+
|
|
|
function load_modal_elements() {
|
|
|
modal = document.getElementById('myModal');
|
|
|
var span = document.getElementById('close_modal');
|
|
@@ -4345,7 +4457,7 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
$ccm = get_coursemodule_from_id('iassign', optional_param('id', 0, PARAM_INT));
|
|
|
|
|
|
$radio_buttons = " <form name='form_move_activity'><input type='hidden' name='action' value='move_activity' />
|
|
|
- <input type='hidden' name='id' value='" . optional_param('id', NULL, PARAM_TEXT) . "' />
|
|
|
+ <input type='hidden' name='id' value='" . optional_param('id', NULL, PARAM_TEXT) . "'>
|
|
|
<input type='hidden' name='iassign_current' value='' />";
|
|
|
|
|
|
$course_sections = get_fast_modinfo($PAGE->course->id)->get_section_info_all();
|
|
@@ -4371,7 +4483,7 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
}
|
|
|
|
|
|
print $radio_buttons . " <center><input type='submit' value='OK' onClick='return validate_move();' />\n
|
|
|
- <input type='button' value='" . get_string('cancel', 'iassign') . "' onClick='modal.style.display = \'none\';' /></center>
|
|
|
+ <input type='button' value='" . get_string('cancel', 'iassign') . "' onClick='closeModal()' data-bs-dismiss='modal' /></center>
|
|
|
</form>
|
|
|
</div></div> </div></div>\n";
|
|
|
print " <style>.modal {
|
|
@@ -4426,7 +4538,8 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
</style>";
|
|
|
|
|
|
if (has_capability('mod/iassign:viewiassignall', $this->context, $USER->id)) {
|
|
|
- print "<p><font color='#0000aa'><strong>" . $title . "</strong></font></p>";
|
|
|
+ print '<h5 class="fw-bold" style="font-weight: 400; margin: -1rem 0 1.5rem 0;">' . $title . "</h5>";
|
|
|
+ print '<table class="table table-hover" style="border-bottom: 1px solid #dee2e6;">';
|
|
|
for ($j = 0; $j < $i; $j ++) {
|
|
|
$iassign_current = $iassign_array[$j]->id;
|
|
|
|
|
@@ -4468,46 +4581,50 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
$links .= $comment_unread;
|
|
|
if (has_capability('mod/iassign:editiassign', $this->context, $USER->id) && $USER->iassignEdit == 1) {
|
|
|
|
|
|
+ $action_links = "<nav aria-label='Action links'><ul class='pagination pagination-sm mb-0 my-1 text-success'>";
|
|
|
+
|
|
|
//D echo "id=$id, iassign_current=$iassign_current, iassign_up=$iassign_up, iassign_down=$iassign_down<br/>";
|
|
|
$str_aux = "&id=$id&iassign_current=$iassign_current&iassign_up=$iassign_up&iassign_down=$iassign_down";
|
|
|
|
|
|
- $link_up = " <a href='view.php?action=up$str_aux'>" . iassign_icons::insert('move_up_iassign') . "</a>";
|
|
|
+ $link_up = "<li class='page-item'><a href='view.php?action=up$str_aux' class='page-link' title='".get_string('move_up_iassign', 'iassign')."'><i class='fa fa-arrow-up' aria-hidden='true'></i></a></li>";
|
|
|
if ($j==0) // first activity
|
|
|
- $link_down = " <a href='view.php?action=firstdown$str_aux'>" . iassign_icons::insert('move_down_iassign') . "</a>";
|
|
|
+ $link_down = "<li class='page-item'><a href='view.php?action=firstdown$str_aux' class='page-link' title='".get_string('move_down_iassign', 'iassign')."'><i class='fa fa-arrow-down' aria-hidden='true'></i></a></li>";
|
|
|
else
|
|
|
- $link_down = " <a href='view.php?action=down$str_aux'>" . iassign_icons::insert('move_down_iassign') . "</a>";
|
|
|
- $link_delete = " <a href='view.php?action=delete$str_aux'>" . iassign_icons::insert('delete_iassign') . "</a>";
|
|
|
- $link_visible_hide = " <a href='view.php?action=visible$str_aux'>" . iassign_icons::insert('hide_iassign') . "</a>";
|
|
|
- $link_visible_show = " <a href='view.php?action=visible$str_aux'>" . iassign_icons::insert('show_iassign') . "</a>";
|
|
|
- $link_edit = " <a href='view.php?action=edit$str_aux'>" . iassign_icons::insert('edit_iassign') . "</a>";
|
|
|
- $link_duplicate_activity = " <a href='view.php?action=duplicate_activity$str_aux' >" . iassign_icons::insert('duplicate_iassign') . "</a>\n";
|
|
|
- $link_move_activity = " <a href='#' onclick='load_move($iassign_current); return false;' >" . iassign_icons::insert('move_activity') . "</a>\n";
|
|
|
+ $link_down = "<li class='page-item'><a href='view.php?action=down$str_aux' class='page-link' title='".get_string('move_up_iassign', 'iassign')."'><i class='fa fa-arrow-down' aria-hidden='true'></i></a></li>";
|
|
|
+ $link_delete = "<li class='page-item'><a href='view.php?action=delete$str_aux' class='page-link' title='".get_string('delete_iassign', 'iassign')."'><i class='fa fa-trash-o' aria-hidden='true'></i></a></li>";
|
|
|
+ $link_visible_hide = "<li class='page-item'><a href='view.php?action=visible$str_aux' class='page-link' title='".get_string('hide_iassign', 'iassign')."'><i class='fa fa-eye' aria-hidden='true'></i></a></li>";
|
|
|
+ $link_visible_show = "<li class='page-item'><a href='view.php?action=visible$str_aux' class='page-link' title='".get_string('show_iassign', 'iassign')."'><i class='fa fa-eye-slash' aria-hidden='true'></i></a></li>";
|
|
|
+ $link_edit = "<li class='page-item'><a href='view.php?action=edit$str_aux' class='page-link' title='".get_string('edit_iassign', 'iassign')."'><i class='fa fa-pencil-square-o' aria-hidden='true'></i></a></li>";
|
|
|
+ $link_duplicate_activity = "<li class='page-item'><a href='view.php?action=duplicate_activity$str_aux' class='page-link' title='".get_string('duplicate_iassign', 'iassign')."'><i class='fa fa-clone' aria-hidden='true'></i></a></li>";
|
|
|
+ $link_move_activity = "<li class='page-item'><a href='#' onclick='load_move($iassign_current); return false;' class='page-link' title='".get_string('move_activity', 'iassign')."'><i class='fa fa-sign-out' aria-hidden='true'></i></a></li>";
|
|
|
|
|
|
if (count($iassign_array) > 1) {
|
|
|
if ($j == 0)
|
|
|
- $links .= $link_down;
|
|
|
+ $action_links .= $link_down;
|
|
|
elseif ($j == $i - 1)
|
|
|
- $links .= $link_up;
|
|
|
+ $action_links .= $link_up;
|
|
|
else
|
|
|
- $links .= $link_up . $link_down;
|
|
|
+ $action_links .= $link_up . $link_down;
|
|
|
} // if (count($iassign_array) > 1)
|
|
|
- $links .= $link_edit . $link_delete;
|
|
|
+ $action_links .= $link_edit . $link_delete;
|
|
|
|
|
|
if ($iassign_array[$j]->visible == 0)
|
|
|
- $links .= $link_visible_show;
|
|
|
+ $action_links .= $link_visible_show;
|
|
|
else
|
|
|
- $links .= $link_visible_hide;
|
|
|
+ $action_links .= $link_visible_hide;
|
|
|
|
|
|
- $links .= $link_duplicate_activity . $link_move_activity;
|
|
|
+ $action_links .= $link_duplicate_activity . $link_move_activity;
|
|
|
} // if ($USER->iassignEdit == 1 && has_capability('mod/iassign:editiassign', $this->context, $USER->id))
|
|
|
|
|
|
- print '<p>' . $links . '</p>' . "\n";
|
|
|
+ $action_links .= '</ul></nav>';
|
|
|
+
|
|
|
+ print '<tr><td style="white-space: nowrap; width: 1%; padding-right: 2rem;" class="align-middle">' . $links . '</td><td class="align-middle">'.$action_links.'</td></tr>' . "\n";
|
|
|
}
|
|
|
+ print '</tbody></table>';
|
|
|
} // if (has_capability('mod/iassign:viewiassignall', $this->context, $USER->id))
|
|
|
elseif (has_capability('mod/iassign:submitiassign', $this->context, $USER->id)) { // student
|
|
|
- print '<table width=100% ><tr>' . "\n";
|
|
|
- print "<td width=70% align='left'><font color='#0000aa'><strong>" . $title . "</strong></font></td>" . "\n";
|
|
|
- print '</tr></table>' . "\n";
|
|
|
+ print '<h5 class="fw-bold" style="font-weight: 400; margin: -1rem 0 1.5rem 0;">' . $title . "</h5>";
|
|
|
+ print '<table class="table table-hover" style="border-bottom: 1px solid #dee2e6;">';
|
|
|
|
|
|
for ($j = 0; $j < $i; $j ++) {
|
|
|
$icon_status = "";
|
|
@@ -4543,13 +4660,13 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
if ($iassign_array[$j]->type_iassign == 3) {
|
|
|
if ($iassign_array[$j]->show_answer == 1) {
|
|
|
if ($iassign_submission->status == 3)
|
|
|
- $icon_status = iassign_icons::insert('correct');
|
|
|
+ $icon_status = '<i class="fa fa-check" style="color: green; font-size: 1.2rem;" aria-hidden="true" title="'.get_string('correct', 'iassign').'"></i>';
|
|
|
elseif ($iassign_submission->status == 2)
|
|
|
- $icon_status = iassign_icons::insert('incorrect');
|
|
|
+ $icon_status = '<i class="fa fa-times" style="color: red; font-size: 1.2rem;" aria-hidden="true" title="'.get_string('incorrect', 'iassign').'"></i>';
|
|
|
elseif ($iassign_submission->status == 1)
|
|
|
$icon_status = iassign_icons::insert('post');
|
|
|
elseif ($iassign_submission->status == 0)
|
|
|
- $icon_status = iassign_icons::insert('not_post');
|
|
|
+ $icon_status = '<i class="fa fa-question" style="color: #77229c; font-size: 1.2rem;" aria-hidden="true" title="'.get_string('not_post', 'iassign').'"></i>';
|
|
|
} // if ($iassign_array[$j]->show_answer==1)
|
|
|
else {
|
|
|
if ($iassign_submission->status == 0)
|
|
@@ -4560,9 +4677,10 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
} // if ($iassign_array[$j]->type_iassign == 3)
|
|
|
} // if ($iassign_submission)
|
|
|
elseif ($iassign_array[$j]->type_iassign == 3) {
|
|
|
- $icon_status = iassign_icons::insert('not_post');
|
|
|
+ $icon_status = '<i class="fa fa-question" style="color: #77229c; font-size: 1.2rem;" aria-hidden="true" title="'.get_string('not_post', 'iassign').'"></i>';
|
|
|
} // if ($iassign_array[$j]->type_iassign == 3)
|
|
|
- print '<p>' . $icon_status . ' ' . $links . ' ' . $icon_comment . '</p>' . "\n";
|
|
|
+ print '<tr><td style="white-space: nowrap; width: 1%; padding-right: 0; text-align: center;">'. $icon_status .'</td><td style="white-space: nowrap; width: 1%; padding-right: 2rem; padding-left: 0.2rem;">' . $links . '</td><td>'. $icon_comment.'</td></tr>' . "\n";
|
|
|
+ //print '<p>' . $icon_status . ' ' . $links . ' ' . $icon_comment . '</p>' . "\n";
|
|
|
} // if ($iassign_array[$j]->visible == 1)
|
|
|
} // for ($j = 0; $j < $i; $j++)
|
|
|
} else if (isguestuser()) {
|
|
@@ -4581,6 +4699,7 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
} // if ($iassign_array[$j]->visible == 1)
|
|
|
}
|
|
|
}
|
|
|
+ print '</table>';
|
|
|
print $OUTPUT->box_end();
|
|
|
} // function show_iassign($title, $iassign_array, $i)
|
|
|
|
|
@@ -4599,6 +4718,7 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
//D echo '</td></tr></table>' . "\n";
|
|
|
//D echo $OUTPUT->box_end();
|
|
|
//D // echo $OUTPUT->footer();
|
|
|
+
|
|
|
redirect(new moodle_url($this->return . '¬ice=' . $message));
|
|
|
exit;
|
|
|
}
|
|
@@ -4744,22 +4864,7 @@ $param->special_param1 = 0; // 'special_param1 == 1' => script of iGeom
|
|
|
$newentry->comment = $submission_comment;
|
|
|
$newentry->receiver = $receiver;
|
|
|
$ia_assign_submissions_comment_id = $DB->insert_record('iassign_submission_comment', $newentry);
|
|
|
- //T foreach ($tousers as $touser) { //TODO Para registrar mensagem na area do Moodle - tem que ativar '$tousers[] = $DB->get_record(...);' acima
|
|
|
- //T $eventdata = new stdClass();
|
|
|
- //T $eventdata->component = 'mod_iassign'; //your component name
|
|
|
- //T $eventdata->name = 'comment'; //this is the message name from messages.php
|
|
|
- //T $eventdata->userfrom = $USER;
|
|
|
- //T $eventdata->userto = $touser;
|
|
|
- //T $eventdata->subject = "Teste de Subject";
|
|
|
- //T $eventdata->fullmessage = "Teste de Mensagem...";
|
|
|
- //T $eventdata->fullmessageformat = FORMAT_PLAIN;
|
|
|
- //T $eventdata->fullmessagehtml = "<b>Teste de Mensagem...</b>";
|
|
|
- //T $eventdata->smallmessage = "Teste de Mensagem";
|
|
|
- //T $eventdata->notification = 1; //this is only set to 0 for personal messages between users
|
|
|
- //T // alteracao tulio faria
|
|
|
- //T //message_send($eventdata);
|
|
|
- //T } //MOOC 2016 - TODO NAO finalizado, iniciado pelo Tulio
|
|
|
- // Trigger module viewed event.
|
|
|
+
|
|
|
$event = \mod_iassign\event\submission_comment_created::create(array(
|
|
|
'objectid' => $this->iassign->id,
|
|
|
'context' => $this->context
|
|
@@ -4857,7 +4962,8 @@ class activity {
|
|
|
|
|
|
$iassign_submission_currents = $DB->get_records("iassign_submission", array("iassign_statementid" => $this->activity->id));
|
|
|
|
|
|
- $output = $OUTPUT->header();
|
|
|
+ print $OUTPUT->header();
|
|
|
+
|
|
|
$output .= $OUTPUT->box_start();
|
|
|
$output .= "<p>" . get_string('delete_activity', 'iassign') . " <strong>" . $this->activity->name . "</strong></p>";
|
|
|
if ($iassign_submission_currents) {
|