|
|
|
@ -24,71 +24,96 @@ Display :: display_header($nameTools); |
|
|
|
$export_csv = false; |
|
|
|
$export_csv = false; |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['export']) && $_GET['export'] == 'csv') { |
|
|
|
if (isset($_GET['export']) && $_GET['export'] == 'csv') { |
|
|
|
$export_csv = true; |
|
|
|
$export_csv = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
FUNCTION |
|
|
|
FUNCTION |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
function count_sessions_coached() { |
|
|
|
function count_sessions_coached() |
|
|
|
global $nb_sessions; |
|
|
|
{ |
|
|
|
return $nb_sessions; |
|
|
|
global $nb_sessions; |
|
|
|
|
|
|
|
return $nb_sessions; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function sort_sessions($a, $b) { |
|
|
|
function sort_sessions($a, $b) |
|
|
|
global $tracking_column; |
|
|
|
{ |
|
|
|
if ($a[$tracking_column] > $b[$tracking_column]) { |
|
|
|
global $tracking_column; |
|
|
|
return 1; |
|
|
|
if ($a[$tracking_column] > $b[$tracking_column]) { |
|
|
|
} else { |
|
|
|
return 1; |
|
|
|
return -1; |
|
|
|
} else { |
|
|
|
} |
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function rsort_sessions($a, $b) { |
|
|
|
function rsort_sessions($a, $b) |
|
|
|
global $tracking_column; |
|
|
|
{ |
|
|
|
if ($b[$tracking_column] > $a[$tracking_column]) { |
|
|
|
global $tracking_column; |
|
|
|
return 1; |
|
|
|
if ($b[$tracking_column] > $a[$tracking_column]) { |
|
|
|
} else { |
|
|
|
return 1; |
|
|
|
return -1; |
|
|
|
} else { |
|
|
|
} |
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* MAIN CODE */ |
|
|
|
/* MAIN CODE */ |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['id_coach']) && $_GET['id_coach'] != '') { |
|
|
|
if (isset($_GET['id_coach']) && $_GET['id_coach'] != '') { |
|
|
|
$id_coach = intval($_GET['id_coach']); |
|
|
|
$id_coach = intval($_GET['id_coach']); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$id_coach = $_user['user_id']; |
|
|
|
$id_coach = $_user['user_id']; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) { |
|
|
|
if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) { |
|
|
|
|
|
|
|
|
|
|
|
$a_sessions = SessionManager::get_sessions_followed_by_drh(api_get_user_id()); |
|
|
|
$a_sessions = SessionManager::get_sessions_followed_by_drh(api_get_user_id()); |
|
|
|
|
|
|
|
|
|
|
|
if (!api_is_session_admin()) { |
|
|
|
if (!api_is_session_admin()) { |
|
|
|
$menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ); |
|
|
|
$menu_items[] = Display::url( |
|
|
|
$menu_items[] = Display::url(Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), "index.php?view=drh_students&display=yourstudents"); |
|
|
|
Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), |
|
|
|
$menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), 'teachers.php'); |
|
|
|
api_get_path(WEB_CODE_PATH)."auth/my_progress.php" |
|
|
|
$menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php'); |
|
|
|
); |
|
|
|
$menu_items[] = Display::url(Display::return_icon('session_na.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), '#'); |
|
|
|
$menu_items[] = Display::url( |
|
|
|
} |
|
|
|
Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), |
|
|
|
|
|
|
|
"index.php?view=drh_students&display=yourstudents" |
|
|
|
echo '<div class="actions">'; |
|
|
|
); |
|
|
|
$nb_menu_items = count($menu_items); |
|
|
|
$menu_items[] = Display::url( |
|
|
|
if ($nb_menu_items > 1) { |
|
|
|
Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), |
|
|
|
foreach ($menu_items as $key => $item) { |
|
|
|
'teachers.php' |
|
|
|
echo $item; |
|
|
|
); |
|
|
|
} |
|
|
|
$menu_items[] = Display::url( |
|
|
|
} |
|
|
|
Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), |
|
|
|
if (count($a_sessions) > 0) { |
|
|
|
'course.php' |
|
|
|
echo '<span style="float:right">'; |
|
|
|
); |
|
|
|
echo Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick'=>'javascript: window.print();')); |
|
|
|
$menu_items[] = Display::url( |
|
|
|
echo Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self().'?export=csv'); |
|
|
|
Display::return_icon('session_na.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), |
|
|
|
echo '</span>'; |
|
|
|
'#' |
|
|
|
} |
|
|
|
); |
|
|
|
echo '</div>'; |
|
|
|
} |
|
|
|
echo Display::page_header(get_lang('YourSessionsList')); |
|
|
|
|
|
|
|
|
|
|
|
echo '<div class="actions">'; |
|
|
|
|
|
|
|
$nb_menu_items = count($menu_items); |
|
|
|
|
|
|
|
if ($nb_menu_items > 1) { |
|
|
|
|
|
|
|
foreach ($menu_items as $key => $item) { |
|
|
|
|
|
|
|
echo $item; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (count($a_sessions) > 0) { |
|
|
|
|
|
|
|
echo '<span style="float:right">'; |
|
|
|
|
|
|
|
echo Display::url( |
|
|
|
|
|
|
|
Display::return_icon('printer.png', get_lang('Print'), array(), 32), |
|
|
|
|
|
|
|
'javascript: void(0);', |
|
|
|
|
|
|
|
array('onclick'=>'javascript: window.print();') |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
echo Display::url( |
|
|
|
|
|
|
|
Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), |
|
|
|
|
|
|
|
api_get_self().'?export=csv' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
echo '</span>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
echo '</div>'; |
|
|
|
|
|
|
|
echo Display::page_header(get_lang('YourSessionsList')); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$a_sessions = Tracking :: get_sessions_coached_by_user($id_coach); |
|
|
|
$a_sessions = Tracking :: get_sessions_coached_by_user($id_coach); |
|
|
|
@ -97,69 +122,70 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) { |
|
|
|
$nb_sessions = count($a_sessions); |
|
|
|
$nb_sessions = count($a_sessions); |
|
|
|
|
|
|
|
|
|
|
|
if ($export_csv) { |
|
|
|
if ($export_csv) { |
|
|
|
$csv_content = array(); |
|
|
|
$csv_content = array(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($nb_sessions > 0) { |
|
|
|
if ($nb_sessions > 0) { |
|
|
|
|
|
|
|
|
|
|
|
$table = new SortableTable('tracking', 'count_sessions_coached'); |
|
|
|
$table = new SortableTable('tracking', 'count_sessions_coached'); |
|
|
|
$table->set_header(0, get_lang('Title')); |
|
|
|
$table->set_header(0, get_lang('Title')); |
|
|
|
$table->set_header(1, get_lang('Date')); |
|
|
|
$table->set_header(1, get_lang('Date')); |
|
|
|
$table->set_header(2, get_lang('NbCoursesPerSession')); |
|
|
|
$table->set_header(2, get_lang('NbCoursesPerSession')); |
|
|
|
$table->set_header(3, get_lang('Details'), false); |
|
|
|
$table->set_header(3, get_lang('Details'), false); |
|
|
|
|
|
|
|
|
|
|
|
$all_data = array(); |
|
|
|
$all_data = array(); |
|
|
|
foreach ($a_sessions as $session) { |
|
|
|
foreach ($a_sessions as $session) { |
|
|
|
$row = array(); |
|
|
|
$row = array(); |
|
|
|
$row[] = $session['name']; |
|
|
|
$row[] = $session['name']; |
|
|
|
|
|
|
|
|
|
|
|
if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') { |
|
|
|
if ($session['date_start'] != '0000-00-00' && $session['date_end'] != '0000-00-00') { |
|
|
|
$row[] = get_lang('From').' '. api_convert_and_format_date($session['date_start'], DATE_FORMAT_SHORT, date_default_timezone_get()).' '.get_lang('To').' '.api_convert_and_format_date($session['date_end'], DATE_FORMAT_SHORT, date_default_timezone_get()); |
|
|
|
$row[] = get_lang('From').' '. api_convert_and_format_date($session['date_start'], DATE_FORMAT_SHORT, date_default_timezone_get()).' '.get_lang('To').' '.api_convert_and_format_date($session['date_end'], DATE_FORMAT_SHORT, date_default_timezone_get()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$row[] = ' - '; |
|
|
|
$row[] = ' - '; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$row[] = count(Tracking::get_courses_list_from_session($session['id'])); |
|
|
|
$row[] = count(Tracking::get_courses_list_from_session($session['id'])); |
|
|
|
|
|
|
|
|
|
|
|
if ($export_csv) { |
|
|
|
if ($export_csv) { |
|
|
|
$csv_content[] = $row; |
|
|
|
$csv_content[] = $row; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['id_coach']) && $_GET['id_coach'] != '') { |
|
|
|
if (isset($_GET['id_coach']) && $_GET['id_coach'] != '') { |
|
|
|
$row[] = '<a href="student.php?id_session='.$session['id'].'&id_coach='.intval($_GET['id_coach']).'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>'; |
|
|
|
$row[] = '<a href="student.php?id_session='.$session['id'].'&id_coach='.intval($_GET['id_coach']).'"> |
|
|
|
} else { |
|
|
|
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>'; |
|
|
|
$row[] = '<a href="course.php?id_session='.$session['id'].'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>'; |
|
|
|
} else { |
|
|
|
} |
|
|
|
$row[] = '<a href="course.php?id_session='.$session['id'].'"> |
|
|
|
$all_data[] = $row; |
|
|
|
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$all_data[] = $row; |
|
|
|
if (!isset($tracking_column)) { |
|
|
|
} |
|
|
|
$tracking_column = 0; |
|
|
|
|
|
|
|
} |
|
|
|
if (!isset($tracking_column)) { |
|
|
|
|
|
|
|
$tracking_column = 0; |
|
|
|
if ($_GET['tracking_direction'] == 'DESC') { |
|
|
|
} |
|
|
|
usort($all_data, 'rsort_sessions'); |
|
|
|
|
|
|
|
} else { |
|
|
|
if ($_GET['tracking_direction'] == 'DESC') { |
|
|
|
usort($all_data, 'sort_sessions'); |
|
|
|
usort($all_data, 'rsort_sessions'); |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
usort($all_data, 'sort_sessions'); |
|
|
|
if ($export_csv) { |
|
|
|
} |
|
|
|
usort($csv_content, 'sort_sessions'); |
|
|
|
|
|
|
|
} |
|
|
|
if ($export_csv) { |
|
|
|
|
|
|
|
usort($csv_content, 'sort_sessions'); |
|
|
|
foreach ($all_data as $row) { |
|
|
|
} |
|
|
|
$table -> addRow($row); |
|
|
|
|
|
|
|
} |
|
|
|
foreach ($all_data as $row) { |
|
|
|
|
|
|
|
$table->addRow($row); |
|
|
|
//$table -> setColAttributes(2, array('align' => 'center')); |
|
|
|
} |
|
|
|
$table -> display(); |
|
|
|
|
|
|
|
|
|
|
|
$table -> display(); |
|
|
|
if ($export_csv) { |
|
|
|
|
|
|
|
ob_end_clean(); |
|
|
|
if ($export_csv) { |
|
|
|
Export :: export_table_csv($csv_content, 'reporting_student_list'); |
|
|
|
ob_end_clean(); |
|
|
|
exit; |
|
|
|
Export :: export_table_csv($csv_content, 'reporting_student_list'); |
|
|
|
} |
|
|
|
exit; |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
echo get_lang('NoSession'); |
|
|
|
echo get_lang('NoSession'); |
|
|
|
} |
|
|
|
} |
|
|
|
Display::display_footer(); |
|
|
|
Display::display_footer(); |
|
|
|
|