本文整理匯總了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;
}
示例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');