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


PHP GroupManager::number_of_students方法代码示例

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


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

示例1: get_group_list_of_course

 /**
  * Get the list of groups from the course
  * @param   string $course_code
  * @param   int $session_id Session ID (optional)
  * @param   boolean $in_get_empty_group get empty groups (optional)
  * @return  array   List of groups info
  */
 public static function get_group_list_of_course($course_code, $session_id = 0, $in_get_empty_group = 0)
 {
     $course_info = api_get_course_info($course_code);
     if (empty($course_info)) {
         return array();
     }
     $course_id = $course_info['real_id'];
     if (empty($course_id)) {
         return array();
     }
     $group_list = array();
     $session_id != 0 ? $session_condition = ' WHERE g.session_id IN(1,' . intval($session_id) . ')' : ($session_condition = ' WHERE g.session_id = 0');
     if ($in_get_empty_group == 0) {
         // get only groups that are not empty
         $sql = "SELECT DISTINCT g.id, g.name\n                    FROM " . Database::get_course_table(TABLE_GROUP) . " AS g\n                    INNER JOIN " . Database::get_course_table(TABLE_GROUP_USER) . " gu\n                    ON (g.id = gu.group_id AND g.c_id = {$course_id} AND gu.c_id = {$course_id})\n                    {$session_condition}\n                    ORDER BY g.name";
     } else {
         // get all groups even if they are empty
         $sql = "SELECT g.id, g.name\n                    FROM " . Database::get_course_table(TABLE_GROUP) . " AS g\n                    {$session_condition}\n                    AND c_id = {$course_id}";
     }
     $result = Database::query($sql);
     while ($group_data = Database::fetch_array($result)) {
         $group_data['userNb'] = GroupManager::number_of_students($group_data['id'], $course_id);
         $group_list[$group_data['id']] = $group_data;
     }
     return $group_list;
 }
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:33,代码来源:course.lib.php

示例2: get_lang

     $create_groups_form->addGroup($group_el, 'create_groups', get_lang('NumberOfGroupsToCreate'), ' ', false);
     $defaults = array();
     $defaults['number_of_groups'] = 1;
     $create_groups_form->setDefaults($defaults);
     $create_groups_form->display();
 } else {
     echo get_lang('NoCategoriesDefined');
 }
 /*
  * Show form to generate subgroups
  */
 if (api_get_setting('allow_group_categories') == 'true' && count(GroupManager::get_group_list()) > 0) {
     $base_group_options = array();
     $groups = GroupManager::get_group_list();
     foreach ($groups as $index => $group) {
         $number_of_students = GroupManager::number_of_students($group['id']);
         if ($number_of_students > 0) {
             $base_group_options[$group['id']] = $group['name'] . ' (' . $number_of_students . ' ' . get_lang('Users') . ')';
         }
     }
     if (count($base_group_options) > 0) {
         $create_subgroups_form = new FormValidator('create_subgroups');
         $create_subgroups_form->addElement('header', get_lang('CreateSubgroups'));
         $create_subgroups_form->addElement('html', get_lang('CreateSubgroupsInfo'));
         $create_subgroups_form->addElement('hidden', 'action');
         $group_el = array();
         $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups'));
         $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, array('size' => 3));
         $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom'));
         $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options);
         $group_el[] = $create_subgroups_form->createElement('button', 'submit', get_lang('Ok'));
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:group_creation.php


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