Exemplo n.º 1
0
 /**
  * @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);
 }
Exemplo n.º 2
0
        if ($i <= 10) {
            $list[] = SocialManager::get_logged_user_course_html($my_course, $i);
            $course_list_code[] = array('code' => $my_course['code']);
        } else {
            break;
        }
        $i++;
    }
    //to avoid repeted courses
    $course_list_code = array_unique_dimensional($course_list_code);
}
//Social Block Menu
$social_menu_block = SocialManager::show_social_menu('shared_profile', null, $user_id, $show_full_profile);
//Setting some session info
$user_info = api_get_user_info($my_user_id);
$sessionList = SessionManager::getSessionsFollowedByUser($my_user_id, $user_info['status']);
// My friends
$friend_html = SocialManager::listMyFriendsBlock($user_id, $link_shared, $show_full_profile);
$wallSocialAddPost = SocialManager::getWallForm();
$social_wall_block = $wallSocialAddPost;
// Social Post Wall
$posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId);
$posts = empty($posts) ? '<p>' . get_lang("NoPosts") . '</p>' : $posts;
$social_post_wall_block = Display::panel($posts, get_lang('Posts'));
$socialAutoExtendLink = Display::url(get_lang('SeeMore'), $socialAjaxUrl . '?u=' . $my_user_id . '&a=listWallMessage&start=10&length=5', array('class' => 'nextPage next'));
// Added a Jquery Function to return the Preview of OpenGraph URL Content
$htmlHeadXtra[] = '<script language="JavaScript">
		$(document).ready(function() {
            $("label").remove();
            $("[name=\'social_wall_new_msg_main\']").on("paste", function(e) {
                $.ajax({
Exemplo n.º 3
0
         }
     }
     $searchByGroups = true;
 }
 if ($searchByGroups) {
     $userGroup = new UserGroup();
     $userIdList = array_merge($userIdList, $userGroup->getGroupUsersByUser(api_get_user_id()));
 }
 if (is_array($userIdList)) {
     $userIdList = array_unique($userIdList);
 }
 if (api_is_student_boss()) {
     $userCourses = [];
     foreach ($userIdList as $userId) {
         $userCourses = array_merge($userCourses, CourseManager::get_courses_list_by_user_id($userId, true));
         $userSessions = SessionManager::getSessionsFollowedByUser($userId);
         $sessionIdList = array_merge($sessionIdList, array_column($userSessions, 'id'));
     }
     $courseCodeList = array_column($userCourses, 'code');
 }
 if (!empty($courseCodeList)) {
     $courseCodeList = array_unique($courseCodeList);
 }
 if (!empty($sessionIdList)) {
     $sessionIdList = array_unique($sessionIdList);
 }
 if (api_is_student_boss() && empty($userIdList)) {
     $count = 0;
     break;
 }
 if ($action == 'get_user_course_report') {
Exemplo n.º 4
0
                    }
                    $certificateStudent['certificates'][] = array('createdAt' => api_convert_and_format_date($certificate['created_at']), 'id' => $certificate['id']);
                }
                if (count($certificateStudent['certificates']) > 0) {
                    $certificateStudents[] = $certificateStudent;
                }
            }
        }
    }
} elseif ($searchStudentOnly) {
    $selectedStudentInfo = api_get_user_info($selectedStudent);
    if (empty($selectedStudentInfo)) {
        Session::write('reportErrorMessage', get_lang('NoUser'));
        Header::location($selfUrl);
    }
    $sessionList = SessionManager::getSessionsFollowedByUser($selectedStudent);
    foreach ($sessionList as $session) {
        $sessionCourseList = SessionManager::get_course_list_by_session_id($session['id']);
        foreach ($sessionCourseList as $sessionCourse) {
            $gradebookCategories = Category::load(null, null, $sessionCourse['code'], null, false, $session['id']);
            $gradebook = null;
            if (!empty($gradebookCategories)) {
                $gradebook = current($gradebookCategories);
            }
            if (!is_null($gradebook)) {
                $sessionName = $session['name'];
                $courseName = $sessionCourse['title'];
                $certificateStudent = ['fullName' => $selectedStudentInfo['complete_name'], 'sessionName' => $sessionName, 'courseName' => $courseName, 'certificates' => []];
                $studentCertificates = GradebookUtils::get_list_gradebook_certificates_by_user_id($selectedStudent, $gradebook->get_id());
                if (!is_array($studentCertificates) || empty($studentCertificates)) {
                    continue;
Exemplo n.º 5
0
 /**
  * Get the total progress on sessions with gamification mode
  * @param int $userId The user ID
  * @param int $userStatus The user Status
  *
  * @return float
  */
 public static function getTotalUserProgress($userId, $userStatus)
 {
     $progress = 0;
     $sessions = SessionManager::getSessionsFollowedByUser($userId, $userStatus);
     if (empty($sessions)) {
         return 0;
     }
     foreach ($sessions as $session) {
         $progress += self::getSessionProgress($session['id'], $userId);
     }
     return round($progress / count($sessions), 2);
 }