~ubuntu-branches/ubuntu/dapper/moodle/dapper-backports

« back to all changes in this revision

Viewing changes to course/groups.php

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2006-12-01 14:00:21 UTC
  • mfrom: (6.1.5 feisty)
  • Revision ID: james.westby@ubuntu.com-20061201140021-rivugg5tgx6mujzg
Tags: 1.6.3-1ubuntu1~dapper1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php // $Id: groups.php,v 1.19.2.2 2005/10/30 22:14:03 skodak Exp $
 
1
<?php // $Id: groups.php,v 1.24 2006/03/07 19:36:12 skodak Exp $
 
2
 
 
3
///////////////////////////////////////////////////////////////////////////
 
4
//                                                                       //
 
5
// NOTICE OF COPYRIGHT                                                   //
 
6
//                                                                       //
 
7
// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
 
8
//          http://moodle.org                                            //
 
9
//                                                                       //
 
10
// Copyright (C) 1999-2004  Martin Dougiamas  http://dougiamas.com       //
 
11
//                                                                       //
 
12
// This program is free software; you can redistribute it and/or modify  //
 
13
// it under the terms of the GNU General Public License as published by  //
 
14
// the Free Software Foundation; either version 2 of the License, or     //
 
15
// (at your option) any later version.                                   //
 
16
//                                                                       //
 
17
// This program is distributed in the hope that it will be useful,       //
 
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
 
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
 
20
// GNU General Public License for more details:                          //
 
21
//                                                                       //
 
22
//          http://www.gnu.org/copyleft/gpl.html                         //
 
23
//                                                                       //
 
24
///////////////////////////////////////////////////////////////////////////
2
25
 
3
26
/// Editing interface to edit all the groups in a course
4
27
 
5
28
    require_once('../config.php');
6
29
    require_once('lib.php');
7
30
 
8
 
    $courseid      = required_param('id');           // Course id
9
 
    $selectedgroup = optional_param('group', NULL);  // Current group id
 
31
    $courseid      = required_param('id', PARAM_INT);           // Course id
 
32
    $selectedgroup = optional_param('group', NULL, PARAM_INT);  // Current group id
10
33
 
11
34
    if (! $course = get_record('course', 'id', $courseid) ) {
12
35
        error("That's an invalid course id");
42
65
                 "-> $strgroups", "", "", true, '', user_login_string($course, $USER));
43
66
 
44
67
 
45
 
 
46
68
/// First, process any inputs there may be.
47
69
 
48
70
    if ($data = data_submitted() and confirm_sesskey()) {
57
79
            if (!empty($data->nonmembers) and !empty($data->groupid)) {
58
80
                $groupmodified = false;
59
81
                foreach ($data->nonmembers as $userid) {
60
 
                    if (!user_group($course->id, $userid)) {  // Just to make sure (another teacher could be editing)
 
82
                    //since we allow people to be in more than 1 group, this has to go.
 
83
                    if (!ismember($data->groupid,$userid)) {// Just to make sure (another teacher could be editing)
61
84
                        $record->groupid = $data->groupid;
62
85
                        $record->userid = $userid;
63
86
                        $record->timeadded = time();
125
148
 
126
149
/// Calculate data ready to create the editing interface
127
150
 
 
151
    $strmemberincourse = get_string('memberincourse');
128
152
    $strgroupnonmembers = get_string('groupnonmembers');
129
153
    $strgroupmembersselected = get_string('groupmembersselected');
130
154
    $strgroupremovemembers = get_string('groupremovemembers');
172
196
            if ($groupusers = get_group_users($group->id)) {
173
197
                foreach ($groupusers as $groupuser) {
174
198
                    $listmembers[$group->id][$groupuser->id] = $nonmembers[$groupuser->id];
175
 
                    unset($nonmembers[$groupuser->id]);
 
199
                    //we do not remove people from $nonmembers, everyone is displayed
 
200
                    //this is to enable people to be registered in multiple groups
 
201
                    //unset($nonmembers[$groupuser->id]);
176
202
                    $countusers++;
177
203
                }
178
204
                natcasesort($listmembers[$group->id]);