本文整理汇总了PHP中hierarchy::get_departments_forschool方法的典型用法代码示例。如果您正苦于以下问题:PHP hierarchy::get_departments_forschool方法的具体用法?PHP hierarchy::get_departments_forschool怎么用?PHP hierarchy::get_departments_forschool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hierarchy
的用法示例。
在下文中一共展示了hierarchy::get_departments_forschool方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
.dataTables_length{float:none;padding-top:20px;}
.pagination { margin: 10px 50px;}
</style>
<?php
if (count($schools) != 1) {
echo '<div class="selfilterpos" >';
/* Bug report #275
* @author hemalatha a arun<hemalatha@eabyas.in>
* resolved - restrict to display only shared school
*/
/* $select = new single_select(new moodle_url('/local/modules/assigncourse.php?moduleid='.$moduleids.''), 'scid', $school, $scid, null, 'switchcategory');
$select->set_label(get_string('schoolid','local_collegestructure').':');
echo $OUTPUT->render($select); */
echo '</div>';
$displaylist = $hier->get_departments_forschool($modulelist->schoolid, false, true, true);
echo '<div class="selfilterpos" style="float:none;">';
$select = new single_select(new moodle_url('/local/modules/assigncourse.php?moduleid=' . $moduleids . '&scid=' . $scid . ''), 'id', $displaylist, $id, null, 'switchcategory');
$select->set_label(get_string('dept', 'local_departments') . ':');
$select->set_help_icon('dept_formatname', 'local_departments');
echo $OUTPUT->render($select);
echo '</div>';
if(count( $displaylist)<=1)
echo $hier-> cobalt_navigation_msg(get_string('navigation_info','local_collegestructure'),get_string('create_department','local_departments'),$CFG->wwwroot.'/local/departments/departments.php');
} else {
foreach ($schools as $scl) {
$key = $scl->id;
$value = $scl->fullname;
}
//$displaylist=$hier->get_departments_forschool($key);
示例2: hierarchy
function definition_after_data() {
global $DB, $CFG;
$mform = $this->_form;
$id = $this->_customdata['id'];
$schoid = $this->_customdata['schoid'];
$hierarchy = new hierarchy();
$formatvalue = $mform->getElementValue('schoolid');
$formatvalue = $formatvalue[0];
if ($formatvalue > 0) {
/*
* ###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);
$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);
$departments = $hierarchy->get_departments_forschool($formatvalue, $none = "");
$dept = $mform->createElement('select', 'departmentid', get_string('department', 'local_clclasses'), $departments);
$mform->insertElementBefore($dept, 'adddepartmentlisthere');
if (count($departments) <= 1) {
$empty_deptmsg = $mform->createElement('static', 'department_emptyinfo', '', $hierarchy->cobalt_navigation_msg(get_string('navigation_info', 'local_collegestructure'), get_string('create_department', 'local_departments'), $CFG->wwwroot . '/local/departments/departments.php'));
$mform->insertElementBefore($empty_deptmsg, 'adddepartmentemptymsg');
}
$mform->addHelpButton('departmentid', 'department', 'local_clclasses');
$mform->addRule('departmentid', get_string('departmentmissing', 'local_clclasses'), 'required', null, 'client');
$mform->setType('departmentid', PARAM_RAW);
$departmentvalue = $mform->getElementValue('departmentid');
$departmentvalue = $departmentvalue[0];
if ($departmentvalue > 0) {
$selectonline = array();
$selectonline[NULL] = get_string('select', 'local_clclasses');
$selectonline['1'] = get_string('online', 'local_clclasses');
$selectonline['2'] = get_string('offline', 'local_clclasses');
$cobaltclasstype = $mform->createElement('select', 'online', get_string('classtype', 'local_clclasses'), $selectonline);
$mform->insertElementBefore($cobaltclasstype, 'addonlinelisthere');
$mform->addRule('online', get_string('missingonline', 'local_clclasses'), 'required', null, 'client');
$mform->setType('online', PARAM_INT);
$mform->addHelpButton('online', 'classtype', 'local_clclasses');
}
if ($departmentvalue > 0) {
$online = $mform->getElementValue('online');
if (isset($online)) {
$online = $online[0];
if ($online == 1) {
$onlinecourses = $hierarchy->get_records_cobaltselect_menu('course', 'visible=1 AND category>0', null, '', 'id,concat(shortname,": ",fullname)', '--Select--');
$cobaltcourse2 = $mform->createElement('select', 'onlinecourseid', get_string('onlinecourse', 'local_clclasses'), $onlinecourses);
$mform->insertElementBefore($cobaltcourse2, 'addonlinecoursehere');
$mform->addRule('onlinecourseid', get_string('required'), 'required', null, 'client');
$mform->setType('onlinecourseid', PARAM_RAW);
$mform->addHelpButton('onlinecourseid', 'onlinecourse', 'local_clclasses');
$new1 = $mform->createElement('html', '<a id="newonlinecourse" style="float:right;margin-right:240px;cursor:pointer;"
onclick="onlinecourse(' . $formatvalue . ',' . $departmentvalue . ')">' . get_string('addnewonlinecourse', 'local_clclasses') . '</a>');
$mform->insertElementBefore($new1, 'onlinecourseid');
}
}
}
if ($departmentvalue > 0) {
$cobaltcourses = $hierarchy->get_records_cobaltselect_menu('local_cobaltcourses', "departmentid=$departmentvalue AND visible=1", null, '', 'id,concat(shortname,": ",fullname)', '--Select--');
$cobaltcourse = $mform->createElement('select', 'cobaltcourseid', get_string('cobaltcourse', 'local_clclasses'), $cobaltcourses);
$mform->insertElementBefore($cobaltcourse, 'addcobaltcoursehere');
$mform->addHelpButton('cobaltcourseid', 'cobaltcourse', 'local_clclasses');
$mform->addRule('cobaltcourseid', get_string('cobaltcoursemissing', 'local_clclasses'), 'required', null, 'client');
$mform->setType('cobaltcourseid', PARAM_RAW);
$new = $mform->createElement('html', '<a id="newcobaltcourse" style="float:right;margin-right: 240px;cursor:pointer;"
onclick="cobaltcourse(' . $formatvalue . ',' . $departmentvalue . ')">' . get_string('addnewcobaltcourse', 'local_clclasses') . '</a>');
$mform->insertElementBefore($new, 'cobaltcourseid');
$online = $mform->getElementValue('online');
}
// Task code : T1.6 - Assigning instructor to class
//-------- selecting instructor to class-----------------------------------------------------------
if ($formatvalue > 0 && $departmentvalue > 0 && $online[0] > 0) {
$cobaltcourses1 = $hierarchy->get_department_instructors($departmentvalue, $formatvalue);
$instructorfield = $mform->createElement('select', 'instructor', get_string('instructor', 'local_clclasses'), $cobaltcourses1, array('multiple' => 'multiple'));
if (count($cobaltcourses1) <= 1) {
$insroleid = $DB->get_record_sql("SELECT * FROM {role} where shortname='instructor'");
$instructorexits = $DB->get_records('local_school_permissions', array('schoolid' => $schoid, 'roleid' => $insroleid->id));
if ($instructorexits)
$navigationlink = $CFG->wwwroot . '/local/departments/assign_instructor.php?slsid=' . $schoid . '';
else
$navigationlink = $CFG->wwwroot . '/local/users/user.php';
$navigationmsg = get_string('nodata_assigninstructorpage', 'local_departments');
$linkname = get_string('linkname_assigninstructorpage', 'local_departments');
//.........这里部分代码省略.........
示例3: 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');
//.........这里部分代码省略.........