$message = get_string('failure', 'local_scheduleexam', $data); $style = array('style' => 'notifyproblem'); } $hierarchy->set_confirmation($message, $returnurl, $style); } if ($id > 0) { if (!($tool = $DB->get_record('local_scheduledexams', array('id' => $id)))) { print_error('invalidtoolid', 'local_gradeletter'); } } else { $tool = new stdClass(); $tool->id = -1; } $scheduleexamobj = new edit_form(NULL, array('id' => $id)); $scheduleexamobj->set_data($tool); if ($scheduleexamobj->is_cancelled()) { redirect($returnurl); } else if ($data = $scheduleexamobj->get_data()) { $data->timecreated = time(); $data->timemodified = time(); $data->usermodified = $USER->id; if ($data->id > 0) { $co_id = $DB->get_field("local_clclasses", 'cobaltcourseid', array('id' => $data->classid)); $class_name = $DB->get_field("local_clclasses", 'fullname', array('id' => $data->classid));
$DB->set_field('local_lecturetype', 'visible', $disabled, array('id' => $id)); redirect($returnurl); } $PAGE->navbar->add(get_string('managelecturetypes', 'local_lecturetype'), new moodle_url('/local/lecturetype/index.php', array('id' => $id))); if ($id > 0) { $strheading = $strheading . ' : ' . get_string('edit', 'local_lecturetype'); $PAGE->navbar->add(get_string('edit', 'local_lecturetype')); } else { $strheading = $strheading . ' : ' . get_string('create', 'local_lecturetype'); $PAGE->navbar->add(get_string('create', 'local_lecturetype')); } $PAGE->set_title($strheading); $editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes, 'trusttext' => false, 'noclean' => true); $editform = new edit_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->lecturetype_update_instance($data); $instance->success_error_msg($result, 'success_up_lecture', 'error_up_lecture', $currenturl, $data); } else { // Create new $data->description = $data->description['text']; $result = $instance->lecturetype_add_instance($data); $instance->success_error_msg($result, 'success_add_lecture', 'error_add_lecture', $currenturl, $data);
$message = get_string('activegradeletters', 'local_gradeletter', $data); } $options = array('style' => 'notifysuccess'); $hierarchy->set_confirmation($message, $returnurl, $options); } if ($id > 0) { if (!($tool = $DB->get_record('local_gradeletters', array('id' => $id)))) { print_error('invalidtoolid', 'local_gradeletter'); } } else { $tool = new stdClass(); $tool->id = -1; } $gradeeditform = new edit_form(null, array('id' => $id)); $gradeeditform->set_data($tool); if ($gradeeditform->is_cancelled()) { redirect($returnurl); } else{ if ($data = $gradeeditform->get_data()) { $data->schoolname = $DB->get_field('local_school', 'fullname', array('id' => $data->schoolid)); if ($data->id > 0) { // Update $gletters->gradeletter_update_instance($data); $message = get_string('updatedgradeletter', 'local_gradeletter', $data); } else {
} else { $message = get_string('failure', 'local_examtype', $data); $style = array('style' => 'notifyproblem'); } $hierarchy->set_confirmation($message, $returnurl, $style); } $PAGE->navbar->add(get_string('manageexamtype', 'local_examtype'), new moodle_url('/local/examtype/index.php', array('id' => $id))); if ($id > 0) { $strheading = get_string('editexamtype', 'local_examtype'); $string = get_string('pluginname', 'local_examtype') . ' : ' . $strheading; } $PAGE->navbar->add($strheading); $string = get_string('pluginname', 'local_examtype') . ' : ' . $strheading; $PAGE->set_title($string); $examtypeedit = new edit_form(); $examtypeedit->set_data($tool); if ($examtypeedit->is_cancelled()) { redirect($returnurl); } else if ($data = $examtypeedit->get_data()) { if ($data->id > 0) { $data->description = $data->description['text']; $result = $instance->examtype_update_instance($data); $instance->success_error_msg($result, 'success_up_exam', 'error_up_exam', $currenturl, $data); } else { $data->description = $data->description['text']; $result = $instance->examtype_add_instance($data); $instance->success_error_msg($result, 'success_add_exam', 'error_add_exam', $currenturl, $data); } redirect($returnurl); }