Beispiel #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');
    }