本文整理汇总了PHP中CourseManager::getCoursesFollowedByUser方法的典型用法代码示例。如果您正苦于以下问题:PHP CourseManager::getCoursesFollowedByUser方法的具体用法?PHP CourseManager::getCoursesFollowedByUser怎么用?PHP CourseManager::getCoursesFollowedByUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CourseManager
的用法示例。
在下文中一共展示了CourseManager::getCoursesFollowedByUser方法的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: intval
if ($access_url_id != -1) {
$sql = "SELECT course.id, code, title, visual_code, session_id\n FROM {$tbl_course} course\n LEFT JOIN {$tbl_session_rel_course} session_rel_course\n ON\n course.id = session_rel_course.c_id AND\n session_rel_course.session_id = " . intval($sessionId) . "\n INNER JOIN {$tbl_course_rel_access_url} url_course\n ON (url_course.c_id = course.id)\n WHERE access_url_id = {$access_url_id}\n ORDER BY " . (sizeof($courses) ? "(code IN(" . implode(',', $courses) . ")) DESC," : "") . " title";
}
}
$result = Database::query($sql);
$Courses = Database::store_result($result);
foreach ($Courses as $course) {
if ($course['session_id'] == $sessionId) {
$sessionCourses[$course['id']] = $course;
} else {
$nosessionCourses[$course['id']] = $course;
}
}
}
if (!api_is_platform_admin() && api_is_teacher()) {
$coursesFromTeacher = CourseManager::getCoursesFollowedByUser(api_get_user_id(), COURSEMANAGER);
foreach ($nosessionCourses as &$course) {
if (in_array($course['code'], array_keys($coursesFromTeacher))) {
continue;
} else {
unset($nosessionCourses[$course['id']]);
}
}
}
unset($Courses);
?>
<form name="formulaire" method="post" action="<?php
echo api_get_self();
?>
?page=<?php
echo $page;
示例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;
}