MDL-12439 database preset fixes
This commit is contained in:
+3
-2
@@ -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 */
|
||||
|
||||
+1
-12
@@ -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&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}&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);
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user