Пример #1
0
/**
 * Returns the display name of a grouping - the grouping name followed 
 * by the number of groups in the grouping in brackets.
 * @param int $groupingid The grouping ID.
 * @param int $courseid The related course.
 * @return string The display name of the grouping
 */
function groups_get_grouping_displayname($groupingid, $courseid)
{
    if ($groupingname = groups_get_grouping_name($groupingid)) {
        $count = groups_count_groups_in_grouping($groupingid, $courseid);
        return "{$groupingname} ({$count})";
    }
    return false;
}
Пример #2
0
 <input type="hidden" name="roleid" value="<?php p($roleid) ?>" />
 */
 echo '<table cellpadding="6" class="generaltable generalbox groupmanagementtable boxaligncenter" summary="">' . "\n";
 echo '<tr>' . "\n";
 if (empty($CFG->enablegroupings)) {
     // NO GROUPIGS YET!
     $sel_groupingid = -1;
 } else {
     echo '<td class="generalboxcontent">' . "\n";
     echo '<p><label for="groupings">' . get_string('groupings', 'group') . '<span id="dummygrouping">&nbsp;</span></label></p>' . "\n";
     echo '<select name="grouping" id="groupings" size="15" class="select"';
     echo ' onchange="groupsCombo.refreshGroups(this.options[this.selectedIndex].value);"';
     //NOTE: onclick/onmouseout is for long names in IE6 (Firefox/IE7 display OPTION title).
     echo ' onclick="window.status=this.options[this.selectedIndex].title;" onmouseout="window.status=\'\';">' . "\n";
     $groupingids = groups_get_groupings($courseid);
     if (groups_count_groups_in_grouping(GROUP_NOT_IN_GROUPING, $courseid) > 0) {
         //NOTE, only show the pseudo-grouping if it has groups.
         $groupingids[] = GROUP_NOT_IN_GROUPING;
     }
     $sel_groupingid = -1;
     if ($groupingids) {
         // Put the groupings into a hash and sort them
         foreach ($groupingids as $id) {
             $listgroupings[$id] = groups_get_grouping_displayname($id, $courseid);
         }
         natcasesort($listgroupings);
         // Print out the HTML
         $count = 1;
         foreach ($listgroupings as $id => $name) {
             $select = '';
             if ($groupingid == $id) {