public function get_content() { if ($this->content !== null) { return $this->content; } global $USER, $CFG, $DB, $OUTPUT; require_once $CFG->dirroot . '/local/lib.php'; $this->content = new stdClass(); $this->content->text = ''; /*************************** this can seen by admin,instructor and trainer*************************************/ if (is_siteadmin() || is_instructor() || is_trainers()) { //$startday=date ("d-m-y",$user->startdate); $today = date('Y-m-d'); $today_timestamp = strtotime($today); $users = $DB->get_records_sql("SELECT * FROM {facetoface} WHERE completion_status = 0 AND trainerid = {$USER->id} AND enddate < {$today_timestamp}"); //tab changing code start $this->content->text[] = "<div class='alerts_course_exmas_icons'>"; $clswise = html_writer::tag('p', get_string('upcoming', 'block_batchcompletion'), array("class" => "alerts_course_exmas_icons_classwise")); //$this->content->text[] = html_writer::tag('a', $clswise, array('href'=>'javascript:void(0)','class' => 'link','data-link'=>'first')); $datewise = html_writer::tag('p', get_string('inactive', 'block_batchcompletion'), array("class" => "alerts_course_exmas_icons_datewise")); $this->content->text[] = html_writer::tag('a', $datewise, array('href' => 'javascript:void(0)', 'class' => 'link', 'data-link' => 'second')); $this->content->text[] = "</div>"; $this->content->text[] = "<div class='linkdetails' data-link='second' >"; foreach ($users as $user) { $this->content->text[] = html_writer::start_tag('div'); $this->content->text[] = html_writer::tag('b', get_string('batchname', 'block_batchcompletion'), array()); $this->content->text[] = html_writer::tag('a', $user->name, array('href' => $CFG->wwwroot . '/mod/facetoface/view_sessions.php')); $this->content->text[] = html_writer::empty_tag('br'); //$this->content->text[] ="This batch is inactive ,enable the batch to active"; $this->content->text[] = html_writer::end_tag('div'); } $this->content->text[] = html_writer::tag('a', get_string('viewmore', 'block_batchcompletion'), array('href' => $CFG->wwwroot . '/blocks/batchcompletion/viewmore.php')); $this->content->text[] = "</div>"; } // script used for tab changing $this->content->text[] = html_writer::script("\n\t\t\t\$(document).ready(function(){\n\t\t\t\t\$('#details').hide();\n\t\t\t\t\n\t\t\t\t\$('.link').click(function() {\n\t\t\t\t\t\$('.linkdetails').hide();\n\t\t\t\t\t\$('.linkdetails[data-link=' + \$(this).data('link') + ']').fadeIn({\n\t\t\t\t\t\twidth: '200px'\n\t\t\t\t\t}, 300);\t\n\t\t\t\t});\n\t\t\t});\n\t\t\t"); $this->content->footer = ''; $this->content->text = implode('', $this->content->text); return $this->content; }
<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 echo $OUTPUT->login_info(); echo $OUTPUT->blocks('side-pre', 'span3'); ?>
/** *get a record to the facetoface ace2face table script * @param integer $userid */ function view_session_face2face_sql($userid,$sessiontype,$requestData,$filter_starttime=0,$filter_endtime=0,$batchid=0){//*This function for face2face sql*// global $DB, $OUTPUT,$USER,$CFG; if(!is_siteadmin()){ $usercategory=$DB->get_field('local_userdata','lms_category',array('userid'=>$USER->id)); if($usercategory=="") $usercategory=""; else $usercategory=$usercategory; } $sql ="SELECT a.* FROM {facetoface} as a JOIN {user} as u ON u.id=a.trainerid where 1=1 "; /* * Filtering * NOTE this does not match the built-in DataTables filtering which does it * word by word on any field. It's possible to do here, but concerned about efficiency * on very large tables, and MySQL's regex functionality is very limited */ if ( $requestData['sSearch'] != "" ) { $sql .= " and ((a.name LIKE '%".$requestData['sSearch']."%') or (concat(u.firstname,u.lastname) LIKE '%".$requestData['sSearch']."%') ) "; } if($filter_starttime!=0){ $sql .= " AND a.startdate >='$filter_starttime' "; } if($filter_endtime!=0){ $sql .= " AND a.enddate <='$filter_endtime' "; } if($batchid!=0){ $sql.= " AND a.id =$batchid"; } if(!is_siteadmin() && is_ast_nh()){ if($sessiontype>=0){ $sql .=" and a.course=1 and a.category='$usercategory' and a.active={$sessiontype} order by a.id DESC"; }else{ $sql .=" and a.course=1 and a.category='$usercategory' order by a.id DESC"; } }else if(is_instructor() || is_trainers()){ if($sessiontype>=0){ $sql .=" and a.trainerid={$USER->id} and a.course=1 and a.active={$sessiontype} order by a.id DESC"; }else{ $sql .=" and a.trainerid={$USER->id} and a.course=1 order by a.id DESC"; } } elseif(!is_siteadmin()){ if($sessiontype>=0){ $sql .=" and a.course=1 and a.active={$sessiontype} order by a.id DESC"; }else{ $sql .=" and a.course=1 order by a.id DESC"; } } else if(is_siteadmin()){ if($sessiontype>=0){ $sql .=" and a.category='' and a.active={$sessiontype} order by a.id DESC"; }else{ $sql .=" and a.category='' order by a.id DESC"; } } //// /* //// * Paging //// */ if ( isset( $requestData['iDisplayStart'] ) && $requestData['iDisplayLength'] != '-1' ) { $sql .=" LIMIT ".$requestData['iDisplayStart'] .", ".$requestData['iDisplayLength']; } //echo $sql; //exit; $f2f_records = $DB->get_records_sql($sql); if ( $requestData['sSearch'] != "" ) { $sql1 ="SELECT a.* FROM {facetoface} as a JOIN {local_batch_courses} as lbc ON lbc.batchid=a.id JOIN {course} AS c ON c.id=lbc.courseid WHERE c.fullname LIKE '%".$requestData['sSearch']."%' "; /* * Filtering * NOTE this does not match the built-in DataTables filtering which does it * word by word on any field. It's possible to do here, but concerned about efficiency * on very large tables, and MySQL's regex functionality is very limited */ if($filter_starttime!=0){ $sql1 .= " AND a.startdate >='$filter_starttime' "; } if($filter_endtime!=0){ $sql1 .= " AND a.enddate <='$filter_endtime' "; } if($batchid!=0){ $sql1 .= " AND a.id =$batchid"; } if(!is_siteadmin() && is_ast_nh()){ if($sessiontype>=0){ $sql1 .=" and a.course=1 and a.category='$usercategory' and a.active={$sessiontype} order by a.id DESC"; }else{ $sql1 .=" and a.course=1 and a.category='$usercategory' order by a.id DESC"; } }else if(is_instructor() || is_trainers()){ if($sessiontype>=0){ $sql1 .=" and a.trainerid={$USER->id} and a.course=1 and a.active={$sessiontype} order by a.id DESC"; }else{ $sql1 .=" and a.trainerid={$USER->id} and a.course=1 order by a.id DESC"; } } elseif(!is_siteadmin()){ if($sessiontype>=0){ $sql1 .=" and a.course=1 and a.active={$sessiontype} order by a.id DESC"; }else{ $sql1 .=" and a.course=1 order by a.id DESC"; } } else if(is_siteadmin()){ if($sessiontype>=0){ $sql1 .=" and a.category='' and a.active={$sessiontype} order by a.id DESC"; }else{ $sql1 .=" and a.category='' order by a.id DESC"; } } //// /* //// * Paging //// */ if ( isset( $requestData['iDisplayStart'] ) && $requestData['iDisplayLength'] != '-1' ) { $sql1 .=" LIMIT ".$requestData['iDisplayStart'] .", ".$requestData['iDisplayLength']; } $f2fg_records = $DB->get_records_sql($sql1); foreach($f2fg_records as $f2fg_record){ $f2f_records[$f2fg_record->id]=$f2fg_record; } } return $f2f_records; }
<?php } $forum = apply_filters('wplms_course_forum_privacy', get_post_meta(get_the_ID(), 'vibe_forum', true)); if (isset($forum) && $forum) { //echo '<li id="forum" class="'.(($_GET['action']=='forum')?'selected':'').'"><a href="?action=forum">'._e( 'Forum', 'wplms_modern' ).'</a></li>'; ?> <li id="forum"><a href="<?php echo get_permalink($forum); ?> "><?php _e('Forum', 'wplms_modern'); ?> </a></li> <?php } if (is_super_admin() || is_instructor()) { ?> <li id="admin" class="<?php echo isset($_GET['action']) && $_GET['action'] == 'admin' ? 'selected' : ''; ?> "><a href="<?php bp_course_permalink(); ?> ?action=admin"><?php _e('Admin', 'wplms_modern'); ?> </a></li> <?php } ?> <?php
} $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)==========*/ break; case 5: if(is_trainers()|| is_siteadmin() || is_instructor() || is_ast_nh()){ echo $output->cost_list($id); echo html_writer::script('function costsubmit(id){ var form=$("#formcost"+id); $.ajax({ url: "costsubmit.php", type: "POST", data: form.serialize(), beforeSend: function(){ $("#result").html("Sending...."); }, success: function(data){ $("#result").html("Cost is Updated"); } });
$row[]='No Batches are assigned'; $data[] = $row; } $f2f_table->head = array('',''); $f2f_table->data = $data; if($userid != $USER->id){ echo html_writer::link(new moodle_url('/local/teammanager/myteam.php'),'Back'); $user_object = $DB->get_record('user',array('id'=>$userid)); echo "<h3>".get_string('memberilt', 'facetoface',$user_object)."</h3>"; }else{ if($userid10==''){ //rajesh has written this code $iconimage=html_writer::empty_tag('img', array('src'=>$CFG->wwwroot.'/theme/clean/pix/small/manage_batches_small.png','size'=>'15px')); if($is_manager || is_siteadmin() || is_teammanager() || is_instructor() || is_ast_nh() || is_trainers()) echo "<h2 class='tmhead2'><div class='iconimage'>".$iconimage."</div>".get_string('manageilt','facetoface')."</h3>"; //code end here } else{ $iconimage=html_writer::empty_tag('img', array('src'=>$CFG->wwwroot.'/theme/clean/pix/small/my_sessions_small.png','size'=>'15px')); echo "<h2 class='tmhead2'><div class='iconimage'>".$iconimage."</div>".get_string('viewilt','facetoface')."</h2>"; } } // if(is_siteadmin() || is_instructor() || is_ast_nh() || is_trainers()){ if($userid10==''){ if (has_capability('mod/facetoface:addinstance', $context) || is_siteadmin()) { echo '<style>#page-mod-facetoface-view_sessions .tmhead2 { color: #FFF;
<?php require_once(dirname(__FILE__).'/../../config.php'); require_once($CFG->dirroot.'/local/lib.php'); global $USER, $CFG, $DB, $OUTPUT; $id = optional_param('id',0,PARAM_INT); $PAGE->set_url('/blocks/reminder/viewmore.php'); $PAGE->set_context(context_system::instance()); $PAGE->set_heading('Reminder'); $PAGE->set_pagelayout('admin'); require_login(); echo $OUTPUT->header(); /*************************** this can seen by admin,instructor and trainer*************************************/ if( is_siteadmin() || is_instructor() || is_trainer()){ echo "<div class='span6'>"; $users = $DB->get_records_sql("SELECT * FROM {facetoface} WHERE trainerid = $USER->id AND active=0 order by id DESC "); echo "<div class='alerts_course_exmas_icons'>"; $clswise = html_writer::tag('p',get_string('upcoming', 'block_reminder'),array("class"=>"alerts_course_exmas_icons_classwise")); echo html_writer::tag('a', $clswise, array('href'=>'javascript:void(0)','class' => 'link','data-link'=>'first')); $datewise = html_writer::tag('p',get_string('inactive', 'block_reminder'),array("class"=>"alerts_course_exmas_icons_datewise")); echo html_writer::tag('a', $datewise, array('href'=>'javascript:void(0)','class' => 'link','data-link'=>'second')); echo "</div>"; //echo "<div id='details' class='linkdetails' data-link='first' >"; echo "<div class='linkdetails' data-link='second' >"; /****************************inactivebatchs***************************************/ // echo "<div>"; //echo html_writer::tag('h3',get_string('inactivebatchs', 'block_reminder'),array()); // echo "</div>"; foreach($users as $user){
$offset1 = $userpage * $perpage; $a=0; $activecourses1=department_wise_course($a,$dept_name); //print_object($activecourses1); $drcourses2=array(); foreach($activecourses1 as $drcourse){ $coursecontext = context_course::instance($drcourse->id); //$enrolcourses = get_enrolled_users($coursecontext); ////print_object($enrolcourses); //if(!empty($enrolcourses)) { if(is_siteadmin()||is_ast_nh()){ if(avialbe_courses($drcourse->id)==1) $drcourses2[$drcourse->id]=$drcourse; }elseif(is_instructor()){ if($DB->record_exists('course', array('id'=>$drcourse->id,'usermodified'=>$USER->id))){ if(avialbe_courses($drcourse->id)==1) $drcourses2[$drcourse->id]=$drcourse; } }elseif(is_trainers()){ if($DB->record_exists('local_batch_users', array('courseid'=>$drcourse->id,'userid'=>$USER->id,'completion_status'=>1))){ if(avialbe_courses($drcourse->id)==1) $drcourses2[$drcourse->id]=$drcourse; } } //} } $activecourses=array_slice($drcourses2,$offset1,$perpage);
function department_wise_course($id=0,$dept_name=-1,$requestData){ global $DB,$USER; //echo $id."<br/>".$dept_name; if(!is_siteadmin()){ $userdepartment_exist=$DB->record_exists('local_userdata',array('userid'=>$USER->id)); if($userdepartment_exist==1){ $userdepartment=$DB->get_record('local_userdata',array('userid'=>$USER->id)); switch($userdepartment->lms_category){ case "AST": $astsql="SELECT * FROM {course_categories} WHERE idnumber='AST'"; $astcourse_categories=$DB->get_record_sql($astsql); $sql="SELECT * FROM {course_categories} WHERE idnumber='NON AST'"; $course_categories=$DB->get_record_sql($sql); if($id==0&&$dept_name==-1){ $nonast=category_wise_courses($course_categories->id,$id,$requestData); $ast=category_wise_courses($astcourse_categories->id,$id,$requestData); $array3 = $nonast + $ast; krsort($array3) ; return $array3; }else{ if($id!=0&&$dept_name==-1){ $ast=category_wise_courses($astcourse_categories->id,$id,$requestData); if(is_trainers()){ $trainer_ast=category_wise_courses($astcourse_categories->id,$id,$requestData); $ast=trainers_wise_courses($trainer_ast); }else if(is_instructor()){ $trainer_ast=category_wise_courses($astcourse_categories->id,$id,$requestData); $ast=instructor_wise_courses($trainer_ast); } else{ $ast=category_wise_courses($astcourse_categories->id,$id,$requestData); } krsort($ast); return $ast; }elseif($id==0&&$dept_name!=-1){ switch($dept_name){ case "HR": $nonast=category_wise_courses($course_categories->id,$id,$requestData); krsort($nonast) ; return $nonast; break; case "AST": $ast=category_wise_courses($astcourse_categories->id,$id,$requestData); krsort($ast) ; return $ast; break; } } } break; case "AST-EXT": $astsql="SELECT * FROM {course_categories} WHERE idnumber='AST'"; $astcourse_categories=$DB->get_record_sql($astsql); $ast=category_wise_courses($astcourse_categories->id,$id,$requestData); krsort($ast) ; return $ast; break; case "": $sql="SELECT * FROM {course_categories} WHERE idnumber='NON AST'"; $course_categories=$DB->get_record_sql($sql); $nonast=category_wise_courses($course_categories->id,$id,$requestData); krsort($nonast) ; return $nonast; break; } } }elseif(is_siteadmin()){ $userdepartment_exist=$DB->record_exists('local_userdata',array('userid'=>$USER->id)); if($userdepartment_exist==1){ $userdepartment=$DB->get_record('local_userdata',array('userid'=>$USER->id)); switch($userdepartment->lms_category){ case "AST": $astsql="SELECT * FROM {course_categories} WHERE idnumber='AST'"; $astcourse_categories=$DB->get_record_sql($astsql); $sql="SELECT * FROM {course_categories} WHERE idnumber='NON AST'"; $course_categories=$DB->get_record_sql($sql); if($id==0&&$dept_name==-1){ $nonast=category_wise_courses($course_categories->id,$id,$requestData); $ast=category_wise_courses($astcourse_categories->id,$id,$requestData); $array3 = $nonast + $ast; krsort($array3) ; return $array3; }else{ if($id!=0&&$dept_name==-1){ krsort($ast); return $ast; }elseif($id==0&&$dept_name!=-1){ switch($dept_name){ case "HR": $nonast=category_wise_courses($course_categories->id,$id,$requestData); krsort($nonast) ; return $nonast; break; case "AST": $ast=category_wise_courses($astcourse_categories->id,$id,$requestData); krsort($ast) ; return $ast; break; } } } break; case "AST-EXT": $astsql="SELECT * FROM {course_categories} WHERE idnumber='AST'"; $astcourse_categories=$DB->get_record_sql($astsql); $ast=category_wise_courses($astcourse_categories->id,$id,$requestData); krsort($ast) ; return $ast; break; case "": $sql="SELECT * FROM {course_categories} WHERE idnumber='NON AST'"; $course_categories=$DB->get_record_sql($sql); $nonast=category_wise_courses($course_categories->id,$id,$requestData); krsort($nonast) ; return $nonast; break; } }else{ $sql="SELECT * FROM {course_categories} WHERE idnumber='NON AST'"; $course_categories=$DB->get_record_sql($sql); $nonast=category_wise_courses($course_categories->id,$id,$requestData); krsort($nonast) ; return $nonast; } } }
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; }
/** * Generates the HTML for a miniature calendar * * @param array $courses list of course to list events from * @param array $groups list of group * @param array $users user's info * @param int|bool $calmonth calendar month in numeric, default is set to false * @param int|bool $calyear calendar month in numeric, default is set to false * @param string|bool $placement the place/page the calendar is set to appear - passed on the the controls function * @param int|bool $courseid id of the course the calendar is displayed on - passed on the the controls function * @param int $time the unixtimestamp representing the date we want to view, this is used instead of $calmonth * and $calyear to support multiple calendars * @return string $content return html table for mini calendar */ function calendar_get_mini($courses, $groups, $users, $calmonth = false, $calyear = false, $placement = false, $courseid = false, $time = 0) { global $DB, $PAGE,$USER,$CFG,$OUTPUT; require_once $CFG->dirroot.'/local/lib.php'; // Get the calendar type we are using. $calendartype = \core_calendar\type_factory::get_calendar_instance(); $display = new stdClass; // Assume we are not displaying this month for now. $display->thismonth = false; $content = ''; // Do this check for backwards compatibility. The core should be passing a timestamp rather than month and year. // If a month and year are passed they will be in Gregorian. if (!empty($calmonth) && !empty($calyear)) { // Ensure it is a valid date, else we will just set it to the current timestamp. if (checkdate($calmonth, 1, $calyear)) { $time = make_timestamp($calyear, $calmonth, 1); } else { $time = time(); } $date = usergetdate($time); if ($calmonth == $date['mon'] && $calyear == $date['year']) { $display->thismonth = true; } // We can overwrite date now with the date used by the calendar type, if it is not Gregorian, otherwise // there is no need as it is already in Gregorian. if ($calendartype->get_name() != 'gregorian') { $date = $calendartype->timestamp_to_date_array($time); } } else if (!empty($time)) { // Get the specified date in the calendar type being used. $date = $calendartype->timestamp_to_date_array($time); $thisdate = $calendartype->timestamp_to_date_array(time()); if ($date['month'] == $thisdate['month'] && $date['year'] == $thisdate['year']) { $display->thismonth = true; // If we are the current month we want to set the date to the current date, not the start of the month. $date = $thisdate; } } else { // Get the current date in the calendar type being used. $time = time(); $date = $calendartype->timestamp_to_date_array($time); $display->thismonth = true; } list($d, $m, $y) = array($date['mday'], $date['mon'], $date['year']); // This is what we want to display. // Get Gregorian date for the start of the month. $gregoriandate = $calendartype->convert_to_gregorian($date['year'], $date['mon'], 1); // Store the gregorian date values to be used later. list($gy, $gm, $gd, $gh, $gmin) = array($gregoriandate['year'], $gregoriandate['month'], $gregoriandate['day'], $gregoriandate['hour'], $gregoriandate['minute']); // Get the max number of days in this month for this calendar type. $display->maxdays = calendar_days_in_month($m, $y); // Get the starting week day for this month. $startwday = dayofweek(1, $m, $y); // Get the days in a week. $daynames = calendar_get_days(); // Store the number of days in a week. $numberofdaysinweek = $calendartype->get_num_weekdays(); // Set the min and max weekday. $display->minwday = calendar_get_starting_weekday(); $display->maxwday = $display->minwday + ($numberofdaysinweek - 1); // These are used for DB queries, so we want unixtime, so we need to use Gregorian dates. $display->tstart = make_timestamp($gy, $gm, $gd, $gh, $gmin, 0); $display->tend = $display->tstart + ($display->maxdays * DAYSECS) - 1; // Align the starting weekday to fall in our display range // This is simple, not foolproof. if ($startwday < $display->minwday) { $startwday += $numberofdaysinweek; } // Get the events matching our criteria. Don't forget to offset the timestamps for the user's TZ! $events = calendar_get_events($display->tstart, $display->tend, $users, $groups, $courses); // Set event course class for course events if (!empty($events)) { foreach ($events as $eventid => $event) { if (!empty($event->modulename)) { $cm = get_coursemodule_from_instance($event->modulename, $event->instance); if (!\core_availability\info_module::is_user_visible($cm, 0, false)) { unset($events[$eventid]); } } } } // This is either a genius idea or an idiot idea: in order to not complicate things, we use this rule: if, after // possibly removing SITEID from $courses, there is only one course left, then clicking on a day in the month // will also set the $SESSION->cal_courses_shown variable to that one course. Otherwise, we 'd need to add extra // arguments to this function. $hrefparams = array(); if(!empty($courses)) { $courses = array_diff($courses, array(SITEID)); if(count($courses) == 1) { $hrefparams['course'] = reset($courses); } } // We want to have easy access by day, since the display is on a per-day basis. calendar_events_by_day($events, $m, $y, $eventsbyday, $durationbyday, $typesbyday, $courses); // Accessibility: added summary and <abbr> elements. $summary = get_string('calendarheading', 'calendar', userdate($display->tstart, get_string('strftimemonthyear'))); $content .= '<table class="minicalendar calendartable" summary="'.$summary.'">'; // Begin table. if (($placement !== false) && ($courseid !== false)) { $content .= '<caption>'. calendar_top_controls($placement, array('id' => $courseid, 'time' => $time)) .'</caption>'; } $content .= '<tr class="weekdays">'; // Header row: day names // Print out the names of the weekdays. for ($i = $display->minwday; $i <= $display->maxwday; ++$i) { $pos = $i % $numberofdaysinweek; $content .= '<th scope="col"><abbr title="'. $daynames[$pos]['fullname'] .'">'. $daynames[$pos]['shortname'] ."</abbr></th>\n"; } $content .= '</tr><tr>'; // End of day names; prepare for day numbers // For the table display. $week is the row; $dayweek is the column. $dayweek = $startwday; // Paddding (the first week may have blank days in the beginning) for($i = $display->minwday; $i < $startwday; ++$i) { $content .= '<td class="dayblank"> </td>'."\n"; } $weekend = CALENDAR_DEFAULT_WEEKEND; if (isset($CFG->calendar_weekend)) { $weekend = intval($CFG->calendar_weekend); } // Now display all the calendar $daytime = strtotime('-1 day', $display->tstart); for($day = 1; $day <= $display->maxdays; ++$day, ++$dayweek) { $daytime = strtotime('+1 day', $daytime); if($dayweek > $display->maxwday) { // We need to change week (table row) $content .= '</tr><tr>'; $dayweek = $display->minwday; } // Reset vars. if ($weekend & (1 << ($dayweek % $numberofdaysinweek))) { // Weekend. This is true no matter what the exact range is. $class = 'weekend day'; } else { // Normal working day. $class = 'day'; } // Special visual fx if an event is defined if(isset($eventsbyday[$day])) { $popupcontent = ''; foreach($eventsbyday[$day] as $eventid) { $class .= ' hasevent'; $hrefparams['view'] = 'day'; global $DB,$CFG; $instance_facetoface=$events[$eventid]; if($instance_facetoface->modulename=='facetoface'){ $face=$DB->get_record('facetoface',array('id'=>$instance_facetoface->instance)); if(is_siteadmin() || is_ast_nh() || is_instructor() || is_trainers()){ if(($DB->get_record_sql("SELECT * FROM {local_batch_users} where f2fid=$face->id and userid=$USER->id")&&($face->trainerid!=$USER->id))){ $dayhref =$CFG->wwwroot.'/mod/facetoface/my_sessions.php?batchid='.$face->id.'&sessiontype='.$face->active.''; }else{ $dayhref =$CFG->wwwroot.'/mod/facetoface/view_sessions.php?batchid='.$face->id.'&sessiontype='.$face->active.''; } }else{ $dayhref =$CFG->wwwroot.'/mod/facetoface/my_sessions.php?batchid='.$face->id.'&sessiontype='.$face->active.''; } /*end here*/ }else{ $dayhref = calendar_get_link_href(new moodle_url(CALENDAR_URL . 'view.php', $hrefparams), 0, 0, 0, $daytime); } if (!isset($events[$eventid])) { continue; } $event = new calendar_event($events[$eventid]); $popupalt = ''; $component = 'moodle'; if (!empty($event->modulename)) { $popupicon = 'icon'; $popupalt = $event->modulename; $component = $event->modulename; } else if ($event->courseid == SITEID) { // Site event. $popupicon = 'i/siteevent'; } else if ($event->courseid != 0 && $event->courseid != SITEID && $event->groupid == 0) { // Course event. $popupicon = 'i/courseevent'; } else if ($event->groupid) { // Group event. $popupicon = 'i/groupevent'; } else { // Must be a user event. $popupicon = 'i/userevent'; } // $dayhref->set_anchor('event_'.$event->id); $popupcontent .= html_writer::start_tag('div'); //$popupcontent .= $OUTPUT->pix_icon($popupicon, $popupalt, $component); if($instance_facetoface->modulename=='facetoface'){ $lms_category=$DB->get_record_sql("SELECT * FROM {local_userdata} where userid=$USER->id"); if((is_siteadmin())){ if($face->category=='') $name = format_string($event->name, true); } elseif(($face->trainerid==$USER->id)&&(is_ast_nh() || is_instructor() || is_trainers())){ if($lms_category->lms_category==$face->category) $name = format_string($event->name, true); }elseif($DB->get_record_sql("SELECT * FROM {local_batch_users} where f2fid=$face->id and userid=$USER->id")){ $name = format_string($event->name, true); }else{ $name=""; } }else{ $name = format_string($event->name, true); } // Show ical source if needed. if (!empty($event->subscription) && $CFG->calendar_showicalsource) { $a = new stdClass(); $a->name = $name; $a->source = $event->subscription->name; $name = get_string('namewithsource', 'calendar', $a); } $popupcontent .= html_writer::link($dayhref, $name); $popupcontent .= html_writer::end_tag('div'); } //Accessibility: functionality moved to calendar_get_popup. if($display->thismonth && $day == $d) { $popupid = calendar_get_popup(true, $events[$eventid]->timestart, $popupcontent); } else { $popupid = calendar_get_popup(false, $events[$eventid]->timestart, $popupcontent); } // Class and cell content if(isset($typesbyday[$day]['startglobal'])) { $class .= ' calendar_event_global'; } else if(isset($typesbyday[$day]['startcourse'])) { $class .= ' calendar_event_course'; } else if(isset($typesbyday[$day]['startgroup'])) { $class .= ' calendar_event_group'; } else if(isset($typesbyday[$day]['startuser'])) { $class .= ' calendar_event_user'; } $cell = html_writer::link($dayhref, $day, array('id' => $popupid)); } else { $cell = $day; } $durationclass = false; if (isset($typesbyday[$day]['durationglobal'])) { $durationclass = ' duration_global'; } else if(isset($typesbyday[$day]['durationcourse'])) { $durationclass = ' duration_course'; } else if(isset($typesbyday[$day]['durationgroup'])) { $durationclass = ' duration_group'; } else if(isset($typesbyday[$day]['durationuser'])) { $durationclass = ' duration_user'; } if ($durationclass) { $class .= ' duration '.$durationclass; } // If event has a class set then add it to the table day <td> tag // Note: only one colour for minicalendar if(isset($eventsbyday[$day])) { foreach($eventsbyday[$day] as $eventid) { if (!isset($events[$eventid])) { continue; } $event = $events[$eventid]; if (!empty($event->class)) { $class .= ' '.$event->class; } break; } } // Special visual fx for today //Accessibility: hidden text for today, and popup. if($display->thismonth && $day == $d) { $class .= ' today'; $today = get_string('today', 'calendar').' '.userdate(time(), get_string('strftimedayshort')); if(! isset($eventsbyday[$day])) { $class .= ' eventnone'; $popupid = calendar_get_popup(true, false); $cell = html_writer::link('#', $day, array('id' => $popupid)); } $cell = get_accesshide($today.' ').$cell; } // Just display it if(!empty($class)) { $class = ' class="'.$class.'"'; } $content .= '<td'.$class.'>'.$cell."</td>\n"; } // Paddding (the last week may have blank days at the end) for($i = $dayweek; $i <= $display->maxwday; ++$i) { $content .= '<td class="dayblank"> </td>'; } $content .= '</tr>'; // Last row ends $content .= '</table>'; // Tabular display of days ends return $content; }
/** * bp_course_nav_menu() * Navigation menu for BuddyPress course */ function bp_course_nav_menu() { $nav = bp_course_get_nav_permalinks(); $defaults = array('' => array('id' => 'home', 'label' => __('Home', 'vibe'), 'action' => '', 'link' => bp_get_course_permalink()), 'curriculum' => array('id' => 'curriculum', 'label' => __('Curriculum', 'vibe'), 'can_view' => 1, 'action' => empty($nav['curriculum_slug']) ? __('curriculum', 'vibe') : $nav['curriculum_slug'], 'link' => bp_get_course_permalink()), 'members' => array('id' => 'members', 'label' => __('Members', 'vibe'), 'can_view' => 1, 'action' => empty($nav['members_slug']) ? __('members', 'vibe') : $nav['members_slug'], 'link' => bp_get_course_permalink()), 'activity' => array('id' => 'activity', 'label' => __('Activity', 'vibe'), 'can_view' => 1, 'action' => empty($nav['activity_slug']) ? __('activity', 'vibe') : $nav['activity_slug'], 'link' => bp_get_course_permalink())); global $post; if ($post->post_type == 'course') { if (function_exists('bp_is_active') && bp_is_active('groups')) { $vgroup = get_post_meta(get_the_ID(), 'vibe_group', true); if (!empty($vgroup)) { $group = groups_get_group(array('group_id' => $vgroup)); $defaults['group'] = array('id' => 'group', 'label' => __('Group', 'vibe'), 'action' => 'group', 'can_view' => 1, 'link' => bp_get_group_permalink($group), 'external' => true); } } if (in_array('bbpress/bbpress.php', apply_filters('active_plugins', get_option('active_plugins'))) || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('bbpress/bbpress.php')) { $forum = get_post_meta(get_the_ID(), 'vibe_forum', true); if (!empty($forum)) { $defaults['forum'] = array('id' => 'forum', 'label' => __('Forum', 'vibe'), 'action' => 'forum', 'can_view' => 1, 'link' => get_permalink($forum), 'external' => true); } } } $nav_menu = apply_filters('wplms_course_nav_menu', $defaults); global $bp; $action = bp_current_action(); if (empty($action)) { !empty($_GET['action']) ? $action = $_GET['action'] : ($action = ''); } if (is_array($nav_menu)) { foreach ($nav_menu as $key => $menu_item) { $menu_item['action'] = str_replace('/', '', $menu_item['action']); if ($key == $action) { $class = 'class="current"'; } else { $class = ''; } global $wp_query; if (!empty($nav[$menu_item['id'] . '_slug'])) { echo '<li id="' . $menu_item['id'] . '" ' . $class . '><a href="' . $menu_item['link'] . '' . (isset($menu_item['action']) && !isset($menu_item['external']) ? $menu_item['action'] : '') . '">' . $menu_item['label'] . '</a></li>'; } else { echo '<li id="' . $menu_item['id'] . '" ' . $class . '><a href="' . $menu_item['link'] . '' . (!empty($menu_item['action']) && !isset($menu_item['external']) ? (strpos($menu_item['link'], '?') ? '&' : '?') . 'action=' . $menu_item['action'] : '') . '">' . $menu_item['label'] . '</a></li>'; } } } if (is_super_admin() || is_instructor()) { $admin_slug = empty($nav['admin_slug']) ? _x('admin', 'course admin slug', 'vibe') : $nav['admin_slug']; $admin_slug = apply_filters('wplms_course_admin_slug', str_replace('/', '', $admin_slug)); ?> <li id="admin" class="<?php echo !empty($action) && ($action == 'admin' || $action == 'submission' || $action == 'stats') ? 'selected current' : ''; ?> "><a href="<?php bp_course_permalink(); echo $admin_slug; ?> "><?php _e('Admin', 'vibe'); ?> </a></li> <?php } }