本文整理汇总了PHP中SessionManager::get_users_by_session方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::get_users_by_session方法的具体用法?PHP SessionManager::get_users_by_session怎么用?PHP SessionManager::get_users_by_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionManager
的用法示例。
在下文中一共展示了SessionManager::get_users_by_session方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
if (api_is_drh()) {
$sessions = SessionManager::get_sessions_followed_by_drh(api_get_user_id(), $start, $limit, false, false, false, null, $keyword, $description);
} else {
// Sessions for the coach
$sessions = Tracking::get_sessions_coached_by_user(api_get_user_id(), $start, $limit, false, $keyword, $description);
}
$columns = array('name', 'date', 'course_per_session', 'student_per_session', 'details');
$result = array();
if (!empty($sessions)) {
foreach ($sessions as $session) {
if (api_drh_can_access_all_session_content()) {
$count_courses_in_session = count(SessionManager::get_course_list_by_session_id($session['id']));
} else {
$count_courses_in_session = count(Tracking::get_courses_followed_by_coach($user_id, $session['id']));
}
$count_users_in_session = count(SessionManager::get_users_by_session($session['id'], 0));
$session_date = array();
if (!empty($session['access_start_date']) && $session['access_start_date'] != '0000-00-00') {
$session_date[] = get_lang('From') . ' ' . api_format_date($session['access_start_date'], DATE_FORMAT_SHORT);
}
if (!empty($session['access_end_date']) && $session['access_end_date'] != '0000-00-00') {
$session_date[] = get_lang('Until') . ' ' . api_format_date($session['access_end_date'], DATE_FORMAT_SHORT);
}
if (empty($session_date)) {
$session_date_string = '-';
} else {
$session_date_string = implode(' ', $session_date);
}
$sessionUrl = api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?session_id=' . $session['id'];
$result[] = array('name' => $session['name'], 'date' => $session_date_string, 'course_per_session' => $count_courses_in_session, 'student_per_session' => $count_users_in_session, 'details' => Display::url(Display::return_icon('2rightarrow.png'), $sessionUrl));
}
示例2: foreach
$course_founded = false;
foreach ($new_course_list as $course_item) {
if ($origin_course_code == $course_item['code']) {
$course_founded = true;
}
}
$result_message = array();
$result_message_compare = array();
$update_database = true;
if (isset($_REQUEST['view_stat']) && $_REQUEST['view_stat'] == 1) {
$update_database = false;
}
//Check if the same course exist in the session destination
if ($course_founded) {
//Check if the user is registered in the session otherwise we will add it
$result = SessionManager::get_users_by_session($new_session_id);
if (empty($result) || !in_array($user_id, array_keys($result))) {
if ($debug) {
echo 'User added to the session';
}
//Registering user to the new session
SessionManager::suscribe_users_to_session($new_session_id, array($user_id), false);
}
//Begin with the import process
$course_info = api_get_course_info($origin_course_code);
$course_id = $course_info['real_id'];
$TABLETRACK_EXERCICES = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
$TBL_TRACK_ATTEMPT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
$TBL_TRACK_E_COURSE_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$TBL_TRACK_E_LAST_ACCESS = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
$TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);
示例3: show_user_progress
//.........这里部分代码省略.........
if (is_numeric($percentage_score)) {
$html .= $percentage_score . '%';
} else {
$html .= '0%';
}
$html .= '</td>';
$html .= '<td align="center">' . $last_connection . '</td>';
$html .= '<td align="center">';
if (isset($_GET['course']) && $course_code == $_GET['course'] && empty($_GET['session_id'])) {
$html .= '<a href="#">';
$html .= Display::return_icon('2rightarrow_na.png', get_lang('Details'));
} else {
$html .= '<a href="' . api_get_self() . '?course=' . $course_code . $extra_params . '">';
$html .= Display::return_icon('2rightarrow.png', get_lang('Details'));
}
$html .= '</a>';
$html .= '</td></tr>';
}
$html .= '</table>';
}
}
// Session list
if (!empty($course_in_session)) {
$main_session_graph = '';
//Load graphics only when calling to an specific session
$session_graph = array();
$all_exercise_graph_name_list = array();
$my_results = array();
$all_exercise_graph_list = array();
$all_exercise_start_time = array();
foreach ($course_in_session as $my_session_id => $session_data) {
$course_list = $session_data['course_list'];
$session_name = $session_data['name'];
$user_count = count(SessionManager::get_users_by_session($my_session_id));
$exercise_graph_name_list = array();
//$user_results = array();
$exercise_graph_list = array();
foreach ($course_list as $course_data) {
$exercise_list = ExerciseLib::get_all_exercises($course_data, $my_session_id, false, null, false, 1);
foreach ($exercise_list as $exercise_data) {
$exercise_obj = new Exercise($course_data['id']);
$exercise_obj->read($exercise_data['id']);
//Exercise is not necessary to be visible to show results check the result_disable configuration instead
//$visible_return = $exercise_obj->is_visible();
if ($exercise_data['results_disabled'] == 0 || $exercise_data['results_disabled'] == 2) {
$best_average = intval(ExerciseLib::get_best_average_score_by_exercise($exercise_data['id'], $course_data['id'], $my_session_id, $user_count));
$exercise_graph_list[] = $best_average;
$all_exercise_graph_list[] = $best_average;
$user_result_data = ExerciseLib::get_best_attempt_by_user(api_get_user_id(), $exercise_data['id'], $course_data['real_id'], $my_session_id);
$score = 0;
if (!empty($user_result_data['exe_weighting']) && intval($user_result_data['exe_weighting']) != 0) {
$score = intval($user_result_data['exe_result'] / $user_result_data['exe_weighting'] * 100);
}
$time = api_strtotime($exercise_data['start_time']) ? api_strtotime($exercise_data['start_time'], 'UTC') : 0;
$all_exercise_start_time[] = $time;
$my_results[] = $score;
if (count($exercise_list) <= 10) {
$title = cut($course_data['title'], 30) . " \n " . cut($exercise_data['title'], 30);
$exercise_graph_name_list[] = $title;
$all_exercise_graph_name_list[] = $title;
} else {
// if there are more than 10 results, space becomes difficult to find, so only show the title of the exercise, not the tool
$title = cut($exercise_data['title'], 30);
$exercise_graph_name_list[] = $title;
$all_exercise_graph_name_list[] = $title;
}
示例4: api_get_path
echo '</div>';
}
echo '</div>';
if (api_is_platform_admin()) {
echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&display=coaches">' . get_lang('DisplayCoaches') . '</a> | ';
echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&display=useroverview">' . get_lang('DisplayUserOverview') . '</a>';
echo ' | <a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&display=sessionoverview">' . get_lang('DisplaySessionOverview') . '</a>';
echo ' | <a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/?view=admin&display=courseoverview">' . get_lang('DisplayCourseOverview') . '</a>';
echo ' | <a href="' . api_get_path(WEB_CODE_PATH) . 'tracking/question_course_report.php?view=admin">' . get_lang('LPQuestionListResults') . '</a>';
echo ' | ' . get_lang('LPExerciseResultsBySession') . '';
}
echo '<h2>' . get_lang('LPExerciseResultsBySession') . '</h2>';
$form->display();
Display::display_normal_message(get_lang('StudentScoreAverageIsCalculatedBaseInAllLPsAndAllAttempts'));
}
$users = SessionManager::get_users_by_session($session_id);
$course_average = $course_average_counter = array();
$counter = 0;
$main_result = array();
//Getting course list
foreach ($course_list as $current_course) {
$course_info = api_get_course_info($current_course['code']);
$_course = $course_info;
$attempt_result = array();
//Getting LP list
$list = new LearnpathList('', $current_course['code'], $session_id);
$lp_list = $list->get_flat_list();
// Looping LPs
foreach ($lp_list as $lp_id => $lp) {
$exercise_list = ExerciseLib::get_all_exercises_from_lp($lp_id, $course_info['real_id']);
//Looping Chamilo Exercises in LP
示例5: get_user_list_from_courses_as_coach
/**
* @param int $user_id
* @param bool $include_sessions
* @return array
*/
public static function get_user_list_from_courses_as_coach($user_id, $include_sessions = true)
{
$students_in_courses = array();
$sessions = CourseManager::get_course_list_as_coach($user_id, true);
if (!empty($sessions)) {
foreach ($sessions as $session_id => $courses) {
if (!$include_sessions) {
if (!empty($session_id)) {
continue;
}
}
if (empty($session_id)) {
foreach ($courses as $course_code) {
$students_in_course = CourseManager::get_user_list_from_course_code($course_code);
foreach ($students_in_course as $user_item) {
//Only students
if ($user_item['status_rel'] == STUDENT) {
$students_in_courses[$user_item['user_id']] = $user_item['user_id'];
}
}
}
} else {
$students_in_course = SessionManager::get_users_by_session($session_id, '0');
if (is_array($students_in_course)) {
foreach ($students_in_course as $user_item) {
$students_in_courses[$user_item['user_id']] = $user_item['user_id'];
}
}
}
}
}
$students = Tracking::get_student_followed_by_coach($user_id);
if (!empty($students_in_courses)) {
if (!empty($students)) {
$students = array_merge($students, $students_in_courses);
} else {
$students = $students_in_courses;
}
}
if (!empty($students)) {
$students = array_unique($students);
}
return $students;
}
示例6: api_is_allowed_to_edit
/* For licensing terms, see /license.txt */
/*
* Report from students for learning path
*/
require_once '../inc/global.inc.php';
$isAllowedToEdit = api_is_allowed_to_edit(null, true);
if (!$isAllowedToEdit) {
api_not_allowed(true);
}
$lpTable = Database::get_course_table(TABLE_LP_MAIN);
$lpId = isset($_GET['lp_id']) ? boolval($_GET['lp_id']) : false;
$sessionId = api_get_session_id();
$courseId = api_get_course_int_id();
$courseCode = api_get_course_id();
$sessionUsers = SessionManager::get_users_by_session($sessionId, 0);
$userList = [];
$lpInfo = Database::select('*', $lpTable, array('where' => array('c_id = ? AND ' => $courseId, 'id = ?' => $lpId)), 'first');
foreach ($sessionUsers as $user) {
$lpTime = Tracking::get_time_spent_in_lp($user['user_id'], $courseCode, array($lpId), $sessionId);
$lpScore = Tracking::get_avg_student_score($user['user_id'], $courseCode, array($lpId), $sessionId);
$lpPogress = Tracking::get_avg_student_progress($user['user_id'], $courseCode, array($lpId), $sessionId);
$lpLastConnection = Tracking::get_last_connection_time_in_lp($user['user_id'], $courseCode, array($lpId), $sessionId);
$lpLastConnection = empty($lpLastConnection) ? '-' : api_convert_and_format_date($lpLastConnection, DATE_TIME_FORMAT_LONG);
$userList[] = ['id' => $user['user_id'], 'first_name' => $user['firstname'], 'last_name' => $user['lastname'], 'lp_time' => api_time_to_hms($lpTime), 'lp_score' => is_numeric($lpScore) ? "{$lpScore}%" : $lpScore, 'lp_progress' => "{$lpPogress}%", 'lp_last_connection' => $lpLastConnection];
}
// View
$interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php', 'name' => get_lang('LearningPaths')];
$actions = Display::url(Display::return_icon('back.png', get_lang('Back'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'newscorm/lp_controller.php?' . api_get_cidreq());
$template = new Template(get_lang('StudentScore'));
$template->assign('user_list', $userList);
示例7: get_lang
<a href="session_course_user_list.php?id_session=' . $sessionId . '&course_code=' . $course->getCode() . '">' . Display::return_icon('user.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>
<a href="' . api_get_path(WEB_CODE_PATH) . '/user/user_import.php?action=import&cidReq=' . $course->getCode() . '&id_session=' . $sessionId . '">' . Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), null, ICON_SIZE_SMALL) . '</a>
<a href="../tracking/courseLog.php?id_session=' . $sessionId . '&cidReq=' . $course->getCode() . $orig_param . '&hide_course_breadcrumb=1">' . Display::return_icon('statistics.gif', get_lang('Tracking')) . '</a>
<a href="session_course_edit.php?id_session=' . $sessionId . '&page=resume_session.php&course_code=' . $course->getCode() . '' . $orig_param . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>
<a href="' . api_get_self() . '?id_session=' . $sessionId . '&action=delete&idChecked[]=' . $course->getCode() . '" onclick="javascript:if(!confirm(\'' . get_lang('ConfirmYourChoice') . '\')) return false;">' . Display::return_icon('delete.png', get_lang('Delete')) . '</a>
</td>
</tr>';
$count++;
}
$courseListToShow .= $courseItem;
}
$courseListToShow .= '</table><br />';
$url = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "add_users_to_session.php?page=resume_session.php&id_session={$sessionId}");
$url .= Display::url(Display::return_icon('import_csv.png', get_lang('ImportUsers'), array(), ICON_SIZE_SMALL), "session_user_import.php?id_session={$sessionId}");
$userListToShow = Display::page_subheader(get_lang('UserList') . $url);
$userList = SessionManager::get_users_by_session($sessionId);
if (!empty($userList)) {
$table = new HTML_Table(array('class' => 'data_table', 'id' => 'session-user-list'));
$table->setHeaderContents(0, 0, get_lang('User'));
$table->setHeaderContents(0, 1, get_lang('Status'));
$table->setHeaderContents(0, 2, get_lang('Actions'));
$row = 1;
foreach ($userList as $user) {
$userId = $user['user_id'];
$userInfo = api_get_user_info($userId);
$userLink = '<a href="' . api_get_path(WEB_CODE_PATH) . 'admin/user_information.php?user_id=' . $userId . '">' . api_htmlentities($userInfo['complete_name_with_username']) . '</a>';
$reportingLink = Display::url(Display::return_icon('statistics.gif', get_lang('Reporting')), api_get_path(WEB_CODE_PATH) . 'mySpace/myStudents.php?student=' . $user['user_id'] . '' . $orig_param . '&id_session=' . $sessionId);
$courseUserLink = Display::url(Display::return_icon('course.png', get_lang('BlockCoursesForThisUser')), api_get_path(WEB_CODE_PATH) . 'session/session_course_user.php?id_user=' . $user['user_id'] . '&id_session=' . $sessionId);
$removeLink = Display::url(Display::return_icon('delete.png', get_lang('Delete')), api_get_self() . '?id_session=' . $sessionId . '&action=delete&user=' . $user['user_id'], array('onclick' => "javascript:if(!confirm('" . get_lang('ConfirmYourChoice') . "')) return false;"));
$addUserToUrlLink = '';
if ($multiple_url_is_on) {
示例8: get_lang
</th>
<th>
<?php
echo get_lang('Actions');
?>
</th>
</tr>
<?php
/*
if ($session['nbr_users'] == 0) {
} else {
*/
$orig_param = '&origin=resume_session&id_session=' . $id_session;
// change breadcrumb in destination page
$users = SessionManager::get_users_by_session($id_session, 0);
//$reasons = SessionManager::get_session_change_user_reasons();
if (!empty($users)) {
foreach ($users as $user) {
$user_info = api_get_user_info($user['user_id']);
//$link_class = 'class="item_disabled"';
$link_class = null;
$user_status_in_platform = Display::return_icon('error.png', get_lang('Inactive'));
$information = '';
$moved_date = '-';
if ($user_info['active'] == 1) {
$user_status_in_platform = Display::return_icon('accept.png', get_lang('Active'));
//$link_class = null;
} else {
$status_info = get_latest_event_by_user_and_type($user['user_id'], LOG_USER_DEACTIVATED);
//var_dump($status_info);
示例9: Attendance
<?php
require '../../main/inc/global.inc.php';
require '../../main/inc/lib/attendance.lib.php';
$a = new Attendance();
$sessions_list = SessionManager::get_sessions_list();
$min = 90000;
$max = 999999;
// Get sessions
foreach ($sessions_list as $session) {
if ($session['id'] < $min) {
continue;
}
echo "Session " . $session['id'] . "\n";
// Get users in session to build users list
$users = SessionManager::get_users_by_session($session['id']);
$u = array();
foreach ($users as $user) {
$u[] = $user['user_id'];
}
// Get courses list to get the right course (only one in each session)
$courses = SessionManager::get_course_list_by_session_id($session['id']);
if (count($courses) > 0) {
foreach ($courses as $course) {
$course_id = $course['id'];
break;
}
echo "-- Course " . $course_id . "\n";
// Get attendances sheets from course (only one in each course)
$att = $a->get_attendances_list($course_id, $session['id']);
if (count($att) > 0) {