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


PHP CourseManager::get_real_and_linked_user_list方法代码示例

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


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

示例1: get_course_users

 /**
  * this function gets all the users of the course,
  * including users from linked courses
  * @deprecate use CourseManager class
  */
 public static function get_course_users()
 {
     //this would return only the users from real courses:
     $session_id = api_get_session_id();
     if ($session_id != 0) {
         $userList = CourseManager::get_real_and_linked_user_list(api_get_course_id(), true, $session_id, true);
     } else {
         $userList = CourseManager::get_real_and_linked_user_list(api_get_course_id(), false, 0, true);
     }
     return $userList;
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:16,代码来源:AnnouncementManager.php

示例2: fill_groups_list

 /**
  *
  * See : fill_groups
  *       Fill the groups with students.
  *
  * note : optimize fill_groups_list <--> fill_groups
  * @param array $group_ids
  * @return array|bool
  */
 public static function fill_groups_list($group_ids)
 {
     $group_ids = is_array($group_ids) ? $group_ids : array($group_ids);
     $group_ids = array_map('intval', $group_ids);
     /*if (api_is_course_coach()) {
           for ($i = 0; $i < count($group_ids); $i++) {
               if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])) {
                   array_splice($group_ids, $i, 1);
                   $i--;
               }
           }
           if (count($group_ids) == 0) {
               return false;
           }
       }*/
     $_course = api_get_course_info();
     $category = self::get_category_from_group($group_ids[0]);
     $groups_per_user = $category['groups_per_user'];
     $group_table = Database::get_course_table(TABLE_GROUP);
     $group_user_table = Database::get_course_table(TABLE_GROUP_USER);
     $session_id = api_get_session_id();
     $complete_user_list = CourseManager::get_real_and_linked_user_list($_course['sysCode'], true, $session_id);
     $number_groups_per_user = $groups_per_user == self::GROUP_PER_MEMBER_NO_LIMIT ? self::INFINITE : $groups_per_user;
     $course_id = api_get_course_int_id();
     /*
      * Retrieve all the groups where enrollment is still allowed
      * (reverse) ordered by the number of place available
      */
     $sql = "SELECT g.id gid, count(ug.user_id) count_users, g.max_student\n                FROM " . $group_table . " g\n                LEFT JOIN  " . $group_user_table . " ug\n                ON    g.id = ug.group_id\n                WHERE   g.c_id = {$course_id} AND\n                        ug.c_id = {$course_id} AND\n                        g.id IN (" . implode(',', $group_ids) . ")\n                GROUP BY (g.id)";
     $sql_result = Database::query($sql);
     $group_available_place = array();
     while ($group = Database::fetch_array($sql_result, 'ASSOC')) {
         if (!empty($group['max_student'])) {
             $places = intval($group['max_student'] - $group['count_users']);
         } else {
             $places = self::MEMBER_PER_GROUP_NO_LIMIT;
         }
         $group_available_place[$group['gid']] = $places;
     }
     /*
      * Retrieve course users (reverse) ordered by the number
      * of group they are already enrolled
      */
     for ($i = 0; $i < count($complete_user_list); $i++) {
         //find # of groups the user is enrolled in
         $number_of_groups = self::user_in_number_of_groups($complete_user_list[$i]["user_id"], $category['id']);
         //add # of groups to user list
         $complete_user_list[$i]['number_groups_left'] = $number_groups_per_user - $number_of_groups;
     }
     //first sort by user_id to filter out duplicates
     $complete_user_list = TableSort::sort_table($complete_user_list, 'user_id');
     $complete_user_list = self::filter_duplicates($complete_user_list, 'user_id');
     //$complete_user_list = self :: filter_only_students($complete_user_list);
     //now sort by # of group left
     $complete_user_list = TableSort::sort_table($complete_user_list, 'number_groups_left', SORT_DESC);
     return $complete_user_list;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:66,代码来源:groupmanager.lib.php

示例3: generate_user_group_array

 static function generate_user_group_array($course_code, $session_id = 0)
 {
     $order = api_is_western_name_order() ? 'firstname' : 'lastname';
     $user_list = CourseManager::get_real_and_linked_user_list($course_code, true, $session_id, $order);
     $group_list = CourseManager::get_group_list_of_course($course_code, $session_id, 1);
     $items = self::transform_user_group_array($user_list, $group_list);
     return $items;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:8,代码来源:usermanager.lib.php


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