Esempio n. 1
0
$editform = new curriculum_form(null, array('id' => $id, 'editoroptions' => $editoroptions));

if ($id > 0) {
    $tool->description = array('text' => $tool->description, 'format' => FORMAT_HTML);
}
$editform->set_data($tool);

if ($editform->is_cancelled()) {
    redirect($returnurl);
} else if ($data = $editform->get_data()) {
    $data->description = $data->description['text'];
    $data->timemodified = time();
    //This is the edit form condition
    if ($data->id > 0) {
        // Update
        $curriculum->curriculum_update_instance($data);
    } else {

        //create curriculum   
        $data->timecreated = time();
        $curriculum->curriculum_add_instance($data);
    }
    redirect($returnurl);
}

echo $OUTPUT->header();

if ($id < 0)
    $currenttab = "create";
else
    $currenttab = "edit";