} $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); if ($id < 0) echo $OUTPUT->box(get_string('addschooltabdes', 'local_collegestructure')); else echo $OUTPUT->box(get_string('editschooltabdes', 'local_collegestructure'));