Beispiel #1
0
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'noclean' => true);
$editform = new module_form(null, array('editoroptions' => $editoroptions));
$editform->set_data($tool);
if ($editform->is_cancelled()) {
    redirect($returnurl);
} else if ($data = $editform->get_data()) {
    //This is the edit form condition
    if ($data->id > 0) {
        // Update
        $data->description = $data->description['text'];
        $result = $instance->module_update_instance($data, $userid);
        $instance->success_error_msg($result, 'success_up_module', 'error_up_module', $currenturl, $data);
    } else {
        // Create new
        $data->description = $data->description['text'];
        $result = $instance->module_add_instance($data, $userid);
        $instance->success_error_msg($result, 'success_add_module', 'error_add_module', $currenturl, $data);
    }
    redirect($returnurl);
}

echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('managemodule', 'local_modules'));
if ($id < 0)
    $currenttab = "new";
else
    $currenttab = "edit";
$instance->print_tabs($currenttab, $id);
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    if ($id < 0)
        echo $OUTPUT->box(get_string('addnewdesc', 'local_modules'));