本文整理汇总了PHP中hierarchy::get_school_parent方法的典型用法代码示例。如果您正苦于以下问题:PHP hierarchy::get_school_parent方法的具体用法?PHP hierarchy::get_school_parent怎么用?PHP hierarchy::get_school_parent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hierarchy
的用法示例。
在下文中一共展示了hierarchy::get_school_parent方法的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');
}
示例2: 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);
}
示例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();
}
示例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);
}
示例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();
}
示例6: 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);
}
示例7: 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'));
}
示例8: school_formelement_condition
/**
* @method school_formelement_condition
* @todo to display school field form element based on condition (if multiple school providing drop down box else static field)
* @param object $mform
* @return array of objects(form elements)
*/
public function school_formelement_condition($mform) {
global $DB, $CFG, $USER;
$hier = new hierarchy();
if (is_siteadmin($USER->id)) {
$schoolids = $DB->get_records('local_school', array('visible' => 1));
} else
$schoolids = $hier->get_assignedschools();
if (!empty($schoolids)) {
$count = sizeof($schoolids);
if ($count > 1) {
$parents = $hier->get_school_parent($schoolids, '', true);
$mform->addElement('select', 'schoolid', get_string('select', 'local_collegestructure'), $parents);
$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('schoolid', 'local_collegestructure'), $schoolname->fullname);
$mform->addElement('hidden', 'schoolid', $schoolids[0]->id);
}
$mform->setType('schoolid', PARAM_INT);
}
}
示例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'];
$hierarchy= new hierarchy();
$PAGE->requires->yui_module('moodle-local_prefix-hideshow', 'M.local_prefix.init_hideshow', array(array('formid' => $mform->getAttribute('id'))));
if ($eid->id > 0)
$mform->addElement('header', 'settingsheader', get_string('editprefix_settings', 'local_prefix'));
else
$mform->addElement('header', 'settingsheader', get_string('prefixs', 'local_prefix'));
$prefix = prefix_suffix::getInstance();
$entitylist = $hierarchy->get_records_cobaltselect_menu('local_create_entity', '', null, '', 'id,entity_name', '--Select--');
$mform->addElement('select', 'entityid', get_string('entityid', 'local_prefix'), $entitylist);
$mform->addRule('entityid', get_string('entityid', 'local_prefix'), 'required', null, 'client');
//------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('select', 'local_collegestructure'), $school->fullname);
$program = $DB->get_record('local_program', array('id' => $eid->programid));
$mform->addElement('static', 'epid', get_string('selectprogram', 'local_programs'), $program->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);
$mform->addElement('select', 'schoolid', get_string('select', 'local_collegestructure'), $parents);
$mform->addRule('schoolid', get_string('select', 'local_collegestructure'), 'required', null, 'client');
$mform->registerNoSubmitButton('updatecourseformat');
$mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
} 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('hidden', 'addprogramlisthere');
$mform->setType('addprogramlisthere', PARAM_INT);
$mform->addElement('text', 'sequence_no', get_string('sequence', 'local_prefix'));
$mform->addRule('sequence_no', get_string('spaces', 'local_prefix'), 'regex', '/[^ ]+/', 'client');
$mform->addRule('sequence_no', get_string('num', 'local_prefix'), 'numeric', null, 'client');
$mform->addRule('sequence_no', get_string('seq1', 'local_prefix'), 'required', null, 'client');
$mform->setType('sequence_no', PARAM_RAW);
$mform->addElement('text', 'prefix', get_string('prefix', 'local_prefix'));
$mform->addRule('prefix', get_string('spaces', 'local_prefix'), 'regex', '/[^ ]+/', 'client');
$mform->addRule('prefix', get_string('pre1', 'local_prefix'), 'required', null, 'client');
$mform->setType('prefix', PARAM_RAW);
$mform->addElement('text', 'suffix', get_string('suffix', 'local_prefix'));
$mform->addRule('suffix', get_string('spaces', 'local_prefix'), 'regex', '/[^ ]+/', 'client');
$mform->addRule('suffix', get_string('suf1', 'local_prefix'), 'required', null, 'client');
$mform->setType('suffix', PARAM_RAW);
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'page');
$mform->setType('page', PARAM_INT);
$i = get_string('submit', 'local_prefix');
$this->add_action_buttons(true, 'Submit');
}
示例10: hierarchy
//Header and the navigation bar
$PAGE->set_heading(get_string('semesters', 'local_semesters'));
$PAGE->navbar->add(get_string('pluginname', 'local_semesters'), new moodle_url('/local/semesters/index.php'));
$PAGE->navbar->add(get_string('report', 'local_semesters'));
echo $OUTPUT->header();
//Heading of the page
echo $OUTPUT->heading(get_string('pluginname', 'local_semesters'));
$currenttab = 'report';
$mysemester->createtabview($currenttab);
$hierarchy = new hierarchy();
$schoollist = $hierarchy->get_assignedschools();
if (is_siteadmin()) {
$schoollist = $hierarchy->get_school_items();
}
$parent = $hierarchy->get_school_parent($schoollist, '', false, false);
$schoolid = implode(',', array_keys($parent));
//get the reports for the Current & Completed Semesters.
$semesters = $mysemester->get_listofsemesters($currenttab, $schoolid);
$data = array();
foreach ($semesters as $semester) {
$line = array();
$line[] = $semester->fullname;
$line[] = $DB->count_records('local_user_semester', array('semesterid' => $semester->id));
$line[] = $DB->count_records('local_user_sem_details', array('semesterid' => $semester->id, 'studentstatus' => 0));
$line[] = $DB->count_records('local_user_sem_details', array('semesterid' => $semester->id, 'studentstatus' => 1));
$line[] = $DB->count_records('local_user_sem_details', array('semesterid' => $semester->id, 'studentstatus' => 2));
$data[] = $line;
}
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
示例11: hierarchy
//echo $OUTPUT->header();
echo $OUTPUT->header();
//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');
示例12: 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);
}
示例13: array
$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();
$table->id = "semestertable";
$head = array();
示例14: hierarchy
//tabs
createtabview_gsub($currenttab);
// Moodle 2.2 and onwards
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
echo $OUTPUT->box(get_string('allowframembedding', 'local_gradesubmission'));
}
$hierarchy = new hierarchy();
if (is_siteadmin($USER->id)) {
$schools = $DB->get_records('local_school', array('visible' => 1));
} else {
$schools = $hierarchy->get_assignedschools();
}
$schoolist = $hierarchy->get_school_parent($schools);
echo '<br/><br/>';
echo '<div class="selfilterpos" id="school">';
$sch = new single_select(new moodle_url('/local/gradesubmission/submitgrades.php'), 'school', $schoolist, $school, null);
$sch->set_label(get_string('schoolid', 'local_collegestructure'));
echo $OUTPUT->render($sch);
echo '</div>';
if (isset($schoolist)) {
$semesterslist = $hierarchy->get_school_semesters($school);
echo '<div class="selfilterpos" id="semester">';
$sem = new single_select(new moodle_url('/local/gradesubmission/submitgrades.php?school=' . $school), 'semester', $semesterslist, $semester, null);
$sem->set_label(get_string('semester', 'local_semesters'));
echo $OUTPUT->render($sem);
echo '</div>';
示例15: 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));
}
//.........这里部分代码省略.........