Exemple #1
0
$PAGE->set_title($strheading);

if ($id > 0) {
    $tool = $tmobject->timetable_converting_dbdata_toeditform($tool); 
    $editform = new edit_sheduleclass_form(null, array('id' => $id, 'tool' => $tool, 'deptid' => $deptid, 'schoid' => $schoolid, 'semid' => $semid, 'courseid' => $courseid, 'classid' => $classid, 'classtype' => $classtype, 'classtypeid' => $tool->classtypeid));

    $editform->set_data($tool);
    $data = $editform->get_data();
} else {
    $editform = new sheduleclass_form(null, array('id' => $id, 'tool' => $tool, 'deptid' => $deptid, 'schoid' => $schoolid, 'semid' => $semid, 'courseid' => $courseid, 'classid' => $classid, 'classtype' => $classtype));
    $data = $editform->get_data();
}



if ($editform->is_cancelled()) {
    $returnurl = new moodle_url('/local/timetable/scheduleclassview.php');
    redirect($returnurl);
} else if ($data) {

    if ($data->id > 0) {
        $classtypes = array($data->classtypeid);
        foreach ($classtypes as $classtype) {
            $temp = $tmobject->timetable_addscheduleclass_instance($data, $classtype);
            $DB->update_record('local_scheduleclass', $temp);
        }// end of foreach     



        $semid = $data->semesterid;
        $classid = $data->classid;