function definition_after_data() { global $DB,$CFG; $mform = $this->_form; $formatvalue = $mform->getElementValue('schoolid'); $id = $this->_customdata['id']; $tools = array(); if ($formatvalue) { $hierarchy = new hierarchy(); $curricula = new curricula(); $formatvalue = $formatvalue[0]; $tools = $hierarchy->get_records_cobaltselect_menu('local_program', "schoolid=$formatvalue AND visible=1", null, '', 'id,fullname', '--Select--'); $checkentitysetting = array(); $checkentitysetting = $hierarchy->get_entitysetting('CL', $formatvalue); if ($formatvalue > 0) { if(array_key_exists($tools)) $newel = $mform->createElement('static', 'programid', get_string('program', 'local_programs'), $hierarchy->cobalt_navigation_msg('No program available yet, Click here ','Create Program',$CFG->wwwroot.'/local/programs/program.php')); else $newel = $mform->createElement('select', 'programid', get_string('program', 'local_programs'), $tools); $mform->insertElementBefore($newel, 'addprogramslisthere'); //$mform->setType('addprogramslisthere', PARAM_RAW); $mform->addRule('programid', get_string('missingfullname', 'local_programs'), 'required', null, 'client'); $mform->setType('id', PARAM_INT); /** curriculum settings like credithours are displayed here on selecting the school/university * get_entitysetting() function exect if credit hours are set at curriculum level */ if ($checkentitysetting) { foreach ($checkentitysetting as $settings) { $level = "CL"; $level = $mform->createElement('hidden', 'level', $level); $mform->insertElementBefore($level, 'addsettinglisthere'); if ($settings->entityid == 1) { $settingheading = $mform->createElement('header', 'moodle', get_string('settingone', 'local_curriculum')); $mform->insertElementBefore($settingheading, 'addsettinglisthere'); $entityids = 1; $entitys = $mform->createElement('hidden', 'entityids', $entityids); $mform->insertElementBefore($entitys, 'addsettinglisthere'); $subentitys = $mform->createElement('hidden', 'subentityidse', $entityids); $mform->insertElementBefore($subentitys, 'addsettinglisthere'); $credithours = $mform->createElement('text', 'mincrhour', get_string('minch', 'local_curriculum')); $mform->insertElementBefore($credithours, 'addsettinglisthere'); $mform->addRule('mincrhour', get_string('missingtotalch', 'local_curriculum'), 'required', null, 'client'); $mform->setType('mincrhour', PARAM_RAW); } if ($settings->entityid == 2) { $settingheading = $mform->createElement('header', 'moodle', get_string('settingtwo', 'local_curriculum')); $mform->insertElementBefore($settingheading, 'addsettinglisthere'); $entity = 2; $entity = $mform->createElement('hidden', 'entityid', $entity); $mform->insertElementBefore($entity, 'addsettinglisthere'); $subentity = $mform->createElement('hidden', 'subentityid', $entityids); $mform->insertElementBefore($subentity, 'addsettinglisthere'); $freshman = $mform->createElement('text', 'mincredithours[0]', get_string('freshmancrhr', 'local_curriculum')); $mform->insertElementBefore($freshman, 'addsettinglisthere'); $sophomore = $mform->createElement('text', 'mincredithours[1]', get_string('sophomorecrhr', 'local_curriculum')); $mform->insertElementBefore($sophomore, 'addsettinglisthere'); $junior = $mform->createElement('text', 'mincredithours[2]', get_string('juniorcrhr', 'local_curriculum')); $mform->insertElementBefore($junior, 'addsettinglisthere'); $senior = $mform->createElement('text', 'mincredithours[3]', get_string('seniorcrhr', 'local_curriculum')); $mform->insertElementBefore($senior, 'addsettinglisthere'); if ($id < 0) { $mform->setDefault('mincredithours[0]', NULL); $mform->setDefault('mincredithours[1]', NULL); $mform->setDefault('mincredithours[2]', NULL); $mform->setDefault('mincredithours[3]', NULL); } } } } /* * End of the curriculum settings * */ } } }
//if($assigntype==1) echo '<div style="margin-bottom: 10px;">'; $select1 = new single_select(new moodle_url('/local/curriculum/assigncourses.php?id=' . $plan->id . '&mode=' . $mode . '&cid=' . $cid . ''), 'pid', $p, $programid, null, 'switchcategory'); $select1->set_label(get_string('selectprogram', 'local_programs') . ':  '); echo $OUTPUT->render($select1); echo '</div>'; if ($programid) { echo '<div style="margin-bottom: 10px;">'; $modules = $hierarchy->get_records_cobaltselect_menu('local_module', "programid=$programid AND visible=1", null, '', 'id,fullname', 'Select Module',0,0,0); $select2 = new single_select(new moodle_url('/local/curriculum/assigncourses.php?id=' . $plan->id . '&mode=' . $mode . '&cid=' . $cid . '&pid=' . $programid . ''), 'moduleid', $modules, $moduleid, null, 'switchcategory'); $select2->set_label(get_string('selectmodule', 'local_modules') . ':    '); echo $OUTPUT->render($select2); echo '</div>'; if(count($modules)<=1) echo $hierarchy->cobalt_navigation_msg(get_string('navigation_info','local_collegestructure'),get_string('createmodule', 'local_modules'),$CFG->wwwroot.'/local/modules/module.php'); } echo '</div>'; echo '<div id="d" style="margin-bottom: 10px;' . $display2 . '">'; $select3 = new single_select(new moodle_url('/local/curriculum/assigncourses.php?id=' . $plan->id . '&mode=' . $mode . '&cid=' . $cid . ''), 'did', $d, $departmentid, null, 'switchcategory'); $select3->set_label(get_string('selectdepartment', 'local_cobaltcourses') . ':    '); echo $OUTPUT->render($select3); // navigation handling if(count($d)<=1){ echo $hierarchy->cobalt_navigation_msg(get_string('navigation_info','local_collegestructure'),get_string('create_department', 'local_departments'),$CFG->wwwroot.'/local/departments/departments.php'); } echo '</div>'; $checkcount = $cplan->course_count($id, $cid, $moduleid, $departmentid); $disable = ($checkcount) ? 'disabled="disabled"' : '';
function definition_after_data() { global $DB, $CFG; $mform = $this->_form; $id = $this->_customdata['id']; $schoid = $this->_customdata['schoid']; $hierarchy = new hierarchy(); $formatvalue = $mform->getElementValue('schoolid'); $formatvalue = $formatvalue[0]; if ($formatvalue > 0) { /* * ###Bug report #245 - Training Management * @author Naveen Kumar<*****@*****.**> * (Resolved) Changed function to get semesters. We need to get all upcoming and present semesters. * Previous method only get presesnt active semester */ $tools = classes_get_school_semesters($formatvalue); $newel = $mform->createElement('select', 'semesterid', get_string('semester', 'local_semesters'), $tools); $mform->insertElementBefore($newel, 'addsemesterlisthere'); $mform->addHelpButton('semesterid', 'semester', 'local_semesters'); $mform->addRule('semesterid', get_string('missingsemester', 'local_semesters'), 'required', null, 'client'); $mform->setType('semesterid', PARAM_RAW); $departments = $hierarchy->get_departments_forschool($formatvalue, $none = ""); $dept = $mform->createElement('select', 'departmentid', get_string('department', 'local_clclasses'), $departments); $mform->insertElementBefore($dept, 'adddepartmentlisthere'); if (count($departments) <= 1) { $empty_deptmsg = $mform->createElement('static', 'department_emptyinfo', '', $hierarchy->cobalt_navigation_msg(get_string('navigation_info', 'local_collegestructure'), get_string('create_department', 'local_departments'), $CFG->wwwroot . '/local/departments/departments.php')); $mform->insertElementBefore($empty_deptmsg, 'adddepartmentemptymsg'); } $mform->addHelpButton('departmentid', 'department', 'local_clclasses'); $mform->addRule('departmentid', get_string('departmentmissing', 'local_clclasses'), 'required', null, 'client'); $mform->setType('departmentid', PARAM_RAW); $departmentvalue = $mform->getElementValue('departmentid'); $departmentvalue = $departmentvalue[0]; if ($departmentvalue > 0) { $selectonline = array(); $selectonline[NULL] = get_string('select', 'local_clclasses'); $selectonline['1'] = get_string('online', 'local_clclasses'); $selectonline['2'] = get_string('offline', 'local_clclasses'); $cobaltclasstype = $mform->createElement('select', 'online', get_string('classtype', 'local_clclasses'), $selectonline); $mform->insertElementBefore($cobaltclasstype, 'addonlinelisthere'); $mform->addRule('online', get_string('missingonline', 'local_clclasses'), 'required', null, 'client'); $mform->setType('online', PARAM_INT); $mform->addHelpButton('online', 'classtype', 'local_clclasses'); } if ($departmentvalue > 0) { $online = $mform->getElementValue('online'); if (isset($online)) { $online = $online[0]; if ($online == 1) { $onlinecourses = $hierarchy->get_records_cobaltselect_menu('course', 'visible=1 AND category>0', null, '', 'id,concat(shortname,": ",fullname)', '--Select--'); $cobaltcourse2 = $mform->createElement('select', 'onlinecourseid', get_string('onlinecourse', 'local_clclasses'), $onlinecourses); $mform->insertElementBefore($cobaltcourse2, 'addonlinecoursehere'); $mform->addRule('onlinecourseid', get_string('required'), 'required', null, 'client'); $mform->setType('onlinecourseid', PARAM_RAW); $mform->addHelpButton('onlinecourseid', 'onlinecourse', 'local_clclasses'); $new1 = $mform->createElement('html', '<a id="newonlinecourse" style="float:right;margin-right:240px;cursor:pointer;" onclick="onlinecourse(' . $formatvalue . ',' . $departmentvalue . ')">' . get_string('addnewonlinecourse', 'local_clclasses') . '</a>'); $mform->insertElementBefore($new1, 'onlinecourseid'); } } } if ($departmentvalue > 0) { $cobaltcourses = $hierarchy->get_records_cobaltselect_menu('local_cobaltcourses', "departmentid=$departmentvalue AND visible=1", null, '', 'id,concat(shortname,": ",fullname)', '--Select--'); $cobaltcourse = $mform->createElement('select', 'cobaltcourseid', get_string('cobaltcourse', 'local_clclasses'), $cobaltcourses); $mform->insertElementBefore($cobaltcourse, 'addcobaltcoursehere'); $mform->addHelpButton('cobaltcourseid', 'cobaltcourse', 'local_clclasses'); $mform->addRule('cobaltcourseid', get_string('cobaltcoursemissing', 'local_clclasses'), 'required', null, 'client'); $mform->setType('cobaltcourseid', PARAM_RAW); $new = $mform->createElement('html', '<a id="newcobaltcourse" style="float:right;margin-right: 240px;cursor:pointer;" onclick="cobaltcourse(' . $formatvalue . ',' . $departmentvalue . ')">' . get_string('addnewcobaltcourse', 'local_clclasses') . '</a>'); $mform->insertElementBefore($new, 'cobaltcourseid'); $online = $mform->getElementValue('online'); } // Task code : T1.6 - Assigning instructor to class //-------- selecting instructor to class----------------------------------------------------------- if ($formatvalue > 0 && $departmentvalue > 0 && $online[0] > 0) { $cobaltcourses1 = $hierarchy->get_department_instructors($departmentvalue, $formatvalue); $instructorfield = $mform->createElement('select', 'instructor', get_string('instructor', 'local_clclasses'), $cobaltcourses1, array('multiple' => 'multiple')); if (count($cobaltcourses1) <= 1) { $insroleid = $DB->get_record_sql("SELECT * FROM {role} where shortname='instructor'"); $instructorexits = $DB->get_records('local_school_permissions', array('schoolid' => $schoid, 'roleid' => $insroleid->id)); if ($instructorexits) $navigationlink = $CFG->wwwroot . '/local/departments/assign_instructor.php?slsid=' . $schoid . ''; else $navigationlink = $CFG->wwwroot . '/local/users/user.php'; $navigationmsg = get_string('nodata_assigninstructorpage', 'local_departments'); $linkname = get_string('linkname_assigninstructorpage', 'local_departments'); $instructorfield = $mform->createElement('static', 'department_emptyinfo', '', $hierarchy->cobalt_navigation_msg($navigationmsg, $linkname, $navigationlink, 'margin-bottom: 0; line-height: 0px;')); } $mform->insertElementBefore($instructorfield, 'addinstructorhere'); $mform->setType('instructor', PARAM_INT); // $mform->addRule('instructor', get_string('required'), 'required', null, 'client'); } //--------------------------------------------------------------------------------------------------- } }
function definition_after_data() { global $DB, $CFG; $hierarchy = new hierarchy(); $mform = $this->_form; $sid = $mform->getElementValue('schoolid'); if (isset($sid) && !empty($sid) && $sid[0] > 0) { $resource = cobalt_resources::get_instance(); $building = $hierarchy->get_records_cobaltselect_menu('local_building', "schoolid=$sid[0] AND visible=1", null, '', 'id,fullname', get_string('select', 'local_classroomresources')); $one = $mform->createElement('select', 'buildingid', get_string('buildingid', 'local_classroomresources'), $building); $mform->insertElementBefore($one, 'beforefloor'); if (count($building) <= 1) { $navigationmsg = get_string('navigation_info', 'local_collegestructure'); $linkname = get_string('create', 'local_classroomresources'); $navigationlink = $CFG->wwwroot . '/local/classroomresources/building.php?linkschool=' . $sid[0] . ''; $oneempty = $mform->createElement('static', 'buildingid_empty', '', $hierarchy->cobalt_navigation_msg($navigationmsg, $linkname, $navigationlink, 'margin-bottom: 0; line-height: 0px;')); $mform->insertElementBefore($oneempty, 'beforefloor_empty'); } } if (isset($one)) { $bid = $mform->getElementValue('buildingid'); if (isset($bid) && !empty($bid) && $bid[0] > 0) { $resource = cobalt_resources::get_instance(); $floor = $hierarchy->get_records_cobaltselect_menu('local_floor', "buildingid=$bid[0] AND visible=1", null, '', 'id,fullname', get_string('select', 'local_classroomresources')); $two = $mform->createElement('select', 'floorid', get_string('floorname', 'local_classroomresources'), $floor); $mform->insertElementBefore($two, 'beforeclass'); if (count($floor) <= 1) { $navigationmsg = get_string('navigation_info', 'local_collegestructure'); $linkname = get_string('createfloor', 'local_classroomresources'); $navigationlink = $CFG->wwwroot . '/local/classroomresources/floor.php?linkschool=' . $sid[0] . '&linkbuild=' . $bid[0] . ''; $floorempty = $mform->createElement('static', 'floorid_empty', '', $hierarchy->cobalt_navigation_msg($navigationmsg, $linkname, $navigationlink, 'margin-bottom: 0; line-height: 0px;')); $mform->insertElementBefore($floorempty, 'beforeclass_empty'); } } } }
* @author hemalatha a arun<*****@*****.**> * resolved - restrict to display only shared school */ /* $select = new single_select(new moodle_url('/local/modules/assigncourse.php?moduleid='.$moduleids.''), 'scid', $school, $scid, null, 'switchcategory'); $select->set_label(get_string('schoolid','local_collegestructure').':'); echo $OUTPUT->render($select); */ echo '</div>'; $displaylist = $hier->get_departments_forschool($modulelist->schoolid, false, true, true); echo '<div class="selfilterpos" style="float:none;">'; $select = new single_select(new moodle_url('/local/modules/assigncourse.php?moduleid=' . $moduleids . '&scid=' . $scid . ''), 'id', $displaylist, $id, null, 'switchcategory'); $select->set_label(get_string('dept', 'local_departments') . ':'); $select->set_help_icon('dept_formatname', 'local_departments'); echo $OUTPUT->render($select); echo '</div>'; if(count( $displaylist)<=1) echo $hier-> cobalt_navigation_msg(get_string('navigation_info','local_collegestructure'),get_string('create_department','local_departments'),$CFG->wwwroot.'/local/departments/departments.php'); } else { foreach ($schools as $scl) { $key = $scl->id; $value = $scl->fullname; } //$displaylist=$hier->get_departments_forschool($key); $displaylist = $hier->get_departments_forschool($modulelist->schoolid, false, true, true); echo '<div class="selfilterpos" style="float:none;">'; $select = new single_select(new moodle_url('/local/modules/assigncourse.php?moduleid=' . $moduleids . '&scid=' . $key . ''), 'id', $displaylist, $id, null, 'switchcategory'); $select->set_label(get_string('dept', 'local_departments') . ':'); $select->set_help_icon('dept_formatname', 'local_departments'); echo $OUTPUT->render($select); echo '</div>'; if(count( $displaylist)<=1)
function definition_after_data() { global $CFG,$DB, $PAGE, $USER, $hierarchy, $exams, $selected_class; $hierarchy = new hierarchy(); $exams = new schedule_exam(); $linkmsg=get_string('navigation_info','local_collegestructure'); $linkstyle='line-height: 0px;margin-bottom: -10px;'; $mform = $this->_form; $id = $this->_customdata['id']; $selected_school = $mform->getElementValue('schoolid'); //$selected_program = array(); $disable = ($id > 0) ? 'disabled="disabled"' : ''; // for programs and semesters in a school if ($selected_school[0] > 0) { // $programs_list = array(); // $programs_list = $hierarchy->get_school_programs($selected_school[0]); // // $programs_listdrop = $mform->createElement('select', 'programid', get_string('programslist', 'local_scheduleexam'), $programs_list, $disable); // $mform->insertElementBefore($programs_listdrop, 'addprogramslisthere'); // if($id < 0){ // $mform->addRule('programid', get_string('programreq', 'local_scheduleexam'), 'required', null, 'client'); // } // $selected_program = $mform->getElementValue('programid'); $semesters_list = array(); $semesters_list = $exams->get_semesterslists_scheduleexam($selected_school[0]); $semesters_listdrop = $mform->createElement('select', 'semesterid', get_string('semester', 'local_semesters'), $semesters_list, $disable); $mform->insertElementBefore($semesters_listdrop, 'addsemesterslisthere'); if ($id < 0) { $mform->addRule('semesterid', get_string('missingsemester', 'local_semesters'), 'required', null, 'client'); } $selected_semester = array(); $selected_semester = $mform->getElementValue('semesterid'); } // for examtypes in a school if (($selected_school[0])) { $examtype = array(); $examtype = $hierarchy->get_records_cobaltselect_menu('local_examtypes', "schoolid = $selected_school[0] AND visible=1", null, '', 'id,examtype', 'Select Assessment Type'); $examtypelist_listdrop = $mform->createElement('select', 'examtype', get_string('examtype', 'local_examtype'), $examtype, $disable); $mform->insertElementBefore($examtypelist_listdrop, 'addexamtypehere'); if(count($examtype)<=1){ $linkname=get_string('addeditexamtype','local_examtype'); $examtypelist_empty=$mform->createElement('static', 'examtype_emptyinfo', '',$hierarchy->cobalt_navigation_msg($linkmsg,$linkname,$CFG->wwwroot.'/local/examtype/edit.php',$linkstyle)); $mform->insertElementBefore($examtypelist_empty, 'addexamtypeempty_msg'); } if ($id < 0) { $mform->addRule('examtype', get_string('examtypereq', 'local_scheduleexam'), 'required', null, 'client'); } } // for clclasses assigned to a semester if (($selected_school[0]) AND ( $selected_semester[0] > 0)) { $clclasses_list = array(); $clclasses_list = $hierarchy->get_records_cobaltselect_menu('local_clclasses', "semesterid=$selected_semester[0] and schoolid=$selected_school[0] and visible=1", null, '', 'id,fullname', 'Select Class'); $clclasses_listdrop = $mform->createElement('select', 'classid', get_string('class', 'local_clclasses'), $clclasses_list, $disable); $mform->insertElementBefore($clclasses_listdrop, 'addclclasseslisthere'); if ($id < 0) $mform->addRule('classid', get_string('clclassesreq', 'local_clclasses'), 'required', null, 'client'); $selected_class = array(); $selected_class = $mform->getElementValue('classid'); } // for lecturetypes in a school if ($selected_school[0]) { $lecturetype = array(); // $lecturetype = $exams->get_lecturetype_scheduleexam($selected_school[0]); $lecturetype = $hierarchy->get_records_cobaltselect_menu('local_lecturetype', "schoolid=$selected_school[0] ", null, '', 'id,lecturetype', 'Select Mode of Assessment'); $lecturetype_listdrop = $mform->createElement('select', 'lecturetype', get_string('lecturetype', 'local_scheduleexam'), $lecturetype, $disable); $mform->insertElementBefore($lecturetype_listdrop, 'addlecturetypehere'); if(count($lecturetype)<=1){ $linkname=get_string('create','local_lecturetype'); $lecturetypelist_empty=$mform->createElement('static', 'lecturetype_emptyinfo', '',$hierarchy->cobalt_navigation_msg( $linkmsg, $linkname,$CFG->wwwroot.'/local/lecturetype/edit.php',$linkstyle)); $mform->insertElementBefore($lecturetypelist_empty, 'addlecturetypeempty_msg'); } if ($id < 0) { $mform->addRule('lecturetype', get_string('lecturetypereq', 'local_scheduleexam'), 'required', null, 'client'); } } if ($selected_class[0]) { //$cobaltcourse = array(); $cobcourse = $exams->get_cobaltcourse_scheduleexam($selected_class[0]); $cobaltcourse = $mform->createElement('static', 'cobcourse', get_string('coursename', 'local_cobaltcourses'), $cobcourse); $mform->insertElementBefore($cobaltcourse, 'addcobaltcourseehere'); } }
$instructor_list = $DB->get_records_sql($sql1); //--- code-used to display only unassigned instructor(new instructor)------------- foreach ($instructor_list as $s => $s_value) { $assigned_ins = $DB->get_record('local_dept_instructor', array('instructorid' => $s_value->id, 'schoolid' => $s_value->schoolid)); if (!empty($assigned_ins)) unset($instructor_list[$s]); } //------------------------------------------------------------------------------------ $data = array(); if (empty($instructor_list)) { $e = get_string('no_records', 'local_request'); // echo '</table></form></div>'; $navigationmsg = get_string('nodata_assigninstructorpage', 'local_departments'); $linkname = get_string('linkname_assigninstructorpage', 'local_departments'); echo $hier1->cobalt_navigation_msg($navigationmsg, $linkname, $CFG->wwwroot . '/local/users/user.php'); } echo '<form id="movemodules" action="assign_instructor.php" method="post"><div>'; echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; echo '<table id="stu1" class="generaltable" cellspacing="2" width="90%" cellpadding="4"><thead>'; echo '<th class="header" scope="col">' . get_string('firstname', 'local_departments') . '</th>'; echo '<th class="header" scope="col">' . get_string('lastname', 'local_departments') . '</th>'; echo '<th class="header" scope="col">' . get_string('email', 'local_departments') . '</th>'; echo '<th class="header" scope="col">' . get_string('select') . '</th>'; echo '</thead><tbody>'; foreach ($instructor_list as $ins) { $moveschoolid = $ins->schoolid; if ($ins->suspended) $attr = 'style="color:#999 !important;"'; else