';
if (api_is_drh()) {
- $menu_items = array();
- $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(Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), '#');
- $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), 'teachers.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.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), 'session.php');
+ $menu_items = array(
+ Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ),
+ Display::url(Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), '#'),
+ Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), 'teachers.php'),
+ Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php'),
+ Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), 'session.php')
+ );
$nb_menu_items = count($menu_items);
if ($nb_menu_items > 1) {
@@ -201,7 +213,8 @@ $table = new SortableTable(
);
$params = array(
- 'keyword' => isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null,
+ 'keyword' => $keyword,
+ 'active' => $active
);
$table->set_additional_parameters($params);
@@ -214,7 +227,7 @@ if ($is_western_name_order) {
}
$table->set_header(2, get_lang('FirstLogin'), false);
-$table->set_header(3, get_lang('LatestLogin'), false);
+$table->set_header(3, get_lang('LastConnexion'), false);
$table->set_header(4, get_lang('Details'), false);
if ($export_csv) {
@@ -223,14 +236,14 @@ if ($export_csv) {
get_lang('FirstName', ''),
get_lang('LastName', ''),
get_lang('FirstLogin', ''),
- get_lang('LatestLogin', '')
+ get_lang('LastConnexion', '')
);
} else {
$csv_header[] = array (
get_lang('LastName', ''),
get_lang('FirstName', ''),
get_lang('FirstLogin', ''),
- get_lang('LatestLogin', '')
+ get_lang('LastConnexion', '')
);
}
}
@@ -256,6 +269,14 @@ if ($export_csv) {
echo $actions;
$page_title = get_lang('Students');
echo Display::page_subheader($page_title);
+ if (isset($active)) {
+ if ($active) {
+ $activeLabel = get_lang('ActiveUsers');
+ } else {
+ $activeLabel = get_lang('InactiveUsers');
+ }
+ echo Display::page_subheader2($activeLabel);
+ }
$form->display();
$table->display();
}
diff --git a/main/mySpace/teachers.php b/main/mySpace/teachers.php
index 33a020bb94..3b49c1c40f 100644
--- a/main/mySpace/teachers.php
+++ b/main/mySpace/teachers.php
@@ -15,6 +15,8 @@ $cidReset = true;
require_once '../inc/global.inc.php';
require_once 'myspace.lib.php';
+$userId = api_get_user_id();
+
$this_section = SECTION_TRACKING;
$nameTools = get_lang('Teachers');
@@ -23,11 +25,13 @@ api_block_anonymous_users();
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
Display :: display_header($nameTools);
+$sleepingDays = isset($_GET['sleeping_days']) ? intval($_GET['sleeping_days']) : null;
+
$formateurs = array();
if (api_is_drh() || api_is_platform_admin()) {
- // Followed teachers by drh
+ // Followed teachers by drh
if (api_drh_can_access_all_session_content()) {
- $sessions = SessionManager::get_sessions_followed_by_drh(api_get_user_id());
+ $sessions = SessionManager::get_sessions_followed_by_drh($userId);
if (!empty($sessions)) {
$formateurs = array();
foreach ($sessions as $session) {
@@ -43,17 +47,24 @@ if (api_is_drh() || api_is_platform_admin()) {
}
}
}
-
} else {
- $formateurs = UserManager::get_users_followed_by_drh($_user['user_id'], COURSEMANAGER);
+ $formateurs = UserManager::get_users_followed_by_drh($userId, COURSEMANAGER);
}
+ $lastConnectionDate = null;
+
+ if (!empty($sleepingDays)) {
+ $lastConnectionDate = api_get_utc_datetime(strtotime($sleepingDays.' days ago'));
+ }
+
+ $formateurs = SessionManager::getTeacherTracking($userId, 1, $lastConnectionDate);
+
$menu_items = array(
Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ),
- Display::url(Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), "index.php?view=drh_students&display=yourstudents"),
+ Display::url(Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), "index.php?view=drh_students&display=yourstudents"),
Display::url(Display::return_icon('teacher_na.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), '#'),
- Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php'),
- Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), 'session.php')
+ Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php'),
+ Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), ICON_SIZE_MEDIUM), 'session.php')
);
echo '
';
@@ -71,15 +82,17 @@ if (api_is_drh() || api_is_platform_admin()) {
}
echo '
';
echo Display::page_subheader(get_lang('YourTeachers'));
+
+ if (!empty($lastConnectionDate)) {
+ echo Display::page_subheader2(get_lang('SleepingTeachers').' '.api_get_local_time($lastConnectionDate));
+ }
}
if (!api_is_drh()) {
api_display_tool_title($nameTools);
}
-/**
- * MAIN PART
- */
+/** MAIN PART */
if (isset($_POST['export'])) {
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT);
@@ -135,9 +148,27 @@ $form->addelement('style_submit_button', 'submit', get_lang('Filter'));
$form->display();
if ($is_western_name_order) {
- echo '
| '.get_lang('FirstName').' | '.get_lang('LastName').' | '.$time_label.' | '.get_lang('Email').' | '.get_lang('AdminCourses').' | '.get_lang('Students').' |
';
+ echo '
+
+ | '.get_lang('FirstName').' |
+ '.get_lang('LastName').' |
+ '.$time_label.' |
+ '.get_lang('Email').' |
+ '.get_lang('LastConnexion').' |
+ '.get_lang('AdminCourses').' |
+ '.get_lang('Students').' |
+
';
} else {
- echo '| '.get_lang('LastName').' | '.get_lang('FirstName').' | '.$time_label.' | '.get_lang('Email').' | '.get_lang('AdminCourses').' | '.get_lang('Students').' |
';
+ echo '
+
+ | '.get_lang('LastName').' |
+ '.get_lang('FirstName').' |
+ '.$time_label.' |
+ '.get_lang('Email').' |
+ '.get_lang('LastConnexion').' |
+ '.get_lang('AdminCourses').' |
+ '.get_lang('Students').' |
+
';
}
if ($is_western_name_order) {
@@ -156,21 +187,21 @@ $data = array();
if (count($formateurs) > 0) {
$i = 1;
- foreach ($formateurs as $formateur) {
+ foreach ($formateurs as $formateur) {
$user_id = $formateur["user_id"];
$lastname = $formateur["lastname"];
$firstname = $formateur["firstname"];
$email = $formateur["email"];
- if ($i % 2 == 0) {
- $css_class = "row_odd";
-
+ if ($i % 2 == 0) {
+ $css_class = "row_odd";
if ($i % 20 == 0 && $i != 0) {
if ($is_western_name_order) {
echo '
| '.get_lang('FirstName').' |
'.get_lang('LastName').' |
'.get_lang('Email').' |
+ '.get_lang('LastConnexion').' |
'.get_lang('AdminCourses').' |
'.get_lang('Students').' |
';
@@ -179,6 +210,7 @@ if (count($formateurs) > 0) {
'.get_lang('LastName').' |
'.get_lang('FirstName').' |
'.get_lang('Email').' |
+ '.get_lang('LastConnexion').' |
'.get_lang('AdminCourses').' |
'.get_lang('Students').' |
';
@@ -188,7 +220,7 @@ if (count($formateurs) > 0) {
$css_class = "row_even";
}
- $i++;
+ $i++;
if ($is_western_name_order) {
$data[$user_id]["firstname"] = $firstname;
@@ -198,24 +230,50 @@ if (count($formateurs) > 0) {
$data[$user_id]["firstname"] = $firstname;
}
- $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($user_id, $time_filter, $start_date, $end_date));
- $data[$user_id]["timespentlastweek"] = $time_on_platform;
- $data[$user_id]["email"] = $email;
+ $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($user_id, $time_filter, $start_date, $end_date));
+ $data[$user_id]["timespentlastweek"] = $time_on_platform;
+ $data[$user_id]["email"] = $email;
+
+ $timestamp = Tracking::get_last_connection_date($user_id, false, true);
+
+ $lastConnection = api_get_local_time($timestamp);
- if ($is_western_name_order) {
- echo '| '.$firstname.' | '.$lastname.' | '.$time_on_platform.' | '.$email.' | .'2rightarrow.gif) | .'2rightarrow.gif) |
';
- } else {
- echo '| '.$lastname.' | '.$firstname.' | '.$time_on_platform.' | '.$email.' | .'2rightarrow.gif) | .'2rightarrow.gif) |
';
- }
- }
+ if ($is_western_name_order) {
+ echo '
+ | '.$firstname.' |
+ '.$lastname.' |
+ '.$time_on_platform.' |
+ '.$email.' |
+ '.$lastConnection.' |
+
+
+ |
+
+
+
+ |
+
';
+ } else {
+ echo '| '.$lastname.' |
+ '.$firstname.' | '.$time_on_platform.' |
+ '.$email.' |
+
+
+ |
+
+
+ |
+
';
+ }
+ }
} else {
- // No results
- echo '| '.get_lang("NoResults").' |
';
+ // No results
+ echo '| '.get_lang("NoResults").' |
';
}
echo '
';
if (isset($_POST['export']) || (api_is_drh() && isset($_GET['export']))) {
- MySpace::export_csv($header, $data, 'teachers.csv');
+ MySpace::export_csv($header, $data, 'teachers.csv');
}
if (!api_is_drh()) {