|
@@ -321,16 +321,248 @@ class iassign {
|
|
|
|
|
|
function auto_evaluate () {
|
|
|
|
|
|
- global $COURSE, $CFG, $USER, $DB, $OUTPUT;
|
|
|
+ global $USER;
|
|
|
|
|
|
if (!has_capability('mod/iassign:runautoevaluate', $USER->context, $USER->id))
|
|
|
exit;
|
|
|
|
|
|
- print $OUTPUT->header();
|
|
|
-
|
|
|
- print $OUTPUT->footer();
|
|
|
+ global $CFG, $DB, $OUTPUT;
|
|
|
+ $id = $this->cm->id;
|
|
|
+ $iassign_list = $DB->get_records_list('iassign_statement', 'iassignid', array('iassignid' => $this->iassign->id), "position ASC");
|
|
|
|
|
|
- }
|
|
|
+ if ($this->action != 'print') {
|
|
|
+ $title = get_string('report', 'iassign');
|
|
|
+ print $OUTPUT->header();
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($this->action == 'print')
|
|
|
+ print '<table border=1 width="100%">' . "\n";
|
|
|
+ else
|
|
|
+ print '<table id="outlinetable" class="generaltable boxaligncenter" cellpadding="5" width="100%">' . "\n";
|
|
|
+ print '<tr><th colspan=2 class="header c1">' . iassign_utils::remove_code_message($this->iassign->name) . '</th></tr>' . "\n";
|
|
|
+
|
|
|
+ $i = 1;
|
|
|
+ $num = array();
|
|
|
+
|
|
|
+ foreach ($iassign_list as $iassign) {
|
|
|
+ $test_exercise = "";
|
|
|
+ $iassign_submission = $DB->get_records("iassign_submission", array("iassign_statementid" => $iassign->id));
|
|
|
+ if (($iassign_submission) && $iassign->type_iassign < 3) {
|
|
|
+ $test_exercise = " <b>(" . get_string('iassign_exercise', 'iassign') . ")</b>";
|
|
|
+ }
|
|
|
+ if ($iassign->type_iassign == 3 || ($iassign_submission)) {
|
|
|
+ $num[$i] = new stdClass();
|
|
|
+ $num[$i]->name = $iassign->name;
|
|
|
+ $num[$i]->id = $i;
|
|
|
+ $num[$i]->iassignid = $iassign->id;
|
|
|
+ print ' <tr >' . "\n";
|
|
|
+ print " <td class=\"cell c1 numviews\" width=5% align='center'><strong>" . $num[$i]->id . "</strong></td>\n";
|
|
|
+ print "<td class=\"cell c0 actvity\">";
|
|
|
+ print ' ' . $num[$i]->name . ' ' . $test_exercise . "</td>";
|
|
|
+ print ' </tr>' . "\n";
|
|
|
+ $i ++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ print "</table>";
|
|
|
+ print "<p></p>";
|
|
|
+ if ($this->action == 'print')
|
|
|
+ print '<table border=1 width="100%">' . "\n";
|
|
|
+ else
|
|
|
+ print '<table id="outlinetable" class="generaltable boxaligncenter" cellpadding="5" width="100%">' . "\n";
|
|
|
+ $context = context_course::instance($this->course->id);
|
|
|
+ if ($i > 1) {
|
|
|
+
|
|
|
+
|
|
|
+ $params = array('shortname' => 'student');
|
|
|
+ $role = $DB->get_record_sql(
|
|
|
+ "SELECT s.id, s.shortname FROM {role} s " .
|
|
|
+ " WHERE s.shortname = :shortname", $params);
|
|
|
+
|
|
|
+
|
|
|
+ $params = array('contextid' => $context->id, 'roleid' => $role->id);
|
|
|
+ $students = $DB->get_records_sql(
|
|
|
+ "SELECT s.userid, a.firstname, a.lastname FROM {role_assignments} s, {user} a " .
|
|
|
+ " WHERE s.contextid = :contextid AND s.userid = a.id AND s.roleid = :roleid " .
|
|
|
+ " ORDER BY a.firstname ASC,a.lastname ASC", $params);
|
|
|
+
|
|
|
+ print '<tr><th class="header c1">' . get_string('students', 'iassign') . '</th>' . "\n";
|
|
|
+ for ($j = 1; $j < $i; $j ++) {
|
|
|
+ $sum_iassign_correct[$j] = 0;
|
|
|
+ print '<th class="header c1" scope="col">' . $num[$j]->id . '</th>' . "\n";
|
|
|
+ }
|
|
|
+ $sum_iassign = $j - 1;
|
|
|
+ print '</tr>' . "\n";
|
|
|
+ $total = 0;
|
|
|
+ $sum_student = 0;
|
|
|
+ $sum_correct_iassign = array();
|
|
|
+ $sum_correct_student = array();
|
|
|
+
|
|
|
+ $USER->matrix_iassign = array();
|
|
|
+ if ($students) {
|
|
|
+ $w = 0;
|
|
|
+ foreach ($students as $tmp) {
|
|
|
+ $users_array[$w] = $tmp;
|
|
|
+ $w ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ for ($x = 0; $x < $w; $x ++) {
|
|
|
+ print '<tr>' . "\n";
|
|
|
+ $sum_student ++;
|
|
|
+ $name = $users_array[$x]->firstname . ' ' . $users_array[$x]->lastname;
|
|
|
+ print ' <td >' . $name . '</td>' . "\n";
|
|
|
+ $total_student = 0;
|
|
|
+ $tentativas = 0;
|
|
|
+
|
|
|
+ for ($j = 1; $j < $i; $j ++) {
|
|
|
+
|
|
|
+ $student_submissions = $DB->get_record("iassign_submission", array('iassign_statementid' => $num[$j]->iassignid, 'userid' => $users_array[$x]->userid));
|
|
|
+
|
|
|
+ if ($student_submissions) {
|
|
|
+ $last_solution_submission = " title=\"" . userdate($student_submissions->timemodified) . "\" ";
|
|
|
+ $tentativas = $student_submissions->experiment;
|
|
|
+
|
|
|
+
|
|
|
+ if ($j - 1 < 1 || $j == $i)
|
|
|
+ $iassign_previous = "-1";
|
|
|
+ else
|
|
|
+ $iassign_previous = $num[$j - 1]->iassignid;
|
|
|
+
|
|
|
+ if ($x - 1 < 0 || $x == $w)
|
|
|
+ $user_previous = "-1";
|
|
|
+ else
|
|
|
+ $user_previous = $users_array[$x - 1]->userid;
|
|
|
+
|
|
|
+
|
|
|
+ if ($i - 1 > $j)
|
|
|
+ $iassign_next = $num[$j + 1]->iassignid;
|
|
|
+ else
|
|
|
+ $iassign_next = "-1";
|
|
|
+
|
|
|
+ if ($w - 1 > $x)
|
|
|
+ $user_next = $users_array[$x + 1]->userid;
|
|
|
+ else
|
|
|
+ $user_next = "-1";
|
|
|
+
|
|
|
+ $position = "&row= $x&column=$j";
|
|
|
+
|
|
|
+ $url = "" . $CFG->wwwroot . "/mod/iassign/view.php?action=viewsubmission&id=" . $id . "&iassign_submission_current=" . $student_submissions->id .
|
|
|
+ "&userid_iassign=" . $users_array[$x]->userid . "&iassign_current=" . $num[$j]->iassignid . "&view_iassign=" . $this->view_iassign;
|
|
|
+ $url .= $position;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $params = array('iassign_submissionid' => $student_submissions->id, 'return_status' => '0', 'receiver' => '1');
|
|
|
+
|
|
|
+ if ($student_submissions->status == 3) {
|
|
|
+ $sum_iassign_correct[$j] ++;
|
|
|
+ $total_student ++;
|
|
|
+ $feedback = iassign_icons::insert('correct');
|
|
|
+ }
|
|
|
+ elseif ($student_submissions->status == 2) {
|
|
|
+ $feedback = iassign_icons::insert('incorrect');
|
|
|
+ }
|
|
|
+ elseif ($student_submissions->status == 1) {
|
|
|
+ $feedback = iassign_icons::insert('post');
|
|
|
+ }
|
|
|
+ elseif ($student_submissions->status == 0) {
|
|
|
+ $feedback = iassign_icons::insert('not_post');
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($this->action != 'print') {
|
|
|
+ if ($tentativas > 0)
|
|
|
+ print '<td> <a href="' . $url . '" ' . $last_solution_submission . '>' . $feedback . '</a> (' . $tentativas . ')</td>' . "\n";
|
|
|
+ else
|
|
|
+ print '<td> <a href="' . $url . '" ' . $last_solution_submission . '>' . $feedback . '</a> </td>' . "\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($this->action == 'print')
|
|
|
+ print $feedback . ' (' . $tentativas . ')<br>' . $comment . ' (' . $sum_comment . ') ' . "\n";
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
+
|
|
|
+ if ($j - 1 < 1 || $j == $i)
|
|
|
+ $iassign_previous = "-1";
|
|
|
+ else
|
|
|
+ $iassign_previous = $num[$j - 1]->iassignid;
|
|
|
+
|
|
|
+ if ($x - 1 < 0 || $x == $w)
|
|
|
+ $user_previous = "-1";
|
|
|
+ else
|
|
|
+ $user_previous = $users_array[$x - 1]->userid;
|
|
|
+
|
|
|
+
|
|
|
+ if ($i - 1 > $j)
|
|
|
+ $iassign_next = $num[$j + 1]->iassignid;
|
|
|
+ else
|
|
|
+ $iassign_next = "-1";
|
|
|
+
|
|
|
+ if ($w - 1 > $x)
|
|
|
+ $user_next = $users_array[$x + 1]->userid;
|
|
|
+ else
|
|
|
+ $user_next = "-1";
|
|
|
+
|
|
|
+ $position = "&row= $x&column=$j";
|
|
|
+
|
|
|
+ $url = $CFG->wwwroot . "/mod/iassign/view.php?action=viewsubmission&id=" . $id . "&userid_iassign=" . $users_array[$x]->userid .
|
|
|
+ "&iassign_current=" . $num[$j]->iassignid . "&view_iassign=" . $this->view_iassign;
|
|
|
+ $url .= $position;
|
|
|
+ $feedback = iassign_icons::insert('not_post');
|
|
|
+ if ($this->action == 'print')
|
|
|
+ print $feedback . ' (0)<br>' . $comment . ' (' . $sum_comment . ') ' . "\n";
|
|
|
+ else {
|
|
|
+ print '<td> <a href="' . $url . '">' . $feedback . '</a> </td>' . "\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $USER->matrix_iassign[$x][$j] = new stdClass();
|
|
|
+ $USER->matrix_iassign[$x][$j]->iassign_previous = $iassign_previous;
|
|
|
+ $USER->matrix_iassign[$x][$j]->user_previous = $user_previous;
|
|
|
+ $USER->matrix_iassign[$x][$j]->iassign_next = $iassign_next;
|
|
|
+ $USER->matrix_iassign[$x][$j]->user_next = $user_next;
|
|
|
+
|
|
|
+ if ($student_submissions)
|
|
|
+ $USER->matrix_iassign[$x][$j]->iassign_submission_current = $student_submissions->id;
|
|
|
+ else
|
|
|
+ $USER->matrix_iassign[$x][$j]->iassign_submission_current = 0;
|
|
|
+ print '</td>' . "\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ $total = $total + $total_student;
|
|
|
+ $porcentagem = ($total_student / ($j - 1)) * 100;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ print '</tr>' . "\n";
|
|
|
+ $sum_correct_student[$sum_student] = new stdClass();
|
|
|
+ $sum_correct_student[$sum_student]->name = $name;
|
|
|
+ $sum_correct_student[$sum_student]->sum = $total_student;
|
|
|
+ }
|
|
|
+
|
|
|
+ for ($i = 1; $i < $j; $i ++) {
|
|
|
+ if (is_null($sum_iassign_correct[$i]))
|
|
|
+ $sum_iassign_correct[$i] = 0;
|
|
|
+
|
|
|
+ $sum_correct_iassign[$i] = new stdClass();
|
|
|
+ $sum_correct_iassign[$i]->sum = $sum_iassign_correct[$i];
|
|
|
+ $sum_correct_iassign[$i]->name = $num[$i]->name;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ print_string('no_activity', 'iassign');
|
|
|
+ }
|
|
|
+ print "</table>\n";
|
|
|
+
|
|
|
+ if ($this->action != 'print')
|
|
|
+ print $OUTPUT->footer();
|
|
|
+ die();
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
function move_activity () {
|
|
@@ -1328,7 +1560,7 @@ class 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>";
|
|
|
print '<td width=15% align="right">' . $link_stats . '</td>' . "\n";
|