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']; /* ---This is the edit form condition--- */ if ($data->id > 0) { /* ---Update the school--- */ $school->school_update_instance($data->id, $data); } else { /* ---Create new school--- */ $school->school_add_instance($data); } redirect($returnurl); } echo $OUTPUT->header(); if ($id < 0) $currenttab = 'create'; else $currenttab = 'edit'; echo $OUTPUT->heading(get_string('manageschools', 'local_collegestructure')); $school->print_collegetabs($currenttab, $id);