Ejemplo n.º 1
0
    <?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
		
		echo $OUTPUT->login_info();
Ejemplo n.º 2
0
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;
}