Просмотр исходного кода

Update 'locallib.php'

Solved problem of working with old iAssign activity (that do not have "store_all_submissions" field):
 + function new_iassign ($param):
   * Apos "$newentry->type_iassign = $param->type_iassign;"
     if (!isset($param->store_all_submissions)) { $newentry->store_all_submissions = 0; }
 + function update_iassign ($param):
   * Apos "$newentry->type_iassign = $param->type_iassign;" acresc.:
     if (!isset($param->store_all_submissions)) { $newentry->store_all_submissions = 0; }
leo 2 лет назад
Родитель
Сommit
279175a7c0
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      locallib.php

+ 6 - 2
locallib.php

@@ -5555,7 +5555,9 @@ class activity {
     $newentry->iassignid = $param->iassignid;
     $newentry->name = $param->name;
     $newentry->type_iassign = $param->type_iassign;
-    $newentry->store_all_submissions = $param->store_all_submissions;
+    if (!isset($param->store_all_submissions)) { // if is an old acitivity, field 'store_all_submissions' is not defined
+      $newentry->store_all_submissions = 0;
+      }
 
     // $newentry->proposition = $param->proposition; // 2019/02/13 - With the use of 'editor' in 'mform', field 'proposition' is Array ( [text] => <DESCRIPTION> [format] => 1 )
     $proposition = $param->proposition;
@@ -5767,7 +5769,9 @@ class activity {
     $newentry->id = $param->iassign_id;
     $newentry->name = $param->name;
     $newentry->type_iassign = $param->type_iassign;
-    $newentry->store_all_submissions = $param->store_all_submissions;
+    if (!isset($param->store_all_submissions)) { // if is an old acitivity, field 'store_all_submissions' is not defined
+      $newentry->store_all_submissions = 0;
+      }
 
     //2019 $newentry->proposition = $param->proposition;
     $proposition = $param->proposition;