[svn r11977] change the admin view in the reporting. Task : http://projects.dokeos.com/?do=details&id=1413

skala
Julian Prud'homme 18 years ago
parent e9fb79b8c0
commit e69ed13be3
  1. 70
      main/inc/lib/tracking.lib.php
  2. 22
      main/mySpace/index.php
  3. 15
      main/mySpace/myStudents.php
  4. 19
      main/mySpace/session.php
  5. 14
      main/mySpace/student.php

@ -311,7 +311,61 @@ class Tracking {
return $a_students;
}
function get_student_followed_by_coach_in_a_session($id_session,$coach_id){
$coach_id = intval($coach_id);
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
$a_students = array();
//////////////////////////////////////////////////////////////
// At first, courses where $coach_id is coach of the course //
//////////////////////////////////////////////////////////////
$sql = 'SELECT course_code FROM '.$tbl_session_course.' WHERE id_session="'.$id_session.'" AND id_coach='.$coach_id;
$result=api_sql_query($sql);
while($a_courses=mysql_fetch_array($result))
{
$course_code=$a_courses["course_code"];
$sql = "SELECT distinct srcru.id_user
FROM $tbl_session_course_user AS srcru
WHERE course_code='$course_code'";
$rs=api_sql_query($sql);
while($row=mysql_fetch_array($rs))
{
$a_students[$row['id_user']]=$row['id_user'];
}
}
//////////////////////////////////////////////////////////////
// Then, courses where $coach_id is coach of the session //
//////////////////////////////////////////////////////////////
$sql = 'SELECT DISTINCT session_course_user.id_user
FROM '.$tbl_session_course_user.' as session_course_user
INNER JOIN '.$tbl_session_course.' as session_course
ON session_course.course_code = session_course_user.course_code
AND session_course_user.id_session = session_course.id_session
INNER JOIN '.$tbl_session.' as session
ON session.id = session_course.id_session
AND session.id_coach = '.$coach_id.' AND session.id='.$id_session;
$result=api_sql_query($sql);
while($row=mysql_fetch_array($result))
{
$a_students[$row['id_user']]=$row['id_user'];
}
return $a_students;
}
function is_allowed_to_coach_student($coach_id, $student_id)
@ -575,6 +629,20 @@ class Tracking {
return mysql_num_rows($rs);
}
function get_course_list_in_session_from_student($user_id, $id_session){
$user_id = intval($user_id);
$id_session = intval($id_session);
$tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$sql='SELECT course_code FROM '.$tbl_session_course_user.' WHERE id_user="'.$user_id.'" AND id_session="'.$id_session.'"';
$result = api_sql_query($sql, __LINE__, __FILE__);
$a_courses=array();
while($row=mysql_fetch_array($result))
{
$a_courses[$row['course_code']]=$row['course_code'];
}
return $a_courses;
}
}

@ -555,7 +555,7 @@ if(api_is_platform_admin() && $view=='admin'){
$table -> set_header(4, get_lang('NbStudents'), false);
$table -> set_header(5, get_lang('CountCours'), false);
$table -> set_header(6, get_lang('NumberOfSessions'), false);
$table -> set_header(7, get_lang('Probationers'), false,'align="center"');
$table -> set_header(7, get_lang('Sessions'), false,'align="center"');
$csv_content[] = array(
get_lang('FirstName'),
@ -577,10 +577,26 @@ if(api_is_platform_admin() && $view=='admin'){
$result_coaches=api_sql_query($sqlCoachs, __FILE__, __LINE__);
$total_no_coachs = mysql_num_rows($result_coaches);
$global_coachs=array();
while($a_coach=mysql_fetch_array($result_coaches)){
$global_coachs[$a_coach['user_id']] = $a_coach;
}
$sql_session_coach = 'SELECT session.id_coach, user_id, lastname, firstname, MAX(login_date) as login_date
FROM '.$tbl_user.','.$tbl_sessions.' as session,'.$tbl_track_login.'
WHERE id_coach=user_id AND login_user_id=user_id
GROUP BY user_id
ORDER BY login_date '.$tracking_direction;
$result_sessions_coach=api_sql_query($sql_session_coach, __FILE__, __LINE__);
$total_no_coachs += mysql_num_rows($result_sessions_coach);
while($a_coach=mysql_fetch_array($result_sessions_coach)){
$global_coachs[$a_coach['user_id']] = $a_coach;
}
$all_datas=array();
while($a_coachs=mysql_fetch_array($result_coaches)){
foreach($global_coachs as $id_coach => $a_coachs){
$time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($a_coachs['user_id']));
$last_connection = Tracking :: get_last_connection_date($a_coachs['user_id']);
@ -596,7 +612,7 @@ if(api_is_platform_admin() && $view=='admin'){
$table_row[] = $nb_students;
$table_row[] = $nb_courses;
$table_row[] = $nb_sessions;
$table_row[] = '<a href="student.php?id_coach='.$a_coachs['user_id'].'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
$table_row[] = '<a href="session.php?id_coach='.$a_coachs['user_id'].'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
$all_datas[] = $table_row;
$csv_content[] = array(

@ -60,8 +60,14 @@ $csv_content = array();
else
{
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
if(isset($_GET['id_coach']) && intval($_GET['id_coach'])!=0){
$interbreadcrumb[] = array ("url" => "student.php?id_coach=".$_GET['id_coach'], "name" => get_lang("CoachStudents"));
if(isset($_GET['id_session']) && intval($_GET['id_session'])!=0){
$interbreadcrumb[] = array ("url" => "student.php?id_coach=".$_GET['id_coach']."&id_session=".$_GET['id_session'], "name" => get_lang("CoachStudents"));
}
else{
$interbreadcrumb[] = array ("url" => "student.php?id_coach=".$_GET['id_coach'], "name" => get_lang("CoachStudents"));
}
}
else{
$interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents"));
@ -183,7 +189,12 @@ if(!empty($_GET['student']))
$a_infosUser['name'] = $a_infosUser['firstname'].' '.$a_infosUser['lastname'];
// courses followed by user where we are coach
$a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id']);
if(!isset($_GET['id_coach'])){
$a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id']);
}
else{
$a_courses = Tracking :: get_courses_followed_by_coach($_GET['id_coach']);
}
$avg_student_progress = $avg_student_score = $nb_courses = 0;
foreach ($a_courses as $key=>$course_code)
{

@ -65,8 +65,16 @@ function sort_sessions($a, $b)
MAIN CODE
===============================================================================
*/
$a_sessions = Tracking :: get_sessions_coached_by_user ($_user['user_id']);
if(isset($_GET['id_coach']) && $_GET['id_coach']!=''){
$id_coach=$_GET['id_coach'];
}
else{
$id_coach=$_user['user_id'];
}
$a_sessions = Tracking :: get_sessions_coached_by_user ($id_coach);
$nb_sessions = count($a_sessions);
if($nb_sessions > 0)
@ -100,7 +108,12 @@ if($nb_sessions > 0)
{
$csv_content[] = $row;
}
$row[] = '<a href="course.php?id_session='.$session['id'].'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
if(isset($_GET['id_coach']) && $_GET['id_coach']!=''){
$row[] = '<a href="student.php?id_session='.$session['id'].'&id_coach='.$_GET['id_coach'].'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
}
else{
$row[] = '<a href="course.php?id_session='.$session['id'].'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
}
$all_datas[] = $row;
}

@ -102,8 +102,13 @@ if($isCoach || api_is_platform_admin())
$coach_id=$_user['user_id'];
}
$a_courses = Tracking :: get_courses_followed_by_coach($coach_id);
$a_students = Tracking :: get_student_followed_by_coach($coach_id);
if(!isset($_GET['id_session'])){
$a_courses = Tracking :: get_courses_followed_by_coach($coach_id);
$a_students = Tracking :: get_student_followed_by_coach($coach_id);
}
else{
$a_students = Tracking :: get_student_followed_by_coach_in_a_session($_GET['id_session'], $coach_id);
}
$tracking_column = isset($_GET['tracking_column']) ? $_GET['tracking_column'] : 0;
$tracking_direction = isset($_GET['tracking_direction']) ? $_GET['tracking_direction'] : DESC;
@ -139,6 +144,9 @@ if($isCoach || api_is_platform_admin())
foreach($a_students as $student_id)
{
$student_datas = UserManager :: get_user_info_by_id($student_id);
if(isset($_GET['id_session'])){
$a_courses = Tracking :: get_course_list_in_session_from_student($student_id,$_GET['id_session']);
}
$avg_time_spent = $avg_student_score = $avg_student_progress = $total_assignments = $total_messages = 0 ;
$nb_courses_student = 0;
@ -178,7 +186,7 @@ if($isCoach || api_is_platform_admin())
}
if(isset($_GET['id_coach']) && intval($_GET['id_coach'])!=0){
$row[] = '<a href="myStudents.php?student='.$student_id.'&id_coach='.$coach_id.'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
$row[] = '<a href="myStudents.php?student='.$student_id.'&id_coach='.$coach_id.'&id_session='.$_GET['id_session'].'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
}
else{
$row[] = '<a href="myStudents.php?student='.$student_id.'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';

Loading…
Cancel
Save