本文整理汇总了PHP中hierarchy::get_records_cobaltselect_menu方法的典型用法代码示例。如果您正苦于以下问题:PHP hierarchy::get_records_cobaltselect_menu方法的具体用法?PHP hierarchy::get_records_cobaltselect_menu怎么用?PHP hierarchy::get_records_cobaltselect_menu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hierarchy
的用法示例。
在下文中一共展示了hierarchy::get_records_cobaltselect_menu方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: definition
function definition() {
global $USER, $CFG, $DB, $PAGE;
$mform = $this->_form;
$PAGE->requires->yui_module('moodle-local_cobaltsettings-cobaltsetting', 'M.local_cobaltsettings.init_cobaltsetting', array(array('formid' => $mform->getAttribute('id'))));
/* ---used for editing purpose--- */
$eid = $this->_customdata['temp'];
if ($eid->id <= 0)
$mform->addElement('header', 'settingsheader', get_string('category_level_settings', 'local_cobaltsettings'));
else
$mform->addElement('header', 'settingsheader', get_string('editentity_level_settings', 'local_cobaltsettings'));
$hier = new hierarchy();
$global_ob = global_settings::getInstance();
$global_ob->school_formelement_condition($mform);
$aca_list = $hier->get_records_cobaltselect_menu('local_cobalt_entity', '', null, '', 'id,name', 'Select Category');
$mform->addElement('select', 'entityid', get_string('category', 'local_cobaltsettings'), $aca_list);
$mform->addRule('entityid', get_string('category', 'local_cobaltsettings'), 'required', null, 'client');
$mform->setType('entityid', PARAM_INT);
$mform->registerNoSubmitButton('updatecourseformat');
$mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
$mform->addElement('hidden', 'categorytypehere');
$mform->setType('categorytypehere', PARAM_TEXT);
$mform->addElement('hidden', 'radiobuttonhere');
$mform->setType('radiobuttonhere', PARAM_INT);
$radioarray = array();
$radioarray[] = & $mform->createElement('radio', 'level', 'SCH', get_string('schoollevel', 'local_collegestructure'), 'SL');
$radioarray[] = & $mform->createElement('radio', 'level', 'PCH', get_string('programlevel', 'local_programs'), 'PL');
$radioarray[] = & $mform->createElement('radio', 'level', 'CCH', get_string('curriculumlevel', 'local_curriculum'), 'CL');
$mform->addGroup($radioarray, 'radioarray', '', array(' '), false);
$mform->addRule('radioarray', get_string('category', 'local_cobaltsettings'), 'required', null, 'client');
/* if($eid->id <= 0){
$mform->disabledIf('radioarray', 'radiobuttondisable', 'eq', 1);
} */
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$eid->id;
if ($eid->id > 0)
$string = get_string('updateentity', 'local_cobaltsettings');
else
$string = get_string('createentity', 'local_cobaltsettings');
$this->add_action_buttons(true, $string);
}
示例2:
$school = $hierarchy->get_school_parent($scho);
echo '<div class="selfilterposition">';
$select = new single_select(new moodle_url('/local/admission/viewapplicant.php'), 'ptype', $level, $ptype, null);
$select->set_label(get_string('programlevel', 'local_programs'));
echo $OUTPUT->render($select);
echo '</div>';
echo '<div class="selfilterposition">';
$select = new single_select(new moodle_url('/local/admission/viewapplicant.php?ptype=' . $ptype . ''), 'school', $school, $schoolid, null);
$select->set_label(get_string('schoolid', 'local_collegestructure'));
echo $OUTPUT->render($select);
echo '</div>';
if ($schoolid == 0) {
if (is_siteadmin()) {
$program = $hierarchy->get_records_cobaltselect_menu('local_program', 'visible=1', null, '', 'id,fullname', '--Select--');
} else {
$program = $admission->get_pgrms();
}
echo '<div class="selfilterposition">';
$select = new single_select(new moodle_url('/local/admission/viewapplicant.php?ptype=' . $ptype . '&school=' . $schoolid . ''), 'program', $program, $programid, null);
$select->set_label(get_string('program', 'local_programs'));
echo $OUTPUT->render($select);
echo '</div>';
} else {
$program = $hierarchy->get_records_cobaltselect_menu('local_program', "schoolid=$schoolid AND visible=1 AND programlevel=$ptype", null, '', 'id,fullname', '--Select--');
echo '<div class="selfilterposition">';
$select = new single_select(new moodle_url('/local/admission/viewapplicant.php?ptype=' . $ptype . '&school=' . $schoolid . ''), 'program', $program, $programid, null);
$select->set_label(get_string('program', 'local_programs'));
echo $OUTPUT->render($select);
示例3: settingelements
/**
* @method settingelements
* @todo to set form elements
* @param object $mform object
* @param string $place1
* @param string $place2
* @return array of objects ($mfrom objects)
* */
public function settingelements($mform, $place1, $place2) {
global $hierarchy;
$hierarchy = new hierarchy();
$faculties = $hierarchy->get_assignedschools();
$school = $hierarchy->get_school_parent($faculties);
$newel = $mform->createElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $school);
$mform->insertElementBefore($newel, $place1);
$mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
$school_value = $mform->getElementValue('schoolid');
//Creating program element after getting the school value
if (isset($school_value) && !empty($school_value)) {
$school_id = $school_value[0];
$programs = $hierarchy->get_records_cobaltselect_menu('local_program', "schoolid=$school_id AND visible=1", null, '', 'id,fullname', '--Select--');
$newel2 = $mform->createElement('select', 'programid', get_string('selectprogram', 'local_programs'), $programs);
$mform->insertElementBefore($newel2, $place2);
$mform->addRule('programid', get_string('missingfullname', 'local_programs'), 'required', null, 'client');
$program_value = $mform->getElementValue('programid');
return $program_value;
}
}
示例4: hierarchy
/**
* @method get_clclasseslist_gradesubmission
* @Todo to get clclasses under a semester.
* @param object $semid - This parameter contains semesterid.
* @return array
*/
function get_clclasseslist_gradesubmission($schid, $semid) {
global $DB, $USER;
$hierarchy = new hierarchy();
$out = $hierarchy->get_records_cobaltselect_menu('local_clclasses', "semesterid=$semid and schoolid=$schid AND visible=1", null, '', 'id,fullname', 'Select Class');
return $out;
}
示例5: array
function definition_after_data() {
global $DB;
$mform = $this->_form;
$eid = $this->_customdata['temp'];
if ($eid->id < 0) {
$school = $mform->getElementValue('schoolid');
$tools = array();
if ($school[0] > 0) {
$fid = $school[0];
$hierarchy = new hierarchy();
$program = $hierarchy->get_records_cobaltselect_menu('local_program', "schoolid=$fid AND visible=1", null, '', 'id,fullname', '--Select--');
$newel = $mform->createElement('select', 'programid', get_string('selectprogram', 'local_programs'), $program);
$mform->insertElementBefore($newel, 'addprogramlisthere');
$formatvalue2 = $mform->getElementValue('schoolid');
$mform->addRule('programid', get_string('selectprogram', 'local_programs'), 'required', null, 'client');
$formatvalue2 [0];
}
}
}
示例6: array
else {
$conform_msg = get_string('eassign_mentor', 'local_assignmentor', $temp_lang);
$options = array('style' => 'notifyproblem');
}
$hier->set_confirmation($conform_msg, $currenturl, $options);
}
}
try {
/* ----school filter----- */
$schoolids = $assignee_ob->check_loginuser_registrar_admin();
$schoollist = $hier->get_school_parent($schoolids, '', true);
$school_select = new single_select(new moodle_url('/local/assignmentor/assign_mentor.php'), 'sid', $schoollist, $sid, null, null);
$school_select->set_label(get_string('select', 'local_collegestructure'));
echo '<div>' . $OUTPUT->render($school_select) . '</div>';
$programlist = $hier->get_records_cobaltselect_menu('local_program', "schoolid=$sid AND visible=1", null, '', 'id,fullname', '--Select--');
$prg_select = new single_select(new moodle_url('/local/assignmentor/assign_mentor.php', array('sid' => $sid)), 'pid', $programlist, $programid, null);
$prg_select->set_label(get_string('selectprogram', 'local_programs'));
echo '<div style="margin-top:10px;">' . $OUTPUT->render($prg_select) . '</div>';
echo '<br/><br/>';
$currentyear = date("Y", time());
/* ----fetching students of perticular program and students---- */
$sql1 = "SELECT u.id,u.firstname,u.lastname,u.email ,from_unixtime(ud.timecreated,'%Y') as year From {$CFG->prefix}local_userdata AS ud
INNER JOIN {$CFG->prefix}user AS u
ON u.id=ud.userid
where ud.schoolid=$sid and ud.programid=$programid and from_unixtime(ud.timecreated,'%Y')=$currentyear";
$student_list = $DB->get_records_sql($sql1);
/* ---used to remove already assigned student id 's--- */
foreach ($student_list as $stu => $stu_value) {
$exists = $DB->get_record('local_assignmentor_tostudent', array('studentid' => $stu_value->id, 'schoolid' => $sid, 'programid' => $programid));
示例7: hierarchy
function definition_after_data() {
global $DB, $PAGE, $USER, $hierarchy, $exams, $selected_class;
$hierarchy = new hierarchy();
$gradesub = new grade_submission();
$mform = $this->_form;
$id = $this->_customdata['id'];
$selected_school = $mform->getElementValue('schoolid');
$selected_program = array();
$disable = ($id > 0) ? 'disabled="disabled"' : '';
// for programs and semesters in a school
if ($selected_school[0] > 0) {
$programs_list = array();
$programs_list = $hierarchy->get_records_cobaltselect_menu('local_program', "schoolid=$selected_school[0] AND visible=1", null, '', 'id,fullname', '--Select--');
$programs_listdrop = $mform->createElement('select', 'programid', get_string('programslist', 'local_scheduleexam'), $programs_list, $disable);
$mform->insertElementBefore($programs_listdrop, 'addprogramslisthere');
if ($id < 0) {
$mform->addRule('programid', get_string('programreq', 'local_scheduleexam'), 'required', null, 'client');
}
$semesters_list = array();
$semesters_list = $hierarchy->get_school_semesters($selected_school[0]);
$semesters_listdrop = $mform->createElement('select', 'semesterid', get_string('semesterslist', 'local_scheduleexam'), $semesters_list, $disable);
$mform->insertElementBefore($semesters_listdrop, 'addsemesterslisthere');
if ($id < 0) {
$mform->addRule('semesterid', get_string('semestersreq', 'local_scheduleexam'), 'required', null, 'client');
}
$selected_semester = array();
$selected_semester = $mform->getElementValue('semesterid');
}
// for clclasses assigned to a semester
if (($selected_school[0]) AND ( $selected_semester[0] > 0)) {
$clclasses_list = array();
$clclasses_list = $hierarchy->get_records_cobaltselect_menu('local_clclasses', "semesterid=$selected_semester[0] and schoolid=$selected_school[0] AND visible=1", null, '', 'id,fullname', 'Select Class');
$clclasses_listdrop = $mform->createElement('select', 'classid', get_string('clclasseslist', 'local_scheduleexam'), $clclasses_list, $disable);
$mform->insertElementBefore($clclasses_listdrop, 'addclclasseslisthere');
if ($id < 0)
$mform->addRule('classid', get_string('clclassesreq', 'local_scheduleexam'), 'required', null, 'client');
$selected_class = array();
$selected_class = $mform->getElementValue('classid');
}
if (!empty($selected_class[0])) {
$today = time();
$users = $gradesub->get_class_users($selected_semester[0], $selected_class[0]);
$exams = $gradesub->get_class_exams($selected_semester[0], $selected_class[0]);
if (empty($users)) {
echo '<div style="border:1px groove red; padding:10px;color:red;">' . (get_string('nousers', 'local_gradesubmission')) . '</div>';
}
if (empty($exams)) {
echo '<div style="border:1px groove red; padding:10px;color:red;">' . (get_string('noexam', 'local_gradesubmission')) . '</div>';
}
foreach ($exams as $exam) {
if ($exam->opendate > $today) {
$examsnotcomp = 1;
echo '<div style="border:1px groove red; padding:10px;color:red;">' . (get_string('examnotcompleted', 'local_gradesubmission')) . '</div>';
}
}
}
}
示例8: hierarchy
function definition_after_data() {
global $DB, $CFG;
$hierarchy = new hierarchy();
$mform = $this->_form;
$sid = $mform->getElementValue('schoolid');
if (isset($sid) && !empty($sid) && $sid[0] > 0) {
$resource = cobalt_resources::get_instance();
$building = $hierarchy->get_records_cobaltselect_menu('local_building', "schoolid=$sid[0] AND visible=1", null, '', 'id,fullname', get_string('select', 'local_classroomresources'));
$one = $mform->createElement('select', 'buildingid', get_string('buildingid', 'local_classroomresources'), $building);
$mform->insertElementBefore($one, 'beforefloor');
$mform->addRule('buildingid', get_string('required'), 'required', null, 'client');
}
if (isset($one)) {
$bid = $mform->getElementValue('buildingid');
if (isset($bid) && !empty($bid) && $bid[0] > 0) {
$resource = cobalt_resources::get_instance();
$floor = $hierarchy->get_records_cobaltselect_menu('local_floor', "buildingid=$bid[0] AND visible=1", null, '', 'id,fullname', get_string('select', 'local_classroomresources'));
$two = $mform->createElement('select', 'floorid', get_string('floorname', 'local_classroomresources'), $floor);
$mform->insertElementBefore($two, 'beforeclass');
$mform->addRule('floorid', get_string('required'), 'required', null, 'client');
}
}
if (isset($two)) {
$sid = $mform->getElementValue('schoolid');
$fid = $mform->getElementValue('floorid');
if (isset($fid) && !empty($fid) && $fid[0] > 0) {
$resource = cobalt_resources::get_instance();
$classroom = $hierarchy->get_records_cobaltselect_menu('local_classroom', "floorid=$fid[0] AND visible=1", null, '', 'id,fullname', get_string('select', 'local_classroomresources'));
/*
* ###Bugreport # classroom management
* @hemalatha c arun<hemalatha@eabyas.in>
* (Resolved) adding proper addrule method for form field classroomid.
*/
$three = $mform->createElement('select', 'classroomid', get_string('classroomid', 'local_classroomresources'), $classroom);
$mform->insertElementBefore($three, 'beforeresource');
$mform->addRule('classroomid', get_string('required'), 'required', null, 'client');
$resourcelist = $hierarchy->get_records_cobaltselect_menu('local_resource', "schoolid=$sid[0] AND visible=1", null, '', 'id,fullname', get_string('select', 'local_classroomresources'));
$a = $mform->createElement('select', 'resourceid', get_string('resourceid', 'local_classroomresources'), $resourcelist);
$mform->insertElementBefore($a, 'beforer');
$b = $mform->getElement('resourceid')->setMultiple(true);
$mform->addRule('resourceid', get_string('required'), 'required', null, 'client');
}
}
}
示例9: time
if (isset($schoolist)) {
$semesterslist = $hierarchy->get_school_semesters($school);
echo '<div class="selfilterpos" id="semester">';
$sem = new single_select(new moodle_url('/local/gradesubmission/submitgrades.php?school=' . $school), 'semester', $semesterslist, $semester, null);
$sem->set_label(get_string('semester', 'local_semesters'));
echo $OUTPUT->render($sem);
echo '</div>';
}
$gradesub = grade_submission::getInstance();
if (isset($semester)) {
echo '<div class="selfilterpos" id="class" >';
$clclasseslist = $hierarchy->get_records_cobaltselect_menu('local_clclasses', "schoolid=$school and semesterid=$semester and visible=1", null, '', 'id,fullname', 'Select Class');
$cls = new single_select(new moodle_url('/local/gradesubmission/submitgrades.php?school=' . $school . '&semester=' . $semester), 'class', $clclasseslist, $class, null);
$cls->set_label(get_string('class', 'local_clclasses'));
echo $OUTPUT->render($cls);
echo '</div>';
}
if (!empty($class)) {
$today = time();
$today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
$users = $gradesub->get_class_users($semester, $class);
$exams = $gradesub->get_class_exams($semester, $class);
// print_object($exams);
if (empty($users)) {
示例10: reapeat_schedulecontent_basedon_type
//.........这里部分代码省略.........
$mform->addGroup($instructorinfo, $clname . 'instructor', get_string('instructor', 'local_clclasses'), array(' ', '</br>'), true);
//------------- displaying class intervals-----------------------------------
if (isset($classinfo->semesterid) && isset($classinfo->schoolid)) {
$classintervals = array();
$timeintervalslist = $DB->get_records_sql("select * from {local_timeintervals} where schoolid=$classinfo->schoolid and semesterid=$classinfo->semesterid and visible=>1 order by starttime");
// $mform->addElement('header', 'timeintervals', get_string('intervals_header', 'local_timetable'));
// $calssiuntervals[]=$mform->addElement('static', 'timeintervals[]', '', get_string('intervals_header', 'local_timetable'));
if (($timeintervalslist)) {
$i = 1;
foreach ($timeintervalslist as $timeintervals) {
// $timings[$timeintervals->id]= $timeintervals
$timings[$timeintervals->id] = date('h:i a', strtotime($timeintervals->starttime)) . ' To ' . date('h:i a', strtotime($timeintervals->endtime)) . ' (Interval' . $i . ')';
$i++;
}
$timings = array('Select Timeintervals') + $timings;
$mform->addElement('select', $clname . '[timeinterval]', get_string('selecttimeinterval', 'local_timetable'), $timings);
$mform->setDefault($clname . '[timeinterval]', 0);
} else {
$mform->addElement('static', 'timeinterval_emptyinfo', get_string('selecttimeinterval', 'local_timetable'), get_string('timeinterval_emptyinfo', 'local_timetable'));
}
}
// $mform->addGroup($instructorinfo, $clname, '', array(' ','</br>'), true);
$mform->addElement('checkbox', $clname . '[othertimeinterval]', '', get_string('othetimeinterval', 'local_timetable'));
// $mform->setType($clname.'othertimeinterval', PARAM_INT);
// $mform->disabledIf($clname.'othertimeinterval', 'schoolid', 'eq', null);
// $mform->disabledIf($clname.'othertimeinterval', 'classroom_switch[cl_switch]', 'eq', 'online');
for ($i = 0; $i <= 12; $i++) {
$hours[$i] = sprintf("%02d", $i);
}
for ($i = 0; $i < 60; $i+=5) {
$minutes[$i] = sprintf("%02d", $i);
}
$size = 'style="width:100px;"';
$sec = array();
$sec[] = & $mform->createElement('static', 'from_label', '', '<b>' . get_string('from', 'local_timetable') . ' : </b>');
$sec[] = & $mform->createElement('select', 'starthours', get_string('hour', 'form'), $hours, false, true);
$sec[] = & $mform->createElement('select', 'startminutes', get_string('minute', 'form'), $minutes, false, true);
$sec[] = & $mform->createElement('select', 'start_td', get_string('minute', 'form'), array('am' => 'AM', 'pm' => 'PM'), false, true);
$sec[] = & $mform->createElement('static', 'section_space', '', ' ');
$sec[] = & $mform->createElement('static', 'to_label', '', '<b>' . get_string('to', 'local_timetable') . ' : </b>');
$sec[] = & $mform->createElement('select', 'endhours', get_string('hour', 'form'), $hours, false, true);
$sec[] = & $mform->createElement('select', 'endminutes', get_string('minute', 'form'), $minutes, false, true);
$sec[] = & $mform->createElement('select', 'end_td', get_string('minute', 'form'), array('am' => 'AM', 'pm' => 'PM'), false, true);
$mform->addGroup($sec, $clname . '[customtimeintervals]', '', array(''), true);
// $mform->addRule($clname . '[customtimeintervals]', null, 'required', null, 'client');
$mform->disabledIf($clname . '[customtimeintervals]', $clname . '[othertimeinterval]', 'notchecked');
$mform->disabledIf($clname . '[timeinterval]', $clname . '[othertimeinterval]', 'checked');
// displaying classroom resources
if ($DB->record_exists('local_clclasses', array('id' => $classinfo->id, 'online' => 1))) {
} else {
$classroom = array();
if (isset($classinfo->semesterid) && isset($classinfo->schoolid) && isset($classinfo->id)) {
$classroom = $hierarchy->get_records_cobaltselect_menu('local_classroom', "schoolid=$classinfo->schoolid AND visible=1", null, '', 'id,fullname', '--Select--');
}
$mform->addElement('select', $clname . 'classroom[classroomid]', get_string('classroomids', 'local_classroomresources'), $classroom);
$mform->setType($clname . 'classroom[classroomid]', PARAM_INT);
// $mform->addRule('classroomid', get_string('required'), 'required', null, 'client');
$mform->addElement('checkbox', $clname . 'classroom[otherclroom]', '', get_string('otherroom', 'local_timetable'));
$mform->setType($clname . 'classroom[otherclroom]', PARAM_INT);
$mform->disabledIf($clname . 'classroom[otherclroom]', 'schoolid', 'eq', null);
$clroom_resource = array();
$clroom_resource[] = & $mform->createElement('text', 'building', '', array('placeholder' => 'Building'));
$clroom_resource[] = & $mform->createElement('text', 'floor', '', array('placeholder' => 'Floor'));
$clroom_resource[] = & $mform->createElement('text', 'classroom', '', array('placeholder' => 'Classroom'));
$mform->addGroup($clroom_resource, $clname . 'classroom[customclroom]', '', array(' '), true);
// $mform->addRule('classroom_res', get_string('required'), 'required', null, 'client');
$mform->disabledIf($clname . 'classroom[customclroom]', 'eq', null);
$mform->disabledIf($clname . 'classroom[customclroom]', $clname . 'classroom[otherclroom]', 'notchecked');
$mform->disabledIf($clname . 'classroom[classroomid]', $clname . 'classroom[otherclroom]', 'checked');
$mform->setType($clname . 'classroom[customclroom][building]', PARAM_TEXT);
$mform->setType($clname . 'classroom[customclroom][floor]', PARAM_TEXT);
$mform->setType($clname . 'classroom[customclroom][classroom]', PARAM_TEXT);
}
// end of displaying classroom
// }// end of main foreach
}// end of if condition
}
示例11: hierarchy
function definition_after_data() {
global $CFG,$DB, $PAGE, $USER, $hierarchy, $exams, $selected_class;
$hierarchy = new hierarchy();
$exams = new schedule_exam();
$linkmsg=get_string('navigation_info','local_collegestructure');
$linkstyle='line-height: 0px;margin-bottom: -10px;';
$mform = $this->_form;
$id = $this->_customdata['id'];
$selected_school = $mform->getElementValue('schoolid');
//$selected_program = array();
$disable = ($id > 0) ? 'disabled="disabled"' : '';
// for programs and semesters in a school
if ($selected_school[0] > 0) {
// $programs_list = array();
// $programs_list = $hierarchy->get_school_programs($selected_school[0]);
//
// $programs_listdrop = $mform->createElement('select', 'programid', get_string('programslist', 'local_scheduleexam'), $programs_list, $disable);
// $mform->insertElementBefore($programs_listdrop, 'addprogramslisthere');
// if($id < 0){
// $mform->addRule('programid', get_string('programreq', 'local_scheduleexam'), 'required', null, 'client');
// }
// $selected_program = $mform->getElementValue('programid');
$semesters_list = array();
$semesters_list = $exams->get_semesterslists_scheduleexam($selected_school[0]);
$semesters_listdrop = $mform->createElement('select', 'semesterid', get_string('semester', 'local_semesters'), $semesters_list, $disable);
$mform->insertElementBefore($semesters_listdrop, 'addsemesterslisthere');
if ($id < 0) {
$mform->addRule('semesterid', get_string('missingsemester', 'local_semesters'), 'required', null, 'client');
}
$selected_semester = array();
$selected_semester = $mform->getElementValue('semesterid');
}
// for examtypes in a school
if (($selected_school[0])) {
$examtype = array();
$examtype = $hierarchy->get_records_cobaltselect_menu('local_examtypes', "schoolid = $selected_school[0] AND visible=1", null, '', 'id,examtype', 'Select Assessment Type');
$examtypelist_listdrop = $mform->createElement('select', 'examtype', get_string('examtype', 'local_examtype'), $examtype, $disable);
$mform->insertElementBefore($examtypelist_listdrop, 'addexamtypehere');
if(count($examtype)<=1){
$linkname=get_string('addeditexamtype','local_examtype');
$examtypelist_empty=$mform->createElement('static', 'examtype_emptyinfo', '',$hierarchy->cobalt_navigation_msg($linkmsg,$linkname,$CFG->wwwroot.'/local/examtype/edit.php',$linkstyle));
$mform->insertElementBefore($examtypelist_empty, 'addexamtypeempty_msg');
}
if ($id < 0) {
$mform->addRule('examtype', get_string('examtypereq', 'local_scheduleexam'), 'required', null, 'client');
}
}
// for clclasses assigned to a semester
if (($selected_school[0]) AND ( $selected_semester[0] > 0)) {
$clclasses_list = array();
$clclasses_list = $hierarchy->get_records_cobaltselect_menu('local_clclasses', "semesterid=$selected_semester[0] and schoolid=$selected_school[0] and visible=1", null, '', 'id,fullname', 'Select Class');
$clclasses_listdrop = $mform->createElement('select', 'classid', get_string('class', 'local_clclasses'), $clclasses_list, $disable);
$mform->insertElementBefore($clclasses_listdrop, 'addclclasseslisthere');
if ($id < 0)
$mform->addRule('classid', get_string('clclassesreq', 'local_clclasses'), 'required', null, 'client');
$selected_class = array();
$selected_class = $mform->getElementValue('classid');
}
// for lecturetypes in a school
if ($selected_school[0]) {
$lecturetype = array();
// $lecturetype = $exams->get_lecturetype_scheduleexam($selected_school[0]);
$lecturetype = $hierarchy->get_records_cobaltselect_menu('local_lecturetype', "schoolid=$selected_school[0] ", null, '', 'id,lecturetype', 'Select Mode of Assessment');
$lecturetype_listdrop = $mform->createElement('select', 'lecturetype', get_string('lecturetype', 'local_scheduleexam'), $lecturetype, $disable);
$mform->insertElementBefore($lecturetype_listdrop, 'addlecturetypehere');
if(count($lecturetype)<=1){
$linkname=get_string('create','local_lecturetype');
$lecturetypelist_empty=$mform->createElement('static', 'lecturetype_emptyinfo', '',$hierarchy->cobalt_navigation_msg( $linkmsg, $linkname,$CFG->wwwroot.'/local/lecturetype/edit.php',$linkstyle));
$mform->insertElementBefore($lecturetypelist_empty, 'addlecturetypeempty_msg');
}
if ($id < 0) {
$mform->addRule('lecturetype', get_string('lecturetypereq', 'local_scheduleexam'), 'required', null, 'client');
}
}
if ($selected_class[0]) {
//$cobaltcourse = array();
$cobcourse = $exams->get_cobaltcourse_scheduleexam($selected_class[0]);
$cobaltcourse = $mform->createElement('static', 'cobcourse', get_string('coursename', 'local_cobaltcourses'), $cobcourse);
$mform->insertElementBefore($cobaltcourse, 'addcobaltcourseehere');
}
}
示例12: hierarchy
function definition_after_data() {
global $DB, $PAGE, $USER, $hierarchy, $exams, $selected_class, $data;
$hierarchy = new hierarchy();
$gradesub = new grade_submission();
$mform = $this->_form;
$id = $this->_customdata['id'];
$selected_school = $mform->getElementValue('schoolid');
$selected_program = array();
$disable = ($id > 0) ? 'disabled="disabled"' : '';
// for programs and semesters in a school
if ($selected_school[0] > 0) {
$programs_list = array();
$programs_list = $hierarchy->get_records_cobaltselect_menu('local_program', "schoolid=$selected_school[0] AND visible=1", null, '', 'id,fullname', '--Select--');
$programs_listdrop = $mform->createElement('select', 'programid', get_string('programslist', 'local_scheduleexam'), $programs_list, $disable);
$mform->insertElementBefore($programs_listdrop, 'addprogramslisthere');
if ($id < 0) {
$mform->addRule('programid', get_string('programreq', 'local_scheduleexam'), 'required', null, 'client');
}
$selected_program = array();
$selected_program = $mform->getElementValue('programid');
}
if ($selected_school[0] > 0 AND $selected_program[0] > 0) {
$table = new html_table();
$table->head = array(
get_string('studentid', 'local_graduation'), get_string('studentname', 'local_gradesubmission'), get_string('program', 'local_programs'), get_string('graduation', 'local_graduation'));
$table->size = array('30%', '30%', '20%', '19%');
$table->align = array('left', 'left', 'left', 'center');
$table->width = '99%';
$table->data = $data;
$tabledata = html_writer::table($table);
$mform->addElement('html', $tabledata);
}
}
示例13: array
function definition_after_data() {
global $DB;
$mform = $this->_form;
$id = $this->_customdata['id'];
$formatvalue = $mform->getElementValue('schoolid');
$tools = array();
if ($formatvalue) {
$hierarchy = new hierarchy();
$formatvalue = $formatvalue[0];
if ($formatvalue > 0) {
$tools = classes_get_school_semesters($formatvalue);
/* create a semester dropdown */
$newel = $mform->createElement('select', 'semesterid', get_string('semester', 'local_semesters'), $tools);
$mform->insertElementBefore($newel, 'addsemesterlisthere');
$mform->addHelpButton('semesterid', 'semester', 'local_semesters');
$mform->addRule('semesterid', get_string('missingsemester', 'local_semesters'), 'required', null, 'client');
$mform->setType('addsemesterlisthere', PARAM_RAW);
/* end of the semester dropdown */
$departments = $hierarchy->get_departments_forschool($formatvalue, $none = "");
/* create a department dropdown */
$dept = $mform->createElement('select', 'departmentid', get_string('department', 'local_clclasses'), $departments);
$mform->insertElementBefore($dept, 'adddepartmentlisthere');
$mform->addRule('departmentid', get_string('departmentmissing', 'local_clclasses'), 'required', null, 'client');
$mform->addHelpButton('departmentid', 'department', 'local_clclasses');
/* End of department dropdown */
$departmentvalue = $mform->getElementValue('departmentid');
$departmentvalue = $departmentvalue[0];
if ($departmentvalue > 0) {
$cobaltcourses = $hierarchy->get_records_cobaltselect_menu('local_cobaltcourses', "departmentid=$departmentvalue AND visible=1", null, '', 'id,fullname', '--Select--');
$cobaltcourse = $mform->createElement('select', 'cobaltcourseid', get_string('cobaltcourse', 'local_clclasses'), $cobaltcourses);
$mform->insertElementBefore($cobaltcourse, 'addcobaltcoursehere');
$mform->setType('addcobaltcoursehere', PARAM_RAW);
$mform->addRule('cobaltcourseid', get_string('cobaltcoursemissing', 'local_clclasses'), 'required', null, 'client');
$mform->addHelpButton('cobaltcourseid', 'cobaltcourse', 'local_clclasses');
}
}
$online = $mform->getElementValue('online');
$online = $online[0];
if ($online == 1 && $id > 0) {
$onlinecourses = $hierarchy->get_records_cobaltselect_menu('course', "visible=1 AND category>0", null, '', 'id,fullname', '--Select--');
$cobaltcourse2 = $mform->createElement('select', 'onlinecourseid', get_string('onlinecourse', 'local_clclasses'), $onlinecourses);
$mform->addRule('onlinecourseid', get_string('required'), 'required', null, 'client');
$mform->insertElementBefore($cobaltcourse2, 'addonlinecoursehere');
$mform->setType('addonlinecoursehere', PARAM_RAW);
$mform->addHelpButton('onlinecourseid', 'onlinecourse', 'local_clclasses');
} else if ($online == 2 && $id > 0) {
$default = 0;
$cobaltcourse2 = $mform->createElement('hidden', 'onlinecourseid', get_string('onlinecourse', 'local_clclasses'), $default);
// $mform->addRule('onlinecourseid', get_string('required'), 'required', null, 'client');
$mform->insertElementBefore($cobaltcourse2, 'addonlinecoursehere');
$mform->setDefault('onlinecourseid', $default);
$mform->setType('addonlinecoursehere', PARAM_RAW);
} else if ($online == 1 && $id < 0) {
$onlinecourses = $hierarchy->get_records_cobaltselect_menu('course', "visible=1 AND category>0", null, '', 'id,fullname', '--Select--');
$cobaltcourse2 = $mform->createElement('select', 'onlinecourseid', get_string('onlinecourse', 'local_clclasses'), $onlinecourses);
$mform->addRule('onlinecourseid', get_string('required'), 'required', null, 'client');
$mform->insertElementBefore($cobaltcourse2, 'addonlinecoursehere');
$mform->setType('addonlinecoursehere', PARAM_RAW);
$mform->addHelpButton('onlinecourseid', 'onlinecourse', 'local_clclasses');
}
/* end of the department dropdown */
/* create a department dropdown for instructor selection */
$depts = $mform->createElement('select', 'departmentinid', get_string('department', 'local_clclasses'), $departments);
$mform->insertElementBefore($depts, 'adddepartmentinhere');
$mform->addHelpButton('departmentinid', 'departmentin', 'local_clclasses');
/* End of department dropdown for instructor selection */
$departmentin = $mform->getElementValue('departmentinid');
$departmentin = $departmentin[0];
if ($departmentin > 0) {
$cobaltcourses1 = $hierarchy->get_department_instructors($departmentin, $formatvalue);
$instructor = $mform->createElement('select', 'instructorid', get_string('instructor', 'local_clclasses'), $cobaltcourses1);
$mform->insertElementBefore($instructor, 'addinstructorhere');
$mform->setType('instructorid', PARAM_RAW);
$mform->getElement('instructorid')->setMultiple(true);
}
$check = $mform->getElementValue('choose');
$startdate = $mform->getElementValue('startdate');
$enddate = $mform->getElementValue('enddate');
$starttime = $mform->getElementValue('starttime');
$endtime = $mform->getElementValue('endtime');
$scheduleclass = cobalt_scheduleclass::get_instance();
if ($id < 0 && $startdate > 0 && $formatvalue > 0 && $check > 0) {
$classroom = $scheduleclass->classroomlist($startdate, $enddate, $starttime, $endtime, $formatvalue, $id);
$two = $mform->createElement('select', 'classroomid', get_string('classroomids', 'local_classroomresources'), $classroom);
$mform->insertElementBefore($two, 'beforeclassroom');
$mform->addRule('classroomid', get_string('required'), 'required', null, 'client');
//.........这里部分代码省略.........
示例14: get_courses_department
/**
* @method get_courses_department
* @todo Get the records of a course is assigned to a department
* @param $department(int), $school(int)
* @return list of courses in the format of array
* */
function get_courses_department($department, $school, $multi = 0) {
global $CFG, $DB, $USER;
$hierarchy = new hierarchy();
if ($multi) {
$courselist = $hierarchy->get_records_cobaltselect_menu('local_cobaltcourses', "departmentid = $department AND schoolid = $school AND visible = 1 AND id != $multi", null, '', 'id,fullname');
} else {
$courselist = $hierarchy->get_records_cobaltselect_menu('local_cobaltcourses', "departmentid = $department AND schoolid = $school AND visible = 1", null, '', 'id,fullname', 'Select Course');
}
return $courselist;
}
示例15: definition
function definition() {
global $USER, $CFG, $DB, $PAGE;
$mform = $this->_form;
$id = $this->_customdata['id'];
$editoroptions = $this->_customdata['editoroptions'];
$hierarchy= new hierarchy();
$heading = ($id > 0) ? get_string('edittaxrate', 'local_onlinepayment') : get_string('createtaxrate', 'local_onlinepayment');
$mform->addElement('header', 'settingsheader', $heading);
$tax = tax::getInstance();
$taxtype = $hierarchy->get_records_cobaltselect_menu('local_tax_type', '', null, '', 'id,display_name', 'Select Type');
$mform->addElement('select', 'typeid', get_string('taxtype', 'local_onlinepayment'), $taxtype);
$mform->addHelpButton('typeid', 'taxtype', 'local_onlinepayment');
$mform->setType('typeid', PARAM_INT);
$mform->addRule('typeid', get_string('missingtypeid', 'local_onlinepayment'), 'required', null, 'client');
$mform->addElement('text', 'name', get_string('taxname', 'local_onlinepayment'));
$mform->addHelpButton('name', 'taxname', 'local_onlinepayment');
$mform->setType('name', PARAM_TEXT);
$mform->addRule('name', get_string('missingtaxname', 'local_onlinepayment'), 'required', null, 'client');
$country = get_string_manager()->get_list_of_countries();
$default_country[''] = get_string('selectacountry');
$default_country['all'] = get_string('all');
$country = array_merge($default_country, $country);
$mform->addElement('select', 'country', get_string('country'), $country);
$mform->addHelpButton('country', 'country', 'local_onlinepayment');
$mform->setType('country', PARAM_RAW);
$mform->addRule('country', get_string('missingcountry', 'local_onlinepayment'), 'required', null, 'client');
$size = 'style="width:50px !important;"';
$ratearray = array();
$ratearray[] = & $mform->createElement('text', 'rate', '', $size);
$ratearray[] = & $mform->createElement('static', 'ratepercent', '', ' %');
$mform->addGroup($ratearray, 'ratearray', get_string('taxrate', 'local_onlinepayment'), array(' '), false);
$mform->addHelpButton('ratearray', 'taxrate', 'local_onlinepayment');
$mform->setType('rate', PARAM_TEXT);
$mform->addRule('ratearray', get_string('missingtaxrate', 'local_onlinepayment'), 'required', null, 'client');
$mform->addElement('date_selector', 'startdate', get_string('startdate', 'local_academiccalendar'), array('optional' => true));
$mform->addElement('date_selector', 'enddate', get_string('enddate', 'local_academiccalendar'), array('optional' => true));
$mform->addRule('startdate', get_string('missingstartdate_payment', 'local_onlinepayment'), 'required', null, 'client');
$mform->addRule('enddate', get_string('missingenddate', 'local_academiccalendar'), 'required', null, 'client');
$mform->addElement('editor', 'description', get_string('typedescription', 'local_onlinepayment'), null, $editoroptions);
$mform->setType('description', PARAM_TEXT);
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'usermodified', $USER->id);
$mform->setType('usermodified', PARAM_INT);
$mform->addElement('hidden', 'timemodified', time());
$mform->setType('timemodified', PARAM_INT);
$submitlable = ($id > 0) ? get_string('update') : get_string('create');
$this->add_action_buttons($cancel = true, $submitlable);
}