]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12439 database preset fixes
authortoyomoyo <toyomoyo>
Wed, 5 Dec 2007 06:13:17 +0000 (06:13 +0000)
committertoyomoyo <toyomoyo>
Wed, 5 Dec 2007 06:13:17 +0000 (06:13 +0000)
mod/data/lib.php
mod/data/preset.php

index f0a89b9cc786138194a6af135fc4de206da047bb..1b3a9e86f58cad8b6f38f8a2625fdf3278358f7e 100755 (executable)
@@ -2070,10 +2070,11 @@ class PresetImporter {
 
         // existing valuas MUST be sent too - it can not work without them!
         foreach ($this->data as $prop=>$unused) {
-            if (array_key_exists($prop, $settings)) {
-                $this->$prop = $settings->$prop;
+            if (array_key_exists($prop, (array)$settings)) {
+                $this->data->$prop = $settings->$prop;
             }
         }
+
         data_update_instance(addslashes_object($this->data));
 
         if (strstr($this->folder, '/temp/')) clean_preset($this->folder); /* Removes the temporary files */
index 334be156acd349d59a4f877fa176c530b047e690..3f4bac95840a165b05a1c509a0305c7b9993aa24 100644 (file)
@@ -10,7 +10,6 @@ require_once('lib.php');
 require_once($CFG->libdir.'/uploadlib.php');
 require_once($CFG->libdir.'/xmlize.php');
 
-
 $id       = optional_param('id', 0, PARAM_INT);    // course module id
 $d        = optional_param('d', 0, PARAM_INT);     // database activity id
 $action   = optional_param('action', 'base', PARAM_ALPHANUM); // current action
@@ -203,8 +202,6 @@ switch ($action) {
         echo '</div>';
         break;
 
-
-
         /***************** Exporting *****************/
     case 'save1':
         if (!data_submitted() or !confirm_sesskey()) {
@@ -319,25 +316,20 @@ $options->d = $data->id;
 $options->sesskey = sesskey();
 print_single_button('preset.php', $options, $strsave, 'post');
 echo '</td></tr>';
-
-
 echo '<tr><td valign="top" colspan="2" align="center"><h3>'.$strimport.'</h3></td></tr>';
-
 echo '<tr><td><label for="fromfile">'.$strfromfile.'</label>';
 helpbutton('importfromfile', '', 'data');
 echo '</td><td>';
-
 echo '<form id="uploadpreset" method="post" action="preset.php">';
 echo '<fieldset class="invisiblefieldset">';
 echo '<input type="hidden" name="d" value="'.$data->id.'" />';
 echo '<input type="hidden" name="action" value="importzip" />';
 echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
-echo '<input name="file" size="20" value="" id="fromfile" type="text" /><input name="coursefiles" value="'.$strchooseorupload.'" onclick="return openpopup('."'/files/index.php?id=2&amp;choose=uploadpreset.file', 'coursefiles', 'menubar=0,location=0,scrollbars,resizable,width=750,height=500', 0".');" type="button" />';
+echo '<input name="file" size="20" value="" id="fromfile" type="text" /><input name="coursefiles" value="'.$strchooseorupload.'" onclick="return openpopup('."'/files/index.php?id={$course->id}&amp;choose=uploadpreset.file', 'coursefiles', 'menubar=0,location=0,scrollbars,resizable,width=750,height=500', 0".');" type="button" />';
 echo '<input type="submit" value="'.$strimport.'" />';
 echo '</fieldset></form>';
 echo '</td></tr>';
 
-
 echo '<tr valign="top"><td><label>'.$strusestandard.'</label>';
 helpbutton('usepreset', '', 'data');
 echo '</td><td>';
@@ -381,7 +373,4 @@ echo '</div>';
 
 print_footer($course);
 
-
-
-
 ?>