Esempio n. 1
0
$strheading = get_string('manageclasses', 'local_clclasses');
$returnurl = new moodle_url('/local/timetable/index.php?view=scheduled');
$heading = ($id > 0) ? get_string('editschedule', 'local_clclasses') : get_string('scheduleclassroom', 'local_clclasses');
$PAGE->navbar->add(get_string('manageclasses', 'local_clclasses'), new moodle_url('/local/timetable/index.php', array('view' => $view)));
$PAGE->navbar->add($heading);
$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);
Esempio n. 2
0
} else {
    $tool = new stdClass();
    $tool->id = -1;
}
//
$PAGE->set_url('/local/clclasses/scheduleclass.php', array('id' => $id));
$PAGE->set_context($systemcontext);
$PAGE->set_pagelayout('admin');
$PAGE->set_heading($SITE->fullname);
$strheading = get_string('manageclasses', 'local_clclasses');
$returnurl = new moodle_url('/local/clclasses/index.php', array('id' => $id));
$heading = ($id > 0) ? get_string('editschedule', 'local_clclasses') : get_string('scheduleclassroom', 'local_clclasses');
$PAGE->navbar->add(get_string('manageclasses', 'local_clclasses'), new moodle_url('/local/clclasses/index.php', array('id' => $id)));
$PAGE->navbar->add($heading);
$PAGE->set_title($strheading);
$editform = new sheduleclass_form(null, array('id' => $id, 'deptid' => $deptid, 'schoid' => $schoid, 'semid' => $semid, 'courseid' => $courseid, 'classid' => $classid));
$availabledate = explode('-', $tool->availableweekdays);
in_array('M', $availabledate) ? $tool->mon = 1 : $tool->mon = 0;
in_array('TU', $availabledate) ? $tool->tue = 1 : $tool->tue = 0;
in_array('W', $availabledate) ? $tool->wed = 1 : $tool->wed = 0;
in_array('TH', $availabledate) ? $tool->thu = 1 : $tool->thu = 0;
in_array('F', $availabledate) ? $tool->fri = 1 : $tool->fri = 0;
in_array('SA', $availabledate) ? $tool->sat = 1 : $tool->sat = 0;
in_array('SU', $availabledate) ? $tool->sun = 1 : $tool->sun = 0;


$editform->set_data($tool);
if ($editform->is_cancelled()) {
    /* Bug report #297  -  Classes>Enroll Users- Past and Upcoming course offerings
     * @author hemalatha c arun <*****@*****.**>
     * Resolved - Redirected to view page , when class is not belongs to active semester