当前位置: 首页>>代码示例>>PHP>>正文


PHP hierarchy::get_department_instructors方法代码示例

本文整理汇总了PHP中hierarchy::get_department_instructors方法的典型用法代码示例。如果您正苦于以下问题:PHP hierarchy::get_department_instructors方法的具体用法?PHP hierarchy::get_department_instructors怎么用?PHP hierarchy::get_department_instructors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hierarchy的用法示例。


在下文中一共展示了hierarchy::get_department_instructors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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');
//.........这里部分代码省略.........
开发者ID:anilch,项目名称:Personel,代码行数:101,代码来源:createclass_form.php

示例2: 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');
//.........这里部分代码省略.........
开发者ID:anilch,项目名称:Personel,代码行数:101,代码来源:classes_form.php


注:本文中的hierarchy::get_department_instructors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。