本文整理汇总了PHP中Tracking::get_time_spent_on_the_platform方法的典型用法代码示例。如果您正苦于以下问题:PHP Tracking::get_time_spent_on_the_platform方法的具体用法?PHP Tracking::get_time_spent_on_the_platform怎么用?PHP Tracking::get_time_spent_on_the_platform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracking
的用法示例。
在下文中一共展示了Tracking::get_time_spent_on_the_platform方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetTimeSpentOnPlatform
/**
* Gets the time spent on the platform by a given user
*
* @param string User id field name
* @param string User id value
* @return array Array of results
*/
public function GetTimeSpentOnPlatform($user_id_field_name, $user_id_value) {
$user_id = $this->getUserId($user_id_field_name, $user_id_value);
if($user_id instanceof WSError) {
return $user_id;
} else {
return Tracking::get_time_spent_on_the_platform($user_id);
}
}
示例2: MAX
if ($access_url_id != -1) {
$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 . ' , ' . $tbl_session_rel_access_url . ' as session_rel_url
WHERE id_coach=user_id AND login_user_id=user_id AND access_url_id = ' . $access_url_id . ' AND session_rel_url.session_id=session.id
GROUP BY user_id
ORDER BY login_date ' . $tracking_direction;
}
}
$result_sessions_coach = Database::query($sql_session_coach);
$total_no_coaches += Database::num_rows($result_sessions_coach);
while ($coach = Database::fetch_array($result_sessions_coach)) {
$global_coaches[$coach['user_id']] = $coach;
}
$all_datas = array();
foreach ($global_coaches as $id_coach => $coaches) {
$time_on_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($coaches['user_id']));
$last_connection = Tracking::get_last_connection_date($coaches['user_id']);
$nb_students = count(Tracking::get_student_followed_by_coach($coaches['user_id']));
$nb_courses = count(Tracking::get_courses_followed_by_coach($coaches['user_id']));
$nb_sessions = count(Tracking::get_sessions_coached_by_user($coaches['user_id']));
$table_row = array();
if ($is_western_name_order) {
$table_row[] = $coaches['firstname'];
$table_row[] = $coaches['lastname'];
} else {
$table_row[] = $coaches['lastname'];
$table_row[] = $coaches['firstname'];
}
$table_row[] = $time_on_platform;
$table_row[] = $last_connection;
$table_row[] = $nb_students;
示例3: get_teachers_content_html_for_drh
public function get_teachers_content_html_for_drh()
{
$teachers = $this->teachers;
//$content = '<div style="margin:10px;">';
$content = '<h4>' . get_lang('YourTeachers') . '</h4>';
$teachers_table = null;
if (count($teachers) > 0) {
$a_last_week = get_last_week();
$last_week = date('Y-m-d', $a_last_week[0]) . ' ' . get_lang('To') . ' ' . date('Y-m-d', $a_last_week[6]);
$teachers_table .= '<table class="data_table" width:"95%">';
$teachers_table .= '
<tr>
<th>' . get_lang('User') . '</th>
<th>' . get_lang('TimeSpentLastWeek') . '<br />' . $last_week . '</th>
</tr>
';
$i = 1;
foreach ($teachers as $teacher) {
$teacher_id = $teacher['user_id'];
$firstname = $teacher['firstname'];
$lastname = $teacher['lastname'];
$username = $teacher['username'];
$time_on_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($teacher_id, true));
if ($i % 2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$teachers_table .= '<tr class="' . $class_tr . '">
<td>' . api_get_person_name($firstname, $lastname) . ' (' . $username . ')</td>
<td align="right">' . $time_on_platform . '</td>
</tr>';
$i++;
}
$teachers_table .= '</table>';
} else {
$teachers_table .= get_lang('ThereIsNoInformationAboutYourTeachers');
}
$content .= $teachers_table;
if (count($teachers) > 0) {
$content .= '<div style="text-align:right;margin-top:10px;"><a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/teachers.php">' . get_lang('SeeMore') . '</a></div>';
}
//$content .= '</div>';
return $content;
}
示例4: display_tracking_coach_overview
public static function display_tracking_coach_overview($export_csv)
{
global $charset;
if ($export_csv) {
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT);
} else {
$is_western_name_order = api_is_western_name_order();
}
$sort_by_first_name = api_sort_by_first_name();
$tracking_column = isset($_GET['tracking_list_coaches_column']) ? $_GET['tracking_list_coaches_column'] : ($is_western_name_order xor $sort_by_first_name) ? 1 : 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 some of user names.
if ($is_western_name_order) {
$order = array(0 => 'firstname', 1 => 'lastname', 2 => $sort_by_first_name ? 'firstname' : 'lastname', 3 => 'login_date', 4 => $sort_by_first_name ? 'firstname' : 'lastname', 5 => $sort_by_first_name ? 'firstname' : 'lastname');
} else {
$order = array(0 => 'lastname', 1 => 'firstname', 2 => $sort_by_first_name ? 'firstname' : 'lastname', 3 => 'login_date', 4 => $sort_by_first_name ? 'firstname' : 'lastname', 5 => $sort_by_first_name ? 'firstname' : 'lastname');
}
$table = new SortableTable('tracking_list_coaches_myspace', array('MySpace', 'count_coaches'), null, ($is_western_name_order xor $sort_by_first_name) ? 1 : 0);
$parameters['view'] = 'admin';
$table->set_additional_parameters($parameters);
if ($is_western_name_order) {
$table->set_header(0, get_lang('FirstName'), true);
$table->set_header(1, get_lang('LastName'), true);
} else {
$table->set_header(0, get_lang('LastName'), true);
$table->set_header(1, get_lang('FirstName'), true);
}
$table->set_header(2, get_lang('TimeSpentOnThePlatform'), false);
$table->set_header(3, get_lang('LastConnexion'), false);
$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);
if ($is_western_name_order) {
$csv_header[] = array(get_lang('FirstName', ''), get_lang('LastName', ''), get_lang('TimeSpentOnThePlatform', ''), get_lang('LastConnexion', ''), get_lang('NbStudents', ''), get_lang('CountCours', ''), get_lang('NumberOfSessions', ''));
} else {
$csv_header[] = array(get_lang('LastName', ''), get_lang('FirstName', ''), get_lang('TimeSpentOnThePlatform', ''), get_lang('LastConnexion', ''), get_lang('NbStudents', ''), get_lang('CountCours', ''), get_lang('NumberOfSessions', ''));
}
$tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_sessions = Database::get_main_table(TABLE_MAIN_SESSION);
$sqlCoachs = "SELECT DISTINCT\n scu.user_id as id_coach,\n u.id as user_id,\n lastname,\n firstname,\n MAX(login_date) as login_date\n FROM {$tbl_user} u, {$tbl_session_course_user} scu, {$tbl_track_login}\n WHERE\n scu.user_id = u.id AND scu.status=2 AND login_user_id=u.id\n GROUP BY user_id ";
if (api_is_multiple_url_enabled()) {
$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$sqlCoachs = "SELECT DISTINCT\n scu.user_id as id_coach,\n u.id as user_id,\n lastname,\n firstname,\n MAX(login_date) as login_date\n FROM {$tbl_user} u,\n {$tbl_session_course_user} scu,\n {$tbl_track_login} ,\n {$tbl_session_rel_access_url} session_rel_url\n WHERE\n scu.user_id = u.id AND\n scu.status = 2 AND\n login_user_id = u.id AND\n access_url_id = {$access_url_id} AND\n session_rel_url.session_id = scu.session_id\n GROUP BY u.id";
}
}
if (!empty($order[$tracking_column])) {
$sqlCoachs .= "ORDER BY " . $order[$tracking_column] . " " . $tracking_direction;
}
$result_coaches = Database::query($sqlCoachs);
$total_no_coaches = Database::num_rows($result_coaches);
$global_coaches = array();
while ($coach = Database::fetch_array($result_coaches)) {
$global_coaches[$coach['user_id']] = $coach;
}
$sql_session_coach = 'SELECT session.id_coach, u.id as user_id, lastname, firstname, MAX(login_date) as login_date
FROM ' . $tbl_user . ' u ,' . $tbl_sessions . ' as session,' . $tbl_track_login . '
WHERE id_coach = u.id AND login_user_id = u.id
GROUP BY u.id
ORDER BY login_date ' . $tracking_direction;
if (api_is_multiple_url_enabled()) {
$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
$sql_session_coach = 'SELECT session.id_coach, u.id as user_id, lastname, firstname, MAX(login_date) as login_date
FROM ' . $tbl_user . ' u ,' . $tbl_sessions . ' as session, ' . $tbl_track_login . ' , ' . $tbl_session_rel_access_url . ' as session_rel_url
WHERE
id_coach = u.id AND
login_user_id = u.id AND
access_url_id = ' . $access_url_id . ' AND
session_rel_url.session_id = session.id
GROUP BY u.id
ORDER BY login_date ' . $tracking_direction;
}
}
$result_sessions_coach = Database::query($sql_session_coach);
$total_no_coaches += Database::num_rows($result_sessions_coach);
while ($coach = Database::fetch_array($result_sessions_coach)) {
$global_coaches[$coach['user_id']] = $coach;
}
$all_datas = array();
foreach ($global_coaches as $id_coach => $coaches) {
$time_on_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($coaches['user_id']));
$last_connection = Tracking::get_last_connection_date($coaches['user_id']);
$nb_students = count(Tracking::get_student_followed_by_coach($coaches['user_id']));
$nb_courses = count(Tracking::get_courses_followed_by_coach($coaches['user_id']));
$nb_sessions = count(Tracking::get_sessions_coached_by_user($coaches['user_id']));
$table_row = array();
if ($is_western_name_order) {
$table_row[] = $coaches['firstname'];
$table_row[] = $coaches['lastname'];
} else {
$table_row[] = $coaches['lastname'];
$table_row[] = $coaches['firstname'];
}
$table_row[] = $time_on_platform;
//.........这里部分代码省略.........
示例5: get_teachers_information_graph
/**
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html
*/
public function get_teachers_information_graph()
{
$teachers = $this->teachers;
$graph = '';
$user_ids = array_keys($teachers);
$a_last_week = get_last_week();
if (is_array($user_ids) && count($user_ids) > 0) {
$data_set = new pData();
foreach ($user_ids as $user_id) {
$teacher_info = api_get_user_info($user_id);
$username = $teacher_info['username'];
$time_by_days = array();
foreach ($a_last_week as $day) {
// day is received as y-m-d 12:00:00
$start_date = api_get_utc_datetime($day);
$end_date = api_get_utc_datetime($day + (3600 * 24 - 1));
$time_on_platform_by_day = Tracking::get_time_spent_on_the_platform($user_id, 'custom', $start_date, $end_date);
$hours = floor($time_on_platform_by_day / 3600);
$min = floor(($time_on_platform_by_day - $hours * 3600) / 60);
$time_by_days[] = $min;
}
$data_set->AddPoint($time_by_days, $username);
$data_set->AddSerie($username);
}
$last_week = date('Y-m-d', $a_last_week[0]) . ' ' . get_lang('To') . ' ' . date('Y-m-d', $a_last_week[6]);
$days_on_week = array();
foreach ($a_last_week as $weekday) {
$days_on_week[] = date('d/m', $weekday);
}
$data_set->AddPoint($days_on_week, "Days");
$data_set->SetXAxisName($last_week);
$data_set->SetYAxisName(get_lang('Minutes'));
$data_set->SetAbsciseLabelSerie("Days");
$graph_id = $this->user_id . 'TeacherConnectionsGraph';
$cache = new pCache();
// the graph id
$data = $data_set->GetData();
if ($cache->IsInCache($graph_id, $data_set->GetData())) {
//if we already created the img
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
} else {
// Initializing the graph
$bg_width = 440;
$bg_height = 350;
$test = new pChart($bg_width + 10, $bg_height + 20);
$test->setFontProperties(api_get_path(LIBRARY_PATH) . 'pchart/fonts/tahoma.ttf', 8);
$test->setGraphArea(65, 30, $bg_width - 70, $bg_height - 50);
$test->drawFilledRoundedRectangle(7, 7, $bg_width, $bg_height, 5, 240, 240, 240);
$test->drawRoundedRectangle(5, 5, $bg_width + 2, $bg_height + 2, 5, 230, 230, 230);
$test->drawGraphArea(255, 255, 255, TRUE);
$test->drawScale($data_set->GetData(), $data_set->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
$test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Drawing lines
//$test->drawLineGraph($data_set->GetData(),$data_set->GetDataDescription());
$test->drawFilledCubicCurve($data_set->GetData(), $data_set->GetDataDescription(), 0.1, 30);
//$test->drawPlotGraph($data_set->GetData(),$data_set->GetDataDescription(),3,2,255,255,255);
// Drawing Legend
$test->setFontProperties(api_get_path(LIBRARY_PATH) . 'pchart/fonts/tahoma.ttf', 8);
$test->drawLegend($bg_width - 80, 20, $data_set->GetDataDescription(), 204, 204, 255);
$test->writeValues($data_set->GetData(), $data_set->GetDataDescription(), array("Days"));
$cache->WriteToCache($graph_id, $data_set->GetData(), $test);
ob_start();
$test->Stroke();
ob_end_clean();
$img_file = $cache->GetHash($graph_id, $data_set->GetData());
}
if (!empty($img_file)) {
$graph = '<img src="' . api_get_path(WEB_ARCHIVE_PATH) . $img_file . '">';
}
} else {
$graph = '<p>' . api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8') . '</p>';
}
return $graph;
}
示例6: get_teachers_content_html_for_drh
public function get_teachers_content_html_for_drh()
{
$content = '<div style="margin:10px;">';
$content .= '<h3><font color="#000">' . get_lang('YourTeachers') . '</font></h3>';
if (count($this->teachers) > 0) {
$a_last_week = Text::get_last_week();
$last_week = api_convert_and_format_date($a_last_week[0], DATE_FORMAT_SHORT) . ' ' . get_lang('Until') . '<br />' . api_convert_and_format_date($a_last_week[6], DATE_FORMAT_SHORT);
$teachers_table = '<table class="data_table">';
$teachers_table .= '<tr>
<th>' . get_lang('User') . '</th>
<th>' . get_lang('TimeSpentLastWeek') . '<br />' . $last_week . '</th>
</tr>';
$i = 1;
foreach ($this->teachers as $teacher) {
$teacher_id = $teacher['user_id'];
$firstname = $teacher['firstname'];
$lastname = $teacher['lastname'];
$username = $teacher['username'];
$time_on_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($teacher_id, 'custom', api_get_utc_datetime($a_last_week[0]), api_get_utc_datetime($a_last_week[6])));
if ($i % 2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$teachers_table .= '<tr class="' . $class_tr . '">
<td>' . api_get_person_name($firstname, $lastname) . ' (' . $username . ')</td>
<td align="right">' . $time_on_platform . '</td>
</tr>';
$i++;
}
$teachers_table .= '</table>';
} else {
$teachers_table .= get_lang('ThereIsNoInformationAboutYourTeachers');
}
$content .= $teachers_table;
if (count($this->teachers) > 0) {
$content .= '<div style="text-align:right;margin-top:10px;"><a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/teachers.php">' . get_lang('SeeMore') . '</a></div>';
}
$content .= '</div>';
return $content;
}
示例7: get_teachers_information_graph
/**
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html
*/
public function get_teachers_information_graph()
{
$teachers = $this->teachers;
$graph = '';
$user_ids = array_keys($teachers);
$a_last_week = get_last_week();
if (is_array($user_ids) && count($user_ids) > 0) {
$dataSet = new pData();
foreach ($user_ids as $user_id) {
$teacher_info = api_get_user_info($user_id);
$username = $teacher_info['username'];
$time_by_days = array();
foreach ($a_last_week as $day) {
// day is received as y-m-d 12:00:00
$start_date = api_get_utc_datetime($day);
$end_date = api_get_utc_datetime($day + (3600 * 24 - 1));
$time_on_platform_by_day = Tracking::get_time_spent_on_the_platform($user_id, 'custom', $start_date, $end_date);
$hours = floor($time_on_platform_by_day / 3600);
$min = floor(($time_on_platform_by_day - $hours * 3600) / 60);
$time_by_days[] = $min;
}
$dataSet->addPoints($time_by_days, $username);
}
$last_week = date('Y-m-d', $a_last_week[0]) . ' ' . get_lang('To') . ' ' . date('Y-m-d', $a_last_week[6]);
$days_on_week = array();
foreach ($a_last_week as $weekday) {
$days_on_week[] = date('d/m', $weekday);
}
$dataSet->addPoints($days_on_week, 'Days');
$dataSet->setAbscissaName($last_week);
$dataSet->setAxisName(0, get_lang('Minutes'));
$dataSet->setAbscissa('Days');
$dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
// Cache definition
$cachePath = api_get_path(SYS_ARCHIVE_PATH);
$myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
$chartHash = $myCache->getHash($dataSet);
if ($myCache->isInCache($chartHash)) {
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
} else {
/* Create the pChart object */
$widthSize = 440;
$heightSize = 350;
$angle = 50;
$myPicture = new pImage($widthSize, $heightSize, $dataSet);
/* Turn of Antialiasing */
$myPicture->Antialias = false;
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
/* Set the default font */
$myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
/* Do NOT Write the chart title */
/* Define the chart area */
$myPicture->setGraphArea(40, 40, $widthSize - 20, $heightSize - 80);
/* Draw the scale */
$scaleSettings = array('GridR' => 200, 'GridG' => 200, 'GridB' => 200, 'DrawSubTicks' => true, 'CycleBackground' => true, 'Mode' => SCALE_MODE_ADDALL_START0, 'LabelRotation' => $angle);
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
$myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
/* Draw the chart */
$myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
$settings = array('DisplayValues' => true, 'DisplayR' => 0, 'DisplayG' => 0, 'DisplayB' => 0);
$myPicture->drawFilledSplineChart($settings);
$myPicture->drawLegend(40, 20, array('Mode' => LEGEND_HORIZONTAL));
/* Write and save into cache */
$myCache->writeToCache($chartHash, $myPicture);
$imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
$myCache->saveFromCache($chartHash, $imgPath);
$imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
}
$graph = '<img src="' . $imgPath . '" >';
} else {
$graph = '<p>' . api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8') . '</p>';
}
return $graph;
}
示例8: array_values
$progress = Tracking::get_avg_student_progress($studentIds);
$countAssignments = Tracking::count_student_assignments($studentIds);
$studentIds = array_values($students);
$countHumanResourcesUsers = count($humanResourcesUsers);
// average progress
$avg_total_progress = $progress / $nb_students;
// average assignments
$nb_assignments = $countAssignments / $nb_students;
$avg_courses_per_student = $count_courses / $nb_students;
}
if (!empty($teachers)) {
$numberTeachers = count($teachers);
}
// Inactive students
//$countInactiveUsers = Tracking::getInactiveUsers($studentIds, $daysAgo);
$totalTimeSpent = Tracking::get_time_spent_on_the_platform($studentIds);
$posts = Tracking::count_student_messages($studentIds);
$averageScore = Tracking::getAverageStudentScore($studentIds);
$avg_results_to_exercises = $averageScore;
// average posts
$nb_posts = $posts;
$avg_time_spent = $totalTimeSpent;
$linkAddUser = null;
$linkCourseDetailsAsTeacher = null;
$linkAddCourse = null;
$linkAddSession = null;
if (api_is_platform_admin()) {
$linkAddUser = ' ' . Display::url(Display::return_icon('2rightarrow.gif', get_lang('Add')), api_get_path(WEB_CODE_PATH) . 'admin/dashboard_add_users_to_user.php?user=' . api_get_user_id(), array('class' => ''));
$linkCourseDetailsAsTeacher = ' ' . Display::url(Display::return_icon('2rightarrow.gif', get_lang('Details')), api_get_path(WEB_CODE_PATH) . 'mySpace/course.php', array('class' => ''));
$linkAddCourse = ' ' . Display::url(Display::return_icon('2rightarrow.gif', get_lang('Details')), api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?follow', array('class' => ''));
$linkAddSession = ' ' . Display::url(Display::return_icon('2rightarrow.gif', get_lang('Add')), api_get_path(WEB_CODE_PATH) . 'admin/dashboard_add_sessions_to_user.php?user=' . api_get_user_id(), array('class' => ''));
示例9: get_lang
} else {
echo '<tr><th>' . get_lang('LastName') . '</th><th>' . get_lang('FirstName') . '</th><th>' . get_lang('Email') . '</th><th>' . get_lang('AdminCourses') . '</th><th>' . get_lang('Students') . '</th></tr>';
}
}
} else {
$css_class = "row_even";
}
$i++;
if ($is_western_name_order) {
$data[$user_id]["firstname"] = $firstname;
$data[$user_id]["lastname"] = $lastname;
} else {
$data[$user_id]["lastname"] = $lastname;
$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;
if ($is_western_name_order) {
echo '<tr class="' . $css_class . '"><td>' . $firstname . '</td><td>' . $lastname . '</td><td align="right">' . $time_on_platform . '</td><td align="right"><a href="mailto:' . $email . '">' . $email . '</a></td><td align="right"><a href="course.php?user_id=' . $user_id . '"><img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a></td><td align="right"><a href="student.php?user_id=' . $user_id . '&display=yourstudents"><img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a></td></tr>';
} else {
echo '<tr class="' . $css_class . '"><td>' . $lastname . '</td><td>' . $firstname . '</td><td align="right">' . $time_on_platform . '</td><td align="right"><a href="mailto:' . $email . '">' . $email . '</a></td><td align="right"><a href="course.php?user_id=' . $user_id . '"><img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a></td><td align="right"><a href="student.php?user_id=' . $user_id . '&display=yourstudents"><img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a></td></tr>';
}
}
} else {
// No results
echo '<tr><td colspan="6">' . get_lang("NoResults") . '</td></tr>';
}
echo '</table>';
if (isset($_POST['export']) || api_is_drh() && isset($_GET['export'])) {
MySpace::export_csv($header, $data, 'teachers.csv');