فهرست منبع

Update 'ilm_manager.php'

leo 4 سال پیش
والد
کامیت
b3ab03ff46
1فایلهای تغییر یافته به همراه14 افزوده شده و 11 حذف شده
  1. 14 11
      ilm_manager.php

+ 14 - 11
ilm_manager.php

@@ -149,15 +149,15 @@ if ($id>0) { // if reach here by iLM get request, id is not defined!
 
 if (has_capability('mod/iassign:editiassign', $context, $USER->id)) {
 
-  $ilm_manager_instance = new ilm_manager($id, $url, $from); // locallib.php: class ilm_manager
-  $dirid = $ilm_manager_instance->get_dir_ilm('dirid');
-
-
-// Enter here whenever : teacher is viewing/creating an iLM content (preview), here is called by the iLM do not verify credentials.
-if ($action == 'get') {
-  $fileid = optional_param('fileid', 1, PARAM_INT);
-  return $ilm_manager_instance->get_file_ilm($ilmid, $fileid);
-  }
+  $ilm_manager_instance = new ilm_manager($id, $url, $from); // ./locallib.php: class ilm_manager
+  //echo "ilm_manager.php: $id, $url, $from<br/>";
+  $dirid = $ilm_manager_instance->get_dir_ilm('dirid'); // ./locallib.php: class ilm_manager: 
+
+  // Enter here whenever : teacher is viewing/creating an iLM content (preview), here is called by the iLM do not verify credentials.
+  if ($action == 'get') {
+    $fileid = optional_param('fileid', 1, PARAM_INT);
+    return $ilm_manager_instance->get_file_ilm($ilmid, $fileid);
+    }
 
   if ($action) { // avoid several tests when empty...
     switch ($action) { // '$ilm_manager_instance' instace of 'locallib.php : class ilm_manager'
@@ -184,7 +184,10 @@ if ($action == 'get') {
       case 'preview':
         // The function bellow calls '/filter/iassign_filter/filter.php' function 'filter($text, array $options = array())' and exit (do not continue bellow)
         //// prepare_secure_access(): array('content' => $ilm_content_file, 'token' => $token, 'secure_id' => $id_iLM_security)
-        $ilm_manager_instance->preview_ilm($id, $iassign_ilm, $iassign_statementid); // in '/mod/iassign/locallib.php'
+        if (isset($iassign_statementid))
+          $ilm_manager_instance->preview_ilm($id, $iassign_ilm, $iassign_statementid); // in '/mod/iassign/locallib.php'
+        else
+          $ilm_manager_instance->preview_ilm($id, $iassign_ilm); // in '/mod/iassign/locallib.php'
         break;
       case 'addilm':
         $ilm_manager_instance->add_ilm();
@@ -352,4 +355,4 @@ if ($action == 'get') {
   print $OUTPUT->footer();
 
   die;
-  } // if (has_capability('mod/iassign:editiassign', $context, $USER->id))
+  } // if (has_capability('mod/iassign:editiassign', $context, $USER->id))