當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserGroup::getUserGroupInCourse方法代碼示例

本文整理匯總了PHP中UserGroup::getUserGroupInCourse方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserGroup::getUserGroupInCourse方法的具體用法?PHP UserGroup::getUserGroupInCourse怎麽用?PHP UserGroup::getUserGroupInCourse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserGroup的用法示例。


在下文中一共展示了UserGroup::getUserGroupInCourse方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: create_class_groups

 /**
  * Create a group for every class subscribed to the current course
  * @param int $category_id The category in which the groups should be created
  * @return array
  */
 public static function create_class_groups($category_id)
 {
     $options['where'] = array(" usergroup.course_id = ? " => api_get_real_course_id());
     $obj = new UserGroup();
     $classes = $obj->getUserGroupInCourse($options);
     $group_ids = array();
     foreach ($classes as $class) {
         $users_ids = $obj->get_users_by_usergroup($class['id']);
         $group_id = self::create_group($class['name'], $category_id, 0, count($users_ids));
         self::subscribe_users($users_ids, $group_id);
         $group_ids[] = $group_id;
     }
     return $group_ids;
 }
開發者ID:omaoibrahim,項目名稱:chamilo-lms,代碼行數:19,代碼來源:groupmanager.lib.php

示例2: array

         $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'));
         $create_subgroups_form->addGroup($group_el, 'create_groups', null, ' ', false);
         $defaults = array();
         $defaults['action'] = 'create_subgroups';
         $create_subgroups_form->setDefaults($defaults);
         $create_subgroups_form->display();
     }
 }
 /*
  * Show form to generate groups from classes subscribed to the course
  */
 $options['where'] = array(" usergroup.course_id = ? " => api_get_real_course_id());
 $obj = new UserGroup();
 $classes = $obj->getUserGroupInCourse($options);
 if (count($classes) > 0) {
     echo '<b>' . get_lang('GroupsFromClasses') . '</b>';
     echo '<blockquote>';
     echo '<p>' . get_lang('GroupsFromClassesInfo') . '</p>';
     echo '<ul>';
     foreach ($classes as $index => $class) {
         $number_of_users = count($obj->get_users_by_usergroup($class['id']));
         echo '<li>';
         echo $class['name'];
         echo ' (' . $number_of_users . ' ' . get_lang('Users') . ')';
         echo '</li>';
     }
     echo '</ul>';
     $create_class_groups_form = new FormValidator('create_class_groups_form', 'post', api_get_self() . '?' . api_get_cidreq());
     $create_class_groups_form->addElement('hidden', 'action');
開發者ID:KRCM13,項目名稱:chamilo-lms,代碼行數:31,代碼來源:group_creation.php


注:本文中的UserGroup::getUserGroupInCourse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。