'.get_lang('TeacherInterface').'';
}
}
}
if($isCoach)
{
if($nb_teacher_courses==0 && !api_is_platform_admin())
{
$view = 'coach';
}
if($view=='coach')
{
$menu_items[] = get_lang('CoachInterface');
$title = get_lang('YourStatistics');
}
else
{
$menu_items[] = ''.get_lang('CoachInterface').'';
}
}
if(api_is_platform_admin())
{
if(!$isCoach && $nb_teacher_courses==0)
{
$view = 'admin';
}
if($view=='admin')
{
$menu_items[] = get_lang('AdminInterface');
$title = get_lang('CoachList');
}
else
{
$menu_items[] = ''.get_lang('AdminInterface').'';
}
}
if($_user['status']==DRH)
{
$view = 'drh';
$title = get_lang('DrhInterface');
$menu_items[] = ''.get_lang('DrhInterface').'';
}
$nb_menu_items = count($menu_items);
if($nb_menu_items>1)
{
foreach($menu_items as $key=> $item)
{
echo $item;
if($key!=$nb_menu_items-1)
{
echo ' | ';
}
}
echo '
';
}
echo '
'.get_lang('Probationers').' ('.$nbStudents.')'.'
| '.get_lang('InactivesStudents').' | '.$nb_inactive_students.' |
| '.get_lang('AverageTimeSpentOnThePlatform').' | '.api_time_to_hms($avgTimeSpent).' |
| '.get_lang('AverageCoursePerStudent').' | '.$avgCoursesPerStudent.' |
| '.get_lang('AverageProgressInLearnpath').' | '.round($avgTotalProgress,2).' % |
| '.get_lang('AverageResultsToTheExercices').' | '.round($avgResultsToExercises,2).' % |
| '.get_lang('AveragePostsInForum').' | '.round($nb_posts,2).' |
| '.get_lang('AverageAssignments').' | '.round($nb_assignments,2).' |
'.get_lang('Sessions').' ('.$nbSessions.')'.'
| '.get_lang('NbActiveSessions').' | '.$nb_sessions_current.' |
| '.get_lang('NbPastSessions').' | '.$nb_sessions_past.' |
| '.get_lang('NbFutureSessions').' | '.$nb_sessions_future.' |
| '.get_lang('NbStudentPerSession').' | '.round($nbStudents/$nbSessions,2).' |
| '.get_lang('NbCoursesPerSession').' | '.$nb_courses_per_session.' |
';
$csv_content[] = array(
html_entity_decode($course['title']),
$nb_students_in_course,
$avg_time_spent_in_course,
$avg_progress_in_course,
$avg_score_in_course,
$avg_messages_in_course,
$avg_assignments_in_course,
);
$table -> addRow($table_row, 'align="right"');
$a_course_students = array();
}
$table -> updateColAttributes(0,array('align'=>'left'));
$table -> updateColAttributes(7,array('align'=>'center'));
$table -> display();
}
}
if(api_is_platform_admin() && $view=='admin'){
$tracking_column = isset($_GET['tracking_list_coaches_column']) ? $_GET['tracking_list_coaches_column'] : 0;
$tracking_direction = (isset($_GET['tracking_list_coaches_direction']) && in_array(strtoupper($_GET['tracking_list_coaches_direction']),array('ASC','DESC','ASCENDING','DESCENDING','0','1'))) ? $_GET['tracking_list_coaches_direction'] : 'DESC';
//prepare array for column order - when impossible, use lastname
$order = array(0=>'firstname',1=>'lastname',2=>'lastname',3=>'login_date',4=>'lastname',5=>'lastname');
$table = new SortableTable('tracking_list_coaches', 'count_coaches');
$parameters['view'] = 'admin';
$table->set_additional_parameters($parameters);
$table -> set_header(0, get_lang('FirstName'), true, 'align="center"');
$table -> set_header(1, get_lang('LastName'), true, 'align="center"');
$table -> set_header(2, get_lang('TimeSpentOnThePlatform'), false);
$table -> set_header(3, get_lang('LastConnexion'), true, 'align="center"');
$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('Sessions'), false,'align="center"');
$csv_content[] = array(
get_lang('FirstName'),
get_lang('LastName'),
get_lang('TimeSpentOnThePlatform'),
get_lang('LastConnexion'),
get_lang('NbStudents'),
get_lang('CountCours'),
get_lang('NumberOfSessions')
);
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sqlCoachs = " SELECT DISTINCT id_coach, user_id, lastname, firstname, MAX(login_date) as login_date
FROM $tbl_user, $tbl_session_course, $tbl_track_login
WHERE id_coach=user_id AND login_user_id=user_id
GROUP BY user_id " ;
// ORDER BY login_date ".$tracking_direction;
if(!empty($order[$tracking_column]))
{
$sqlCoachs .= "ORDER BY ".$order[$tracking_column]." ".$tracking_direction;
}
$result_coaches=api_sql_query($sqlCoachs, __FILE__, __LINE__);
$total_no_coachs = Database::num_rows($result_coaches);
$global_coachs=array();
while($a_coach=Database::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 += Database::num_rows($result_sessions_coach);
while($a_coach=Database::fetch_array($result_sessions_coach)){
$global_coachs[$a_coach['user_id']] = $a_coach;
}
$all_datas=array();
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']);
$nb_students = count(Tracking :: get_student_followed_by_coach($a_coachs['user_id']));
$nb_courses = count(Tracking :: get_courses_followed_by_coach($a_coachs['user_id']));
$nb_sessions = count(Tracking :: get_sessions_coached_by_user($a_coachs['user_id']));
$table_row = array();
$table_row[] = $a_coachs['firstname'];
$table_row[] = $a_coachs['lastname'];
$table_row[] = $time_on_platform;
$table_row[] = $last_connection;
$table_row[] = $nb_students;
$table_row[] = $nb_courses;
$table_row[] = $nb_sessions;
$table_row[] = '
';
$all_datas[] = $table_row;
$csv_content[] = array(
html_entity_decode($a_coachs['firstname']),
html_entity_decode($a_coachs['lastname']),
$time_on_platform,
$last_connection,
$nb_courses,
$nb_sessions
);
}
if($tracking_column != 3){
usort($all_datas, 'sort_users');
if($tracking_direction == 'DESC')
rsort($all_datas);
}
if($export_csv && $tracking_column != 3)
{
usort($csv_content, 'sort_users');
}
foreach($all_datas as $row)
{
$table -> addRow($row,'align="right"');
}
$table -> updateColAttributes(0,array('align'=>'left'));
$table -> updateColAttributes(1,array('align'=>'left'));
$table -> updateColAttributes(3,array('align'=>'left'));
$table -> updateColAttributes(7,array('align'=>'center'));
$table -> display();
}
// send the csv file if asked
if($export_csv)
{
ob_end_clean();
/*echo ""; print_r($csv_content); echo "";*/ Export :: export_table_csv($csv_content, 'reporting_index'); } /* ============================================================================== FOOTER ============================================================================== */ if(!$export_csv) { Display::display_footer(); } ?>