コード例 #1
0
ファイル: lib.php プロジェクト: anilch/Personel
 public static function getInstance() {
     if (!self::$_plan) {
         self::$_plan = new curriculumplan();
     }
     return self::$_plan;
 }
コード例 #2
0
ファイル: assigncourses.php プロジェクト: anilch/Personel
global $DB, $CFG;

require_login();
$systemcontext = context_system::instance();

//check the context level of the user and check weather the user is login to the system or not
$PAGE->set_context($systemcontext);
$PAGE->set_url('/local/curriculum/assigncourses.php');
$PAGE->set_title(get_string('curriculum', 'local_curriculum') . ': ' . get_string('assigncourses', 'local_curriculum'));
//Header and the navigation bar
$PAGE->set_heading(get_string('curriculumplan', 'local_curriculum'));


$PAGE->set_pagelayout('admin');
$cplan = curriculumplan::getInstance();
$conf = new object();

$returnurl = new moodle_url('/local/curriculum/assigncourses.php', array('id' => $id, 'mode' => $mode, 'cid' => $cid));
$hierarchy = new hierarchy();

//Adding the courses to the Curriculumplan 
if (!empty($moveto) and $data = data_submitted()) {
    $crs = array();
    foreach ($data as $key => $value) {
        if (preg_match('/^c\d+$/', $key)) {
            $cuid = substr($key, 1);
            array_push($crs, $cuid);
        }
    }
    $currenturl = new moodle_url('/local/curriculum/assigncourses.php', array('id' => $id, 'mode' => $mode, 'cid' => $cid));
コード例 #3
0
ファイル: academic_status.php プロジェクト: anilch/Personel
function display_active_classes(){
 global $DB, $CFG, $USER;
 
   $string = '<div id="academic_status_tabs"><ul>';
   $string.='<li><a href="#fragment-1"><span>My Classes</span></a></li>';
   $string .='<li><a href="#fragment-2"><span>Time Table</span></a></li>
		       <li><a href="#fragment-3"><span>Curriculum</span></a></li>
	           </ul>';
 
 
 // Tab for My Classes============
 $string.='<div id="fragment-1">';
 
 $sql = "SELECT plancourse.*, curriculum.programid, map.batchid
 FROM {local_curriculum_plancourses} AS plancourse
 JOIN {local_curriculum_plan} AS plan ON plan.id = plancourse.planid
 JOIN {local_curriculum} AS curriculum ON curriculum.id = plan.curriculumid
 JOIN {local_batch_map} AS map ON map.curriculumid = curriculum.id AND map.programid = curriculum.programid
 JOIN {cohort_members} AS member ON member.cohortid = map.batchid
 WHERE member.userid = {$USER->id}";
 $records = $DB->get_records_sql($sql);
 
 $today = date('Y-m-d');
 $semsql = "SELECT * FROM {local_semester} WHERE '{$today}' <= FROM_UNIXTIME(enddate, '%Y-%m-%d') ORDER BY enddate ASC LIMIT 1";
 $semester = $DB->get_record_sql($semsql);
 
 $record = $DB->get_record('local_userdata', array('userid'=>$USER->id));
 if(is_null($record->batchid)){
  $batch = $DB->get_record('cobort_members', array('userid'=>$USER->id));
  $record->batchid = $batch->cohortid;
 }
 
 $activeplan = $DB->get_record('local_activeplan_batch', array('batchid'=>$record->batchid, 'semesterid'=>$semester->id));
 $program = $DB->get_record('local_program', array('id'=>$record->programid));
 $plan = $DB->get_record('local_curriculum_plan', array('id'=>$activeplan->planid));
 
 $string .= html_writer::start_tag('div', array('style'=>'width: 100%; margin: 10px 0 25px; font-weight: bold; overflow: auto;color: #82152C;font-family: SourceSansPro-Semibold;'));
 $string .= html_writer::tag('div', $program->fullname, array('style'=>'float: left;'));
 $string .= html_writer::tag('div', $plan->fullname.' ('.$semester->fullname.')', array('style'=>'float: right;'));
 $string .= html_writer::end_tag('div');
 
 $data = array();
 foreach($records as $record){
  
  if(!$offernow = $DB->get_record('local_activeplan_batch', array('planid'=>$record->planid, 'batchid'=>$record->batchid))){
   continue;
  }
  
  $row = array();
  
  $course = $DB->get_record('local_cobaltcourses', array('id'=>$record->courseid), '*', MUST_EXIST);
  
  $sql = "SELECT c.* FROM {local_user_clclasses} AS uc JOIN {local_clclasses} AS c ON c.id = uc.classid
		 WHERE c.cobaltcourseid = {$record->courseid} AND uc.userid = {$USER->id} AND registrarapproval = 1";
  $class = $DB->get_record_sql($sql);
  
  $instuser = '';
  if($class->instructor != 0){
   $insts = explode(',', $class->instructor);
   foreach($insts as $inst){
	if($inst){
	$instructor = $DB->get_record('user', array('id'=>$inst), '*', MUST_EXIST);
	$instuser .= html_writer::tag('div', fullname($instructor), array());
	}
   }
  }
  
  $row[] = $course->fullname;
  //$row[] = $class ? $class->shortname : 'Not yet created';
  $row[] = $instuser != '' ? $instuser : '******';
  $row[] = '-'; //'Attendance'
  $row[] = $class ? html_writer::tag('a', '<button>Launch</button>', array('href'=>$CFG->wwwroot.'/course/view.php?id='.$class->onlinecourseid, 'target'=>'_blank')) : '-';
  $data[] = $row;
 }
 if(!empty($data)){
  $table = new html_table();
  $table->data = $data;
  $table->head = array('Course', 'Instructor', 'Attendance', 'Launch Course');
  $table->align = array('left', 'left', 'left', 'center');
  $string .= html_writer::table($table);
 } else {
  $string .= 'No Records Found';
 }
  $string .= '</div>';
  // End of Myclasses #fragment-1
  
  
  // Tab for Timetable ==================
  global $OUTPUT;
  $string.='<div id="fragment-2">';
  $string .= html_writer::start_tag('div', array('style'=>'width: 100%; margin: 10px 0 25px; font-weight: bold; overflow: auto;color: #82152C;font-family: SourceSansPro-Semibold;'));
  $string .= html_writer::tag('div', $program->fullname, array('style'=>'float: left;'));
  $string .= html_writer::tag('div', $plan->fullname.' ('.$semester->fullname.')', array('style'=>'float: right;'));
  $string .= html_writer::end_tag('div');
  $src = $CFG->wwwroot.'/blocks/academic_status/pix/'.$program->shortname.'_'.$plan->fullname.'.png';
  //$src = $OUTPUT->pix_url($program->shortname.'_'.$plan->fullname, 'blocks_academic_status');
  $string .= html_writer::empty_tag('img', array('src'=>$src, 'alt'=>'Timetable for BBE_Semester - I'));

  $string .= '</div>';
  // End of Timetable #fragment-2
  
  
  
  // Tab for Curriculum plan ==================
  $string.='<div id="fragment-3">';
  
  $assignedcount = $DB->count_records('local_userdata', array('userid'=>$USER->id));
  //if($assignedcount > 1){
  // $records = $DB->get_records('local_userdata', array('userid'=>$USER->id));
  //} else {
   $record = $DB->get_record('local_userdata', array('userid'=>$USER->id));
  //}
  require_once($CFG->dirroot . '/local/curriculum/lib.php');
  global $PAGE;
  $currentcss = '/local/curriculum/css/styles.css';
  $PAGE->requires->css($currentcss);
  $cplan = curriculumplan::getInstance();
  
  $program = $DB->get_record('local_program', array('id'=>$record->programid));
  $curriculum = $DB->get_record('local_curriculum', array('id'=>$record->curriculumid));
  $string .= html_writer::start_tag('div', array('style'=>'width: 100%; margin: 10px 0 25px; font-weight: bold; overflow: auto; color: #82152C;font-family: SourceSansPro-Semibold;'));
  $string .= html_writer::tag('div', $program->fullname, array('style'=>'float: left;'));
  $string .= html_writer::tag('div', $curriculum->fullname, array('style'=>'float: right;'));
  $string .= html_writer::end_tag('div');
  
  
  
  $plans = $DB->get_records_sql("SELECT * FROM {local_curriculum_plan} WHERE programid = {$record->programid} AND curriculumid = {$record->curriculumid} ORDER BY sortorder ASC");
  $data = array();
  foreach ($plans as $plan) {
	  $line = array();
	  $line[] = $cplan->display_curriculum_plan($plan) ;
	  $data[] = $line;
  }
  $table = new html_table();
  $table->size = array('65%', '20%', '10%');
  $table->align = array('left', 'left', 'left');
  $table->width = '100%';
  $table->data = $data;
  $string .= html_writer::table($table);
  
  $string .= '</div>';
  // End of Curriculum #fragment-3
  
  
  $string .= '</div>';
  //  End of Tabs functionality
  
  return $string;
}