Selaa lähdekoodia

Update 'locallib.php'

To avoid warnings: "Notice: Undefined offset: 0 in ..." e "Notice: Trying to get property 'iassign_next' of non-object in"
* function view_iassign_current ():
   In "elseif (($this->action == 'viewsubmission') && has_capability('mod/iassign:evaluateiassign', $USER->context, $USER->id))" added:
   "$has_row_column = isset($USER->matrix_iassign[$row][$column]) ? True : False;" and "$has_row_column && " in the next 4 "if ($USER->matrix_iassign[$row][$column]->..." (just bellow)
leo 2 vuotta sitten
vanhempi
commit
4098a9ed9c
1 muutettua tiedostoa jossa 8 lisäystä ja 10 poistoa
  1. 8 10
      locallib.php

+ 8 - 10
locallib.php

@@ -2888,26 +2888,24 @@ var exercises = [ '; // '
       $link_up = iassign_icons::insert('up_disable');
       $link_down = iassign_icons::insert('down_disable');
 
+      $has_row_column = isset($USER->matrix_iassign[$row][$column]) ? True : False;
       // next_activity
-      if ($USER->matrix_iassign[$row][$column]->iassign_next != - 1) {
-        $url_next = "view.php?action=viewsubmission&id=$id&iassign_submission_current=" . $USER->matrix_iassign[$row][$column + 1]->iassign_submission_current . "&userid_iassign=$this->userid_iassign&iassign_current=" . $USER->matrix_iassign[$row][$column]->iassign_next . "&view_iassign=report&row=" . ($row) . "&column=" . ($column + 1);
+      if ($has_row_column && $USER->matrix_iassign[$row][$column]->iassign_next != - 1) {
+        $url_next = "view.php?action=viewsubmission&id=$id&iassign_submission_current=" . $USER->matrix_iassign[$row][$column + 1]->iassign_submission_current . "&userid_iassign=$t$
         $link_next = "<a href='" . $url_next . "'>" . (iassign_icons::insert('next_activity')) . "</a>";
         }
       // previous_activity
-      if ($USER->matrix_iassign[$row][$column]->iassign_previous != - 1) {
-        $url_previous = "view.php?action=viewsubmission&id=$id&iassign_submission_current=" . $USER->matrix_iassign[$row][$column - 1]->iassign_submission_current . "&userid_iassign=$this->userid_iassign&iassign_current=" . $USER->matrix_iassign[$row][$column]->iassign_previous . "&view_iassign=report&row=" . ($row) . "&column=" . ($column - 1);
+      if ($has_row_column && $USER->matrix_iassign[$row][$column]->iassign_previous != - 1) {
+        $url_previous = "view.php?action=viewsubmission&id=$id&iassign_submission_current=" . $USER->matrix_iassign[$row][$column - 1]->iassign_submission_current . "&userid_iassig$
         $link_previous = "<a href='" . $url_previous . "'>" . (iassign_icons::insert('previous_activity')) . "</a>";
         }
       // previous_student
-      if ($USER->matrix_iassign[$row][$column]->user_next != - 1) {
-        $url_down = "view.php?action=viewsubmission&id=$id&iassign_submission_current=" . $USER->matrix_iassign[$row + 1][$column]->iassign_submission_current . "&userid_iassign=" . $USER->matrix_iassign[$row][$column]->user_next . "&iassign_current=" . $this->activity->get_activity()->id . "&view_iassign=report&row=" . ($row + 1) . "&column=" . ($column);
+      if ($has_row_column && $USER->matrix_iassign[$row][$column]->user_next != - 1) {
+        $url_down = "view.php?action=viewsubmission&id=$id&iassign_submission_current=" . $USER->matrix_iassign[$row + 1][$column]->iassign_submission_current . "&userid_iassign=" $
         $link_down = "<a href='" . $url_down . "'>" . (iassign_icons::insert('previous_student')) . "</a>";
         }
       // next_student
-      if ($USER->matrix_iassign[$row][$column]->user_previous != - 1) {
-        $url_up = "view.php?action=viewsubmission&id=$id&iassign_submission_current=" . $USER->matrix_iassign[$row - 1][$column]->iassign_submission_current . "&userid_iassign=" . $USER->matrix_iassign[$row][$column]->user_previous . "&iassign_current=" . $this->activity->get_activity()->id . "&view_iassign=report&row=" . ($row - 1) . "&column=" . ($column);
-        $link_up = "<a href='" . $url_up . "'>" . (iassign_icons::insert('next_student')) . "</a>";
-        }
+      if ($has_row_column && $USER->matrix_iassign[$row][$column]->user_previous != - 1) {
 
       if ($iassign_submission) {
         $student_answer = $iassign_submission->answer;