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