本文整理汇总了PHP中Tracking::get_last_connection_date方法的典型用法代码示例。如果您正苦于以下问题:PHP Tracking::get_last_connection_date方法的具体用法?PHP Tracking::get_last_connection_date怎么用?PHP Tracking::get_last_connection_date使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracking
的用法示例。
在下文中一共展示了Tracking::get_last_connection_date方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_lang
$csvContent[] = get_lang('Information');
$data = array(get_lang('Name') => $user['complete_name'], get_lang('Email') => $user['email'], get_lang('Phone') => $user['phone'], get_lang('OfficialCode') => $user['official_code'], get_lang('Online') => $user['user_is_online'] ? Display::return_icon('online.png') : Display::return_icon('offline.png'), get_lang('Status') => $user['status'] == 1 ? get_lang('Teacher') : get_lang('Student'), null => sprintf(get_lang('CreatedByXYOnZ'), 'user_information.php?user_id=' . $creatorId, $creatorInfo['username'], api_get_utc_datetime($registrationDate)));
$row = 1;
foreach ($data as $label => $item) {
if (!empty($label)) {
$label = $label . ': ';
}
$table->setCellContents($row, 0, $label . $item);
$csvContent[] = array($label, strip_tags($item));
$row++;
}
$userInformation = $table->toHtml();
$table = new HTML_Table(array('class' => 'data_table'));
$table->setHeaderContents(0, 0, get_lang('Tracking'));
$csvContent[] = get_lang('Tracking');
$data = array(get_lang('FirstLogin') => Tracking::get_first_connection_date($user['user_id']), get_lang('LatestLogin') => Tracking::get_last_connection_date($user['user_id'], true));
$row = 1;
foreach ($data as $label => $item) {
if (!empty($label)) {
$label = $label . ': ';
}
$table->setCellContents($row, 0, $label . $item);
$csvContent[] = array($label, strip_tags($item));
$row++;
}
$trackingInformation = $table->toHtml();
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
示例2: get_lang
$result = $result . ' (' . $user_info_stat['attempts'] . ' ' . get_lang('Attempts') . ')';
$counter++;
} else {
$result = '-';
}
$html_result .= $result;
$html_result .= "</td>";
}
if (empty($counter)) {
$total_student = '-';
} else {
$total_student = $total_result_by_user / $counter;
$total_average_score += $total_student;
$total_average_score_count++;
}
$string_date = Tracking::get_last_connection_date($user['user_id'], true);
$html_result .= "<td>{$total_student}</td><td>{$string_date}</td></tr>";
}
$html_result .= "<tr><th>" . get_lang('AverageScore') . "</th>";
$total_average = 0;
$counter = 0;
foreach ($course_list as $course_item) {
if (!empty($course_average_counter[$course_item['code']])) {
$average_per_course = round($course_average[$course_item['code']] / ($course_average_counter[$course_item['code']] * 100) * 100, 2);
} else {
$average_per_course = '-';
}
if (!empty($average_per_course)) {
$counter++;
}
$total_average = $total_average + $average_per_course;
示例3: MAX
$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;
$table_row[] = $nb_courses;
示例4: get_users
function get_users($from, $limit, $column, $direction)
{
$active = isset($_GET['active']) ? $_GET['active'] : 1;
$keyword = isset($_GET['keyword']) ? Security::remove_XSS($_GET['keyword']) : null;
$sleepingDays = isset($_GET['sleeping_days']) ? intval($_GET['sleeping_days']) : null;
$lastConnectionDate = null;
if (!empty($sleepingDays)) {
$lastConnectionDate = api_get_utc_datetime(strtotime($sleepingDays . ' days ago'));
}
$is_western_name_order = api_is_western_name_order();
$coach_id = api_get_user_id();
$drhLoaded = false;
if (api_is_drh()) {
$column = 'u.user_id';
if (api_drh_can_access_all_session_content()) {
$students = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('drh_all', api_get_user_id(), false, $from, $limit, $column, $direction, $keyword, $active, $lastConnectionDate, null, null, api_is_student_boss() ? null : STUDENT);
$drhLoaded = true;
}
}
if ($drhLoaded == false) {
$students = UserManager::getUsersFollowedByUser(api_get_user_id(), api_is_student_boss() ? null : STUDENT, false, false, false, $from, $limit, $column, $direction, $active, $lastConnectionDate, api_is_student_boss() ? STUDENT_BOSS : COURSEMANAGER, $keyword);
}
$all_datas = array();
foreach ($students as $student_data) {
$student_id = $student_data['user_id'];
if (isset($_GET['id_session'])) {
$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;
if (!empty($courses)) {
foreach ($courses as $course_code) {
$courseInfo = api_get_course_info($course_code);
$courseId = $courseInfo['real_id'];
if (CourseManager::is_user_subscribed_in_course($student_id, $course_code, true)) {
$avg_time_spent += Tracking::get_time_spent_on_the_course($student_id, $courseId, $_GET['id_session']);
$my_average = Tracking::get_avg_student_score($student_id, $course_code);
if (is_numeric($my_average)) {
$avg_student_score += $my_average;
}
$avg_student_progress += Tracking::get_avg_student_progress($student_id, $course_code);
$total_assignments += Tracking::count_student_assignments($student_id, $course_code);
$total_messages += Tracking::count_student_messages($student_id, $course_code);
$nb_courses_student++;
}
}
}
if ($nb_courses_student > 0) {
$avg_time_spent = $avg_time_spent / $nb_courses_student;
$avg_student_score = $avg_student_score / $nb_courses_student;
$avg_student_progress = $avg_student_progress / $nb_courses_student;
} else {
$avg_time_spent = null;
$avg_student_score = null;
$avg_student_progress = null;
}
$row = array();
if ($is_western_name_order) {
$row[] = $student_data['firstname'];
$row[] = $student_data['lastname'];
} else {
$row[] = $student_data['lastname'];
$row[] = $student_data['firstname'];
}
$string_date = Tracking::get_last_connection_date($student_id, true);
$first_date = Tracking::get_first_connection_date($student_id);
$row[] = $first_date;
$row[] = $string_date;
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
$detailsLink = '<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 {
$detailsLink = '<a href="myStudents.php?student=' . $student_id . '">
<img src="' . api_get_path(WEB_IMG_PATH) . '2rightarrow.gif" border="0" /></a>';
}
$row[] = $detailsLink;
$all_datas[] = $row;
}
return $all_datas;
}
示例5: get_teachers_content_html_for_platform_admin
/**
* 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_content_html_for_platform_admin()
{
$teachers = $this->teachers;
//$content = '<div style="margin:10px;">';
$content = '<h4>' . get_lang('YourTeachers') . '</h4>';
$teachers_table = null;
if (count($teachers) > 0) {
$teachers_table .= '<table class="data_table" width:"95%">';
$teachers_table .= '
<tr>
<th>' . get_lang('User') . '</th>
<th>' . get_lang('TimeSpentOnThePlatform') . '</th>
<th>' . get_lang('LastConnexion') . '</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));
$last_connection = Tracking::get_last_connection_date($teacher_id);
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>
<td align="right">' . $last_connection . '</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/index.php?view=admin">' . get_lang('SeeMore') . '</a></div>';
}
//$content .= '</div>';
return $content;
}
示例6: _api_format_user
/**
* Formats user information into a standard array
* This function should be only used inside api_get_user_info()
*
* @param array Non-standard user array
* @param bool $add_password
*
* @return array Standard user array
*/
function _api_format_user($user, $add_password = false)
{
$result = array();
$firstname = null;
$lastname = null;
if (isset($user['firstname']) && isset($user['lastname'])) {
$firstname = $user['firstname'];
$lastname = $user['lastname'];
} elseif (isset($user['firstName']) && isset($user['lastName'])) {
$firstname = isset($user['firstName']) ? $user['firstName'] : null;
$lastname = isset($user['lastName']) ? $user['lastName'] : null;
}
$result['complete_name'] = api_get_person_name($firstname, $lastname);
$result['complete_name_with_username'] = $result['complete_name'];
if (!empty($user['username'])) {
$result['complete_name_with_username'] = $result['complete_name'] . ' (' . $user['username'] . ')';
}
$result['firstname'] = $firstname;
$result['lastname'] = $lastname;
// Kept for historical reasons
$result['firstName'] = $firstname;
$result['lastName'] = $lastname;
$attributes = array('phone', 'picture_uri', 'official_code', 'status', 'active', 'auth_source', 'username', 'theme', 'language', 'creator_id', 'registration_date', 'hr_dept_id', 'expiration_date');
foreach ($attributes as $attribute) {
$result[$attribute] = isset($user[$attribute]) ? $user[$attribute] : null;
}
if (isset($user['email'])) {
$result['mail'] = isset($user['email']) ? $user['email'] : null;
$result['email'] = isset($user['email']) ? $user['email'] : null;
} else {
$result['mail'] = isset($user['mail']) ? $user['mail'] : null;
$result['email'] = isset($user['mail']) ? $user['mail'] : null;
}
$user_id = intval($user['user_id']);
// Maintain the user_id index for backwards compatibility
$result['user_id'] = $result['id'] = $user_id;
$saveUserLastLogin = api_get_configuration_value('save_user_last_login');
if ($saveUserLastLogin) {
$last_login = $user['last_login'];
} else {
if (!isset($user['lastLogin']) && !isset($user['last_login'])) {
$timestamp = Tracking::get_last_connection_date($result['user_id'], false, true);
// Convert the timestamp back into a datetime
// NOTE: this timestamp has ALREADY been converted to the local timezone in the get_last_connection_date function
$last_login = date('Y-m-d H:i:s', $timestamp);
} else {
if (isset($user['lastLogin'])) {
$last_login = $user['lastLogin'];
} else {
$last_login = $user['last_login'];
}
}
}
$result['last_login'] = $last_login;
// Kept for historical reasons
$result['lastLogin'] = $last_login;
// Getting user avatar.
$originalFile = UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_ORIGINAL, $result);
$smallFile = UserManager::getUserPicture($user_id, USER_IMAGE_SIZE_SMALL, $result);
$result['avatar'] = $originalFile;
$avatarString = explode('?', $originalFile);
$result['avatar_no_query'] = reset($avatarString);
$result['avatar_small'] = $smallFile;
//$result['avatar_sys_path'] = api_get_path(SYS_CODE_PATH).'img/unknown.jpg';
if (isset($user['user_is_online'])) {
$result['user_is_online'] = $user['user_is_online'] == true ? 1 : 0;
}
if (isset($user['user_is_online_in_chat'])) {
$result['user_is_online_in_chat'] = intval($user['user_is_online_in_chat']);
}
if ($add_password) {
$result['password'] = $user['password'];
}
$result['profile_url'] = api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $user_id;
if (isset($user['extra'])) {
$result['extra'] = $user['extra'];
}
return $result;
}
示例7: 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;
//.........这里部分代码省略.........
示例8: array
//the score inside the Reporting table
$avg_student_score = Tracking::get_avg_student_score($user_info['user_id'], $course_code, array(), $sessionId);
}
$avg_student_progress = round($avg_student_progress, 2);
// time spent on the course
$courseInfo = api_get_course_info($course_code);
$time_spent_on_the_course = 0;
if (!empty($courseInfo)) {
$time_spent_on_the_course = api_time_to_hms(Tracking::get_time_spent_on_the_course($user_info['user_id'], $courseInfo['real_id'], $sessionId));
}
// get information about connections on the platform by student
$first_connection_date = Tracking::get_first_connection_date($user_info['user_id']);
if ($first_connection_date == '') {
$first_connection_date = get_lang('NoConnexion');
}
$last_connection_date = Tracking::get_last_connection_date($user_info['user_id'], true);
if ($last_connection_date == '') {
$last_connection_date = get_lang('NoConnexion');
}
// cvs information
$csv_content[] = array(get_lang('Information', ''));
$csv_content[] = array(get_lang('Name', ''), get_lang('Email', ''), get_lang('Tel', ''));
$csv_content[] = array($user_info['complete_name'], $user_info['email'], $user_info['phone']);
$csv_content[] = array();
// csv tracking
$csv_content[] = array(get_lang('Tracking', ''));
$csv_content[] = array(get_lang('FirstLoginInPlatform', ''), get_lang('LatestLoginInPlatform', ''), get_lang('TimeSpentInTheCourse', ''), get_lang('Progress', ''), get_lang('Score', ''));
$csv_content[] = array(strip_tags($first_connection_date), strip_tags($last_connection_date), $time_spent_on_the_course, $avg_student_progress . '%', $avg_student_score);
//Show title
$info_course = CourseManager::get_course_information($course_code);
$coachs_name = '';
示例9: api_format_user
/**
* Formats user information into a standard array
* This function should be only used inside api_get_user_info()
*
* @param array User array
* @param bool add password key in array
*
* @return array user info
*/
function api_format_user($user, $add_password = false)
{
$result = array();
// If user is anonymous we don't have anything to provide
if (isset($user['is_anonymous']) && $user['is_anonymous']) {
return $user;
}
$firstname = $lastname = null;
if (isset($user['firstname']) && isset($user['lastname'])) {
$firstname = $user['firstname'];
$lastname = $user['lastname'];
} elseif (isset($user['firstName']) && isset($user['lastName'])) {
$firstname = $user['firstName'];
$lastname = $user['lastName'];
}
$result['phone'] = $user['phone'];
$result['complete_name'] = api_get_person_name($firstname, $lastname);
$result['complete_name_with_username'] = $result['complete_name'];
if (!empty($user['username'])) {
$result['complete_name_with_username'] = $result['complete_name'] . ' (' . $user['username'] . ')';
}
$result['complete_name_login_as'] = $result['complete_name'];
$result['profile_url'] = api_get_path(WEB_PUBLIC_PATH) . 'user/' . $user['username'];
if (!empty($user['username'])) {
//$result['complete_name_login_as'] = $result['complete_name'].' ('.sprintf(get_lang('LoginX'), $user['username']).')';
$result['complete_name_login_as'] = $result['complete_name'] . ' (' . $user['username'] . ')';
}
$result['firstname'] = $firstname;
$result['lastname'] = $lastname;
// Kept for historical reasons
$result['firstName'] = $firstname;
$result['lastName'] = $lastname;
if (isset($user['email'])) {
$result['mail'] = $user['email'];
$result['email'] = $user['email'];
} else {
$result['mail'] = $user['mail'];
$result['email'] = $user['mail'];
}
$user_id = intval($user['user_id']);
$result['picture_uri'] = $user['picture_uri'];
$result['user_id'] = $user_id;
$result['official_code'] = $user['official_code'];
$result['status'] = $user['status'];
$result['auth_source'] = $user['auth_source'];
$result['active'] = $user['active'];
$result['expiration_date'] = $user['expiration_date'];
$result['registration_date'] = $user['registration_date'];
$result['creator_id'] = $user['creator_id'];
if (isset($user['username'])) {
$result['username'] = $user['username'];
}
$result['theme'] = $user['theme'];
$result['language'] = $user['language'];
if (!empty($result['user_id'])) {
if (!isset($user['lastLogin']) && !isset($user['last_login'])) {
$timestamp = Tracking::get_last_connection_date($result['user_id'], false, true);
// Convert the timestamp back into a datetime
// NOTE: this timestamp has ALREADY been converted to the local timezone in the get_last_connection_date function
$last_login = date('Y-m-d H:i:s', $timestamp);
} else {
if (isset($user['lastLogin'])) {
$last_login = $user['lastLogin'];
} else {
$last_login = $user['last_login'];
}
}
} else {
$last_login = api_get_utc_datetime();
}
$result['last_login'] = $last_login;
// Kept for historical reasons
$result['lastLogin'] = $last_login;
//Getting user avatar
$picture_filename = trim($user['picture_uri']);
$avatar = api_get_path(WEB_IMG_PATH) . 'unknown.jpg';
$avatar_small = api_get_path(WEB_IMG_PATH) . 'unknown_22.jpg';
$avatar_sys_path = api_get_path(SYS_IMG_PATH) . 'unknown.jpg';
$dir = 'upload/users/' . $user_id . '/';
if (!empty($picture_filename)) {
/*if (api_get_setting('split_users_upload_directory') === 'true') {
$dir = 'upload/users/'.substr((string)$user_id, 0, 1).'/'.$user_id.'/';
}*/
}
$image_sys_path = api_get_path(SYS_CODE_PATH) . $dir . $picture_filename;
if (file_exists($image_sys_path) && !is_dir($image_sys_path)) {
$avatar = api_get_path(WEB_CODE_PATH) . $dir . $picture_filename;
$avatar_small = api_get_path(WEB_CODE_PATH) . $dir . 'small_' . $picture_filename;
$avatar_sys_path = api_get_path(SYS_CODE_PATH) . $dir . $picture_filename;
}
$result['avatar'] = $avatar;
//.........这里部分代码省略.........
示例10: array
$avg_student_score = $avg_student_score / $nb_courses_student;
$avg_student_progress = $avg_student_progress / $nb_courses_student;
} else {
$avg_time_spent = null;
$avg_student_score = null;
$avg_student_progress = null;
}
$row = array();
if ($is_western_name_order) {
$row[] = $student_data['firstname'];
$row[] = $student_data['lastname'];
} else {
$row[] = $student_data['lastname'];
$row[] = $student_data['firstname'];
}
$string_date = Tracking::get_last_connection_date($student_id, true);
$first_date = Tracking::get_first_connection_date($student_id);
$row[] = $first_date;
$row[] = $string_date;
if ($export_csv) {
$row[count($row) - 1] = strip_tags($row[count($row) - 1]);
$row[count($row) - 2] = strip_tags($row[count($row) - 2]);
$csv_content[] = $row;
}
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
$row[] = '<a href="myStudents.php?student=' . $student_id . '&id_coach=' . $coach_id . '&id_session=' . $session_id . '"><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>';
}
$all_datas[] = $row;
}
示例11: _api_format_user
/**
* Formats user information into a standard array
* This function should be only used inside api_get_user_info()
*
* @param array Non-standard user array
* @return array Standard user array
*/
function _api_format_user($user, $add_password = false)
{
$result = array();
$firstname = null;
$lastname = null;
if (isset($user['firstname']) && isset($user['lastname'])) {
$firstname = $user['firstname'];
$lastname = $user['lastname'];
} elseif (isset($user['firstName']) && isset($user['lastName'])) {
$firstname = isset($user['firstName']) ? $user['firstName'] : null;
$lastname = isset($user['lastName']) ? $user['lastName'] : null;
}
$result['complete_name'] = api_get_person_name($firstname, $lastname);
$result['complete_name_with_username'] = $result['complete_name'];
if (!empty($user['username'])) {
$result['complete_name_with_username'] = $result['complete_name'] . ' (' . $user['username'] . ')';
}
$result['firstname'] = $firstname;
$result['lastname'] = $lastname;
// Kept for historical reasons
$result['firstName'] = $firstname;
$result['lastName'] = $lastname;
$attributes = array('phone', 'picture_uri', 'official_code', 'status', 'active', 'auth_source', 'username', 'theme', 'language', 'creator_id', 'registration_date');
foreach ($attributes as $attribute) {
$result[$attribute] = isset($user[$attribute]) ? $user[$attribute] : null;
}
if (isset($user['email'])) {
$result['mail'] = isset($user['email']) ? $user['email'] : null;
$result['email'] = isset($user['email']) ? $user['email'] : null;
} else {
$result['mail'] = isset($user['mail']) ? $user['mail'] : null;
$result['email'] = isset($user['mail']) ? $user['mail'] : null;
}
$user_id = intval($user['user_id']);
$result['user_id'] = $user_id;
if (isset($_configuration['save_user_last_login']) && $_configuration['save_user_last_login']) {
$last_login = $user['last_login'];
} else {
if (!isset($user['lastLogin']) && !isset($user['last_login'])) {
require_once api_get_path(LIBRARY_PATH) . 'tracking.lib.php';
$timestamp = Tracking::get_last_connection_date($result['user_id'], false, true);
// Convert the timestamp back into a datetime
// NOTE: this timestamp has ALREADY been converted to the local timezone in the get_last_connection_date function
$last_login = date('Y-m-d H:i:s', $timestamp);
} else {
if (isset($user['lastLogin'])) {
$last_login = $user['lastLogin'];
} else {
$last_login = $user['last_login'];
}
}
}
$result['last_login'] = $last_login;
// Kept for historical reasons
$result['lastLogin'] = $last_login;
// Getting user avatar.
$picture_filename = trim($result['picture_uri']);
$avatar = api_get_path(WEB_CODE_PATH) . 'img/unknown.jpg';
$avatar_small = api_get_path(WEB_CODE_PATH) . 'img/unknown_22.jpg';
$avatar_sys_path = api_get_path(SYS_CODE_PATH) . 'img/unknown.jpg';
$dir = 'upload/users/' . $user_id . '/';
//if (!empty($picture_filename) && api_is_anonymous() ) { //Why you have to be anonymous?
if (!empty($picture_filename)) {
if (api_get_setting('split_users_upload_directory') === 'true') {
$dir = 'upload/users/' . substr((string) $user_id, 0, 1) . '/' . $user_id . '/';
}
}
$image_sys_path = api_get_path(SYS_CODE_PATH) . $dir . $picture_filename;
if (file_exists($image_sys_path) && !is_dir($image_sys_path)) {
$avatar = api_get_path(WEB_CODE_PATH) . $dir . $picture_filename;
$avatar_small = api_get_path(WEB_CODE_PATH) . $dir . 'small_' . $picture_filename;
$avatar_sys_path = api_get_path(SYS_CODE_PATH) . $dir . $picture_filename;
}
$result['avatar'] = $avatar;
$result['avatar_sys_path'] = $avatar_sys_path;
$result['avatar_small'] = $avatar_small;
if (isset($user['user_is_online'])) {
$result['user_is_online'] = $user['user_is_online'] == true ? 1 : 0;
}
if (isset($user['user_is_online_in_chat'])) {
$result['user_is_online_in_chat'] = intval($user['user_is_online_in_chat']);
}
if ($add_password) {
$result['password'] = $user['password'];
}
return $result;
}