Example #1
0
    function definition_after_data() {
        global $USER, $CFG, $DB, $PAGE;
        $mform = $this->_form;
        $request = new requests();
        $countvalue = $mform->getElementValue('count');
        $school = $mform->getElementValue('schoolid');
        if ($countvalue > 1) {
            $semester = $request->currentsemester($school[0]);
            $mysemester = $mform->createElement('static', 'semester_name', get_string('semester', 'local_semesters'), $semester->fullname);
            $mform->createElement('hidden', 'semesterid', $semester->id);
            $mform->setType('semesterid', PARAM_INT);
            $mform->insertElementBefore($mysemester, 'addsemester');
        }
        $course = array();
        $semester = $mform->getElementValue('semesterid');
        $course = $request->get_enrolledcourses($semester, $school);

        $mycourse = $mform->createElement('select', 'courseid', get_string('course'), $course);
        $mform->setType('courseid', PARAM_INT);
        $mform->insertElementBefore($mycourse, 'addcourse');
        $mform->addHelpButton('courseid', 'courseid', 'local_request');
        $mform->addRule('courseid', get_string('required'), 'required', null, 'client');
        $size = 'style="width:50px !important;"';
        $mygrade = array();
        $mygrade[] = &$mform->createElement('text', 'grades', '', $size);
        $mygrade[] = &$mform->createElement('static', 'outof', '', '100');
        $grade = $mform->createElement('group', 'mygrade', get_string('grades'), $mygrade, ' / ', false);
        $mform->insertElementBefore($grade, 'addcourse');
        $mform->addHelpButton('mygrade', 'mygrade', 'local_request');
        $mform->addRule('mygrade', get_string('required'), 'required', null, 'client');
    }
Example #2
0
    $data = file_postupdate_standard_editor($data, 'definition', $definitionoptions, $context, 'user', 'draft', $data->id);
    $data = file_postupdate_standard_filemanager($data, 'attachment', $attachmentoptions, $context, 'user', 'draft', $data->id);

    $message = get_string('requestsentsuccess', 'local_request', $conf);
    $style = array('style' => 'notifysuccess');
    $hierarchy->set_confirmation($message, $returnurl, $style);
}

echo $OUTPUT->header();
echo $OUTPUT->heading($strheading);
$currenttab = 'request';
$requestid->requestcourseexemtabs($currenttab);
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('courseexemdesc', 'local_request'));
}
/* -Checking weather student have any current Semester- */
$schools = $DB->get_records('local_userdata', array('userid' => $USER->id));
$semlist = array();
$cursem = false;
foreach ($schools as $school) {
    $semlist[] = $requestid->currentsemester($school->schoolid);
}
$semlist = array_filter($semlist); //to remove the null values.
$cursem = !empty($semlist) ? true : false;
if (!$cursem) { //If there are no current Semester, display the information for the Student.
    echo $OUTPUT->box(get_string('notefornocurrentsemester', 'local_request'));
} else {
    $myform->display();
}
echo $OUTPUT->footer();
?>