Forráskód Böngészése

Update 'ilm_handlers/html5.php'

Considering table 'iassign_ilm': messages to fields 'evaluate', 'reevaluate', 'editingbehavior'; fixes to allow the edition of 'reevaluate', 'editingbehavior'
leo 2 éve
szülő
commit
658fcfb103
1 módosított fájl, 25 hozzáadás és 9 törlés
  1. 25 9
      ilm_handlers/html5.php

+ 25 - 9
ilm_handlers/html5.php

@@ -3,9 +3,9 @@
 /**
  * Class that implements ilm_handle, in order to allow manipulation and management of HTML5 iLM
  * 
- * @author Igor Moreira Félix
+ * @author Igor Moreira Fe'lix
  * @author Patricia Alves Rodrigues
- * @author Leônidas O. Brandão
+ * @author Leo^nidas O. Branda~o
  * @version v 1 2017/17/10
  * @package mod_iassign_ilm_handlers
  * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
@@ -22,6 +22,7 @@ class html5 implements ilm_handle {
 
 
   /// Produce HTML code to load iLM
+  //  @calledby  locallib.php: class ilm_settings: function build_ilm_tags($ilm_id, $options=array()): $retorno=$typec::build_ilm_tags($ilm_id, $options);
   public static function build_ilm_tags ($ilm_id, $options = array()) {
     global $DB, $OUTPUT;
     global $CONF_WWW; //TODO 1 => use iLM under WWW; otherwise use under MoodleData
@@ -203,6 +204,9 @@ class html5 implements ilm_handle {
       if (!$fileid) { // 'Something is wrong. Maybe your teacher withdrew this exercise file. Please, inform your teacher.';
         print iassign::warning_message_iassign('error_exercise_removed') . "<br/>\n"; // I couldn't find the file in table 'files'!
         }
+      //D echo "ilm_handlers/html5.php: {course_module}.id=" . $USER->cm .", {iassign_statement}.id=" . $iassign_statement_activity_item->id .
+      //D      ", {iassign_statement}.file=" . $iassign_statement_activity_item->file . ", {iassign_statement}.filesid=" . $iassign_statement_activity_item->filesid .
+      //D      ", {context}.id=" . $context->id . ", {files}.id=" . $fileid . ", {files}.filename=" . $files->filename . "<br/>";
       } // if ($view_teacherfileversion)
 
     $ilm_name = strtolower($ilm->name);
@@ -490,7 +494,7 @@ class html5 implements ilm_handle {
     $iassign_ilm->file_jar = null;
 
     $application_xml = @simplexml_load_file($CFG->dataroot . '/temp/' . 'ilm-application.xml', null, LIBXML_NOCDATA); //2019
-    $file_jar = self::save_ilm_by_xml($application_xml, $files_extract); // iLM ath (since iAssign)> ./ilm/...
+    $file_jar = self::save_ilm_by_xml($application_xml, $files_extract); // iLM path (since iAssign)> ./ilm/...
 
     if ($file_jar == null) { // 'save_ilm_by_xml(...)' detected a problem (perhaps no write permission)
       return false;
@@ -536,7 +540,7 @@ class html5 implements ilm_handle {
     $iassign_ilm = $DB->get_record('iassign_ilm', array('id' => $ilm_id));
 
     $iassign_ilm_configs = $DB->get_records('iassign_ilm_config', array('iassign_ilmid' => $ilm_id)); //MOOC 2016
-    /*if (!$iassign_ilm_configs) return;*/
+    //if (!$iassign_ilm_configs) return;
 
     $files_jar = $iassign_ilm->file_jar;
 
@@ -730,6 +734,10 @@ class html5 implements ilm_handle {
     $updentry->enable = $param->enable;
     $updentry->timemodified = $param->timemodified;
     $updentry->evaluate = $param->evaluate;
+    $updentry->reevaluate = $param->reevaluate; // reevaluate = 1 => allows to the teacher calls method to re-evaluate (does it in batch, to all students)
+    $updentry->editingbehavior = $param->editingbehavior; // editingbehavior = 1 => iLM auto-evaluation remains working over a solution sent by the student (iGeom does not work, iVProg does)
+    $updentry->submissionbehavior = $param->submissionbehavior; // 0 => 'After submission, this iLM remains on the same page'; 1 => 'After submission, this iLM changes the current page'
+
     //D echo "./ilm_handlers/html5.php: edit_ilm(...): file_jar=$file_jar, file_class=" . $updentry->file_class . "<br/>"; //D exit;
 
     $DB->update_record("iassign_ilm", $updentry);
@@ -812,16 +820,19 @@ class html5 implements ilm_handle {
         break;
         }
 
-      print($OUTPUT->notification(get_string('error_import_ilm_version', 'iassign'), 'notifyproblem')); // There is another iLM with the sama version!
+      print($OUTPUT->notification(get_string('error_import_ilm_version', 'iassign'), 'notifyproblem')); // There is another iLM with the same version!
       return false;
       }
     else {
       $file_jar = self::save_ilm_by_xml($application_xml, $files_extract);
-     if ($file_jar == null) {
-       return false;
-       }
+      if ($file_jar == null) {
+        return false;
+        }
 
+      //2022/05/13
+      //D echo "/var/www/html/saw2021_2/mod/iassign/ilm_handlers/html5.php: file_jar=" . $file_jar . "<br/>\n";
       $file_jar = str_replace("./", "", $file_jar);
+      //D echo "/var/www/html/saw2021_2/mod/iassign/ilm_handlers/html5.php: file_jar=" . $file_jar . "<br/>\n";
 
       if (empty($file_jar)) {
         $msg_error = get_string('error_add_ilm', 'iassign') . "<br/>In new_ilm: file_jar empty, files_extract=" . $files_extract . "<br/>\n";
@@ -830,7 +841,9 @@ class html5 implements ilm_handle {
         //print("New file = " . file_jar . "<br/>");	  
         }
       else { // if (empty($file_jar))
-        $iassign_ilm = $DB->get_record('iassign_ilm', array("parent" => 0, "name" => (String) $application_xml->name));
+        $ilm_xml_name = (String) $application_xml->name;
+        //D echo "/var/www/html/saw2021_2/mod/iassign/ilm_handlers/html5.php: ilm_xml_name=" . $ilm_xml_name . "<br/>\n";
+        $iassign_ilm = $DB->get_record('iassign_ilm', array("parent" => 0, "name" => $ilm_xml_name));
         if (!$iassign_ilm) {
           $iassign_ilm = new stdClass(); //MOOC 2016
           $iassign_ilm->id = 0;
@@ -859,6 +872,9 @@ class html5 implements ilm_handle {
         $newentry->submissionbehavior = (String) $application_xml->submissionbehavior;
         $newentry->action_buttons = (String) $application_xml->action_buttons;
 
+        //D echo "/var/www/html/saw2021_2/mod/iassign/ilm_handlers/html5.php: name=" . $$newentry->name . "<br/>version=" . $$newentry->version . "<br/>\n";
+        //D echo "file_jar=" . $$newentry->file_jar . "<br/>\n";
+        //D exit;
         $newentry->id = $DB->insert_record("iassign_ilm", $newentry);
 
         // log event --------------------------------------------------------------------------------------