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


PHP hierarchy::get_school_items方法代码示例

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


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

示例1: definition

    public function definition() {
        global $USER, $CFG, $PAGE;
        $school = new school();
        $mform = $this->_form;
        $id = $this->_customdata['id'];
        $schools = $this->_customdata['tool'];
        $editoroptions = $this->_customdata['editoroptions'];
        if ($id < 0)
            $mform->addElement('header', 'settingsheader', get_string('createschool', 'local_collegestructure'));
        else
            $mform->addElement('header', 'settingsheader', get_string('editschool', 'local_collegestructure'));
        $tools = array();
        $hierarchy = new hierarchy();
        $items = $hierarchy->get_school_items(true);
        $parents = $hierarchy->get_school_parent($items, $schools->id);
        if (count($parents) <= 1) {
            $mform->addElement('hidden', 'parentid', 0);
            $mform->setType('parentid', PARAM_RAW);
        } else {
            $mform->addElement('select', 'parentid', get_string('parent', 'local_collegestructure'), $parents);
            $mform->setType('parentid', PARAM_RAW);
        }
        $mform->addHelpButton('parentid', 'parent', 'local_collegestructure');
        $mform->addElement('text', 'fullname', get_string('schoolname', 'local_collegestructure'), $tools);
        $mform->setType('fullname', PARAM_TEXT);
        $mform->addRule('fullname', get_string('missingschoolname', 'local_collegestructure'), 'required', null, 'client');

        $mform->addElement('editor', 'description', get_string('description', 'local_collegestructure'), null, $editoroptions);
        $mform->setType('description', PARAM_RAW);

        $selecttype = array();
        $selecttype['1'] = get_string('campus', 'local_collegestructure');
        $selecttype['2'] = get_string('university', 'local_collegestructure');
        $selecttype['3'] = get_string('location', 'local_collegestructure');
        $mform->addElement('select', 'type', get_string('type', 'local_collegestructure'), $selecttype);
        $mform->addHelpButton('type', 'type', 'local_collegestructure');
        $mform->setType('type', PARAM_RAW);
        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        $now = date("d-m-Y");
        $now = strtotime($now);
        $mform->addElement('hidden', 'timecreated', $now);
        $mform->setType('timecreated', PARAM_RAW);
        $mform->addElement('hidden', 'usermodified', $USER->id);
        $mform->setType('usermodified', PARAM_RAW);
        $themelist = $school->cobalt_get_theme_list();
        $mform->addElement('select', 'theme', get_string('theme', 'local_collegestructure'), $themelist);
        $mform->setType('theme', PARAM_RAW);
        $mform->addRule('theme', get_string('missingtheme', 'local_collegestructure'), 'required', null, 'client');
        $submit = ($id > 0) ? get_string('update_school', 'local_collegestructure') : get_string('create', 'local_collegestructure');
        $this->add_action_buttons('false', $submit);
    }
开发者ID:anilch,项目名称:Personel,代码行数:52,代码来源:school_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 $USER, $CFG, $PAGE;
        $id = optional_param('id', -1, PARAM_INT);
        $hierarchy = new hierarchy();
        $mform = $this->_form;
        if ($id < 0)
            $PAGE->requires->yui_module('moodle-local_modules-schoolchooser', 'M.local_modules.init_schoolchooser', array(array('formid' => $mform->getAttribute('id'))));
        $editoroptions = $this->_customdata['editoroptions'];
        $items = $hierarchy->get_school_items();
        $school = $hierarchy->get_school_parent($items);
        $editoroptions = $this->_customdata['editoroptions'];
        if ($id > 0)
            $mform->addElement('header', 'settingsheader', get_string('editmodule', 'local_modules'));
        else
            $mform->addElement('header', 'settingsheader', get_string('createmodule', 'local_modules'));
        if ($id < 0) {

            $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->registerNoSubmitButton('updateschoolformat');
            $mform->addElement('submit', 'updateschoolformat', get_string('courseformatudpate'));
            $mform->addElement('hidden', 'addprogramslisthere');
            $mform->setType('addprogramslisthere', PARAM_RAW);
        }

        if ($id > 0) {
            $mform->addElement('static', 'school_name', get_string('schoolid', 'local_collegestructure'));
            $mform->addElement('hidden', 'schoolid');
            $mform->setType('schoolid', PARAM_RAW);
            $mform->addElement('static', 'program_name', get_string('programname', 'local_programs'));
            $mform->addElement('hidden', 'programid');
            $mform->setType('programid', PARAM_RAW);
        }
        $tools = array();
        $mform->addElement('text', 'fullname', get_string('modulename', 'local_modules'), $tools);
        $mform->addRule('fullname', get_string('missingmodulename', 'local_modules'), 'required', null, 'client');
        $mform->setType('fullname', PARAM_RAW);
        $mform->addElement('editor', 'description', get_string('description', 'local_modules'), null, $editoroptions);
        $mform->setType('description', PARAM_RAW);

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

        $submitlable = ($id > 0) ? get_string('savemodule', 'local_modules') : get_string('createmodule', 'local_modules');
        $this->add_action_buttons($cancel = true, $submitlable);
        // $this->add_action_buttons();
    }
开发者ID:anilch,项目名称:Personel,代码行数:49,代码来源:module_form.php

示例4: 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

示例5: definition

 function definition() {
     global $USER, $CFG, $DB, $PAGE;
     $id = optional_param('id', -1, PARAM_INT);
     $hierarchy = new hierarchy();
     $instance = new cobalt_examtype();
     $mform = $this->_form;
     $editoroptions = $this->_customdata['editoroptions'];
     if ($id > 0)
         $mform->addElement('header', 'settingsheader', get_string('editexamtype', 'local_examtype'));
     else
         $mform->addElement('header', 'settingsheader', get_string('addeditexamtype', 'local_examtype'));
     $items = $hierarchy->get_school_items();
     $school = $hierarchy->get_school_parent($items);
     if ($id < 0) {
         $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);
     }
     if ($id > 0) {
         $mform->addElement('static', 'school_name', get_string('schoolid', 'local_collegestructure'));
         $mform->addElement('hidden', 'schoolid');
         $mform->setType('schoolid', PARAM_RAW);
     }
     $mform->addElement('text', 'examtype', get_string('examtype', 'local_examtype'));
     $mform->addRule('examtype', get_string('examtypereq', 'local_examtype'), 'required', null, 'client');
     $mform->setType('examtype', PARAM_RAW);
     $mform->addElement('editor', 'description', get_string('description', 'local_examtype'), null, $editoroptions);
     $mform->setType('description', PARAM_RAW);
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     if ($id < 0)
         $save = get_string('addeditexamtype', 'local_examtype');
     else
         $save = get_string('updateexamtype', 'local_examtype');
     $this->add_action_buttons(true, $save);
 }
开发者ID:anilch,项目名称:Personel,代码行数:36,代码来源:edit_form.php

示例6: hierarchy

<?php

require_once(dirname(__FILE__) . '/../../config.php');
global $CFG, $DB, $PAGE, $USER;
require_once($CFG->dirroot . '/local/classroomresources/lib.php');
require_once($CFG->dirroot . '/local/classroomresources/resource_form.php');
$id = optional_param('id', -1, PARAM_INT);
$delete = optional_param('delete', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$visible = optional_param('visible', -1, PARAM_INT);
$linkschool = optional_param('linkschool', 0, PARAM_INT);
$hierarchy = new hierarchy();


//error handling 
$hierarchy->get_school_items();

$conf = new object();
$currenttab = 'create';
$systemcontext = context_system::instance();
if ($id > 0) {

    if (!($tool = $DB->get_record('local_building', array('id' => $id)))) {
        throw new exception(get_string('invalidtoolid', 'local_building'));
    } else {
        $tool->schoolid = $DB->get_field('local_school', 'fullname', array('id' => $tool->schoolid));
        $tool->description = array('text' => $tool->description, 'format' => FORMAT_HTML);
    }
} else {
    $tool = new stdClass();
    $tool->id = -1;
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:building.php

示例7: hierarchy

//Heading of the page
echo $OUTPUT->heading(get_string('managemodule', 'local_modules'));
$hier = new hierarchy();
$schools = $hier->get_assignedschools();
$currenttab = "lists";
$instance->print_tabs($currenttab, -1);

// 
// Moodle 2.2 and onwards
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('allowframembedding', 'local_modules'));
}

$schools = $hier->get_school_parent($schools, $selected = array(), $inctop = false, $all = false);
if (is_siteadmin()) {
    $schools = $hier->get_school_items();
}

$schoollist_string = implode(',', array_keys($schools));
if (empty($schoollist_string)) {
    echo get_string('no_records', 'local_request');

    echo $OUTPUT->footer();
    die;
}
$tools = $DB->get_records_sql('select * from {local_module} where schoolid in (' . $schoollist_string . ')');
$data = array();
$capabilities_array = array('local/modules:manage', 'local/modules:delete', 'local/modules:update', 'local/modules:visible');
$assigncourse_cap = array('local/modules:manage', 'local/modules:assigncourse');
foreach ($tools as $tool) {
    $line = array();
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:index.php

示例8: 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

示例9: definition

    function definition() {
        global $USER, $CFG, $DB, $PAGE;
        $hierarchy = new hierarchy();
        $mform = $this->_form;
        $id = $this->_customdata['id'];
        $mform->addElement('header', 'settingsheader', get_string('accountingperiod', 'local_onlinepayment'));
        $schoollist = $hierarchy->get_assignedschools();
        if (is_siteadmin()) {
            $schoollist = $hierarchy->get_school_items();
        }
        $schoollist = $hierarchy->get_school_parent($schoollist, $selected = array(), $inctop = true, $all = false);
        if ($id < 0) {
            $mform->addElement('select', 'schoolid', get_string('select', 'local_collegestructure'), $schoollist);
            $mform->setType('schoolid', PARAM_INT);
            $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
        } else {
            $mform->addElement('static', 'school_name', get_string('schoolname', 'local_collegestructure'));
            $mform->addElement('hidden', 'schoolid');
            $mform->setType('schoolid', PARAM_INT);
        }
        $mform->addElement('date_selector', 'datefrom', get_string('startdate', 'local_academiccalendar'), array('optional' => true));
        $mform->addElement('date_selector', 'dateto', get_string('enddate', 'local_academiccalendar'), array('optional' => true));
        $mform->addRule('datefrom', get_string('missingstartdate', 'local_academiccalendar'), 'required', null, 'client');
        $mform->addRule('dateto', get_string('missingenddate', 'local_academiccalendar'), 'required', null, 'client');

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

        $buttonarray = array();
        $buttonarray[] = &$mform->createElement('submit', 'submitbutton', get_string('submit'));
        $buttonarray[] = &$mform->createElement('cancel');
        $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
    }
开发者ID:anilch,项目名称:Personel,代码行数:33,代码来源:paytax_form.php

示例10: 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

示例11: array

 function get_usercount($extraselect = '', array $extraparams = null)
 {
     global $DB, $CFG, $SESSION;
     $select = " u.id <> :guestid AND u.deleted = 0";
     $params = array('guestid' => $CFG->siteguest);
     if ($extraselect) {
         $select .= " AND {$extraselect}";
         $params = $params + (array) $extraparams;
     }
     if (isset($SESSION->user_filtering['courseid'])) {
         $sql = "SELECT u.* FROM {user_enrolments} ue\n\t\t\t\t\t\t\t\t\t\tJOIN {enrol} e ON e.id = ue.enrolid\n\t\t\t\t\t\t\t\t\t\tJOIN {user} u ON u.id = ue.userid\n\t\t\t\t\t\t\t\t\t\tJOIN {course} c ON c.id = e.courseid\n\t\t\t\t\t\t\t\t\t\tWHERE c.visible = 1 AND ue.status = 0 AND {$select}";
         $users = $DB->get_records_sql($sql, $params);
     } else {
         $users = $DB->get_records_sql("SELECT u.*, lu.rosterid\n\t\t\t\t\t\t\t   FROM {user} u\n\t\t\t\t\t\t\t   JOIN {local_users} lu ON lu.userid = u.id\n\t\t\t\t\t\t\t   WHERE {$select}", $params);
     }
     $records = array();
     if (!empty($users)) {
         $useridin = implode(',', array_keys($users));
         $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();
         }
         if (!empty($schoollist)) {
             $schoolidin = implode(',', array_keys($schoollist));
             $records = $DB->get_records_sql("(SELECT u.* FROM {user} u\n                                         JOIN {local_users} lu ON lu.userid = u.id\n                                         JOIN {local_school_permissions} sp ON sp.userid = u.id\n\n                                         WHERE u.id in ({$useridin}) AND sp.schoolid IN ({$schoolidin}))\n                                         UNION\n                                         (SELECT u.* FROM {user} u\n                                         JOIN {local_users} lu ON lu.userid = u.id\n                                         JOIN {local_userdata} ud ON ud.userid = u.id\n                                        WHERE u.id in ({$useridin}) AND ud.schoolid IN ({$schoolidin}))");
         }
     }
     return sizeof($records);
 }
开发者ID:harshasunny,项目名称:alltasks,代码行数:31,代码来源:lib.php

示例12: registrarapprovecourse

if (!empty($approve) && !empty($classid)) {

    registrarapprovecourse($userid, $classid);
}
if (!empty($reject) && !empty($classid)) {

    registrarrejectcourse($userid, $classid);
}

/*
 * ###Bugreport #174-Course Approvals
 * @author Naveen Kumar<naveen@eabyas.in>
 * (Resolved) Retreiving assigned schools clclasses only
 */
$hierarchy = new hierarchy();
$assigned_schools = $hierarchy->get_school_items();

/* ---Moodle 2.2 and onwards--- */
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('allowclassregistration', 'local_courseregistration'));
}

foreach ($assigned_schools as $assignedschool) {
    $asarray[] = $assignedschool->id;
}
$assignedschoolstring = implode(',', $asarray);
// $compare_scale_clause = $DB->sql_compare_text("event")  . ' != ' . $DB->sql_compare_text(":et");
$query = "SELECT c.id as userclassid,lc.*,
                cc.id AS courseid,
                c.classid AS classid,
                c.userid AS userid,c.event,
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:registrar.php

示例13: array

$semesters = $DB->get_records_sql($mysql);

$data = array();
foreach ($semesters as $semester) {
    $line = array();
    $line[] = $semester->fullname;
    $schoollist = $DB->get_records('local_school_semester', array('semesterid' => $semester->id));
    $schoolname = '';
    $unassign = '';
    foreach ($schoollist as $school) {
        $schoolname .= '<div>' . $DB->get_field('local_school', 'fullname', array('id' => $school->schoolid)) . '</div>';
        $unassign .= '<div>' . html_writer::link(new moodle_url('/local/semesters/assign.php', array('schoolid' => $school->schoolid, 'semesterid' => $school->semesterid, 'unassign' => 1, 'sesskey' => sesskey())), html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/delete'), 'title' => get_string('unassign', 'local_semesters'), 'alt' => get_string('unassign', 'local_semesters'), 'class' => 'iconsmall'))) . '</div>';
    }
    $line[] = $schoolname;
    $line[] = $unassign;
    $items = $hierarchy->get_school_items();
    $items = $mysemester->remove_assignedschool($items, $semester->id);
    $parents = $hierarchy->get_school_parent($items);
    $scl = new single_select(new moodle_url('/local/semesters/assign.php?semesterid=' . $semester->id . ''), 'schoolid', $parents, '', null);
    $line[] = $OUTPUT->render($scl);
    $data[] = $line;
}
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('viewsemesterreportspage', 'local_semesters'));
}
if (!empty($data)) {  //if data is present in the table then only display the filters
    $PAGE->requires->js('/local/semesters/semesterjs.js');
}
//View Part starts
//start the table
$table = new html_table();
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:assign.php

示例14: stdClass

    function get_content() {
        global $CFG, $DB, $PAGE,$USER,$OUTPUT;
        require_once($CFG->dirroot.'/local/lib.php');
		
		if(!isloggedin()){
			return $this->content;
		}
		
        if ($this->content !== NULL) {
            return $this->content;
        }
		
		if(!has_capability('local/collegestructure:manage', context_system::instance())){
			return $this->content;
		}
		
		$this->content = new stdClass();
		$this->content->items = array();
		
		
		$hierarchy = new hierarchy;
		$schools = $hierarchy->get_school_items();
		$schoolidin = '';
		if(!empty($schools)){
			$schoolidin = implode(', ', array_keys($schools));
		}

		$renderer = $this->page->get_renderer('block_dashboard');
		
		//Programs...
		$programs    = $DB->get_records_select('local_program', 'schoolid IN ('.$schoolidin.') AND visible = 1');
		$programtable = $renderer->display_programs($hierarchy, $programs);
		
		//Curriculums...
		$curriculums = $DB->get_records_select('local_curriculum', 'schoolid IN ('.$schoolidin.') AND visible = 1');
		$curriculumtable = $renderer->display_curriculums($hierarchy, $curriculums);
		
		//Departments...
		$departments = $DB->get_records_select('local_department', 'schoolid IN ('.$schoolidin.') AND visible = 1');
		$depts       = $DB->get_records_sql("SELECT * FROM {local_department} d, {local_assignedschool_dept} sd WHERE d.id = sd.deptid AND sd.assigned_schoolid IN ($schoolidin) AND d.visible=1");
		$departments = $departments + $depts;		
		$departmenttable = $renderer->display_departments($hierarchy, $departments);
		
		//Classes...
		$classes = $DB->get_records_select('local_clclasses', 'schoolid IN ('.$schoolidin.') AND visible = 1');
		$classtable = $renderer->display_classes($hierarchy, $classes);
		
		//Courses...
		$courses = $DB->get_records_select('local_cobaltcourses', 'schoolid IN ('.$schoolidin.') AND visible = 1');
		$coursetable = $renderer->display_courses($hierarchy, $courses);
		
		//Exams...
		$exams = $DB->get_records_select('local_scheduledexams', 'schoolid IN ('.$schoolidin.') AND visible = 1');
		$examtable = $renderer->display_exams($hierarchy, $exams);
		
		$this->content->items[] = '<div class="row row-fluid span12 dashboard_tablerow desktop-first-column">' .
									html_writer::tag('div', $head . $programtable, array('class'=>'span4 dashboard_table')) .
									html_writer::tag('div', $curriculumtable, array('class'=>'span4 dashboard_table')) .
									html_writer::tag('div', $departmenttable, array('class'=>'span4 dashboard_table')) .
									'</div><div class="row row-fluid span12 dashboard_tablerow desktop-first-column">' .
									html_writer::tag('div', $coursetable, array('class'=>'span4 dashboard_table')) .
									html_writer::tag('div', $classtable, array('class'=>'span4 dashboard_table')) .
									html_writer::tag('div', $examtable, array('class'=>'span4 dashboard_table')) .
									'</div>';
			
		$this->content->footer = '';
		$this->page->requires->js('/blocks/dashboard/javascript/custom.js');
		return $this->content;
    }
开发者ID:anilch,项目名称:Personel,代码行数:69,代码来源:block_dashboard.php

示例15: bulk_batch_enroll_newstudents


//.........这里部分代码省略.........
        }
        foreach ($PRF_FIELDS as $field) {
            if (isset($admission->$field)) {
                continue;
            }
            if (isset($formdata->$field)) {
                $formdefaults[$field] = true;
            }
        }
        // can we process with update or insert?
        $skip = false;
        if ($optype == 'UU_ADMISSION_ADDNEW') {
            if ($existingadmission) {
                $admissionsskipped++;
                $skip = true;
            }
        }
        if ($skip) {
            continue;
        }
        // save the new admission to the database
        // schools validation
        //$scname = trim($admission->schoolname);
        //$schoollist = $DB->get_record('local_school', array('fullname' => $scname));
        //if (empty($schoollist)) {
        //    $result .= '<h3 style="color:red;">Invalid school  "' . $admission->schoolname . '" entered at line no. "' . $linenum . '" of excelsheet.</h3>';
        //    goto loop;
        //}
       // $scid = $schoollist->id;
        // check schoolname
        $hier = new hierarchy();
        $schools = $hier->get_assignedschools();
        if (is_siteadmin()) {
            $schools = $hier->get_school_items();
        }
        $c = 0;
        foreach ($schools as $scl) {
            if ($scid == $scl->id) {
                ++$c;
                break;
            }
        }
        //if ($c == 0) {
        //     $result .='<h3 style="color:red;">Sorry you are not assigned to this school "' . $admission->schoolname . '" entered at line no. "' . $linenum . '" of uploaded excelsheet.</h3>';
        //    goto loop;
        //}
        //if (empty($admission->typeofprogram)) {
        //     $result .= '<h3 style="color:red;">Please enter value for "typeofprogram" field in line no. "' . $linenum . '" of uploaded excelsheet.</h3>';
        //    goto loop;
        //}
        if (empty($admission->typeofapplication)) {
             $result .= '<div class="alert alert-error">Please enter value for "typeofapplication" field in line no. "' . $linenum . '" of uploaded excelsheet.</div>';
            goto loop;
        }
        if ($admission->typeofapplication > 2 || $admission->typeofapplication < 1) {
             $result .= '<div class="alert alert-error">You have entered invalid typeofapplication "' . $admission->typeofapplication . '" at line no. "' . $linenum . '" of uploaded excelsheet.</div>';
            goto loop;
        }
        // type of program validation
        //if ($admission->typeofprogram > 2 || $admission->typeofprogram < 1) {
        //     $result .= '<h3 style="color:red;">You have entered invalid typeofprogram "' . $admission->typeofprogram . '" at line no. "' . $linenum . '" of uploaded excelsheet.';
        //    goto loop;
        //}
        //  program validation
        //$prg = trim($admission->programname);
        //$programlist = $DB->get_record('local_program', array('fullname' => $prg));
开发者ID:anilch,项目名称:Personel,代码行数:67,代码来源:bulk_enrollib.php


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