|
@@ -186,8 +186,10 @@ class iassign {
|
|
|
else if (!$this->iassign = $DB->get_record('iassign', array('id' => $this->cm->instance))) {
|
|
|
print_error('invalidid', 'iassign');
|
|
|
}
|
|
|
+
|
|
|
$USER->context = context_module::instance($this->cm->id);
|
|
|
$USER->cm = $this->cm->id;
|
|
|
+
|
|
|
$this->iassign->cmidnumber = $this->cm->idnumber;
|
|
|
$this->iassign->courseid = $this->course->id;
|
|
|
$this->context = context_module::instance($this->cm->id);
|
|
@@ -284,8 +286,9 @@ class iassign {
|
|
|
'stats' => '$this->stats();',
|
|
|
'printstats' => '$this->stats();');
|
|
|
|
|
|
- $restricted = array('up' => '$this->activity->move_iassign($this->iassign_up,$this->return);',
|
|
|
- 'down' => '$this->activity->move_iassign($this->iassign_down,$this->return);',
|
|
|
+ $restricted = array('firstdown' => '$this->activity->move_iassign("firstdown", $this->iassign_down, $this->return);',
|
|
|
+ 'up' => '$this->activity->move_iassign("up", $this->iassign_up, $this->return);',
|
|
|
+ 'down' => '$this->activity->move_iassign("down", $this->iassign_down, $this->return);',
|
|
|
'visible' => '$this->activity->visible_iassign($this->return);',
|
|
|
'delete' => '$this->activity->delete($this->return);',
|
|
|
'deleteno' => '$this->return_home_course("confirm_not_delete_iassign");',
|
|
@@ -307,7 +310,7 @@ class iassign {
|
|
|
elseif (has_capability('mod/iassign:evaluateiassign', $this->context, $USER->id)) {
|
|
|
eval($action_iassign_limit[$this->action]);
|
|
|
}
|
|
|
- else {
|
|
|
+ else {
|
|
|
|
|
|
|
|
|
eval($action_iassign[$this->action]);
|
|
@@ -1374,6 +1377,9 @@ class iassign {
|
|
|
global $USER, $CFG, $COURSE, $DB, $OUTPUT;
|
|
|
$id = $this->cm->id;
|
|
|
$iassignid = $this->iassign->id;
|
|
|
+
|
|
|
+ $only_one_send_button = 0;
|
|
|
+
|
|
|
$iassign = $DB->get_record("iassign", array("id" => $iassignid));
|
|
|
|
|
|
|
|
@@ -1408,7 +1414,7 @@ class iassign {
|
|
|
} else {
|
|
|
$iassign_submission = $DB->get_record("iassign_submission", array("iassign_statementid" => $this->activity->get_activity()->id, "userid" => $this->userid_iassign));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if ($iassign_submission)
|
|
|
$this->update_comment($iassign_submission->id);
|
|
|
|
|
@@ -1430,6 +1436,7 @@ class iassign {
|
|
|
|
|
|
if (($this->action != 'viewsubmission') && has_capability('mod/iassign:evaluateiassign', $USER->context, $USER->id)) {
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -1655,42 +1662,18 @@ class iassign {
|
|
|
|
|
|
print $OUTPUT->box('<p><strong>' . $last_iassign . '</strong></p>' . "\n");
|
|
|
|
|
|
- if (!$enderecoPOST) $enderecoPOST = "";
|
|
|
+ if (!isset($enderecoPOST)) $enderecoPOST = "";
|
|
|
|
|
|
print $OUTPUT->box($ilm->view_iLM($iassign_statement_activity_item, $student_answer, $enderecoPOST, $loadTeacherActivity));
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ($iassign_statement_activity_item->type_iassign == 3) {
|
|
|
- $output = '';
|
|
|
- $history_comment = '';
|
|
|
- if ($iassign_submission) {
|
|
|
- $enderecoPOSTcomment = "" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=newcomment&iassign_current=" . $this->activity->get_activity()->id .
|
|
|
- "&iassign_submission_current=" . $iassign_submission->id . "&userid_iassign=" . $this->userid_iassign . "&row=" . ($row) . "&column=" . ($column);
|
|
|
- $history_comment = $this->search_comment_submission($iassign_submission->id);
|
|
|
- }
|
|
|
- else {
|
|
|
- $enderecoPOSTcomment = "" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=newcomment&iassign_current=" . $this->activity->get_activity()->id .
|
|
|
- "&userid_iassign=" . $this->userid_iassign . "&row=" . ($row) . "&column=" . ($column);
|
|
|
- }
|
|
|
-
|
|
|
- $output .= $OUTPUT->box_start();
|
|
|
-
|
|
|
- $output .= "<center><form name='formEnvioComment' id='formEnvioComment1' method='post' action='$enderecoPOSTcomment' enctype='multipart/form-data'>\n";
|
|
|
- $output .= "<p><textarea rows='2' cols='60' name='submission_comment'></textarea></p>\n";
|
|
|
- $output .= "<p><input type=submit value='" . get_string('submit_comment', 'iassign') . "'\></p>\n";
|
|
|
- $output .= "</form></center>\n";
|
|
|
- if (!empty($history_comment)) {
|
|
|
- $output .= " <table id='outlinetable' class='generaltable boxaligncenter' cellpadding='5' width='100%'> \n";
|
|
|
- $output .= " <tr><th>" . get_string('history_comments', 'iassign') . "</th></tr>";
|
|
|
- $output .= $history_comment;
|
|
|
- $output .= "</table>";
|
|
|
- }
|
|
|
- $output .= $OUTPUT->box_end();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- print $output;
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -1976,6 +1959,9 @@ class iassign {
|
|
|
$output .= "</form></center>\n";
|
|
|
$output .= $OUTPUT->box_end();
|
|
|
print $output;
|
|
|
+
|
|
|
+ $only_one_send_button = 1;
|
|
|
+
|
|
|
} else {
|
|
|
$output .= $OUTPUT->box_end();
|
|
|
print $output;
|
|
@@ -2004,6 +1990,40 @@ class iassign {
|
|
|
print $output;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ if ($only_one_send_button==0 && $iassign_statement_activity_item->type_iassign == 3) {
|
|
|
+
|
|
|
+ $output = '';
|
|
|
+ $history_comment = '';
|
|
|
+ $row = optional_param('row', 0, PARAM_INT);
|
|
|
+ $column = optional_param('column', 0, PARAM_INT);
|
|
|
+ if ($iassign_submission) {
|
|
|
+ $enderecoPOSTcomment = "" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=newcomment&iassign_current=" . $this->activity->get_activity()->id .
|
|
|
+ "&iassign_submission_current=" . $iassign_submission->id . "&userid_iassign=" . $this->userid_iassign . "&row=" . ($row) . "&column=" . ($column);
|
|
|
+ $history_comment = $this->search_comment_submission($iassign_submission->id);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $enderecoPOSTcomment = "" . $CFG->wwwroot . "/mod/iassign/view.php?id=" . $id . "&action=newcomment&iassign_current=" . $this->activity->get_activity()->id .
|
|
|
+ "&userid_iassign=" . $this->userid_iassign . "&row=" . ($row) . "&column=" . ($column);
|
|
|
+ }
|
|
|
+
|
|
|
+ $output .= $OUTPUT->box_start();
|
|
|
+ $output .= "<center><form name='formEnvioComment' id='formEnvioComment1' method='post' action='$enderecoPOSTcomment' enctype='multipart/form-data'>\n";
|
|
|
+ $output .= "<p><textarea rows='2' cols='60' name='submission_comment'></textarea></p>\n";
|
|
|
+ $output .= "<p><input type=submit value='" . get_string('submit_comment', 'iassign') . "'\></p>\n";
|
|
|
+ $output .= "</form></center>\n";
|
|
|
+ if (!empty($history_comment)) {
|
|
|
+ $output .= " <table id='outlinetable' class='generaltable boxaligncenter' cellpadding='5' width='100%'> \n";
|
|
|
+ $output .= " <tr><th>" . get_string('history_comments', 'iassign') . "</th></tr>";
|
|
|
+ $output .= $history_comment;
|
|
|
+ $output .= "</table>";
|
|
|
+ }
|
|
|
+ $output .= $OUTPUT->box_end();
|
|
|
+ print $output;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
print $OUTPUT->footer();
|
|
|
die();
|
|
@@ -3142,14 +3162,20 @@ class iassign {
|
|
|
$links = " <a href='view.php?id=$id&userid_iassign=$USER->id&action=view&iassign_current=$iassign_current'>" . $iassign_array[$j]->name . "</a>";
|
|
|
$links .= $comment_unread;
|
|
|
if (has_capability('mod/iassign:editiassign', $this->context, $USER->id) && $USER->iassignEdit == 1) {
|
|
|
- $aux = "&id=$id&iassign_current=$iassign_current&iassign_up=$iassign_up&iassign_down=$iassign_down";
|
|
|
- $link_up = " <a href='view.php?action=up$aux'>" . iassign_icons::insert('move_up_iassign') . "</a>";
|
|
|
- $link_down = " <a href='view.php?action=down$aux'>" . iassign_icons::insert('move_down_iassign') . "</a>";
|
|
|
- $link_delete = " <a href='view.php?action=delete$aux'>" . iassign_icons::insert('delete_iassign') . "</a>";
|
|
|
- $link_visible_hide = " <a href='view.php?action=visible$aux'>" . iassign_icons::insert('hide_iassign') . "</a>";
|
|
|
- $link_visible_show = " <a href='view.php?action=visible$aux'>" . iassign_icons::insert('show_iassign') . "</a>";
|
|
|
- $link_edit = " <a href='view.php?action=edit$aux'>" . iassign_icons::insert('edit_iassign') . "</a>";
|
|
|
- $link_duplicate_activity = " <a href='view.php?action=duplicate_activity$aux' >" . iassign_icons::insert('duplicate_iassign') . "</a>\n";
|
|
|
+
|
|
|
+
|
|
|
+ $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>";
|
|
|
+ if ($j==0)
|
|
|
+ $link_down = " <a href='view.php?action=firstdown$str_aux'>" . iassign_icons::insert('move_down_iassign') . "</a>";
|
|
|
+ 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";
|
|
|
|
|
|
if (count($iassign_array) > 1) {
|
|
@@ -3272,24 +3298,36 @@ class iassign {
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
|
|
|
function search_comment_submission ($iassign_submissionid) {
|
|
|
global $USER, $DB, $OUTPUT, $COURSE;
|
|
|
- $context = context_course::instance($COURSE->id);
|
|
|
+
|
|
|
+ $colorEdit1 = "#a7bede";
|
|
|
+ $colorEdit2 = "#b7ceee";
|
|
|
+ $has_capability = 0;
|
|
|
|
|
|
$comments = $DB->get_records_list('iassign_submission_comment', 'iassign_submissionid', array('iassign_submissionid' => $iassign_submissionid), 'timecreated DESC');
|
|
|
$text = "";
|
|
|
if ($comments) {
|
|
|
|
|
|
+ $even = 1;
|
|
|
foreach ($comments as $tmp) {
|
|
|
$user_data = $DB->get_record("user", array('id' => $tmp->comment_authorid));
|
|
|
- if (has_capability('mod/iassign:editiassign', $context, $tmp->comment_authorid)) {
|
|
|
- $text .= "<tr><td bgcolor='#fee7ae'><b> $user_data->firstname</b> (" . userdate($tmp->timecreated) . "</br>\n";
|
|
|
- $text .= "$tmp->comment</td></tr>";
|
|
|
- } else {
|
|
|
- $text .= "<tr><td bgcolor='#dce7ec'>»<b>" . $user_data->firstname . "</b> (" . userdate($tmp->timecreated) . "</br>\n";
|
|
|
- $text .= $tmp->comment . "</td></tr>\n";
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ($even) {
|
|
|
+ $text .= "<tr><td bgcolor='" . $colorEdit1 . "'>»<b>" . $user_data->firstname . "</b> (" . userdate($tmp->timecreated) . ")</br>\n";
|
|
|
+ $even = 0;
|
|
|
+ } else {
|
|
|
+ $text .= "<tr><td bgcolor='" . $colorEdit2 . "'>»<b>" . $user_data->firstname . "</b> (" . userdate($tmp->timecreated) . ")</br>\n";
|
|
|
+ $even = 1;
|
|
|
}
|
|
|
+ $text .= $tmp->comment . "</td></tr>\n";
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
return $text;
|
|
@@ -3576,23 +3614,48 @@ class activity {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- function move_iassign ($target, $return) {
|
|
|
- global $DB, $OUTPUT;
|
|
|
- $iassign_target = $DB->get_record("iassign_statement", array("id" => $target));
|
|
|
- $aux = $this->activity->position;
|
|
|
- $newentry = new stdClass();
|
|
|
- $newentry->id = $this->activity->id;
|
|
|
- $newentry->position = $iassign_target->position;
|
|
|
|
|
|
- if (!$DB->update_record('iassign_statement', $newentry)) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ function move_iassign ($move_action, $target, $return) {
|
|
|
+ global $DB, $OUTPUT;
|
|
|
+
|
|
|
+ $initial_position_source = $this->activity->position;
|
|
|
+ $iassign_target = $DB->get_record("iassign_statement", array("id" => $target));
|
|
|
+ if ($move_action=="firstdown") {
|
|
|
+ $final_position_source = 2;
|
|
|
+ $final_position_target = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ if ($move_action=="down") {
|
|
|
+ $final_position_target = $this->activity->position;
|
|
|
+ $final_position_source = $final_position_target + 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ if ($move_action=="up") {
|
|
|
+ $final_position_target = $this->activity->position;
|
|
|
+ $final_position_source = $final_position_target - 1;
|
|
|
+ }
|
|
|
+ else {
|
|
|
print_error('error_update_move_iassign', 'iassign');
|
|
|
+ exit;
|
|
|
}
|
|
|
+ $newentry = new stdClass();
|
|
|
+ $newentry->id = $this->activity->id;
|
|
|
+ $newentry->position = $final_position_source;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- $newentry->id = $iassign_target->id;
|
|
|
- $newentry->position = $aux;
|
|
|
- if (!$DB->update_record('iassign_statement', $newentry))
|
|
|
+ if (!$DB->update_record('iassign_statement', $newentry)) {
|
|
|
print_error('error_update_move_iassign', 'iassign');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $newentry->id = $iassign_target->id;
|
|
|
+ $newentry->position = $final_position_target;
|
|
|
+ if (!$DB->update_record('iassign_statement', $newentry))
|
|
|
+ print_error('error_update_move_iassign', 'iassign');
|
|
|
+ }
|
|
|
redirect($return);
|
|
|
}
|
|
|
|
|
@@ -4027,6 +4090,7 @@ class ilm {
|
|
|
$this->ilm = null;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
function view_iLM ($iassign_statement_activity_item, $student_answer, $enderecoPOST, $view_teacherfileversion) {
|
|
@@ -4215,8 +4279,8 @@ class ilm_settings {
|
|
|
if (!$iassign_ilm) {
|
|
|
print get_string('empty_file', 'iassign') . "?<br/>\n";
|
|
|
|
|
|
- return;
|
|
|
- }
|
|
|
+ return;
|
|
|
+ }
|
|
|
$description = json_decode($iassign_ilm->description);
|
|
|
if ($iassign_ilm) {
|
|
|
if ($iassign_ilm->parent == 0)
|
|
@@ -6134,7 +6198,7 @@ class ilm_manager {
|
|
|
|
|
|
$itemid = $item_fc->get_id();
|
|
|
if (!in_array($itemid, $array_files_id)) {
|
|
|
-
|
|
|
+
|
|
|
$allfiles[] = $item_fc;
|
|
|
$array_files_id[] = $itemid;
|
|
|
$countf++;
|