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


PHP hierarchy::get_assignedschools方法代码示例

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


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

示例1: definition

    function definition() {
        global $USER, $CFG, $DB, $PAGE;
        $mform = $this->_form;
        $mform->addElement('header', 'settingsheader', get_string('system_settings', 'local_cobaltsettings'));
        $hier1 = new hierarchy();
        $schoolids = $hier1->get_assignedschools();
        if (!empty($schoolids)) {
            $count = sizeof($schoolids);
            if ($count > 1) {
                $parents = $hier1->get_school_parent($schoolids, '', true);
                $attributes1 = 'style="height:25px; width:29%; "';
                $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $parents, $attributes1);
                $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
            } else {
                $schoolname = $DB->get_record('local_school', array('id' => $schoolids[0]->id));
                $mform->addElement('static', 'sid', get_string('select', 'local_collegestructure'), $schoolname->fullname);
                $mform->addElement('hidden', 'schoolid', $schoolids[0]->id);
            }
        }
        $mform->addElement('advcheckbox', 'batch', null, 'Batch', array('group' => 1), array(0, 1));
        $mform->addElement('html', '<div style=" margin-left:265px;" class="form-description"><p>' . get_string('enable_batch', 'local_cobaltsettings') . '
			   </p></div>');
        $mform->addElement('advcheckbox', 'prefix_suffix', null, 'Prefix-Suffix', array('group' => 1), array(0, 1));
        $mform->addElement('html', '<div style=" margin-left:265px;" class="form-description"><p>' . get_string('create_batch', 'local_cobaltsettings') . '
			   </p></div>');
        $mform->addElement('advcheckbox', 'online_app', null, 'Online Applications', array('group' => 1), array(0, 1));
        $mform->addElement('html', '<div style=" margin-left:265px; color:light-grey" class="form-description"><p>' . get_string('enable_online', 'local_cobaltsettings') . '
			   </p></div>');
        $mform->addElement('advcheckbox', 'certificate', null, 'Issue certificates', array('group' => 1), array(0, 1));
        /* start of vijaya jan-29 */
        $mform->addElement('advcheckbox', 'onlinepayment', null, 'Online Payment', array('group' => 1), array(0, 1));
        /* end of vijaya jan-29 */
        $this->add_action_buttons(true, 'Submit');
    }
开发者ID:anilch,项目名称:Personel,代码行数:34,代码来源:schoolsettings_form.php

示例2: user_download_xls

function user_download_xls($fields) {

    global $CFG, $DB;
    require_once("$CFG->libdir/excellib.class.php");
    $filename = clean_filename(get_string('course', 'local_cobaltcourses') . '.xls');
    $workbook = new MoodleExcelWorkbook('-');
    $workbook->send($filename);
    $worksheet = array();
    $worksheet[0] = $workbook->add_worksheet('');
    $col = 0;
    foreach ($fields as $fieldname) {
        $worksheet[0]->write(0, $col, $fieldname);
        $col++;
    }


    $hierarchy = new hierarchy();
    $schoollist = $hierarchy->get_assignedschools();
    if (is_siteadmin()) {
        $schoollist = $hierarchy->get_school_items();
    }

    $sheetrow = 1;
    foreach ($schoollist as $school) {
        $courses = $DB->get_records('local_cobaltcourses', array('schoolid' => $school->id));
        foreach ($courses as $course) {
            $post = new stdclass();

            $post->fullname = $course->fullname;
            $post->shortname = $course->shortname;
            $departmentname = $DB->get_field('local_department', 'fullname', array('id' => $course->departmentid));
            $post->courselibraryname = $departmentname;
            $schoolname = $DB->get_field('local_school', 'fullname', array('id' => $course->schoolid));
            $post->organizationname = $schoolname;
            $post->summary = $course->summary;
            $post->coursetype = ($course->coursetype == 0) ? 'General' : 'Elective';
            $post->credithours = $course->credithours;
            $post->coursecost = $course->coursecost;
            $col = 0;
            foreach ($fields as $fieldname) {
                $worksheet[0]->write($sheetrow, $col, $post->$fieldname);
                $col++;
            }
            $sheetrow++;
        }
    }

    $workbook->close();
    die;
}
开发者ID:anilch,项目名称:Personel,代码行数:50,代码来源:download_all.php

示例3: definition

    public function definition() {
        global $CFG, $DB;
        $mform = & $this->_form;
        $hierarchy = new hierarchy();
        if (is_siteadmin()) {
            $scho = $hierarchy->get_school_items();
        } else {
            $scho = $hierarchy->get_assignedschools();
        }
        $count = count($scho);
        if ($count > 1) {
            $school = $hierarchy->get_school_parent($scho);
            $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $school);
            $mform->addRule('schoolid', get_string('required'), 'required', null, 'client');
        } else {
            $school = $DB->get_record('local_school', array('visible' => 1));
            $mform->addElement('static', 'school', get_string('schoolid', 'local_collegestructure'), $school->fullname);
            $mform->setType('school', PARAM_RAW);

            $mform->addElement('hidden', 'schoolid', $school->id);
            $mform->setType('schoolidid', PARAM_INT);
        }

        for ($i = 0; $i <= 23; $i++) {
            $hours[$i] = sprintf("%02d", $i);
        }
        for ($i = 0; $i < 60; $i+=5) {
            $minutes[$i] = sprintf("%02d", $i);
        }

        $durtime = array();
        $durtime[] = & $mform->createElement('select', 'starthours', get_string('hour', 'form'), $hours, false, true);
        $durtime[] = & $mform->createElement('select', 'startminutes', get_string('minute', 'form'), $minutes, false, true);
        $mform->addGroup($durtime, 'starttime', get_string('starttime', 'local_attendance'), array(' '), true);


        $durtimes = array();
        $durtimes[] = & $mform->createElement('select', 'endhours', get_string('hour', 'form'), $hours, false, true);
        $durtimes[] = & $mform->createElement('select', 'endminutes', get_string('minute', 'form'), $minutes, false, true);
        $mform->addGroup($durtimes, 'endtime', get_string('orgendtime', 'local_attendance'), array(' '), true);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $submit = ($this->_customdata['id'] > 0) ? 'Update' : 'Create';
        $this->add_action_buttons('false', $submit);
    }
开发者ID:anilch,项目名称:Personel,代码行数:47,代码来源:mod_form.php

示例4: user_download_xls

function user_download_xls($fields) {

    global $CFG, $DB;
    require_once("$CFG->libdir/excellib.class.php");
    $filename = clean_filename(get_string('department', 'local_departments') . '.xls');
    $workbook = new MoodleExcelWorkbook('-');
    $workbook->send($filename);
    $worksheet = array();
    $worksheet[0] = $workbook->add_worksheet('');
    $col = 0;
    foreach ($fields as $fieldname) {
        $worksheet[0]->write(0, $col, $fieldname);
        $col++;
    }

    $hierarchy = new hierarchy();
    /*   Bug report #260 
     * Edited by hemalatha c arun <hemalatha@eabyas.in>
     * resolved- If loggedin user is admin, downloading all the department   
     */
    if (is_siteadmin()) {
        $sql = "SELECT distinct(s.id),s.* FROM {local_school} s ORDER BY s.sortorder";
        $schoollist = $DB->get_records_sql($sql);
    } else
        $schoollist = $hierarchy->get_assignedschools();

    $sheetrow = 1;
    foreach ($schoollist as $school) {
        $departments = $DB->get_records('local_department', array('schoolid' => $school->id));
        foreach ($departments as $department) {
            $post = new stdclass();
            $post->shortname = $department->shortname;
            $post->fullname = $department->fullname;
            $schoolname = $DB->get_field('local_school', 'fullname', array('id' => $department->schoolid));
            $post->schoolname = $schoolname;
            $post->summary = $department->description;
            $col = 0;
            foreach ($fields as $fieldname) {
                $worksheet[0]->write($sheetrow, $col, $post->$fieldname);
                $col++;
            }
            $sheetrow++;
        }
    }
    $workbook->close();
    die;
}
开发者ID:anilch,项目名称:Personel,代码行数:47,代码来源:download_all.php

示例5: definition

    function definition() {
        global $USER, $CFG, $DB, $PAGE;

        $mform = $this->_form;
        $mform->addElement('header', 'settingsheader', get_string('addeditgradeletter', 'local_gradesubmission'));

        $PAGE->requires->yui_module('moodle-local_gradesubmission-heirarchyselector', 'M.local_gradesubmission.init_heirarchyselector', array(array('formid' => $mform->getAttribute('id'))));
        $id = $this->_customdata['id'];

        $disable = ($id > 0) ? 'disabled="disabled"' : '';

        $hierarchy = new hierarchy();
        $schools = $hierarchy->get_assignedschools();
        $count = count($schools);

        if ($count > 1) {
            $parents = $hierarchy->get_school_parent($schools);
            $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $parents, $disable);
            if ($id < 0) {
                $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
            }
            $mform->setType('schoolid', PARAM_INT);
        } else {
            $school_name = $DB->get_record('local_school', array('id' => $schools[0]->id));
            $mform->addElement('static', 'schid', get_string('schoolid', 'local_collegestructure'), $school_name->fullname);
            $mform->addElement('hidden', 'schoolid', $schools[0]->id);
            $mform->setType('schoolid', PARAM_INT);
        }

        $mform->registerNoSubmitButton('updatecourseformat');
        $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
        $mform->addElement('hidden', 'addprogramslisthere');
        $mform->setType('addprogramslisthere', PARAM_INT);
        $mform->addElement('hidden', 'addsemesterslisthere');
        $mform->setType('addsemesterslisthere', PARAM_INT);
        $mform->addElement('hidden', 'addclclasseslisthere');
        $mform->setType('addclclasseslisthere', PARAM_INT);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $this->add_action_buttons();
    }
开发者ID:anilch,项目名称:Personel,代码行数:43,代码来源:gradesub_form.php

示例6: time

        $d_event['description'] = $data->description;
        $d_event['userid'] = $USER->id;
        $d_event['eventtype'] = $data->activityname;
        $d_event['timestart'] = $data->startdate;
        $d_event['timemodified'] = $today;
        $d_event['visible'] = $data->publish;
        $data->visble = $data->publish;
        $data->userid = $USER->id;
        $data->timecreated = time();
        $data->timemodified = time();

        if (isset($data->eventlevel) && $data->eventlevel == 1 && $data->eventtypeid == 1) {
            if (is_siteadmin($USER)) {
                $faculties = $DB->get_records('local_school', array('visible' => 1));
            } else {
                $faculties = $hierarchy->get_assignedschools();
            }

            foreach ($faculties as $faculty) {
                $programlist = $DB->get_records('local_program', array('schoolid' => $faculty->id, 'visible' => 1));
                foreach ($programlist as $program) {
                    $data->schoolid = $program->schoolid;
                    $data->programid = $program->id;
                    $eventid = $acalendar->event_add_instance($data);
                    $d_event['uuid'] = $eventid;
                    $acalendar->devent_add($d_event);
                }
            }

            $options = array('style' => 'notifysuccess');
            $hierarchy->set_confirmation(get_string('eventsuccess', 'local_academiccalendar'), $returnurl, $options);
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:edit_event.php

示例7: definition

    public function definition() {
        global $CFG, $DB, $PAGE;

        $mform = & $this->_form;

        $schoolid = $this->_customdata['sid'];
        $PAGE->requires->yui_module('moodle-local_classroomresources-building', 'M.local_classroomresources.init_building', array(array('formid' => $mform->getAttribute('id'))));
        $PAGE->requires->yui_module('moodle-local_classroomresources-floor', 'M.local_classroomresources.init_floor', array(array('formid' => $mform->getAttribute('id'))));
        $PAGE->requires->yui_module('moodle-local_classroomresources-classroom', 'M.local_classroomresources.init_classroom', array(array('formid' => $mform->getAttribute('id'))));

        $c = 'class="one";style="border:none";readonly="readonly";';
        $hierarchy = new hierarchy();
        if (is_siteadmin()) {
            $scho = $hierarchy->get_school_items();
        } else {
            $scho = $hierarchy->get_assignedschools();
        }
        $count = count($scho);
        $school = $hierarchy->get_school_parent($scho);
        $this->_customdata['id'];
        if ($this->_customdata['id'] > 0) {

            $mform->addElement('static', 'schoolid', get_string('schoolname', 'local_collegestructure'));
            $mform->setType('schoolid', PARAM_RAW);
            $mform->addElement('text', 'buildingid', get_string('buildingname', 'local_classroomresources'), $c);
            $mform->setType('buildingid', PARAM_RAW);
            $mform->addElement('text', 'floorid', get_string('floorname', 'local_classroomresources'), $c);
            $mform->setType('floorid', PARAM_RAW);
            $mform->addElement('text', 'classroomid', get_string('classroomid', 'local_classroomresources'), $c);
            $mform->setType('classroomid', PARAM_RAW);
            $resource = cobalt_resources::get_instance();
            $resourcelist = $hierarchy->get_records_cobaltselect_menu('local_resource', "schoolid=$schoolid AND visible=1", null, '', 'id,fullname', get_string('select', 'local_classroomresources'));
            $select = $mform->addElement('select', 'resourceid', get_string('resourceid', 'local_classroomresources'), $resourcelist);
            $select->setMultiple(true);
        } else {

            $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $school);
            $mform->addRule('schoolid', get_string('required'), 'required', null, 'client');


            $mform->addElement('hidden', 'beforefloor');
            $mform->setType('beforefloor', PARAM_RAW);
            $mform->addElement('hidden', 'beforeclass');
            $mform->setType('beforeclass', PARAM_RAW);
            $mform->addElement('hidden', 'beforeresource');
            $mform->setType('beforeresource', PARAM_RAW);
            $mform->addElement('hidden', 'beforer');
            $mform->setType('beforer', PARAM_RAW);
            $mform->registerNoSubmitButton('updatecourseformat');
            $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
        }

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        $submit = ($this->_customdata['id'] > 0) ? 'Update' : 'Assign Resources';
        $this->add_action_buttons('false', $submit);
    }
开发者ID:anilch,项目名称:Personel,代码行数:57,代码来源:resource_form.php

示例8: array

$PAGE->navbar->add(get_string('listdepts', 'local_departments'));

//-------------manage_dept heading------------------------
echo $OUTPUT->heading(get_string('dept_heading', 'local_departments'));
echo $OUTPUT->header();

try {

    $dept = $DB->get_record('local_department', array('id' => $id));
    $PAGE->set_title(get_string('department', 'local_departments') . ': ' . $dept->fullname);

//Heading of the page
    echo $OUTPUT->heading($dept->fullname); //Semester Name
//------------if registrar not assigned to any school it throws exception    
    $hier1 = new hierarchy();
    $schoolid = $hier1->get_assignedschools();
    if (empty($schoolid)) {
        $e = get_string('rnot_assigned', 'local_departments');
        throw new Exception($e);
    }

    $data[] = array('<b>' . get_string('deptid', 'local_departments') . '</b>', $dept->shortname);
    $schoolname = $DB->get_record('local_school', array('id' => $dept->schoolid));
    $data[] = array('<b>' . get_string('belongs', 'local_departments') . '</b>', $schoolname->fullname . 'school');

    // list of assigned school for the perticular department
    $school_list = $DB->get_records('local_assignedschool_dept', array('deptid' => $dept->id));
    if (!empty($school_list)) {
        $school_name = '';
        foreach ($school_list as $sl) {
            $sn = $DB->get_record('local_school', array('id' => $sl->assigned_schoolid));
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:dept_view.php

示例9: definition

    function definition() {
        global $USER, $CFG, $DB, $PAGE;
        $mform = $this->_form;
        //------used for editing purpose(used to put static schoolname and shortname)
        $eid = $this->_customdata['temp'];
        //-------used for adding department from college structure plugin or other plugin
        $schoolid_collegestruct = $this->_customdata['scid'];
        /* Bug-id #262 
         * @author hemalatha c arun <hemalatha@eabyas.in>  
         * resolved -string issue
         */

        if ($eid->id > 0) {
            $mform->addElement('header', 'editheader', get_string('edit_department', 'local_departments'));
            $mform->addHelpButton('editheader', 'deptnote', 'local_departments');
        } else {
            // get_string('create_note','local_departments');
            $mform->addElement('header', 'createheader', get_string('create_department', 'local_departments'));
            $mform->addHelpButton('createheader', 'deptnote', 'local_departments');
        }
        $attributes = 'style="height:30px; "';
        //------used for editing purpose(used to put static schoolname )
        if ($eid->id > 0) {
            $school = $DB->get_record('local_school', array('id' => $eid->schoolid));
            $mform->addElement('static', 'esid', get_string('schoolid', 'local_collegestructure'), $school->fullname);
        } else {
            $hier = new hierarchy();
            if (is_siteadmin($USER->id)) {
                $schoolids = $DB->get_records('local_school', array('visible' => 1));
            } else
                $schoolids = $hier->get_assignedschools();

            $count = sizeof($schoolids);
            if ($count > 1) {
                //  $items = $hier->get_school_items();
                $parents = $hier->get_school_parent($schoolids, '', true);
                //$attributes1='style="height:30px; width:29%; "';
                $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $parents);
                $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
                if ($schoolid_collegestruct > 0)
                    $mform->setDefault('schoolid', $schoolid_collegestruct);
            }
            else {          
                foreach($schoolids as $sid){
                  $schoolid=$sid->id;
                  $schoolname=$sid->fullname;
                }          
                $mform->addElement('static', 'sid', get_string('schoolid', 'local_collegestructure'), $schoolname);
                $mform->addElement('hidden', 'schoolid', $schoolid);
            }
        }
        $mform->setType('schoolid', PARAM_INT);

        $mform->addElement('text', 'fullname', get_string('deptfullname', 'local_departments'), $attributes);
        $mform->addRule('fullname', get_string('missing_deptfullname', 'local_departments'), 'required', null, 'client');
        $mform->setType('fullname', PARAM_RAW);
        $mform->addHelpButton('fullname', 'fullname_note', 'local_departments');

        //-----used to put static shortname while editing---------
        if ($eid->id > 0) {
            $mform->addElement('static', 'eshortname', get_string('deptid', 'local_departments'), $eid->shortname);
        } else {
            $mform->addElement('text', 'shortname', get_string('deptid', 'local_departments'), $attributes);
            $mform->addRule('shortname', get_string('missing_deptid', 'local_departments'), 'required', null, 'client');
            $mform->setType('shortname', PARAM_TEXT);
            $mform->addHelpButton('shortname', 'shortname_note', 'local_departments');
        }

        //$mform->addElement('textarea', 'description', get_string("description", "local_departments"), 'wrap="virtual" rows="6" cols="150"',$attributes);
        //$mform->setType('description', PARAM_TEXT);

        $mform->addElement('editor', 'description', get_string("description", "local_departments"));
        $mform->setType('description', PARAM_RAW);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $submitbuttonname = ($eid->id > 0) ? 'update_department' : 'create_department';
        $this->add_action_buttons(true, get_string($submitbuttonname, 'local_departments'));
    }
开发者ID:anilch,项目名称:Personel,代码行数:80,代码来源:dept_form.php

示例10: foreach

$context =context_user::instance($USER->id);
if (has_capability('local/clclasses:enrollclass', $context) && !is_siteadmin()) {
    echo $OUTPUT->heading(get_string('myacademics', 'local_courseregistration'));
} else {
    echo $OUTPUT->heading(get_string('pluginname', 'local_academiccalendar'));
}
if (is_siteadmin($USER)) {
    $admin_school = $DB->get_records('local_school');
    if (empty($admin_school))
        throw new schoolnotfound_exception();
}

if (!is_siteadmin($USER)) {
    if (has_capability('local/collegestructure:manage', $systemcontext)) {
        $assigned_schools = $hierarchy->get_assignedschools();

        foreach ($assigned_schools as $assigned_school) {
            if ($assigned_school->id != null) {
                $aschools[] = $assigned_school->id;
            }
        }
        $schoollist = implode(',', $aschools);
        empty($schoollist) ? $schoollist = 0 : $schoollist;
        empty($sql) ? $sql .=' ((eventlevel=1) OR
                                     (schoolid in (' . $schoollist . ')))' : $sql .=' AND ((eventlevel=1) OR
                                     (schoolid in (' . $schoollist . ')))';
    } elseif (has_capability('local/clclasses:enrollclass', $usercontext)) {

        $userdetails = $DB->get_records('local_userdata', array('userid' => $USER->id));
        $usersems = $DB->get_records('local_user_semester', array('userid' => $USER->id));
开发者ID:anilch,项目名称:Personel,代码行数:30,代码来源:index.php

示例11: definition

    public function definition() {
        global $CFG, $DB, $PAGE, $USER;
        $mform = & $this->_form;
        $hierarchy = new hierarchy();
        $id = $this->_customdata['id'];
        $deptid = $this->_customdata['deptid'];
        $schoid = $this->_customdata['schoid'];
        $semid = $this->_customdata['semid'];
        $courseid = $this->_customdata['courseid'];
        $classid = $this->_customdata['classid'];
        $classtype = $this->_customdata['classtype'];

        // remove empty value in classtype
        if ($classtype) {
            foreach ($classtype as $key => $value) {
                if ($value == 0)
                    unset($classtype[$key]);
            }
        }

        if (isset($classid))
            $classinfo = $DB->get_record('local_clclasses', array('id' => $classid, 'visible' => 1));


        $deptid = (isset($classinfo->departmentid) ? $classinfo->departmentid : 0);
        $schoolid = (isset($classinfo->schoolid) ? $classinfo->schoolid : 0);
        $semid = (isset($classinfo->semesterid) ? $classinfo->semesterid : 0);

        $id = $this->_customdata['id'];
        //$PAGE->requires->yui_module('moodle-local_clclasses-chooser', 'M.local_clclasses.init_chooser', array(array('formid' => $mform->getAttribute('id'))));
        $PAGE->requires->yui_module('moodle-local_timetable-timetable', 'M.local_timetable.init_timetable', array(array('formid' => $mform->getAttribute('id'))));
        $PAGE->requires->js('/local/timetable/unassign_type.js');
        $hierarchy = new hierarchy();
        if (is_siteadmin()) {
            $scho = $hierarchy->get_school_items();
        } else {
            $scho = $hierarchy->get_assignedschools();
        }
        $count = count($scho);
        $school = $hierarchy->get_school_parent($scho);

        $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $school);
        $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
        $mform->setType('schoolid', PARAM_RAW);
        $mform->setDefault('schoolid', $classinfo->schoolid);

        $mform->registerNoSubmitButton('updatecourseformat');
        $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));

        $mform->addElement('hidden', 'addsemesterlisthere');
        $mform->setType('addsemesterlisthere', PARAM_RAW);

        $mform->addElement('hidden', 'addclasslisthere');
        $mform->setType('addclasslisthere', PARAM_RAW);

        // adding classtype       
        $mform->addElement('header', 'settingsheader', get_string('classtype', 'local_timetable'));
        $classtypes = $DB->get_records_menu('local_class_scheduletype', array('schoolid' => $schoolid,'visible'=>1), '', 'id, classtype');
	if(sizeof($classtypes) > 0 ){
           $string_cltype = array('Select classtype', '-1' => 'All');
           $final_classtype = $string_cltype + $classtypes;
	  } 
	else  {
	  $string_cltype = array('Select classtype');   
          $final_classtype=$string_cltype + $classtypes;
	}

        if ($classid) {
            $select = $mform->addElement('select', 'classtype', get_string('classtype', 'local_timetable'), $final_classtype);
            $select->setMultiple(true);

            $mform->setType('classtype', PARAM_INT);
            $mform->addRule('classtype', get_string('required'), 'required', null, 'client');
        }


        $mform->addElement('html', '<a id="newclasstype" style="float:right;margin-right: 240px;cursor:pointer;"
			onclick="newclasstype(' . $schoolid . ')">' . get_string('classtype', 'local_timetable') . '</a>');

        $mform->addElement('html', '<div id="createclasstype"></div>');
        $mform->addElement('html', '<div id="myratings1"></div>');

        $mform->registerNoSubmitButton('scheduleclasstype');
        $mform->addElement('submit', 'scheduleclasstype', get_string('scheduleclasstype', 'local_timetable'));


        $scheduleclass = cobalt_scheduleclass::get_instance();
        $hour = $scheduleclass->hour();
        $min = $scheduleclass->min();
        $starttime = array();
        $endtime = array();
        /* Start of scheduleclass startdate */
        //providing semester startdate and enddate helpful to select date
        if ($semid) {
            $seminfo = $DB->get_record('local_semester', array('id' => $semid));
            $seminfo->startdate = date('d M Y', $seminfo->startdate);
            $seminfo->enddate = date('d M Y', $seminfo->enddate);
            $mform->addElement('static', 'datedescription', '', get_string('classschedule_datedescription', 'local_clclasses', $seminfo));
        }

//.........这里部分代码省略.........
开发者ID:anilch,项目名称:Personel,代码行数:101,代码来源:scheduleclass_form.php

示例12: check_loginuser_registrar_admin

 /**
  * @method  check_loginuser_registrar_admin
  * @todo to display school list based logged in user (registrar, admin)     * 
  * @param boolean $schoolids_in_formofstring (used to get schoolids in the form of string)    
  * @return based on condition it returns array of objects or string type of data
  */
 public function check_loginuser_registrar_admin($schoolids_in_formofstring = false) {
     global $DB, $USER, $CFG;
     $hier1 = new hierarchy();
     //  checking of login user is admin..
     if (is_siteadmin($USER->id)) {
         $schoolid = $DB->get_records('local_school', array('visible' => 1));
        
     } else {
         //------------if registrar not assigned to any school it throws exception    
         $users = $hier1->get_manager();
         $schoolid = $hier1->get_assignedschools();
         
     } // end of else
     if (empty($schoolid)) {
         throw new schoolnotfound_exception();
     }
     if ($schoolids_in_formofstring) {
         foreach ($schoolid as $sid) {
             $temp[] = $sid->id;
         }
         $school_id = implode(',', $temp);
         return $school_id;
     } else
         return $schoolid;
 }
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:lib.php

示例13: array

    /**
     * @method get_users_listing
     * @todo to get user list of school based on condition  
     * @param string $sort fieldname
     * @param string $dir specify the order to sort
     * @param int $page page number
     * @param int $recordsperpage records perpage
     * @param string $extraselect extra condition to select user
     * @param array $extraparams
     * @return array of objects , list of users
     */
    function get_users_listing($sort = 'lastaccess', $dir = 'ASC', $page = 0, $recordsperpage = 0, $extraselect = '', array $extraparams = null, $extracontext = null) {
        global $DB, $CFG;
        $extraselect;

        $select = "deleted <> 1 AND id <> :guestid";  //$select = "deleted=0";
        $params = array('guestid' => $CFG->siteguest);

        if ($extraselect) {
            $select .= " AND $extraselect";
            $params = $params + (array) $extraparams;
        }

        // If a context is specified, get extra user fields that the current user
        // is supposed to see.
        $extrafields = '';
        if ($extracontext) {
            $extrafields = get_extra_user_fields_sql($extracontext, '', '', array('id', 'username', 'email', 'firstname', 'lastname', 'city', 'country',
                'lastaccess', 'confirmed', 'mnethostid'));
        }
        /*
         * ###Bugreport#183-Filters
         * @author Naveen Kumar<naveen@eabyas.in>
         * (Resolved) Added $select parameters for conditions 
         */
        // warning: will return UNCONFIRMED USERS
        //  print_object($params);
        $users = $DB->get_records_sql("SELECT *
                                       FROM {user}
                                       WHERE $select", $params);

        $hierarchy = new hierarchy();
        $schoollist = $hierarchy->get_assignedschools();
        $schoollist = $hierarchy->get_school_parent($schoollist, $selected = array(), $inctop = false, $all = false);
        if (is_siteadmin()) {
            $schoollist = $hierarchy->get_school_items();
        }
        $schoolidin = implode(',', array_keys($schoollist));
        if ($users && $schoollist) {
            $useridin = implode(',', array_keys($users));
            return $DB->get_records_sql("select user.* from (SELECT u.id, u.username, u.email, u.firstname, u.lastname, u.city, u.country,
                                            u.lastaccess, u.confirmed, u.mnethostid, u.suspended FROM {user} u
                                        JOIN {local_users} lu ON lu.userid = u.id
                                        JOIN {local_school_permissions} sp ON sp.userid = u.id
                                        WHERE u.id in ($useridin) AND sp.schoolid IN ($schoolidin)
                                        UNION
                                        SELECT u.id, u.username, u.email, u.firstname, u.lastname, u.city, u.country,
                                            u.lastaccess, u.confirmed, u.mnethostid, u.suspended FROM {user} u
                                        JOIN {local_users} lu ON lu.userid = u.id
                                        JOIN {local_userdata} ud ON ud.userid = u.id
                                        WHERE u.id in ($useridin) AND ud.schoolid IN ($schoolidin)) user GROUP BY user.id ORDER BY user.$sort $dir LIMIT $page, $recordsperpage ");
        }
    }
开发者ID:anilch,项目名称:Personel,代码行数:63,代码来源:lib.php

示例14: if

    $semester = student_semesters($USER->id, 'courseregistration');
    // print_object($semester);
    foreach ($semester as $key => $value) {
        $current_semid = $key;
    }
    if (empty($current_semid))
        print_error(get_string('noactivesem', 'local_timetable'));

    $sessionsinfo = $DB->get_records_sql("select sd.* FROM {local_user_clclasses} as cl
                       JOIN {local_scheduleclass} as sd ON sd.classid= cl.classid and sd.visible=1
                       WHERE cl.semesterid=$current_semid and cl.userid=$USER->id  and from_unixtime('%Y',sd.startdate) > 2014 and sd.visible=1   ");
}
// only for registrar
else if (has_capability('local/collegestructure:manage', $systemcontext) && !is_siteadmin()) {
    $hier = new hierarchy();
    $schoolist = $hier->get_assignedschools();
    if ($schoolist) {
        $result = '';
        foreach ($schoolist as $school)
            $result[] = $school->id;
        $result = implode(',', $result);
        $sessionsinfo = $DB->get_records_sql("select * from {local_scheduleclass} where schoolid IN ($result) and  from_unixtime('%Y',startdate) > 2014 and visible=1");
    }
}
// only for instructor
else if (has_capability('local/clclasses:submitgrades', $systemcontext) && !is_siteadmin()) {

    $sessionsinfo = $DB->get_records_sql(" select sh.*  from  mdl_local_clclasses as cl
           JOIN mdl_local_scheduleclass as sh ON sh.classid=cl.id
     where sh.instructorid=$USER->id and from_unixtime('%Y',sh.startdate) > 2013 and sh.visible=1");
} else {
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:events.php

示例15: definition

    function definition() {
        global $USER, $CFG, $DB, $PAGE;

        $mform = $this->_form;
        $id = $this->_customdata['id'];

        $mform->addElement('header', 'settingsheader', get_string('addeditgradeletter', 'local_gradeletter'));

        $hierarchy = new hierarchy();
        if (is_siteadmin($USER->id)) {
            $schools = $DB->get_records('local_school', array('visible' => 1));
        } else {
            $schools = $hierarchy->get_assignedschools();
        }
        $noofschools = count($schools);

        if ($noofschools > 1) {
            $parents = $hierarchy->get_school_parent($schools);
            $mform->addElement('select', 'schoolid', get_string('select', 'local_collegestructure'), $parents);
            $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
            $mform->setType('schoolid', PARAM_INT);
        } else {
            foreach($schools as $sl){
                $schoolid  = $sl->id;
                $schoolname= $sl->fullname;
            }            
            $mform->addElement('static', 'schid', get_string('select', 'local_collegestructure'), $schoolname);
            $mform->addElement('hidden', 'schoolid', $schoolid);
            $mform->setType('schoolid', PARAM_INT);
        }

        $mform->addElement('text', 'letter', get_string('lettergrades', 'local_gradeletter'));
        $mform->addRule('letter', get_string('letterreq', 'local_gradeletter'), 'required', null, 'client');
        $mform->addRule('letter', get_string('lettersonly', 'local_gradeletter'), 'lettersonly', null, 'client');
        $mform->setType('letter', PARAM_TEXT);

        $mform->addElement('text', 'markfrom', get_string('markfrom', 'local_gradeletter'));
        $mform->addRule('markfrom', get_string('marksfromreq', 'local_gradeletter'), 'required', null, 'client');
        $mform->addRule('markfrom', null, 'numeric', null, 'client');
        // $mform->addRule('markfrom', get_string('markslengthmin','local_gradeletter'), 'minlength',2, 'client');
        $mform->setType('markfrom', PARAM_INT);

        $mform->addElement('text', 'markto', get_string('markto', 'local_gradeletter'));
        $mform->addRule('markto', get_string('reqmarktoval', 'local_gradeletter'), 'required', null, 'client');
        $mform->addRule('markto', null, 'numeric', null, 'client');
        $mform->addRule('markto', get_string('markslengthmin', 'local_gradeletter'), 'minlength', 2, 'client');
        $mform->setType('markto', PARAM_INT);

        $mform->addRule(array('markfrom', 'markto'), '"Mark from" value should be lesser than "Mark to" value.', 'compare', '<');

        $mform->addElement('text', 'gradepoint', get_string('gradepoint', 'local_gradeletter'));
        $mform->addRule('gradepoint', get_string('gradepointreq', 'local_gradeletter'), 'required', null, 'client');
        $mform->addRule('gradepoint', null, 'numeric', null, 'client');
        $mform->setType('gradepoint', PARAM_TEXT);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $submitlable = ($id > 0) ? get_string('updategradeletter', 'local_gradeletter') : get_string('creategradeletter', 'local_gradeletter');
        $this->add_action_buttons($cancel = true, $submitlable);
    }
开发者ID:anilch,项目名称:Personel,代码行数:61,代码来源:edit_form.php


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