function get_rows($elements, $sqlorder = ''){ global $DB, $CFG, $USER; require_once $CFG->dirroot.'/local/lib.php'; //$superviourrole= new assign_smanager(); $newsuper = is_supervisor_dashboard(); $finalelements = array(); if(!empty($elements)){ list($usql, $params) = $DB->get_in_or_equal($elements); $filter_programme = optional_param('filter_programme', '', PARAM_RAW); $sql="SELECT lbu.courseid as courseid, (SELECT c.fullname FROM {course} as c where c.id=lbu.courseid) as course_name, (SELECT count(lbu1.userid) as completions FROM {local_batch_users} as lbu1 where lbu1.courseid=lbu.courseid and lbu1.supervisorid=$USER->id and lbu1.completion_status=1) as course_completions, (SELECT count(lbu1.userid) as completions FROM {local_batch_users} as lbu1 where lbu1.courseid=lbu.courseid and lbu1.supervisorid=$USER->id and lbu1.completion_status=0) as course_uncompletions, (SELECT count(lbu1.userid) as completions FROM {local_batch_users} as lbu1 where lbu1.courseid=lbu.courseid and lbu1.supervisorid=$USER->id) as course_enrolled FROM {local_batch_users} as lbu WHERE lbu.supervisorid=$USER->id AND (lbu.courseid IS NOT NULL AND lbu.courseid!='0')"; if(!empty($filter_programme)){ $sql.=" AND lbu.courseid=$filter_programme "; } $sql.=" group by lbu.courseid"; $classrooms = $DB->get_records_sql($sql); $reportarray = array(); foreach($classrooms as $classroom){ $manger=new stdClass(); $manger->course_name = $classroom->course_name; $manger->enrolled =$classroom->course_enrolled; $manger->completed =$classroom->course_completions; $manger->pending =$classroom->course_uncompletions; $reportarray[] = $manger; } if($newsuper) { //print_object($total); return $reportarray; } } if($newsuper) { return $finalelements; } }
function get_content() { global $CFG, $PAGE, $OUTPUT, $USER; $renderer = $this->page->get_renderer('block_attendance'); // Cache block contents. if ($this->content !== NULL) { return $this->content; } $this->content = new stdClass(); // Initialise jquery requirements. require_once $CFG->dirroot . '/local/lib.php'; $this->content->text = ''; if (!is_supervisor_dashboard()) { $this->content->text .= $renderer->attendance_alerts($USER->id); } return $this->content; }
public function get_content() { if ($this->content !== null) { return $this->content; } global $USER, $CFG, $DB, $OUTPUT,$USER; require_once($CFG->dirroot.'/blocks/users_team/lib.php'); require_once($CFG->dirroot.'/local/lib.php'); $this->content = new stdClass; $this->content->text = ''; if(is_supervisor_dashboard()){ $data = block_users_team_userdetails(); $this->content->text = $data; $this->content->footer = ''; } return $this->content; }
/* Code end By @Harsha*/ </style> <?php echo $OUTPUT->standard_head_html() ?> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="<?php echo $CFG->wwwroot ?>/theme/clean/css/bootstrap.min.css" rel="stylesheet"> <!-- Custom CSS --> <link href="<?php echo $CFG->wwwroot ?>/theme/clean/css/simple-sidebar.css" rel="stylesheet"> </head> <body <?php echo $OUTPUT->body_attributes(); ?>> <?php echo $OUTPUT->standard_top_of_body_html(); global $DB,$USER, $CFG; require_once $CFG->dirroot.'/local/lib.php'; //$superviourrole= new assign_smanager(); $newsuper = is_supervisor_dashboard(); $is_ast_nh = is_ast_nh($USER->id); $is_zht = is_zht($USER->id); $is_hod = is_hod($USER->id); $is_instructor = is_instructor($USER->id); $is_trainers = is_trainers($USER->id); $is_bt = is_bt($USER->id); $is_ct = is_ct($USER->id); $is_zh = is_zh($USER->id); $is_rh = is_rh($USER->id); ?> <div id="wrapper" class=""> <!-- Sidebar --> <div id="sidebar-wrapper"> <?php
/*==========================Started by rajut for dispaly assigned users and assigne users (date:16-11-2015)==========*/ $user_toggle=""; $assigned_courses=$DB->get_record_sql("SELECT * FROM {local_batch_courses} WHERE batchid=$id"); $batchstatus=$DB->get_field('facetoface','active',array('id'=>$id)); if(!empty($assigned_courses)){ if(($batchstatus==0 || $batchstatus==3 || $batchstatus==8)&&(has_capability('mod/facetoface:addinstance', context_system::instance()))){ $user_toggle.='<span class="create_feedback" style="Width:100%;float:right;text-align:center;border:none !important;"> <a href="'.$CFG->wwwroot.'/mod/facetoface/users_batches.php?batchid='.$id.'&sessiontype='.$sessiontype.'" class="show"><ul style="display: inline-table;list-style-type: none;"> <li></li><li class="add_users">Add Users</li></ul></a></span>'; }else{ // $user_toggle='<span class="create_feedback" style=Width:18%;float:right;text-align:center;border:none !important;> // <a href="'.$CFG->wwwroot.'/mod/facetoface/users_batches.php?batchid='.$id.'" class="show"><ul style="display: inline-table;list-style-type: none;"> // <li></li><li class="add_users">Add Users</li></ul></a></span>'; } $user_toggle.= "<div id='dialoguser$id'>"; if( !(is_siteadmin() || is_ast_nh() ||is_instructor() || is_trainers()) && is_supervisor_dashboard()) { if($userid!=0) $user_toggle .= $output->assign_users($id,0,$USER->id); }else{ $user_toggle .= $output->assign_users($id,$userid,0); } $user_toggle .="</div>"; echo $user_toggle; }elseif(empty($assigned_courses)){ $user_toggle .= "<div id='dialoguser$id'>"; $user_toggle .= "<p class='empty_data' >No courses are assigned to this batch.Please assign courses.</p>"; $user_toggle .="</div>"; echo $user_toggle; } /*==========================Started by rajut for dispaly assigned users and assigne users (date:16-11-2015)==========*/
$output = $PAGE->get_renderer('quiz'); switch($page){ case 4: /*==========================Started by rajut for dispaly assigned users and assigne users (date:16-11-2015)==========*/ $user_toggle='<span class="create_feedback" style=Width:100%;text-align:center;border:none !important;> <ul style="display: inline-table;list-style-type: none;float: right;"> <li class="add_users"> <a href="'.$CFG->wwwroot.'/mod/quiz/users_assign.php?id='.$id.'&sessiontype='.$sessiontype.'" class="show">Add Users</a> </li> </ul> </span>'; $user_toggle.= "<div id='dialoguser$id'>"; if(is_supervisor_dashboard()) { if($userid10!=0) $user_toggle .= $output->assign_quizusers($id,0,$USER->id); }else{ $user_toggle .= $output->assign_quizusers($id,$userid10,0); } $user_toggle .="</div>"; echo $user_toggle; /*==========================Started by rajut for dispaly assigned users and assigne users (date:16-11-2015)==========*/ break; }
public function get_content() { if ($this->content !== null) { return $this->content; } global $USER, $CFG, $DB, $OUTPUT; require_once($CFG->dirroot.'/local/lib.php'); require_once($CFG->dirroot.'/local/mycourses/lib.php'); $userid = optional_param('id', $USER->id, PARAM_INT); $this->content = new stdClass; $this->content->text = ''; if(!is_supervisor_dashboard()){ /*************************** this can seen by admin,instructor and trainer*************************************/ //$users = $DB->get_records_sql("SELECT * FROM {facetoface} WHERE trainerid = $USER->id AND active=0 order by id DESC LIMIT 5 "); //tab changing code start $this->content->text[] = "<div class='alerts_course_exmas_icons'>"; $clswise = html_writer::tag('p',get_string('elearning', 'block_course_status'),array("class"=>"alerts_course_exmas_icons_classwise")); $this->content->text[] = html_writer::tag('a', $clswise, array('href'=>'javascript:void(0)', 'class' => 'tablink active','data-link'=>'elearning')); $datewise = html_writer::tag('p',get_string('classroom', 'block_course_status'),array("class"=>"alerts_course_exmas_icons_datewise")); $this->content->text[] = html_writer::tag('a', $datewise, array('href'=>'javascript:void(0)', 'class' => 'tablink','data-link'=>'classroom')); $requestwise = html_writer::tag('p',get_string('request', 'block_course_status'),array("class"=>"alerts_course_exmas_icons_classwise")); $this->content->text[] = html_writer::tag('a', $requestwise, array('href'=>'javascript:void(0)', 'class' => 'tablink','data-link'=>'request')); $this->content->text[] = "</div>"; /********************************First tab content************************************************/ //$this->content->text[] = "<div class='tabdetails' data-link='second' >"; $this->content->text[] = "<div id='tabid1' class='tabdetails' data-link='elearning' >"; $courses_courses1 = my_enrolled_courses($userid); //$this->content->text[] = '<h3 class="tab_heading" >'.get_string('elearningcourses','block_course_status').'</h3>'; if (!empty($courses_courses1)) { $this->content->text[] = '<table class="generaltable">'; $this->content->text[] = '<tr><th class="table_header" style="width:70%;">'.get_string('coursename','block_course_status').'</th><th class="table_header" style="width:30%;">'.get_string('enrolledon','block_course_status').'</th></tr>'; foreach ($courses_courses1 as $course) { $this->content->text[] = '<tr><td class="" style="width:70%;">'; //$this->content->text[] = html_writer::start_tag('div'); $this->content->text[] = html_writer::tag('a', $course->fullname, array('href' => $CFG->wwwroot . '/course/view.php?id=' . $course->id)).'</p>'; //$this->content->text[] = html_writer::tag('a', 'View', array('href' => $CFG->wwwroot . '/course/view.php?id=' . $course->id)); //$this->content->text[] = html_writer::end_tag('div'); $this->content->text[] = '</td><td class="" style="width:30%;">'; $this->content->text[] = date('d M, Y', $course->time_enroled); $this->content->text[] = '</td>'; $this->content->text[] = '</tr>'; } $this->content->text[] = '</table>'; }else { $this->content->text[] = '<div class="empty_data_message">No courses to display.</div>'; } $this->content->text[] = "</div>"; /********************************END of First tab************************************************/ /****************************second tab***************************************/ $this->content->text[] = "<div id='tabid2' class='tabdetails' data-link='classroom' >"; $courses_courses2 = my_enrolled_batchcourses($userid); //$this->content->text[] = '<h3 class="tab_heading" >'.get_string('classroomcourses','block_course_status').'</h3>'; if (!empty($courses_courses2)) { $this->content->text[] = '<table class="generaltable">'; $this->content->text[] = '<tr><th class="table_header">'.get_string('coursename','block_course_status').'</th><th class="table_header">'.get_string('trainername','block_course_status').'</th><th class="table_header" >'.get_string('coursestatus','block_course_status').'</th></tr>'; foreach ($courses_courses2 as $course) { //$this->content->text[] = html_writer::start_tag('div'); $this->content->text[] = '<tr><td class="">'; $this->content->text[] = html_writer::tag('a', $course->fullname, array('href' => $CFG->wwwroot . '/course/view.php?id=' . $course->id)); $this->content->text[] = '</td><td class="">'; $this->content->text[] = $course->trainer_name; $this->content->text[] = '</td><td class="">'; if($course->completion_status==0){ $this->content->text[] ="Not Completed"; }else{ $this->content->text[] ="Completed"; } $this->content->text[] = '</td></tr>'; //$this->content->text[] = html_writer::end_tag('div'); } $this->content->text[] = html_writer::end_tag('table'); }else{ $this->content->text[] = '<div class="empty_data_message">No courses to display.</div>'; } $this->content->text[] = "</div>"; /********************************END of Second tab************************************************/ /********************************Third tab************************************************/ $this->content->text[] = "<div id='tabid3' class='tabdetails' data-link='request' >"; $courses_courses3 = my_request_coursesonly($userid); //$this->content->text[] = '<h3 class="tab_heading" >'.get_string('requestedcourses','block_course_status').'</h3>'; if (!empty($courses_courses3)) { $this->content->text[] = '<table class="generaltable">'; $this->content->text[] = '<tr><th class="table_header" style="width:68%;">'.get_string('coursename','block_course_status').'</th><th class="table_header" style="width:32%;">'.get_string('approvestatus','block_course_status').'</th>'; foreach ($courses_courses3 as $course) { $this->content->text[] = '<tr><td class="" style="width:68%;">'; //$this->content->text[] = html_writer::start_tag('div'); $this->content->text[] = html_writer::tag('a', $course->fullname, array('href' => $CFG->wwwroot . '/course/view.php?id=' . $course->id)); $this->content->text[] = '</td><td class="" style="width:22%;">'; if($course->aprove_status==1){ $this->content->text[] ="Pending"; }else{ $this->content->text[] ="Approved"; } $this->content->text[] = '</td></tr>'; //$this->content->text[] = html_writer::start_tag('div'); } $this->content->text[] = '</table>'; }else { $this->content->text[] = '<div class="empty_data_message">No courses to display.</div>'; } $this->content->text[] = "</div>"; /********************************END of Third tab************************************************/ $this->content->text[] = html_writer::script(" $('.tablink').click(function() { $('.tablink').removeClass( 'active' ); $(this).addClass( 'active' ); }); $(document).ready(function(){ $('#tabid2').hide(); $('#tabid3').hide(); $('.tablink').click(function() { $('.tabdetails').hide(); $('.tabdetails[data-link=' + $(this).data('link') + ']').fadeIn({ width: '200px' }, 300); }); }); "); $this->content->footer = ''; $this->content->text = implode('', $this->content->text); } return $this->content; }
//get the admin layout $PAGE->set_pagelayout('admin'); $PAGE->requires->jquery(); $PAGE->requires->jquery_plugin('ui'); $PAGE->requires->js('/mod/facetoface/js/jquery.dataTables.min.js');//*This js and css files for data grid of batches*// $PAGE->requires->css('/mod/facetoface/css/jquery.dataTables.css'); //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/aprove_enroll/aprove_learners.php'); $PAGE->set_title(get_string('aprove_learners', 'local_aprove_enroll')); $PAGE->set_heading(get_string('aprove_learners', 'local_aprove_enroll')); $PAGE->navbar->add(get_string('requested_courses', 'local_aprove_enroll')); require_login(); if(is_siteadmin($USER->id) || is_supervisor_dashboard() || is_ast_nh()){ echo $OUTPUT->header(); $noreqcourses = "<h2 style='text-align: center;'>".get_string('norequested_courses', 'local_aprove_enroll')."</h2>"; // for draft courses $userdepartment=$DB->get_record('local_userdata',array('userid'=>$USER->id)); $sql="SELECT en.*,c.category FROM {enrol} as en JOIN {course} as c ON c.id=en.courseid JOIN {course_categories} as cat ON cat.id=c.category WHERE en.enrol = 'apply' and en.status=0"; if($userdepartment){ switch($userdepartment->lms_category){ case "AST": $sql.= " AND cat.idnumber='AST'"; break;
function getAllEnrolment($id = null,$enrolid=null){ global $DB,$USER,$CFG; $newsuper = is_supervisor_dashboard(); $is_ast_nh = is_ast_nh($USER->id); $is_zht = is_zht($USER->id); $is_hod = is_hod($USER->id); $is_instructor = is_instructor($USER->id); $is_trainers = is_trainers($USER->id); $is_bt = is_bt($USER->id); $is_ct = is_ct($USER->id); $is_zh = is_zh($USER->id); $is_rh = is_rh($USER->id); $userdepartment=$DB->get_record('local_userdata',array('userid'=>$USER->id)); $sql="select ue.userid,ue.id,c.fullname as course,ue.timecreated from {user_enrolments} as ue join {enrol} as e on ue.enrolid=e.id join {course} as c on e.courseid=c.id,{local_userdata} ud where ue.userid=ud.userid AND ue.status=1 and e.courseid=$id and e.id=$enrolid "; if (is_siteadmin()||$is_ast_nh||$is_hod||$is_instructor||$is_zht||$is_trainers) { }else if($newsuper) { $sql.= " AND ud.supervisorid=$USER->id"; } //if(is_supervisor_dashboard()){ // $sql.= " AND ud.supervisorid=$USER->id"; //} if($userdepartment){ switch($userdepartment->lms_category){ case "AST": $sql.= " AND (ud.lms_category='AST')"; break; case "AST-EXT": $sql.= " AND (ud.lms_category='AST-EXT')"; break; } } //echo $sql; //if(!$userdepartment->lms_category !=' ' || is_ast_nh()){ // $userdepartment_lms_category=0; // $sql="select ue.userid,ue.id,u.firstname,u.lastname,u.email,u.picture,c.fullname as course,ue.timecreated from {user_enrolments} as ue left join {user} as u on ue.userid=u.id left join {enrol} as e on ue.enrolid=e.id left join {course} as c on e.courseid=c.id JOIN {local_userdata} ud ON u.id=ud.userid where ue.status=1 and e.courseid={$id} AND u.deleted=0 AND u.suspended=0 AND (ud.lms_category='AST' OR ud.lms_category='NON AST')"; //}else{ // $userdepartment_lms_category=$userdepartment->lms_category; // $sql="select ue.userid,ue.id,u.firstname,u.lastname,u.email,u.picture,c.fullname as course,ue.timecreated from {user_enrolments} as ue left join {user} as u on ue.userid=u.id left join {enrol} as e on ue.enrolid=e.id left join {course} as c on e.courseid=c.id JOIN {local_userdata} ud ON u.id=ud.userid where ue.status=1 and e.courseid={$id}"; // //} if($id){ $userenrolments = $DB->get_records_sql($sql); }else{ $userenrolments = $DB->get_records_sql($sql); } //print_object($userenrolments); return $userenrolments; }
public function view_session_tabs($frecord,$userid,$sessiontype=-1){//*This function returns Sessions list of Tabs based on there capabilities*// global $DB, $OUTPUT,$USER,$CFG; $extrainfo = ''; $extrainfo .= '<div id="face2face' . $frecord->id . '"> <ul>'; if(is_siteadmin() || is_instructor() || is_ast_nh() || is_trainers()){ $extrainfo .= '<li><a href="' . $CFG->wwwroot . '/mod/facetoface/ajax.php?page=3&id=' . $frecord->id .'">'.get_string('course', 'facetoface').'</a></li> <li><a href="' . $CFG->wwwroot . '/mod/facetoface/ajax.php?page=4&id=' . $frecord->id . '&sessiontype='.$sessiontype.'">'.get_string('users', 'facetoface').'</a></li> <li><a href="' . $CFG->wwwroot . '/mod/facetoface/ajax.php?page=1&id=' . $frecord->id . '">'.get_string('view_sessions', 'facetoface').'</a></li> <li><a href="' . $CFG->wwwroot . '/mod/facetoface/ajax.php?page=2&id=' . $frecord->id . '">'.get_string('feedback', 'facetoface').'</a></li> <li><a href="' . $CFG->wwwroot . '/mod/facetoface/ajax.php?page=5&id=' . $frecord->id . '">Cost</a></li>'; }else if(is_supervisor_dashboard()){ $extrainfo .= '<li><a href="' . $CFG->wwwroot . '/mod/facetoface/ajax.php?page=1&id=' . $frecord->id . '">'.get_string('view_sessions', 'facetoface').'</a></li>'; if($userid!=$USER->id){ $extrainfo .= '<li><a href="' . $CFG->wwwroot . '/mod/facetoface/ajax.php?page=2&id=' . $frecord->id . '&userid='.$userid.'">'.get_string('feedback', 'facetoface').'</a></li>'; } } else{ $extrainfo .= '<li><a href="' . $CFG->wwwroot . '/mod/facetoface/ajax.php?page=1&id=' . $frecord->id . '">'.get_string('view_sessions', 'facetoface').'</a></li>'; } $extrainfo .=' </ul> </div>'; $extrainfo .= face2face_tab_script($frecord); $extrainfo .= " <style> .ui-tabs-vertical { width: 100% !important; float: left; margin-top: 0px !important; } .ui-tabs-vertical .ui-tabs-nav { padding: 5px 0px 0px 0px; float: left; width: 12% !important; } .ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 1px !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; } .ui-tabs-vertical .ui-tabs-nav li a { display:block; } .ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active { padding-bottom: 0; padding-right: .1em; border-right-width: 1px; } .ui-tabs-vertical .ui-tabs-panel { padding: 1em; margin: 5px 0px; float: right; width: 88% !important;background-color: #b5e8f5;min-height: 228px;} </style>";/*.ui-tabs-vertical .ui-tabs-panel{width: 85%; changed by hameed on 28 dec}*/ $assigned_users_status=$DB->get_record_sql("SELECT * FROM {local_batch_courses} where batchid=$frecord->id"); $extrainfo .='<script> $(document).ready(function(){ $("#show'.$frecord->id.'").click(function(){ $("#'.$frecord->id.'").popup({ autozindex:true }); }); $("#show'.$frecord->id.$assigned_users_status->courseid.$assigned_users_status->testid.'").click(function(){ $("#'.$frecord->id.$assigned_users_status->courseid.$assigned_users_status->testid.'").popup({ autozindex:true }); }); }); </script>'; return $extrainfo; }