当前位置: 首页>>代码示例>>PHP>>正文


PHP UserManager::get_personal_session_course_list方法代码示例

本文整理汇总了PHP中UserManager::get_personal_session_course_list方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManager::get_personal_session_course_list方法的具体用法?PHP UserManager::get_personal_session_course_list怎么用?PHP UserManager::get_personal_session_course_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserManager的用法示例。


在下文中一共展示了UserManager::get_personal_session_course_list方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_courses_code

 public function get_courses_code($username, $password)
 {
     if ($this->verifyUserPass($username, $password) == "valid") {
         $user_id = UserManager::get_user_id_from_username($username);
         $listOfCourses = UserManager::get_personal_session_course_list($user_id);
         $courses_id = "#";
         foreach ($listOfCourses as $course) {
             $courses_id .= $course['code'] . "#";
         }
         return $courses_id;
     } else {
         return get_lang('InvalidId');
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:14,代码来源:cm_webservice_courses.php

示例2: array

$interbreadcrumb[] = array('url' => 'home.php', 'name' => get_lang('SocialNetwork'));
if (isset($_GET['u']) && is_numeric($_GET['u']) && $_GET['u'] != api_get_user_id()) {
    $info_user = api_get_user_info($_GET['u']);
    $interbreadcrumb[] = array('url' => '#', 'name' => api_get_person_name($info_user['firstName'], $info_user['lastName']));
    $nametool = '';
}
if (isset($_GET['u'])) {
    $param_user = 'u=' . Security::remove_XSS($_GET['u']);
} else {
    $info_user = api_get_user_info(api_get_user_id());
    $param_user = '';
}
$_SESSION['social_user_id'] = intval($user_id);
// Setting some course info
$my_user_id = isset($_GET['u']) ? intval($_GET['u']) : api_get_user_id();
$personal_course_list = UserManager::get_personal_session_course_list($my_user_id);
$course_list_code = array();
$i = 1;
$list = [];
if (is_array($personal_course_list)) {
    foreach ($personal_course_list as $my_course) {
        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);
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:profile.php

示例3: foreach

         foreach ($result as &$item) {
             $userGroups = $userGroup->get_groups_by_user($item['user_id']);
             $item['group'] = implode(", ", array_column($userGroups, 'name'));
             unset($item['user_id']);
         }
     }
     break;
 case 'get_user_skill_ranking':
     $columns = array('photo', 'firstname', 'lastname', 'skills_acquired', 'currently_learning', 'rank');
     $result = $skill->get_user_list_skill_ranking($start, $limit, $sidx, $sord, $whereCondition);
     $result = ArrayClass::msort($result, 'skills_acquired', 'asc');
     $skills_in_course = array();
     if (!empty($result)) {
         foreach ($result as &$item) {
             $user_info = api_get_user_info($item['user_id']);
             $personal_course_list = UserManager::get_personal_session_course_list($item['user_id']);
             $count_skill_by_course = array();
             foreach ($personal_course_list as $course_item) {
                 if (!isset($skills_in_course[$course_item['code']])) {
                     $count_skill_by_course[$course_item['code']] = $skill->get_count_skills_by_course($course_item['code']);
                     $skills_in_course[$course_item['code']] = $count_skill_by_course[$course_item['code']];
                 } else {
                     $count_skill_by_course[$course_item['code']] = $skills_in_course[$course_item['code']];
                 }
             }
             $item['photo'] = Display::img($user_info['avatar_small'], $user_info['complete_name'], [], false);
             $item['currently_learning'] = !empty($count_skill_by_course) ? array_sum($count_skill_by_course) : 0;
         }
     }
     break;
 case 'get_course_announcements':
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:model.ajax.php

示例4: show_social_menu


//.........这里部分代码省略.........
                     </a>
                 </li>
                 <li class="friends-icon">
                     <a href="' . api_get_path(WEB_CODE_PATH) . 'social/friends.php">
                         ' . $friendsIcon . ' ' . get_lang('Friends') . '
                     </a>
                 </li>
                 <li class="browse-groups-icon">
                     <a href="' . api_get_path(WEB_CODE_PATH) . 'social/groups.php">
                         ' . $groupsIcon . ' ' . get_lang('SocialGroups') . '
                     </a>
                 </li>';
             $active = $show == 'search' ? 'active' : null;
             $links .= '
                 <li class="search-icon ' . $active . '">
                     <a href="' . api_get_path(WEB_CODE_PATH) . 'social/search.php">
                         ' . $searchIcon . ' ' . get_lang('Search') . '
                     </a>
                 </li>';
             $active = $show == 'myfiles' ? 'active' : null;
             $myFiles = '
                 <li class="myfiles-icon ' . $active . '">
                  <a href="' . api_get_path(WEB_CODE_PATH) . 'social/myfiles.php">
                         ' . $filesIcon . ' ' . get_lang('MyFiles') . '
                     </a>
                 </li>';
             if (api_get_setting('platform.allow_my_files') === 'false') {
                 $myFiles = '';
             }
             $links .= $myFiles;
         }
         // My friend profile.
         if ($user_id != api_get_user_id()) {
             $sendMessageText = get_lang('SendMessage');
             $sendMessageIcon = Display::return_icon('new-message.png', $sendMessageText);
             $sendMesssageUrl = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?' . http_build_query(['a' => 'get_user_popup', 'user_id' => $user_id]);
             $links .= '<li>';
             $links .= Display::url("{$sendMessageIcon} {$sendMessageText}", $sendMesssageUrl, ['class' => 'ajax', 'title' => $sendMessageText, 'data-title' => $sendMessageText]);
             $links .= '</li>';
         }
         // Check if I already sent an invitation message
         $invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
         if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0) {
             $links .= '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">' . Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')) . '&nbsp;&nbsp;' . get_lang('YouAlreadySentAnInvitation') . '</a></li>';
         } else {
             if (!$show_full_profile) {
                 $links .= '<li><a class="btn-to-send-invitation" href="#" data-send-to="' . $user_id . '" title="' . get_lang('SendInvitation') . '">' . Display::return_icon('invitation.png', get_lang('SocialInvitationToFriends')) . '&nbsp;' . get_lang('SendInvitation') . '</a></li>';
             }
         }
         $links .= '</ul>';
         $html .= Display::panelCollapse(get_lang('SocialNetwork'), $links, 'social-network-menu', null, 'sn-sidebar', 'sn-sidebar-collapse');
         if ($show_full_profile && $user_id == intval(api_get_user_id())) {
             $personal_course_list = UserManager::get_personal_session_course_list($user_id);
             $course_list_code = array();
             $i = 1;
             if (is_array($personal_course_list)) {
                 foreach ($personal_course_list as $my_course) {
                     if ($i <= 10) {
                         $course_list_code[] = array('code' => $my_course['code']);
                     } else {
                         break;
                     }
                     $i++;
                 }
                 // To avoid repeated courses
                 $course_list_code = ArrayClass::array_unique_dimensional($course_list_code);
             }
             // Announcements
             $my_announcement_by_user_id = intval($user_id);
             $announcements = array();
             foreach ($course_list_code as $course) {
                 $course_info = api_get_course_info($course['code']);
                 if (!empty($course_info)) {
                     $content = AnnouncementManager::get_all_annoucement_by_user_course($course_info['code'], $my_announcement_by_user_id);
                     if (!empty($content)) {
                         $url = Display::url(Display::return_icon('announcement.png', get_lang('Announcements')) . $course_info['name'] . ' (' . $content['count'] . ')', api_get_path(WEB_CODE_PATH) . 'announcements/announcements.php?cidReq=' . $course['code']);
                         $announcements[] = Display::tag('li', $url);
                     }
                 }
             }
             if (!empty($announcements)) {
                 $html .= '<div class="social_menu_items">';
                 $html .= '<ul>';
                 foreach ($announcements as $announcement) {
                     $html .= $announcement;
                 }
                 $html .= '</ul>';
                 $html .= '</div>';
             }
         }
     }
     if ($show_delete_account_button) {
         $html .= '<div class="sidebar-nav"><ul><li>';
         $url = api_get_path(WEB_CODE_PATH) . 'auth/unsubscribe_account.php';
         $html .= Display::url(Display::return_icon('delete.png', get_lang('Unsubscribe'), array(), ICON_SIZE_TINY) . get_lang('Unsubscribe'), $url);
         $html .= '</li></ul></div>';
     }
     $html .= '';
     return $html;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:101,代码来源:social.lib.php

示例5: intval

 $page = intval($_REQUEST['page']);
 //page
 $limit = intval($_REQUEST['rows']);
 // quantity of rows
 $sidx = isset($_REQUEST['sidx']) && !empty($_REQUEST['sidx']) ? $_REQUEST['sidx'] : 'id';
 $sidx = str_replace(array('course asc,', ' '), '', $sidx);
 $sord = $_REQUEST['sord'];
 //asc or desc
 if (!in_array($sord, array('asc', 'desc'))) {
     $sord = 'desc';
 }
 $session_id = intval($_REQUEST['session_id']);
 $course_id = intval($_REQUEST['course_id']);
 //Filter users that does not belong to the session
 if (!api_is_platform_admin()) {
     $new_session_list = UserManager::get_personal_session_course_list(api_get_user_id());
     $my_session_list = array();
     foreach ($new_session_list as $item) {
         if (!empty($item['id_session'])) {
             $my_session_list[] = $item['id_session'];
         }
     }
     if (!in_array($session_id, $my_session_list)) {
         break;
     }
 }
 $start = $limit * $page - $limit;
 $course_list = SessionManager::get_course_list_by_session_id($session_id);
 $count = 0;
 $temp = [];
 foreach ($course_list as $item) {
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:course_home.ajax.php

示例6: show_social_menu


//.........这里部分代码省略.........
                 $active = $show == 'invitations' ? 'active' : null;
                 $html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/invitations.php">' . Display::return_icon('invitation.png', get_lang('Invitations'), array()) . get_lang('Invitations') . $total_invitations . '</a></li>';
             }
             $html .= '<li class="active"><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php">' . Display::return_icon('my_shared_profile.png', get_lang('ViewMySharedProfile'), array('style' => 'float:left')) . '' . get_lang('ViewMySharedProfile') . '</a></li>
                       <li><a href="' . api_get_path(WEB_PATH) . 'main/social/friends.php">' . Display::return_icon('friend.png', get_lang('Friends'), array()) . get_lang('Friends') . '</a></li>
                       <li><a href="' . api_get_path(WEB_PATH) . 'main/social/groups.php">' . Display::return_icon('group_s.png', get_lang('SocialGroups'), array()) . get_lang('SocialGroups') . '</a></li>';
             $active = $show == 'search' ? 'active' : null;
             $html .= '<li class="' . $active . '"><a href="' . api_get_path(WEB_PATH) . 'main/social/search.php">' . Display::return_icon('zoom.png', get_lang('Search'), array()) . get_lang('Search') . '</a></li>';
         }
         // My friend profile
         if (api_get_setting('allow_message_tool') == 'true') {
             if ($user_id != api_get_user_id()) {
                 $html .= '<li><a href="javascript:void(0);" onclick="javascript:send_message_to_user(\'' . $user_id . '\');" title="' . get_lang('SendMessage') . '">';
                 $html .= Display::return_icon('compose_message.png', get_lang('SendMessage')) . '&nbsp;&nbsp;' . get_lang('SendMessage') . '</a></li>';
             }
             //check if I already sent an invitation message
             $invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
             if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0) {
                 $html .= '<li><a href="' . api_get_path(WEB_PATH) . 'main/social/invitations.php">' . Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')) . '&nbsp;&nbsp;' . get_lang('YouAlreadySentAnInvitation') . '</a></li>';
             } else {
                 if (!$show_full_profile) {
                     $html .= '<li><a  href="javascript:void(0);" onclick="javascript:send_invitation_to_user(\'' . $user_id . '\');" title="' . get_lang('SendInvitation') . '">' . Display::return_icon('invitation.png', get_lang('SocialInvitationToFriends')) . '&nbsp;' . get_lang('SendInvitation') . '</a></li>';
                 }
             }
         }
         //@todo check if user is online and if it's a friend to show the chat link
         if (api_is_global_chat_enabled()) {
             $user_name = $user_info['complete_name'];
             if ($user_friend_relation == USER_RELATION_TYPE_FRIEND) {
                 if ($user_id != api_get_user_id()) {
                     //Only show chat if I'm available to talk
                     if ($current_user_info['user_is_online_in_chat'] == 1) {
                         $options = array('onclick' => "javascript:chatWith('" . $user_id . "', '" . Security::remove_XSS($user_name) . "', '" . $user_info['user_is_online_in_chat'] . "')");
                         $chat_icon = $user_info['user_is_online_in_chat'] ? Display::return_icon('online.png', get_lang('Online')) : Display::return_icon('offline.png', get_lang('Offline'));
                         $html .= Display::tag('li', Display::url($chat_icon . '&nbsp;&nbsp;' . get_lang('Chat'), 'javascript:void(0);', $options));
                     }
                 }
             } else {
                 // Do something?
                 if ($user_id != api_get_user_id()) {
                     if ($current_user_info['user_is_online_in_chat'] == 1) {
                         $message = Security::remove_XSS(sprintf(get_lang("YouHaveToAddXAsAFriendFirst"), $user_name));
                         $options = array('onclick' => "javascript:chatNotYetWith('" . $message . "')");
                         $chat_icon = $user_info['user_is_online_in_chat'] ? Display::return_icon('online.png', get_lang('Online')) : Display::return_icon('offline.png', get_lang('Offline'));
                         $html .= Display::tag('li', Display::url($chat_icon . '&nbsp;&nbsp;' . get_lang('Chat'), 'javascript:void(0);', $options));
                     }
                 }
             }
         }
         $html .= '</ul></div>';
         if ($show_full_profile && $user_id == intval(api_get_user_id())) {
             $personal_course_list = UserManager::get_personal_session_course_list($user_id);
             $course_list_code = array();
             $i = 1;
             if (is_array($personal_course_list)) {
                 foreach ($personal_course_list as $my_course) {
                     if ($i <= 10) {
                         $course_list_code[] = array('code' => $my_course['code']);
                     } else {
                         break;
                     }
                     $i++;
                 }
                 //to avoid repeted courses
                 $course_list_code = ArrayClass::array_unique_dimensional($course_list_code);
             }
             //-----Announcements
             $my_announcement_by_user_id = intval($user_id);
             $announcements = array();
             foreach ($course_list_code as $course) {
                 $course_info = api_get_course_info($course['code']);
                 if (!empty($course_info)) {
                     $content = AnnouncementManager::get_all_annoucement_by_user_course($course_info['code'], $my_announcement_by_user_id);
                     if (!empty($content)) {
                         $url = Display::url(Display::return_icon('announcement.png', get_lang('Announcements')) . $course_info['name'] . ' (' . $content['count'] . ')', api_get_path(WEB_CODE_PATH) . 'announcements/announcements.php?cidReq=' . $course['code']);
                         $announcements[] = Display::tag('li', $url);
                     }
                 }
             }
             if (!empty($announcements)) {
                 //echo '<div align="center" class="social-menu-title" ><span class="social-menu-text1">'.get_lang('ToolAnnouncement').'</span></div>';
                 $html .= '<div class="social_menu_items">';
                 $html .= '<ul>';
                 foreach ($announcements as $announcement) {
                     $html .= $announcement;
                 }
                 $html .= '</ul>';
                 $html .= '</div>';
             }
         }
     }
     if ($show_delete_account_button) {
         $html .= '<div class="sidebar-nav"><ul><li>';
         $url = api_get_path(WEB_CODE_PATH) . 'auth/unsubscribe_account.php';
         $html .= Display::url(Display::return_icon('delete.png', get_lang('Unsubscribe'), array(), ICON_SIZE_TINY) . get_lang('Unsubscribe'), $url);
         $html .= '</li></ul></div>';
     }
     $html .= '</div>';
     return $html;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:social.lib.php

示例7: indexAction


//.........这里部分代码省略.........
             $column_names = array(get_lang('Company'), get_lang('TrainingHoursAccumulated'), get_lang('CountOfSubscriptions'), get_lang('CountOfUsers'), get_lang('AverageHoursPerStudent'), get_lang('CountCertificates'));
             $result = \CourseManager::get_user_list_from_course_code(null, null, "LIMIT {$start}, {$limit}", " {$sidx} {$sord}", null, null, true, true, 'ruc');
             $new_result = array();
             if (!empty($result)) {
                 foreach ($result as $row) {
                     $row['training_hours'] = api_time_to_hms($row['training_hours']);
                     $row['average_hours_per_user'] = api_time_to_hms($row['average_hours_per_user']);
                     $new_result[] = $row;
                 }
                 $result = $new_result;
             }
             break;
         case 'get_user_course_report':
             $columns = array('course', 'user', 'time', 'certificate', 'progress_100', 'progress');
             $column_names = array(get_lang('Course'), get_lang('User'), get_lang('ManHours'), get_lang('CertificateGenerated'), get_lang('Approved'), get_lang('CourseAdvance'));
             $extra_fields = \UserManager::get_extra_fields(0, 100, null, null, true, true);
             if (!empty($extra_fields)) {
                 foreach ($extra_fields as $extra) {
                     $columns[] = $extra['1'];
                     $column_names[] = $extra['3'];
                 }
             }
             $result = \CourseManager::get_user_list_from_course_code(null, null, "LIMIT {$start}, {$limit}", " {$sidx} {$sord}", null, null, true);
             break;
         case 'get_user_skill_ranking':
             $columns = array('photo', 'firstname', 'lastname', 'skills_acquired', 'currently_learning', 'rank');
             $result = $skill->get_user_list_skill_ranking($start, $limit, $sidx, $sord, $where_condition);
             $result = \ArrayClass::msort($result, 'skills_acquired', 'asc');
             $skills_in_course = array();
             if (!empty($result)) {
                 //$counter = 1;
                 foreach ($result as &$item) {
                     $user_info = api_get_user_info($item['user_id']);
                     $personal_course_list = \UserManager::get_personal_session_course_list($item['user_id']);
                     $count_skill_by_course = array();
                     foreach ($personal_course_list as $course_item) {
                         if (!isset($skills_in_course[$course_item['code']])) {
                             $count_skill_by_course[$course_item['code']] = $skill->get_count_skills_by_course($course_item['code']);
                             $skills_in_course[$course_item['code']] = $count_skill_by_course[$course_item['code']];
                         } else {
                             $count_skill_by_course[$course_item['code']] = $skills_in_course[$course_item['code']];
                         }
                     }
                     $item['photo'] = \Display::img($user_info['avatar_small']);
                     $item['currently_learning'] = !empty($count_skill_by_course) ? array_sum($count_skill_by_course) : 0;
                 }
             }
             break;
         case 'get_work_user_list':
             if (isset($type) && $type == 'simple') {
                 $columns = array('type', 'firstname', 'lastname', 'username', 'title', 'qualification', 'sent_date', 'qualificator_id', 'actions');
             } else {
                 $columns = array('type', 'firstname', 'lastname', 'username', 'title', 'sent_date', 'actions');
             }
             $result = get_work_user_list($start, $limit, $sidx, $sord, $work_id, $where_condition);
             break;
         case 'get_exercise_results':
             $course = api_get_course_info();
             //used inside get_exam_results_data()
             $documentPath = api_get_path(SYS_COURSE_PATH) . $course['path'] . "/document";
             if ($is_allowedToEdit) {
                 $columns = array('firstname', 'lastname', 'username', 'group_name', 'exe_duration', 'start_date', 'exe_date', 'score', 'status', 'lp', 'actions');
             } else {
                 //$columns = array('exe_duration', 'start_date', 'exe_date', 'score', 'status', 'actions');
             }
             $result = \ExerciseLib::get_exam_results_data($start, $limit, $sidx, $sord, $exercise_id, $where_condition);
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:67,代码来源:ModelAjaxController.php

示例8: show_social_menu


//.........这里部分代码省略.........
         if ($user_id != api_get_user_id()) {
             $html .= '<li><a href="#" class="btn-to-send-message" data-send-to="' . $user_id . '" title="' . get_lang('SendMessage') . '">';
             $html .= Display::return_icon('compose_message.png', get_lang('SendMessage')) . '&nbsp;&nbsp;' . get_lang('SendMessage') . '</a></li>';
         }
         // Check if I already sent an invitation message
         $invitation_sent_list = SocialManager::get_list_invitation_sent_by_user_id(api_get_user_id());
         if (isset($invitation_sent_list[$user_id]) && is_array($invitation_sent_list[$user_id]) && count($invitation_sent_list[$user_id]) > 0) {
             $html .= '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'social/invitations.php">' . Display::return_icon('invitation.png', get_lang('YouAlreadySentAnInvitation')) . '&nbsp;&nbsp;' . get_lang('YouAlreadySentAnInvitation') . '</a></li>';
         } else {
             if (!$show_full_profile) {
                 $html .= '<li><a class="btn-to-send-invitation" href="#" data-send-to="' . $user_id . '" title="' . get_lang('SendInvitation') . '">' . Display::return_icon('invitation.png', get_lang('SocialInvitationToFriends')) . '&nbsp;' . get_lang('SendInvitation') . '</a></li>';
             }
         }
         // Chat
         //@todo check if user is online and if it's a friend to show the chat link
         /*if (api_is_global_chat_enabled()) {
                         $user_name = $user_info['complete_name'];
         
                         if ($user_friend_relation == USER_RELATION_TYPE_FRIEND) {
                             if ($user_id != api_get_user_id()) {
                                 //Only show chat if I'm available to talk
                                 if ($current_user_info['user_is_online_in_chat'] == 1) {
                                     $options = array('onclick' => "javascript:chatWith('".$user_id."', '".Security::remove_XSS($user_name)."', '".$user_info['user_is_online_in_chat']."')");
                                     $chat_icon = $user_info['user_is_online_in_chat'] ? Display::return_icon('online.png', get_lang('Online')) : Display::return_icon('offline.png', get_lang('Offline'));
                                     $html .= Display::tag('li',
                                         Display::url(
                                             $chat_icon.'&nbsp;&nbsp;'.get_lang('Chat'),
                                             'javascript:void(0);',
                                             $options
                                         )
                                     );
                                 }
                             }
                         } else {
                             if ($user_id != api_get_user_id()) {
                                 if ($current_user_info['user_is_online_in_chat'] == 1) {
                                     $message = Security::remove_XSS(sprintf(get_lang("YouHaveToAddXAsAFriendFirst"), $user_name));
                                     $options = array('onclick' => "javascript:chatNotYetWith('".$message."')");
                                     $chat_icon = $user_info['user_is_online_in_chat'] ? Display::return_icon('online.png', get_lang('Online')) : Display::return_icon('offline.png', get_lang('Offline'));
                                     $html .= Display::tag('li',
                                         Display::url(
                                             $chat_icon.'&nbsp;&nbsp;'.get_lang('Chat'),
                                             'javascript:void(0);',
                                             $options
                                         )
                                     );
                                 }
                             }
                         }
                     }*/
         $html .= '</ul></div></div>';
         if ($show_full_profile && $user_id == intval(api_get_user_id())) {
             $personal_course_list = UserManager::get_personal_session_course_list($user_id);
             $course_list_code = array();
             $i = 1;
             if (is_array($personal_course_list)) {
                 foreach ($personal_course_list as $my_course) {
                     if ($i <= 10) {
                         $course_list_code[] = array('code' => $my_course['code']);
                     } else {
                         break;
                     }
                     $i++;
                 }
                 // To avoid repeated courses
                 $course_list_code = array_unique_dimensional($course_list_code);
             }
             // Announcements
             $my_announcement_by_user_id = intval($user_id);
             $announcements = array();
             foreach ($course_list_code as $course) {
                 $course_info = api_get_course_info($course['code']);
                 if (!empty($course_info)) {
                     $content = AnnouncementManager::get_all_annoucement_by_user_course($course_info['code'], $my_announcement_by_user_id);
                     if (!empty($content)) {
                         $url = Display::url(Display::return_icon('announcement.png', get_lang('Announcements')) . $course_info['name'] . ' (' . $content['count'] . ')', api_get_path(WEB_CODE_PATH) . 'announcements/announcements.php?cidReq=' . $course['code']);
                         $announcements[] = Display::tag('li', $url);
                     }
                 }
             }
             if (!empty($announcements)) {
                 $html .= '<div class="social_menu_items">';
                 $html .= '<ul>';
                 foreach ($announcements as $announcement) {
                     $html .= $announcement;
                 }
                 $html .= '</ul>';
                 $html .= '</div>';
             }
         }
     }
     if ($show_delete_account_button) {
         $html .= '<div class="sidebar-nav"><ul><li>';
         $url = api_get_path(WEB_CODE_PATH) . 'auth/unsubscribe_account.php';
         $html .= Display::url(Display::return_icon('delete.png', get_lang('Unsubscribe'), array(), ICON_SIZE_TINY) . get_lang('Unsubscribe'), $url);
         $html .= '</li></ul></div>';
     }
     $html .= '';
     return $html;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:social.lib.php

示例9: onAuthenticationSuccess

 /**
  * @param Request $request
  * @param TokenInterface $token
  * @return null|RedirectResponse|\Symfony\Component\Security\Http\Authentication\Response
  */
 public function onAuthenticationSuccess(Request $request, TokenInterface $token)
 {
     /** @var User $user */
     $user = $token->getUser();
     $userId = $user->getId();
     $session = $request->getSession();
     $userInfo = api_get_user_info($user->getId());
     $userInfo['is_anonymous'] = false;
     // Backward compatibility.
     $ip = $request->getClientIp();
     // Setting user info.
     $request->getSession()->set('_user', $userInfo);
     // Setting admin permissions for.
     if ($this->security->isGranted('ROLE_ADMIN')) {
         $request->getSession()->set('is_platformAdmin', true);
     }
     // Setting teachers permissions.
     if ($this->security->isGranted('ROLE_TEACHER')) {
         $request->getSession()->set('is_allowedCreateCourse', true);
     }
     // Setting last login datetime
     $session->set('user_last_login_datetime', api_get_utc_datetime());
     $response = null;
     /* Possible values: index.php, user_portal.php, main/auth/courses.php */
     $pageAfterLogin = api_get_setting('registration.page_after_login');
     $url = null;
     if ($this->security->isGranted('ROLE_STUDENT') && !empty($pageAfterLogin)) {
         switch ($pageAfterLogin) {
             case 'index.php':
                 $url = $this->router->generate('home');
                 break;
             case 'user_portal.php':
                 $url = $this->router->generate('userportal');
                 break;
             case 'main/auth/courses.php':
                 $url = api_get_path(WEB_PUBLIC_PATH) . $pageAfterLogin;
                 break;
         }
     }
     // Redirecting to a course or a session.
     if (api_get_setting('course.go_to_course_after_login') == 'true') {
         // Get the courses list
         $personal_course_list = \UserManager::get_personal_session_course_list($userId);
         $my_session_list = array();
         $count_of_courses_no_sessions = 0;
         $count_of_courses_with_sessions = 0;
         foreach ($personal_course_list as $course) {
             if (!empty($course['session_id'])) {
                 $my_session_list[$course['session_id']] = true;
                 $count_of_courses_with_sessions++;
             } else {
                 $count_of_courses_no_sessions++;
             }
         }
         $count_of_sessions = count($my_session_list);
         if ($count_of_sessions == 1 && $count_of_courses_no_sessions == 0) {
             $key = array_keys($personal_course_list);
             $course_info = $personal_course_list[$key[0]]['course_info'];
             $id_session = isset($course_info['session_id']) ? $course_info['session_id'] : 0;
             $url = api_get_path(WEB_COURSE_PATH) . $course_info['directory'] . '/index.php?id_session=' . $id_session;
         }
         if ($count_of_sessions == 0 && $count_of_courses_no_sessions == 1) {
             $key = array_keys($personal_course_list);
             $course_info = $personal_course_list[$key[0]]['course_info'];
             $url = api_get_path(WEB_COURSE_PATH) . $course_info['directory'] . '/index.php?id_session=0';
         }
     }
     if (!empty($url)) {
         $response = new RedirectResponse($url);
     }
     // Redirect the user to where they were before the login process begun.
     if (empty($response)) {
         $url = $request->headers->get('referer');
         /*// if the referer is the login use the home.
           if (strpos($url, 'login') !== false) {
               $url = $this->router->generate('home');
           }*/
         $response = new RedirectResponse($url);
     }
     return $response;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:86,代码来源:LoginSuccessHandler.php


注:本文中的UserManager::get_personal_session_course_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。