Browse Source

Merge branch 'changeActivitiesList' of LInE/iassign into master

igor 4 years ago
parent
commit
03488a513d
4 changed files with 67 additions and 57 deletions
  1. BIN
      icon/__comment_unread.gif
  2. BIN
      icon/comment_unread.gif
  3. 1 1
      lang/en/iassign.php
  4. 66 56
      locallib.php

BIN
icon/__comment_unread.gif


BIN
icon/comment_unread.gif


+ 1 - 1
lang/en/iassign.php

@@ -273,7 +273,7 @@ $string['hbar_orange_r']                  = '';
 $string['hbar_red']                       = '';
 $string['hbar_red_r']                     = '';
 $string['height']                         = 'Height';
-$string['help_ilm']                       = 'on the iLM';
+$string['help_ilm']                       = 'About iLM';
 $string['helpactivitygroup']              = 'Seen by group type?';
 $string['helpactivitygroup_help']         = '<p>If this option is on the activities will be grouped by type, otherwise they will be displayed in a single block in the order of registration.</p>';
 $string['helpchoose_file']                = 'iLM file';

+ 66 - 56
locallib.php

@@ -189,7 +189,7 @@ 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;
 
@@ -313,14 +313,14 @@ class iassign {
     elseif (has_capability('mod/iassign:evaluateiassign', $this->context, $USER->id)) {
       eval($action_iassign_limit[$this->action]);
       }
-    else { // Student reaches this point
-      // When student do/redo activity: do => action = "view"; redo => action = "repeat" 
-      // Arrive here with: "get_answer"; "view"
-      if (isset($action_iassign[$this->action])) // avoid error if non capable user try direct acess
-        eval($action_iassign[$this->action]); // Now load 'view_iassign_current()' with 'view'
-      }
-
-    } // function action()
+      else { // Student reaches this point
+        // When student do/redo activity: do => action = "view"; redo => action = "repeat" 
+        // Arrive here with: "get_answer"; "view"
+        if (isset($action_iassign[$this->action])) // avoid error if non capable user try direct acess
+          eval($action_iassign[$this->action]); // Now load 'view_iassign_current()' with 'view'
+        }
+  
+      } // function action()
 
 
   /// This method runs activities auto evaluation in teacher area
@@ -332,7 +332,7 @@ class iassign {
 
     print $OUTPUT->header();
     print $OUTPUT->footer();
-    }
+  }
 
 
   /// This method moves an iAssign activity
@@ -515,7 +515,7 @@ class iassign {
 
           $status = 3;
           $grade_student = $iLM_PARAM_RealGrade; // evaluated as correct solution submitted is assigned the note pattern of activity
-
+          
           $msg = '<tr><td colspan=2>' . iassign_icons::insert('feedback_correct') . '<br>' . get_string('get_answer_correct', 'iassign') . '</td>';
 
           // log record
@@ -1365,12 +1365,12 @@ class iassign {
         } // 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') . '&nbsp;' . 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
+      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') . '&nbsp;' . 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()
 
@@ -1418,7 +1418,7 @@ class iassign {
       } else {
       $iassign_submission = $DB->get_record("iassign_submission", array("iassign_statementid" => $this->activity->get_activity()->id, "userid" => $this->userid_iassign)); // data about student solution
       }
-      
+
     if ($iassign_submission)
       $this->update_comment($iassign_submission->id);
 
@@ -1665,19 +1665,19 @@ class iassign {
           }
 
         print $OUTPUT->box('<p><strong>' . $last_iassign . '</strong></p>' . "\n");
-
+        
         if (!isset($enderecoPOST)) $enderecoPOST = "";
         // Prepare tags to present the iLM
         print $OUTPUT->box($ilm->view_iLM($iassign_statement_activity_item, $student_answer, $enderecoPOST, $loadTeacherActivity));
 
         }
 
-       //2020 Eliminei daqui o codigo para colocar o quadro com area para enivar e ler comentarios
-       //2020 Estava subordinado ao: elseif (($this->action == 'viewsubmission') && has_capability('mod/iassign:evaluateiassign', $USER->context, $USER->id))
-       //2020 e com isso NAO permitia aluno ter o quadro para envio!
-       //2020 Foi para final dessa funcao 'view_iassign_current()'
+      //2020 Eliminei daqui o codigo para colocar o quadro com area para enivar e ler comentarios
+      //2020 Estava subordinado ao: elseif (($this->action == 'viewsubmission') && has_capability('mod/iassign:evaluateiassign', $USER->context, $USER->id))
+      //2020 e com isso NAO permitia aluno ter o quadro para envio!
+      //2020 Foi para final dessa funcao 'view_iassign_current()'
 
-      } // elseif (($this->action == 'viewsubmission') && has_capability('mod/iassign:evaluateiassign', $USER->context, $USER->id))
+    } // elseif (($this->action == 'viewsubmission') && has_capability('mod/iassign:evaluateiassign', $USER->context, $USER->id))
     // *** (end) Teacher access (view learner's submission to the activity)
 
     // *** Student access (view the activity)
@@ -1948,7 +1948,7 @@ class iassign {
             $output .= $ilm->view_iLM($iassign_statement_activity_item, $student_answer, $enderecoPOST, $loadTeacherActivity); // presents iLM
             }
 
-          //1 Desse modo entre area para comentario, mas nao seu botao separado - deixar para o final com botao!
+           //1 Desse modo entre area para comentario, mas nao seu botao separado - deixar para o final com botao!
           //1 if ($iassign_statement_activity_item->type_iassign == 3) {
           //1   $history_comment = '';
           //1   if ($iassign_submission) {
@@ -1963,6 +1963,7 @@ class iassign {
           //1   $output .= "</form></center>\n";
           //1   $only_one_send_button = 1; // avoid put comment frame again (bellow)
           //1   }
+          
 
           $output .= $OUTPUT->box_end();
           print $output;
@@ -1991,7 +1992,7 @@ class iassign {
       print $output;
       }
 
-    //2020 Quadro com area para enivar e ler comentarios veio para este ponto para permitir todos o terem
+      //2020 Quadro com area para enivar e ler comentarios veio para este ponto para permitir todos o terem
     // $only_one_send_button is to avoid to put 2 copies of comments (area to send and see comments between teacher and student)
     if ($only_one_send_button==0 && $iassign_statement_activity_item->type_iassign == 3) { // type_iassign=3 => activity of type "exercise" - submit button and automatic evaluation
       // Put a block with area to sent/answer comments
@@ -2043,9 +2044,9 @@ class iassign {
     $c = 1;
     foreach ($iassign_list as $iassign) {
       $fields .= ", activity_id_$c, activity_name_$c, total_submissions_activity_$c, grade_activity_$c"
-              . ", status_activity_$c, ilm_id_activity_$c, ilm_name_activity_$c";
+          . ", status_activity_$c, ilm_id_activity_$c, ilm_name_activity_$c";
       $c ++;
-      }
+    }
 
     // Finding enrolled students:
     $params = array('shortname' => 'student');
@@ -2081,14 +2082,14 @@ class iassign {
           case 0:
             $str .= '"not_post",';
             break;
-          }
+        }
         $str .= $iassign->iassign_ilmid . ',';
 
         $ilm_activity = $DB->get_record("iassign_ilm", array('id' => $iassign->iassign_ilmid));
         $str .= '"' . $ilm_activity->name . '"';
-        }
-      $str .= "\n";
       }
+      $str .= "\n";
+    }
     $str = $fields . "\n" . $str;
     header("Content-disposition: attachment; filename=report.csv");
     header("Pragma: no-cache");
@@ -2097,7 +2098,7 @@ class iassign {
     header('Connection: close');
     print $str;
     flush();
-    } // function export_csv()
+  } // function export_csv()
 
 
   /// Display report of performance
@@ -2870,6 +2871,11 @@ class iassign {
       print $link_add;
       print "</td>\n";
       } // if (has_capability('mod/iassign:editiassign', $this->context, $USER->id))
+    
+    //print '</tr></table>' . "\n";
+
+
+    print '<div style="float: right;">';
     if (has_capability('mod/iassign:editiassign', $this->context, $USER->id)) {
       if ($iassign_list) {
         print '<td align="right">' . "\n";
@@ -2894,8 +2900,8 @@ class iassign {
         print "</td>\n";
         } // if ($iassign_list)
       }
-    print '</tr></table>' . "\n";
-
+      print '</tr></table>' . "\n";
+    
     if (has_capability('mod/iassign:submitiassign', $this->context, $USER->id))
       $this->view_legend_icons();
 
@@ -2936,15 +2942,15 @@ class iassign {
         }
 
       if ($iassign_array_exercise) {
-        $title = get_string('exercise', 'iassign');
+        $title = get_string('exercise', 'iassign').(count($iassign_array_exercise)>1?'s':'');
         $this->show_iassign($title, $iassign_array_exercise, $i_exercise);
         }
       if ($iassign_array_test) {
-        $title = get_string('test', 'iassign');
+        $title = get_string('test', 'iassign').(count($iassign_array_test)>1?'s':'');
         $this->show_iassign($title, $iassign_array_test, $i_test);
         }
       if ($iassign_array_example) {
-        $title = get_string('example', 'iassign');
+        $title = get_string('example', 'iassign').(count($iassign_array_example)>1?'s':'');;
         $this->show_iassign($title, $iassign_array_example, $i_example);
         }
       if ($iassign_array_general) {
@@ -2975,6 +2981,9 @@ class iassign {
         print $OUTPUT->box_end();
         } // 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();
     } // function view_iassigns()
 
 
@@ -3165,20 +3174,20 @@ class iassign {
         if (has_capability('mod/iassign:editiassign', $this->context, $USER->id) && $USER->iassignEdit == 1) {
 
 	  //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 = "&nbsp;<a href='view.php?action=up$str_aux'>" . iassign_icons::insert('move_up_iassign') . "</a>";
-	  if ($j==0) // first activity
-            $link_down = "&nbsp;<a href='view.php?action=firstdown$str_aux'>" . iassign_icons::insert('move_down_iassign') . "</a>";
-          else
-            $link_down = "&nbsp;<a href='view.php?action=down$str_aux'>" . iassign_icons::insert('move_down_iassign') . "</a>";
-          $link_delete = "&nbsp;<a href='view.php?action=delete$str_aux'>" . iassign_icons::insert('delete_iassign') . "</a>";
-          $link_visible_hide = "&nbsp;<a href='view.php?action=visible$str_aux'>" . iassign_icons::insert('hide_iassign') . "</a>";
-          $link_visible_show = "&nbsp;<a href='view.php?action=visible$str_aux'>" . iassign_icons::insert('show_iassign') . "</a>";
-          $link_edit = "&nbsp;<a href='view.php?action=edit$str_aux'>" . iassign_icons::insert('edit_iassign') . "</a>";
-          $link_duplicate_activity = "&nbsp;<a href='view.php?action=duplicate_activity$str_aux' >" . iassign_icons::insert('duplicate_iassign') . "</a>\n";
-          $link_move_activity = "&nbsp;<a href='#' onclick='load_move($iassign_current); return false;' >" . iassign_icons::insert('move_activity') . "</a>\n";
+    $str_aux = "&id=$id&iassign_current=$iassign_current&iassign_up=$iassign_up&iassign_down=$iassign_down";
 
+    $link_up = "&nbsp;<a href='view.php?action=up$str_aux'>" . iassign_icons::insert('move_up_iassign') . "</a>";
+    if ($j==0) // first activity
+      $link_down = "&nbsp;<a href='view.php?action=firstdown$str_aux'>" . iassign_icons::insert('move_down_iassign') . "</a>";
+    else
+      $link_down = "&nbsp;<a href='view.php?action=down$str_aux'>" . iassign_icons::insert('move_down_iassign') . "</a>";
+    $link_delete = "&nbsp;<a href='view.php?action=delete$str_aux'>" . iassign_icons::insert('delete_iassign') . "</a>";
+    $link_visible_hide = "&nbsp;<a href='view.php?action=visible$str_aux'>" . iassign_icons::insert('hide_iassign') . "</a>";
+    $link_visible_show = "&nbsp;<a href='view.php?action=visible$str_aux'>" . iassign_icons::insert('show_iassign') . "</a>";
+    $link_edit = "&nbsp;<a href='view.php?action=edit$str_aux'>" . iassign_icons::insert('edit_iassign') . "</a>";
+    $link_duplicate_activity = "&nbsp;<a href='view.php?action=duplicate_activity$str_aux' >" . iassign_icons::insert('duplicate_iassign') . "</a>\n";
+    $link_move_activity = "&nbsp;<a href='#' onclick='load_move($iassign_current); return false;' >" . iassign_icons::insert('move_activity') . "</a>\n";
+    
           if (count($iassign_array) > 1) {
             if ($j == 0)
               $links .= $link_down;
@@ -4245,7 +4254,7 @@ class ilm_settings {
         $param->ilm_type = $iassign_ilm->type;
         $param->type = $iassign_ilm->type; // using as 'type' in ilm_handlers/html5.php
         $param->url = $iassign_ilm->url;
-
+      
         // If the iLM does not present curret language => Notice: Undefined property: stdClass::$en_us in...
         if (!isset($description->{current_language()})) {
           if (isset($description->{"en_us"})) $param->description = $description->{"en_us"};
@@ -4280,8 +4289,8 @@ class ilm_settings {
       if (!$iassign_ilm) { // The second turn (form sended) reaches this point - Just in case (if the admin use back and forward in the browser)
         print get_string('empty_file', 'iassign') . "?<br/>\n"; //TODO warning not to use back?
         // echo "Sem dados<br/>"; exit;
-        return;
-        }
+	return;
+	}
       $description = json_decode($iassign_ilm->description);
       if ($iassign_ilm) {
         if ($iassign_ilm->parent == 0)
@@ -4434,9 +4443,9 @@ class ilm_settings {
           if ($file)
             $fs->delete_area_files($contextsystem->id, 'mod_iassign', 'ilm', $file->get_itemid());
           }
-        }
-      }
-    else // if ($files_ilm)
+        } 
+      } 
+        else // if ($files_ilm)
       $return = $iassign_ilm->file_jar;
 
     $delete_file = $fs->delete_area_files($contextuser->id, 'user', 'draft', $itemid);
@@ -6233,6 +6242,7 @@ class ilm_manager {
     }
 
 
+  //NN
 //NN
   // Build string with JavaScript code with function to edit/remove/double iLM files
   // @calledby view_files_ilm($iassign_ilm_class, $extension, $start = 0)