Ejemplo n.º 1
0
        $urlroot = $CFG->wwwroot . '/email/contacts/list.php?id=' . $course->id;
        $showall = 1;
        echo '<br/>';
        print_group_menu($groups, $groupsmode, $currentgroup, $urlroot, $showall);
    } else {
        // Prints only groups current user is a participant of
        $usergroups = groups_get_groups_for_user($USER->id, $course->id);
        // Shows a Show all users to users in multiple groups
        $showall = 0;
        if (count($usergroups) > 1) {
            $showall = 1;
        }
        $usergroups = groups_groupids_to_groups($usergroups, $course->id);
        $urlroot = $CFG->wwwroot . '/email/contacts/list.php?id=' . $course->id;
        echo '<br/>';
        print_group_menu($usergroups, $course->groupmode, $selgroup, $urlroot, $showall);
    }
}
//--------- l'frame
echo '<hr />';
echo '<div id="search_res"></div>' . '<iframe id="idsearch" name="bssearch" src="search.php?id=' . $id . '&pop=si&group=' . $selgroup . '" style="display:none;"></iframe>' . "\n\n";
// '<iframe id="idsearch" name="isearch" src="search.php?id='.$cm->id.'&cid='.$course->id.'" style="display:none;"></iframe>';
?>
<script type="text/javascript" language="JavaScript" >
 <!-- // Non-Static Javascript functions

// This function checks all added users and enables the remove user if they have
// already been added to the email
function checkAllRemoveActions() {
    var addedids = null;
    var icon = null;
Ejemplo n.º 2
0
/**
 * A big combination function to make it easier for modules
 * to set up groups.
 *
 * Terminates if the current user shouldn't be looking at this group
 * Otherwise returns the current group if there is one
 * Otherwise returns false if groups aren't relevant
 *
 * @uses SEPARATEGROUPS
 * @uses VISIBLEGROUPS
 * @param course $course A {@link $COURSE} object
 * @param int $groupmode Either NOGROUPS, SEPARATEGROUPS or VISIBLEGROUPS
 * @param string $urlroot ?
 * @return int|false
 */
function setup_and_print_groups($course, $groupmode, $urlroot)
{
    global $USER, $SESSION;
    //needs his id, need to hack his groups in session
    $changegroup = optional_param('group', -1, PARAM_INT);
    $currentgroup = get_and_set_current_group($course, $groupmode, $changegroup);
    if ($currentgroup === false) {
        return false;
    }
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    if ($groupmode == SEPARATEGROUPS and !$currentgroup and !has_capability('moodle/site:accessallgroups', $context)) {
        //we are in separate groups and the current group is group 0, as last set.
        //this can mean that either, this guy has no group
        //or, this guy just came from a visible all forum, and he left when he set his current group to 0 (show all)
        if ($usergroups = groups_get_all_groups($course->id, $USER->id)) {
            //for the second situation, we need to perform the trick and get him a group.
            $first = reset($usergroups);
            $currentgroup = get_and_set_current_group($course, $groupmode, $first->id);
        } else {
            //else he has no group in this course
            print_heading(get_string('notingroup'));
            print_footer($course);
            exit;
        }
    }
    if ($groupmode == VISIBLEGROUPS or $groupmode and has_capability('moodle/site:accessallgroups', $context)) {
        if ($groups = groups_get_all_groups($course->id)) {
            echo '<div class="groupselector">';
            print_group_menu($groups, $groupmode, $currentgroup, $urlroot, 1);
            echo '</div>';
        }
    } else {
        if ($groupmode == SEPARATEGROUPS and has_capability('moodle/course:view', $context)) {
            //get all the groups this guy is in in this course
            if ($usergroups = groups_get_all_groups($course->id, $USER->id)) {
                echo '<div class="groupselector">';
                //print them in the menu
                print_group_menu($usergroups, $groupmode, $currentgroup, $urlroot, 0);
                echo '</div>';
            }
        }
    }
    return $currentgroup;
}
Ejemplo n.º 3
0
            print_group_menu($groups, $groupmode, $currentgroup, "{$CFG->wwwroot}/mod/mumiemodule/view.php?id={$cm->id}");
            print_box_end();
            // groupmenu
        }
    } else {
        if ($groupmode == SEPARATEGROUPS) {
            $validgroups = array();
            // Get all the groups this guy is in in this course
            if ($p = user_group($course->id, $USER->id)) {
                /// Extract the name and id for the group
                foreach ($p as $index => $object) {
                    $validgroups[$object->id] = $object->name;
                }
                /// Print them in the menu
                print_box_start('groupmenu');
                print_group_menu($validgroups, $groupmode, $currentgroup, "view.php?id={$cm->id}", 0);
                print_box_end();
                // groupmenu
            }
        }
    }
    echo '<br />';
    if (!empty($showall)) {
        show_grades($currentgroup, $cm, $course, $mumiemodule);
    } else {
        show_grades($currentgroup, $cm, $course, $mumiemodule);
    }
} else {
    if (has_capability('mod/mumiemodule:participate', $context)) {
        if (!record_exists('mumiemodule_students', 'mumiemodule', $mumiemodule->id, 'userid', $USER->id)) {
            error("You have to take part in this activity to take a look! So you should be part of a group.", "../../course/view.php?id=" . $COURSE->id);