we don't show teachers or coaches in the attendance user list see bt#2503

skala
Julio Montoya 14 years ago
parent 13e28decfd
commit a8fdf528cb
  1. 25
      main/inc/lib/attendance.lib.php
  2. 44
      main/inc/lib/sessionmanager.lib.php

@ -342,6 +342,9 @@ class Attendance
* @return array users data
*/
public function get_users_rel_course($attendance_id = 0) {
require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php';
$current_session_id = api_get_session_id();
$current_course_id = api_get_course_id();
if (!empty($current_session_id)) {
@ -352,13 +355,21 @@ class Attendance
// get registered users inside current course
$a_users = array();
foreach ($a_course_users as $key =>$user_data) {
$value = array();
$value = array();
$uid = $user_data['user_id'];
$status = $user_data['status'];
$user_status_in_course = CourseManager::get_user_in_course_status($uid, $current_course_id);
$user_status_in_session = null;
$user_status_in_course = null;
if (api_get_session_id()) {
$user_status_in_session = SessionManager::get_user_status_in_session($uid, $current_course_id, $current_session_id);
} else {
$user_status_in_course = CourseManager::get_user_in_course_status($uid, $current_course_id);
}
//Not taking into account DRH or COURSEMANAGER
if ($uid <= 1 || $status == DRH || $user_status_in_course == COURSEMANAGER) continue;
if ($uid <= 1 || $status == DRH || $user_status_in_course == COURSEMANAGER || $user_status_in_session == 2) continue;
if (!empty($attendance_id)) {
$user_faults = $this->get_faults_of_user($uid, $attendance_id);
@ -377,10 +388,10 @@ class Attendance
$photo = '<center><img src="'.$user_profile['file'].'" '.$user_profile['style'].' alt="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" title="'.api_get_person_name($user_data['firstname'], $user_data['lastname']).'" /></center>';
}
$value['photo'] = $photo;
$value['firstname'] = $user_data['firstname'];
$value['lastname'] = $user_data['lastname'];
$value['user_id'] = $uid;
$value['photo'] = $photo;
$value['firstname'] = $user_data['firstname'];
$value['lastname'] = $user_data['lastname'];
$value['user_id'] = $uid;
//Sending only 5 items in the array instead of 60
$a_users[$key] = $value;

@ -1349,6 +1349,50 @@ class SessionManager {
return Database::select('*', $session_table, array('where'=>array('id_coach = ?'=>$user_id)));
}
/*
public static function get_coaches_by_session($session_id, $course_code) {
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT user.user_id
FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
WHERE session_rcru.id_user = user.user_id AND
session_rcru.id_session = '".intval($session_id)."' AND
session_rcru.course_code ='".Database::escape_string($course_code)."' AND
session_rcru.status = 2 ";
$result = Database::query($sql);
while ($row = Database::fetch_array($result,'ASSOC')) {
$return_array[] = $row;
}
return $return_array;
}*/
/**
* Gets user status within a session
* @param $user_id
* @param $course_code
* @param $session_id
* @return unknown_type
*/
public function get_user_status_in_session($user_id, $course_code, $session_id) {
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$sql = "SELECT session_rcru.status
FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
WHERE session_rcru.id_user = user.user_id AND
session_rcru.id_session = '".intval($session_id)."' AND
session_rcru.course_code ='".Database::escape_string($course_code)."' AND
user.user_id = ".intval($user_id);
$result = Database::query($sql);
$status = false;
if (Database::num_rows($result)) {
$status = Database::fetch_row($result);
$status = $status['0'];
}
return $status;
}
public static function get_session_by_user($coach_id, $user_id) {
}

Loading…
Cancel
Save