本文整理汇总了PHP中hierarchy::get_school_semesters方法的典型用法代码示例。如果您正苦于以下问题:PHP hierarchy::get_school_semesters方法的具体用法?PHP hierarchy::get_school_semesters怎么用?PHP hierarchy::get_school_semesters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hierarchy
的用法示例。
在下文中一共展示了hierarchy::get_school_semesters方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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>';
}
}
}
}
示例2: array
function definition_after_data() {
global $DB, $CFG;
$mform = $this->_form;
$id = $this->_customdata['id'];
$classid = $this->_customdata['classid'];
if (isset($classid))
$classinfo = $DB->get_record('local_clclasses', array('id' => $classid, 'visible' => 1));
$hierarchy = new hierarchy();
$tmobject = manage_timetable::getInstance();
$formatvalue = $mform->getElementValue('schoolid');
$formatvalue = $formatvalue[0];
if ($formatvalue > 0) {
$hierarchy->get_school_semesters($formatvalue);
/*
* ###Bug report #245 - Training Management
* @author Naveen Kumar<naveen@eabyas.in>
* (Resolved) Changed function to get semesters. We need to get all upcoming and present semesters.
* Previous method only get presesnt active semester
*/
$tools = classes_get_school_semesters($formatvalue);
if ($id > 0) {
// it works only for editing
$editrecord = $this->_customdata['tool'];
$editsemestersvalue = $DB->get_records_sql_menu("select id, fullname from {local_semester} where id=$editrecord->semesterid");
$tools = $tools + $editsemestersvalue;
}
$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('semesterid', PARAM_RAW);
$mform->setDefault('semesterid', $classinfo->semesterid);
$semestervalue = $mform->getElementValue('semesterid');
// $mform->registerNoSubmitButton('updatecourseformat');
// $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
}
if ($formatvalue > 0 && $semestervalue[0] > 0) {
$tools = $tmobject->timetable_get_listofclasses($formatvalue, $semestervalue[0]);
// $tools = classes_get_school_semesters($formatvalue);
$newclasslist = $mform->createElement('select', 'classid', get_string('classes', 'local_timetable'), $tools);
$mform->insertElementBefore($newclasslist, 'addclasslisthere');
// $mform->addHelpButton('classid', 'semester', 'local_semesters');
$mform->addRule('classid', get_string('missingclass', 'local_timetable'), 'required', null, 'client');
$mform->setType('classid', PARAM_RAW);
$mform->setDefault('classid', $classinfo->id);
}
}
示例3: array
if (is_siteadmin($USER->id)) {
$schools = $DB->get_records('local_school', array('visible' => 1));
} else {
$schools = $hierarchy->get_assignedschools();
}
$schoolist = $hierarchy->get_school_parent($schools);
echo '<br/><br/>';
echo '<div class="selfilterpos" id="school">';
$sch = new single_select(new moodle_url('/local/gradesubmission/submitgrades.php'), 'school', $schoolist, $school, null);
$sch->set_label(get_string('schoolid', 'local_collegestructure'));
echo $OUTPUT->render($sch);
echo '</div>';
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);
示例4: ac_hierarchyelements
/**
* @method ac_hierarchyelements
* @todo creates hierarchy elements in form (school,program and semester)
* @param1 object $mform (form object)
* @param2 string $place1 (element1 position)
* @param3 string $place2 (element2 position)
* @param4 int $eventlevel (event level ID)
* @param5 int $eventtypeid (event type ID)
* @return form elments add to form
*/
public function ac_hierarchyelements($mform, $place1, $place2, $eventlevel, $eventtype) {
global $USER, $DB;
$hierarchy = new hierarchy();
if ($eventlevel != 1) {
$isadmin = is_siteadmin($USER);
if ($isadmin) {
$school = $hierarchy->get_records_cobaltselect_menu('local_school', 'visible=1', null, '', 'id,fullname', '--Select--');
} else {
$faculties = $hierarchy->get_assignedschools();
$school = $hierarchy->get_school_parent($faculties, null, true, false);
}
$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_value[0] > 0 && $eventlevel == 3) {
$school_id = $school_value[0];
$programs = $hierarchy->get_records_cobaltselect_menu('local_program', "schoolid=$school_value[0] AND visible=1", null, '', 'id,fullname', '--Select--');
$newel2 = $mform->createElement('select', 'programid', get_string('program', '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;
}
if (isset($school_value) && !empty($school_value) && $school_value[0] > 0 && $eventlevel == 4) {
$school_id = $school_value[0];
//if ($eventtype == 2)
// $semesters = $hierarchy->get_upcoming_school_semesters($school_id);
//else
$semesters = $hierarchy->get_school_semesters($school_id);
$newel2 = $mform->createElement('select', 'semesterid', get_string('semester', 'local_semesters'), $semesters);
$mform->insertElementBefore($newel2, $place2);
$mform->addRule('semesterid', get_string('semester_help', 'local_semesters'), 'required', null, 'client');
$sem_value = $mform->getElementValue('semesterid');
if($sem_value[0]){
$this->static_description_dateselection($mform, $sem_value[0],$eventtype,$school_id,1);
}
return $sem_value;
}
}