本文整理汇总了PHP中SessionManager::getAllCoursesFollowedByUser方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionManager::getAllCoursesFollowedByUser方法的具体用法?PHP SessionManager::getAllCoursesFollowedByUser怎么用?PHP SessionManager::getAllCoursesFollowedByUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionManager
的用法示例。
在下文中一共展示了SessionManager::getAllCoursesFollowedByUser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStats
/**
* @param int $userId
*
* @return array
*/
public static function getStats($userId)
{
if (api_is_drh() && api_drh_can_access_all_session_content()) {
$studentList = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('drh_all', $userId, false, null, null, null, null, null, null, null, array(), array(), STUDENT);
$students = array();
foreach ($studentList as $studentData) {
$students[] = $studentData['user_id'];
}
$teacherList = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('drh_all', $userId, false, null, null, null, null, null, null, null, array(), array(), COURSEMANAGER);
$teachers = array();
foreach ($teacherList as $teacherData) {
$teachers[] = $teacherData['user_id'];
}
$humanResources = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('drh_all', $userId, false, null, null, null, null, null, null, null, array(), array(), DRH);
$humanResourcesList = array();
foreach ($humanResources as $item) {
$humanResourcesList[] = $item['user_id'];
}
$platformCourses = SessionManager::getAllCoursesFollowedByUser($userId, null, null, null, null, null);
//$platformCourses = SessionManager::getAllCoursesFromAllSessionFromDrh($userId);
$courses = array();
foreach ($platformCourses as $course) {
$courses[$course['code']] = $course['code'];
}
$sessions = SessionManager::get_sessions_followed_by_drh($userId);
} else {
$studentList = UserManager::getUsersFollowedByUser($userId, STUDENT, false, false, false, null, null, null, null, null, null, COURSEMANAGER);
$students = array();
foreach ($studentList as $studentData) {
$students[] = $studentData['user_id'];
}
$teacherList = UserManager::getUsersFollowedByUser($userId, COURSEMANAGER, false, false, false, null, null, null, null, null, null, COURSEMANAGER);
$teachers = array();
foreach ($teacherList as $teacherData) {
$teachers[] = $teacherData['user_id'];
}
$humanResources = UserManager::getUsersFollowedByUser($userId, DRH, false, false, false, null, null, null, null, null, null, COURSEMANAGER);
$humanResourcesList = array();
foreach ($humanResources as $item) {
$humanResourcesList[] = $item['user_id'];
}
$platformCourses = CourseManager::getCoursesFollowedByUser($userId, COURSEMANAGER);
foreach ($platformCourses as $course) {
$courses[$course['code']] = $course['code'];
}
$sessions = SessionManager::getSessionsFollowedByUser($userId, COURSEMANAGER);
}
return array('drh' => $humanResourcesList, 'teachers' => $teachers, 'students' => $students, 'courses' => $courses, 'sessions' => $sessions);
}
示例2: api_is_session_admin
api_is_session_admin() ||
api_is_drh() ||
api_is_course_tutor() ||
api_is_course_admin();
if (!$is_allowedToTrack) {
api_not_allowed(true);
exit;
}
// If the user is a HR director (drh)
if (api_is_drh()) {
// Blocking course for drh
if (api_drh_can_access_all_session_content()) {
// If the drh has been configured to be allowed to see all session content, give him access to the session courses
$coursesFromSession = SessionManager::getAllCoursesFollowedByUser(api_get_user_id(), null);
if (!empty($coursesFromSession)) {
$coursesFromSession = array_keys($coursesFromSession);
}
$coursesFollowedList = CourseManager::get_courses_followed_by_drh(api_get_user_id());
if (!empty($coursesFollowedList)) {
$coursesFollowedList = array_keys($coursesFollowedList);
}
if (!in_array($courseCode, $coursesFollowedList)) {
if (!in_array($courseCode, $coursesFromSession)) {
api_not_allowed();
}
}
} else {
// If the drh has *not* been configured to be allowed to see all session content, then check if he has also been given access to the corresponding courses
示例3: get_courses
function get_courses($from, $limit, $column, $direction)
{
$userId = api_get_user_id();
$sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
$keyword = isset($_GET['keyword']) ? $_GET['keyword'] : null;
$follow = isset($_GET['follow']) ? true : false;
$drhLoaded = false;
if (api_is_drh()) {
if (api_drh_can_access_all_session_content()) {
$courses = SessionManager::getAllCoursesFollowedByUser($userId, $sessionId, $from, $limit, $column, $direction, false, $keyword);
$drhLoaded = true;
}
}
if ($drhLoaded == false) {
$courses = CourseManager::getCoursesFollowedByUser($userId, COURSEMANAGER, $from, $limit, $column, $direction, false, $keyword, $sessionId, $follow);
}
$courseList = array();
if (!empty($courses)) {
foreach ($courses as $data) {
$courseCode = $data['code'];
$courseInfo = api_get_course_info($courseCode);
$userList = CourseManager::get_user_list_from_course_code($data['code'], $sessionId);
$userIdList = array();
if (!empty($userList)) {
foreach ($userList as $user) {
$userIdList[] = $user['user_id'];
}
}
$messagesInCourse = 0;
$assignmentsInCourse = 0;
$avgTimeSpentInCourse = 0;
$avgProgressInCourse = 0;
if (count($userIdList) > 0) {
$countStudents = count($userIdList);
// tracking data
$avgProgressInCourse = Tracking::get_avg_student_progress($userIdList, $courseCode, array(), $sessionId);
$avgScoreInCourse = Tracking::get_avg_student_score($userIdList, $courseCode, array(), $sessionId);
$avgTimeSpentInCourse = Tracking::get_time_spent_on_the_course($userIdList, $courseInfo['real_id'], $sessionId);
$messagesInCourse = Tracking::count_student_messages($userIdList, $courseCode, $sessionId);
$assignmentsInCourse = Tracking::count_student_assignments($userIdList, $courseCode, $sessionId);
$avgTimeSpentInCourse = api_time_to_hms($avgTimeSpentInCourse / $countStudents);
$avgProgressInCourse = round($avgProgressInCourse / $countStudents, 2);
if (is_numeric($avgScoreInCourse)) {
$avgScoreInCourse = round($avgScoreInCourse / $countStudents, 2) . '%';
}
}
$thematic = new Thematic();
$tematic_advance = $thematic->get_total_average_of_thematic_advances($courseCode, $sessionId);
$tematicAdvanceProgress = '-';
if (!empty($tematic_advance)) {
$tematicAdvanceProgress = '<a title="' . get_lang('GoToThematicAdvance') . '" href="' . api_get_path(WEB_CODE_PATH) . 'course_progress/index.php?cidReq=' . $courseCode . '&id_session=' . $sessionId . '">' . $tematic_advance . '%</a>';
}
$courseIcon = '<a href="' . api_get_path(WEB_CODE_PATH) . 'tracking/courseLog.php?cidReq=' . $courseCode . '&id_session=' . $sessionId . '">
' . Display::return_icon('2rightarrow.png', get_lang('Details')) . '
</a>';
$title = Display::url($data['title'], $courseInfo['course_public_url'] . '?id_session=' . $sessionId);
$attendanceLink = Display::url(Display::return_icon('attendance_list.png', get_lang('Attendance'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'attendance/index.php?cidReq=' . $courseCode . '&id_session=' . $sessionId . '&action=calendar_logins');
$courseList[] = array($title, $countStudents, is_null($avgTimeSpentInCourse) ? '-' : $avgTimeSpentInCourse, $tematicAdvanceProgress, is_null($avgProgressInCourse) ? '-' : $avgProgressInCourse . '%', is_null($avgScoreInCourse) ? '-' : $avgScoreInCourse, is_null($messagesInCourse) ? '-' : $messagesInCourse, is_null($assignmentsInCourse) ? '-' : $assignmentsInCourse, $attendanceLink, $courseIcon);
}
}
return $courseList;
}