本文整理汇总了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');