MDL-30997 - group - update of the api block documentation.

This commit is contained in:
Adrian Greeve 2012-01-05 09:29:55 +08:00
parent 0dde394db5
commit 4d8e241742
19 changed files with 532 additions and 198 deletions

View File

@ -19,8 +19,8 @@
* Add/remove group from grouping.
*
* @copyright 1999 Martin Dougiamas http://dougiamas.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package groups
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/
require_once('../config.php');

View File

@ -1,11 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Create and allocate users go groups
* Create and allocate users to groups
*
* @author Matt Clarkson mattc@catalyst.net.nz
* @version 0.0.1
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
* @package core_group
* @copyright Matt Clarkson mattc@catalyst.net.nz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');
@ -239,4 +254,4 @@ if($preview !== '') {
echo $preview;
}
echo $OUTPUT->footer();
echo $OUTPUT->footer();

View File

@ -1,5 +1,27 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Auto group form
*
* @package core_group
* @copyright 2007 mattc-catalyst (http://moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
@ -7,10 +29,18 @@ if (!defined('MOODLE_INTERNAL')) {
require_once($CFG->dirroot.'/lib/formslib.php');
require_once($CFG->dirroot.'/cohort/lib.php');
/// get url variables
/**
* Auto group form class
*
* @package core_group
* @copyright 2007 mattc-catalyst (http://moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class autogroup_form extends moodleform {
// Define the form
/**
* Form Definition
*/
function definition() {
global $CFG, $COURSE;
@ -110,7 +140,13 @@ class autogroup_form extends moodleform {
$mform->closeHeaderBefore('buttonar');
}
/**
* Performs validation of the form information
*
* @param array $data
* @param array $files
* @return array $errors An array of $errors
*/
function validation($data, $files) {
global $CFG, $COURSE;
$errors = parent::validation($data, $files);

View File

@ -1,8 +1,23 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Client-side JavaScript for group management interface.
* @author vy-shane AT moodle.com
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
* @copyright vy-shane AT moodle.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/

View File

@ -1,11 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Delete group
*
* @copyright &copy; 2008 The Open University
* @author s.marshall AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
* @package core_group
* @copyright 2008 The Open University, s.marshall AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');

View File

@ -1,5 +1,4 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@ -18,8 +17,7 @@
/**
* External groups API
*
* @package moodlecore
* @subpackage webservice
* @package core_group
* @copyright 2009 Moodle Pty Ltd (http://moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@ -28,6 +26,10 @@ require_once("$CFG->libdir/externallib.php");
/**
* Group functions
*
* @package core_group
* @copyright 2009 Moodle Pty Ltd (http://moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_group_external extends external_api {
@ -100,9 +102,9 @@ class core_group_external extends external_api {
return $groups;
}
/**
/**
* Returns description of method result value
* @return external_description
* @return external_multiple_structure
*/
public static function create_groups_returns() {
return new external_multiple_structure(
@ -163,9 +165,9 @@ class core_group_external extends external_api {
return $groups;
}
/**
/**
* Returns description of method result value
* @return external_description
* @return external_multiple_structure
*/
public static function get_groups_returns() {
return new external_multiple_structure(
@ -224,9 +226,9 @@ class core_group_external extends external_api {
return $groups;
}
/**
/**
* Returns description of method result value
* @return external_description
* @return external_multiple_structure
*/
public static function get_course_groups_returns() {
return new external_multiple_structure(
@ -294,7 +296,7 @@ class core_group_external extends external_api {
$transaction->allow_commit();
}
/**
/**
* Returns description of method result value
* @return external_description
*/
@ -349,7 +351,7 @@ class core_group_external extends external_api {
return $members;
}
/**
/**
* Returns description of method result value
* @return external_description
*/
@ -387,7 +389,6 @@ class core_group_external extends external_api {
/**
* Add group members
* @param array $members of arrays with keys userid, groupid
* @return void
*/
public static function add_group_members($members) {
global $CFG, $DB;
@ -429,7 +430,7 @@ class core_group_external extends external_api {
$transaction->allow_commit();
}
/**
/**
* Returns description of method result value
* @return null
*/
@ -460,7 +461,6 @@ class core_group_external extends external_api {
/**
* Delete group members
* @param array $members of arrays with keys userid, groupid
* @return void
*/
public static function delete_group_members($members) {
global $CFG, $DB;
@ -497,7 +497,7 @@ class core_group_external extends external_api {
$transaction->allow_commit();
}
/**
/**
* Returns description of method result value
* @return null
*/
@ -509,13 +509,15 @@ class core_group_external extends external_api {
/**
* Deprecated group functions
* @deprecated since Moodle 2.2 please use core_group_external instead
* @deprecated since Moodle 2.2 please do not call this class any more.
* @see core_group_external()
*/
class moodle_group_external extends external_api {
/**
* Returns description of method parameters
* @deprecated since Moodle 2.2 please use core_group_external::create_groups_parameters instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::create_groups_parameters()
* @return external_function_parameters
*/
public static function create_groups_parameters() {
@ -524,7 +526,8 @@ class moodle_group_external extends external_api {
/**
* Create groups
* @deprecated since Moodle 2.2 please use core_group_external::create_groups instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::create_groups()
* @param array $groups array of group description arrays (with keys groupname and courseid)
* @return array of newly created groups
*/
@ -533,17 +536,19 @@ class moodle_group_external extends external_api {
}
/**
* Returns description of method result value
* @deprecated since Moodle 2.2 please use core_group_external::create_groups_returns instead
* @return external_description
*/
* Returns description of method result value
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::create_groups_returns()
* @return external_description
*/
public static function create_groups_returns() {
return core_group_external::create_groups_returns();
}
/**
* Returns description of method parameters
* @deprecated since Moodle 2.2 please use core_group_external::get_groups_parameters instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::get_groups_parameters()
* @return external_function_parameters
*/
public static function get_groups_parameters() {
@ -552,7 +557,8 @@ class moodle_group_external extends external_api {
/**
* Get groups definition specified by ids
* @deprecated since Moodle 2.2 please use core_group_external::get_groups instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::get_groups()
* @param array $groupids arrays of group ids
* @return array of group objects (id, courseid, name, enrolmentkey)
*/
@ -561,45 +567,50 @@ class moodle_group_external extends external_api {
}
/**
* Returns description of method result value
* @deprecated since Moodle 2.2 please use core_group_external::get_groups_returns instead
* @return external_description
*/
* Returns description of method result value
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::get_groups_returns()
* @return external_description
*/
public static function get_groups_returns() {
return core_group_external::get_groups_returns();
}
/**
* Returns description of method parameters
* @deprecated since Moodle 2.2 please use core_group_external::get_course_groups_parameters instead
* @return external_function_parameters
*/
/**
* Returns description of method parameters
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::get_course_groups_parameters()
* @return external_function_parameters
*/
public static function get_course_groups_parameters() {
return core_group_external::get_course_groups_parameters();
}
/**
* Get all groups in the specified course
* @deprecated since Moodle 2.2 please use core_group_external::get_course_groups instead
* @param int $courseid id of course
* @return array of group objects (id, courseid, name, enrolmentkey)
*/
/**
* Get all groups in the specified course
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::get_course_groups()
* @param int $courseid id of course
* @return array of group objects (id, courseid, name, enrolmentkey)
*/
public static function get_course_groups($courseid) {
return core_group_external::get_course_groups($courseid);
}
/**
* Returns description of method result value
* @deprecated since Moodle 2.2 please use core_group_external::get_course_groups_returns instead
* @return external_description
*/
* Returns description of method result value
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::get_course_groups_returns()
* @return external_description
*/
public static function get_course_groups_returns() {
return core_group_external::get_course_groups_returns();
}
/**
* Returns description of method parameters
* @deprecated since Moodle 2.2 please use core_group_external::delete_group_members_parameters instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::delete_group_members_parameters()
* @return external_function_parameters
*/
public static function delete_groups_parameters() {
@ -608,7 +619,8 @@ class moodle_group_external extends external_api {
/**
* Delete groups
* @deprecated since Moodle 2.2 please use core_group_external::delete_groups instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::delete_groups()
* @param array $groupids array of group ids
* @return void
*/
@ -617,10 +629,11 @@ class moodle_group_external extends external_api {
}
/**
* Returns description of method result value
* @deprecated since Moodle 2.2 please use core_group_external::delete_group_members_returns instead
* @return external_description
*/
* Returns description of method result value
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::delete_group_members_returns()
* @return external_description
*/
public static function delete_groups_returns() {
return core_group_external::delete_group_members_returns();
}
@ -628,7 +641,8 @@ class moodle_group_external extends external_api {
/**
* Returns description of method parameters
* @deprecated since Moodle 2.2 please use core_group_external::get_group_members_parameters instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::get_group_members_parameters()
* @return external_function_parameters
*/
public static function get_groupmembers_parameters() {
@ -637,7 +651,8 @@ class moodle_group_external extends external_api {
/**
* Return all members for a group
* @deprecated since Moodle 2.2 please use core_group_external::get_group_members instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::get_group_members()
* @param array $groupids array of group ids
* @return array with group id keys containing arrays of user ids
*/
@ -646,10 +661,11 @@ class moodle_group_external extends external_api {
}
/**
* Returns description of method result value
* @deprecated since Moodle 2.2 please use core_group_external::get_group_members_returns instead
* @return external_description
*/
* Returns description of method result value
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::get_group_members_returns()
* @return external_description
*/
public static function get_groupmembers_returns() {
return core_group_external::get_group_members_returns();
}
@ -657,7 +673,8 @@ class moodle_group_external extends external_api {
/**
* Returns description of method parameters
* @deprecated since Moodle 2.2 please use core_group_external::add_group_members_parameters instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::add_group_members_parameters()
* @return external_function_parameters
*/
public static function add_groupmembers_parameters() {
@ -666,7 +683,8 @@ class moodle_group_external extends external_api {
/**
* Add group members
* @deprecated since Moodle 2.2 please use core_group_external::add_group_members instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::add_group_members()
* @param array $members of arrays with keys userid, groupid
* @return void
*/
@ -675,10 +693,11 @@ class moodle_group_external extends external_api {
}
/**
* Returns description of method result value
* @deprecated since Moodle 2.2 please use core_group_external::add_group_members_returns instead
* @return external_description
*/
* Returns description of method result value
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::add_group_members_returns()
* @return external_description
*/
public static function add_groupmembers_returns() {
return core_group_external::add_group_members_returns();
}
@ -686,7 +705,8 @@ class moodle_group_external extends external_api {
/**
* Returns description of method parameters
* @deprecated since Moodle 2.2 please use core_group_external::delete_group_members_parameters instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::delete_group_members_parameters()
* @return external_function_parameters
*/
public static function delete_groupmembers_parameters() {
@ -695,7 +715,8 @@ class moodle_group_external extends external_api {
/**
* Delete group members
* @deprecated since Moodle 2.2 please use core_group_external::delete_group_members instead
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::delete_group_members()
* @param array $members of arrays with keys userid, groupid
* @return void
*/
@ -704,10 +725,11 @@ class moodle_group_external extends external_api {
}
/**
* Returns description of method result value
* @deprecated since Moodle 2.2 please use core_group_external::delete_group_members_returns instead
* @return external_description
*/
* Returns description of method result value
* @deprecated since Moodle 2.2 please do not call this function any more.
* @see core_group_external::delete_group_members_returns()
* @return external_description
*/
public static function delete_groupmembers_returns() {
return core_group_external::delete_group_members_returns();
}

View File

@ -1,12 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Create group OR edit group settings.
*
* @copyright &copy; 2006 The Open University
* @author N.D.Freear AT open.ac.uk
* @author J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
* @copyright 2006 The Open University, N.D.Freear AT open.ac.uk, J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/
require_once('../config.php');

View File

@ -1,23 +1,44 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Create//edit group form.
* A form for the creation and editing of groups.
*
* @copyright &copy; 2006 The Open University
* @author N.D.Freear AT open.ac.uk
* @author J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
* @copyright 2006 The Open University, N.D.Freear AT open.ac.uk, J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/
defined('MOODLE_INTERNAL') || die;
require_once($CFG->dirroot.'/lib/formslib.php');
/// get url variables
/**
* Group form class
*
* @copyright 2006 The Open University, N.D.Freear AT open.ac.uk, J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/
class group_form extends moodleform {
// Define the form
/**
* Definition of the form
*/
function definition () {
global $USER, $CFG, $COURSE;
@ -52,6 +73,13 @@ class group_form extends moodleform {
$this->add_action_buttons();
}
/**
* Form validation
*
* @param array $data
* @param array $files
* @return array $errors An array of errors
*/
function validation($data, $files) {
global $COURSE, $DB, $CFG;
@ -82,6 +110,11 @@ class group_form extends moodleform {
return $errors;
}
/**
* Get editor options for this form
*
* @return array An array of options
*/
function get_editor_options() {
return $this->_customdata['editoroptions'];
}

View File

@ -1,12 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Create grouping OR edit grouping settings.
*
* @copyright &copy; 2006 The Open University
* @author N.D.Freear AT open.ac.uk
* @author J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
* @copyright 2006 The Open University, N.D.Freear AT open.ac.uk, J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/
require_once('../config.php');
require_once('lib.php');

View File

@ -1,12 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Create/Edit grouping form.
* A form for creating and editing groupings.
*
* @copyright &copy; 2006 The Open University
* @author N.D.Freear AT open.ac.uk
* @author J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
* @copyright 2006 The Open University, N.D.Freear AT open.ac.uk, J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/
if (!defined('MOODLE_INTERNAL')) {
@ -15,10 +29,18 @@ if (!defined('MOODLE_INTERNAL')) {
require_once($CFG->dirroot.'/lib/formslib.php');
/// get url variables
/**
* Grouping form class
*
* @copyright 2006 The Open University, N.D.Freear AT open.ac.uk, J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/
class grouping_form extends moodleform {
// Define the form
/**
* Form definition
*/
function definition () {
global $USER, $CFG, $COURSE;
@ -41,6 +63,13 @@ class grouping_form extends moodleform {
$this->add_action_buttons();
}
/**
* Form validation
*
* @param array $data
* @param array $files
* @return array $errors An array of validataion errors for the form.
*/
function validation($data, $files) {
global $COURSE, $DB;

View File

@ -20,7 +20,7 @@
*
* @copyright 1999 Martin Dougiamas http://dougiamas.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package groups
* @package core_group
*/
require_once '../config.php';

View File

@ -20,7 +20,7 @@
*
* @copyright 1999 Martin Dougiamas http://dougiamas.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package course
* @package core_group
*/
require_once('../config.php');

View File

@ -1,4 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* A form for group import.
*
* @package core_group
* @copyright 2010 Toyomoyo (http://moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
@ -6,8 +28,18 @@ if (!defined('MOODLE_INTERNAL')) {
require_once($CFG->libdir.'/formslib.php');
/**
* Groups import form class
*
* @package core_group
* @copyright 2010 Toyomoyo (http://moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class groups_import_form extends moodleform {
/**
* Form definition
*/
function definition() {
$mform =& $this->_form;
$data = $this->_customdata;

View File

@ -1,12 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* The main group management user interface.
*
* @copyright &copy; 2006 The Open University
* @author N.D.Freear AT open.ac.uk
* @author J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
* @copyright 2006 The Open University, N.D.Freear AT open.ac.uk, J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/
require_once('../config.php');
require_once('lib.php');
@ -269,8 +283,8 @@ echo $OUTPUT->footer();
/**
* Returns the first button action with the given prefix, taken from
* POST or GET, otherwise returns false.
* See /lib/moodlelib.php function optional_param.
* @param $prefix 'act_' as in 'action'.
* @see /lib/moodlelib.php function optional_param().
* @param string $prefix 'act_' as in 'action'.
* @return string The action without the prefix, or false if no action found.
*/
function groups_param_action($prefix = 'act_') {

View File

@ -1,11 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Extra library for groups and groupings.
*
* @copyright &copy; 2006 The Open University
* @author J.White AT open.ac.uk, Petr Skoda (skodak)
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
* @copyright 2006 The Open University, J.White AT open.ac.uk, Petr Skoda (skodak)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/
/*
@ -15,9 +30,10 @@
/**
* Adds a specified user to a group
* @param mixed $groupid The group id or group object
* @param mixed $userid The user id or user object
* @return boolean True if user added successfully or the user is already a
*
* @param mixed $grouporid The group id or group object
* @param mixed $userorid The user id or user object
* @return bool True if user added successfully or the user is already a
* member of the group, false otherwise.
*/
function groups_add_member($grouporid, $userorid) {
@ -69,9 +85,10 @@ function groups_add_member($grouporid, $userorid) {
/**
* Deletes the link between the specified user and group.
* @param mixed $groupid The group id or group object
* @param mixed $userid The user id or user object
* @return boolean True if deletion was successful, false otherwise
*
* @param mixed $grouporid The group id or group object
* @param mixed $userorid The user id or user object
* @return bool True if deletion was successful, false otherwise
*/
function groups_remove_member($grouporid, $userorid) {
global $DB;
@ -112,8 +129,10 @@ function groups_remove_member($grouporid, $userorid) {
/**
* Add a new group
* @param object $data group properties
* @param object $um upload manager with group picture
*
* @param stdClass $data group properties
* @param stdClass $editform
* @param array $editoroptions
* @return id of group or false if error
*/
function groups_create_group($data, $editform = false, $editoroptions = false) {
@ -158,7 +177,9 @@ function groups_create_group($data, $editform = false, $editoroptions = false) {
/**
* Add a new grouping
* @param object $data grouping properties
*
* @param stdClass $data grouping properties
* @param array $editoroptions
* @return id of grouping or false if error
*/
function groups_create_grouping($data, $editoroptions=null) {
@ -193,9 +214,10 @@ function groups_create_grouping($data, $editoroptions=null) {
/**
* Update the group icon from form data
* @param $group
* @param $data
* @param $editform
*
* @param stdClass $group group information
* @param stdClass $data
* @param stdClass $editform
*/
function groups_update_group_icon($group, $data, $editform) {
global $CFG, $DB;
@ -221,10 +243,11 @@ function groups_update_group_icon($group, $data, $editform) {
/**
* Update group
* @param object $data group properties (with magic quotes)
* @param object $editform
*
* @param stdClass $data group properties (with magic quotes)
* @param stdClass $editform
* @param array $editoroptions
* @return boolean true or exception
* @return bool true or exception
*/
function groups_update_group($data, $editform = false, $editoroptions = false) {
global $CFG, $DB;
@ -255,8 +278,10 @@ function groups_update_group($data, $editform = false, $editoroptions = false) {
/**
* Update grouping
* @param object $data grouping properties (with magic quotes)
* @return boolean true or exception
*
* @param stdClass $data grouping properties (with magic quotes)
* @param array $editoroptions
* @return bool true or exception
*/
function groups_update_grouping($data, $editoroptions=null) {
global $DB;
@ -275,8 +300,9 @@ function groups_update_grouping($data, $editoroptions=null) {
/**
* Delete a group best effort, first removing members and links with courses and groupings.
* Removes group avatar too.
*
* @param mixed $grouporid The id of group to delete or full group object
* @return boolean True if deletion was successful, false otherwise
* @return bool True if deletion was successful, false otherwise
*/
function groups_delete_group($grouporid) {
global $CFG, $DB;
@ -316,6 +342,7 @@ function groups_delete_group($grouporid) {
/**
* Delete grouping
*
* @param int $groupingorid
* @return bool success
*/
@ -357,6 +384,7 @@ function groups_delete_grouping($groupingorid) {
/**
* Remove all users (or one user) from all groups in course
*
* @param int $courseid
* @param int $userid 0 means all users
* @param bool $showfeedback
@ -397,6 +425,7 @@ function groups_delete_group_members($courseid, $userid=0, $showfeedback=false)
/**
* Remove all groups from all groupings in course
*
* @param int $courseid
* @param bool $showfeedback
* @return bool success
@ -417,6 +446,7 @@ function groups_delete_groupings_groups($courseid, $showfeedback=false) {
/**
* Delete all groups from course
*
* @param int $courseid
* @param bool $showfeedback
* @return bool success
@ -456,6 +486,7 @@ function groups_delete_groups($courseid, $showfeedback=false) {
/**
* Delete all groupings from course
*
* @param int $courseid
* @param bool $showfeedback
* @return bool success
@ -497,7 +528,8 @@ function groups_delete_groupings($courseid, $showfeedback=false) {
/**
* Obtains a list of the possible roles that group members might come from,
* on a course. Generally this includes only profile roles.
* @param object $context Context of course
*
* @param context $context Context of course
* @return Array of role ID integers, or false if error/none.
*/
function groups_get_possible_roles($context) {
@ -508,6 +540,7 @@ function groups_get_possible_roles($context) {
/**
* Gets potential group members for grouping
*
* @param int $courseid The id of the course
* @param int $roleid The role to select users from
* @param int $cohortid restrict to cohort id
@ -553,6 +586,7 @@ function groups_get_potential_members($courseid, $roleid = null, $cohortid = nul
/**
* Parse a group name for characters to replace
*
* @param string $format The format a group name will follow
* @param int $groupnumber The number of the group to be used in the parsed format string
* @return string the parsed format string
@ -572,6 +606,7 @@ function groups_parse_name($format, $groupnumber) {
/**
* Assigns group into grouping
*
* @param int groupingid
* @param int groupid
* @return bool true or exception
@ -593,6 +628,7 @@ function groups_assign_grouping($groupingid, $groupid) {
/**
* Unassigns group grom grouping
*
* @param int groupingid
* @param int groupid
* @return bool success
@ -614,6 +650,7 @@ function groups_unassign_grouping($groupingid, $groupid) {
* and pseudo-role details (including a name, 'No role'). Users with multiple
* roles, same deal with key '*' and name 'Multiple roles'. You can find out
* which roles each has by looking in the $roles array of the user object.
*
* @param int $groupid
* @param int $courseid Course ID (should match the group's course)
* @param string $fields List of fields from user table prefixed with u, default 'u.*'
@ -654,8 +691,8 @@ function groups_get_members_by_role($groupid, $courseid, $fields='u.*',
* results of a database query that includes a list of users and possible
* roles on a course.
*
* @param object $rs The record set (may be false)
* @param int $contextid ID of course context
* @param moodle_recordset $rs The record set (may be false)
* @param int $context ID of course context
* @return array As described in groups_get_members_by_role
*/
function groups_calculate_role_people($rs, $context) {

View File

@ -1,12 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Add/remove members from group.
*
* @copyright &copy; 2006 The Open University and others
* @author N.D.Freear AT open.ac.uk
* @author J.White AT open.ac.uk and others
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
* @copyright 2006 The Open University and others, N.D.Freear AT open.ac.uk, J.White AT open.ac.uk and others
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/
require_once(dirname(__FILE__) . '/../config.php');
require_once(dirname(__FILE__) . '/lib.php');

View File

@ -1,11 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Print an overview of groupings & group membership
*
* @author Matt Clarkson mattc@catalyst.net.nz
* @version 0.0.1
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
* @copyright Matt Clarkson mattc@catalyst.net.nz
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core_group
*/
require_once('../config.php');

View File

@ -1,4 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Prints navigation tabs
*
* @package core_group
* @copyright 2010 Petr Skoda (http://moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$row = $tabs = array();
$row[] = new tabobject('groups',
$CFG->wwwroot.'/group/index.php?id='.$courseid,

View File

@ -18,8 +18,7 @@
/**
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package core
* @subpackage group
* @package core_group
*/
defined('MOODLE_INTERNAL') || die();
@ -43,9 +42,9 @@ define('VISIBLEGROUPS', 2);
/**
* Determines if a group with a given groupid exists.
*
* @global object
* @category group
* @param int $groupid The groupid to check for
* @return boolean True if the group exists, false otherwise or if an error
* @return bool True if the group exists, false otherwise or if an error
* occurred.
*/
function groups_group_exists($groupid) {
@ -56,7 +55,7 @@ function groups_group_exists($groupid) {
/**
* Gets the name of a group with a specified id
*
* @global object
* @category group
* @param int $groupid The id of the group
* @return string The name of the group
*/
@ -68,7 +67,7 @@ function groups_get_group_name($groupid) {
/**
* Gets the name of a grouping with a specified id
*
* @global object
* @category group
* @param int $groupingid The id of the grouping
* @return string The name of the grouping
*/
@ -81,7 +80,7 @@ function groups_get_grouping_name($groupingid) {
* Returns the groupid of a group with the name specified for the course.
* Group names should be unique in course
*
* @global object
* @category group
* @param int $courseid The id of the course
* @param string $name name of group (without magic quotes)
* @return int $groupid
@ -98,7 +97,7 @@ function groups_get_group_by_name($courseid, $name) {
* Returns the groupingid of a grouping with the name specified for the course.
* Grouping names should be unique in course
*
* @global object
* @category group
* @param int $courseid The id of the course
* @param string $name name of group (without magic quotes)
* @return int $groupid
@ -114,8 +113,11 @@ function groups_get_grouping_by_name($courseid, $name) {
/**
* Get the group object
*
* @category group
* @param int $groupid ID of the group.
* @return object group object
* @param string $fields (default is all fields)
* @param int $strictness (IGNORE_MISSING - default)
* @return stdGlass group object
*/
function groups_get_group($groupid, $fields='*', $strictness=IGNORE_MISSING) {
global $DB;
@ -125,9 +127,11 @@ function groups_get_group($groupid, $fields='*', $strictness=IGNORE_MISSING) {
/**
* Get the grouping object
*
* @category group
* @param int $groupingid ID of the group.
* @param string $fields
* @return object group object
* @param int $strictness (IGNORE_MISSING - default)
* @return stdClass group object
*/
function groups_get_grouping($groupingid, $fields='*', $strictness=IGNORE_MISSING) {
global $DB;
@ -137,6 +141,7 @@ function groups_get_grouping($groupingid, $fields='*', $strictness=IGNORE_MISSIN
/**
* Gets array of all groups in a specified course.
*
* @category group
* @param int $courseid The id of the course.
* @param mixed $userid optional user id or array of ids, returns only groups of the user.
* @param int $groupingid optional returns only groups in the specified grouping.
@ -177,6 +182,7 @@ function groups_get_all_groups($courseid, $userid=0, $groupingid=0, $fields='g.*
/**
* Returns info about user's groups in course.
*
* @category group
* @param int $courseid
* @param int $userid $USER if not specified
* @return array Array[groupingid][groupid] including grouping id 0 which means all groups
@ -223,10 +229,9 @@ function groups_get_user_groups($courseid, $userid=0) {
}
/**
* Gets array of all groupings in a specified course.
* Gets an array of all groupings in a specified course.
*
* @global object
* @global object
* @category group
* @param int $courseid return only groupings in this with this courseid
* @return array|bool Returns an array of the grouping objects or false if no records
* or an error occurred.
@ -247,11 +252,10 @@ function groups_get_all_groupings($courseid) {
*
* If $userid is null, use the global object.
*
* @global object
* @global object
* @category group
* @param int $groupid The group to check for membership.
* @param int $userid The user to check against the group.
* @return boolean True if the user is a member, false otherwise.
* @return bool True if the user is a member, false otherwise.
*/
function groups_is_member($groupid, $userid=null) {
global $USER, $DB;
@ -266,13 +270,11 @@ function groups_is_member($groupid, $userid=null) {
/**
* Determines if current or specified is member of any active group in activity
*
* @global object
* @global object
* @global object
* @category group
* @staticvar array $cache
* @param object $cm coruse module object
* @param int $userid id of user, null menas $USER->id
* @return booelan true if user member of at least one group used in activity
* @param cm_info $cm course module object
* @param int $userid id of user, null means $USER->id
* @return bool true if user member of at least one group used in activity
*/
function groups_has_membership($cm, $userid=null) {
global $CFG, $USER, $DB;
@ -311,7 +313,7 @@ function groups_has_membership($cm, $userid=null) {
/**
* Returns the users in the specified group.
*
* @global object
* @category group
* @param int $groupid The groupid to get the users for
* @param int $fields The fields to return
* @param int $sort optional sorting of returned users
@ -331,10 +333,10 @@ function groups_get_members($groupid, $fields='u.*', $sort='lastname ASC') {
/**
* Returns the users in the specified grouping.
*
* @global object
* @category group
* @param int $groupingid The groupingid to get the users for
* @param int $fields The fields to return
* @param int $sort optional sorting of returned users
* @param string $fields The fields to return
* @param string $sort optional sorting of returned users
* @return array|bool Returns an array of the users for the specified
* group or false if no users or an error returned.
*/
@ -352,7 +354,9 @@ function groups_get_grouping_members($groupingid, $fields='u.*', $sort='lastname
/**
* Returns effective groupmode used in course
*
* @return integer group mode
* @category group
* @param stdClass $course course object.
* @return int group mode
*/
function groups_get_course_groupmode($course) {
return $course->groupmode;
@ -362,11 +366,10 @@ function groups_get_course_groupmode($course) {
* Returns effective groupmode used in activity, course setting
* overrides activity setting if groupmodeforce enabled.
*
* @global object
* @global object
* @param object $cm the course module object. Only the ->course and ->groupmode need to be set.
* @param object $course object optional course object to improve perf
* @return integer group mode
* @category group
* @param cm_info $cm the course module object. Only the ->course and ->groupmode need to be set.
* @param stdClass $course object optional course object to improve perf
* @return int group mode
*/
function groups_get_activity_groupmode($cm, $course=null) {
global $COURSE, $DB;
@ -388,9 +391,10 @@ function groups_get_activity_groupmode($cm, $course=null) {
/**
* Print group menu selector for course level.
*
* @category group
* @param stdClass $course course object
* @param string|moodle_url $urlroot return address
* @param boolean $return return as string instead of printing
* @param mixed $urlroot return address. Accepts either a string or a moodle_url
* @param bool $return return as string instead of printing
* @return mixed void or string depending on $return param
*/
function groups_print_course_menu($course, $urlroot, $return=false) {
@ -459,11 +463,12 @@ function groups_print_course_menu($course, $urlroot, $return=false) {
/**
* Print group menu selector for activity.
*
* @category group
* @param stdClass $cm course module object
* @param string|moodle_url $urlroot return address that users get to if they choose an option;
* should include any parameters needed, e.g. "$CFG->wwwroot/mod/forum/view.php?id=34"
* @param boolean $return return as string instead of printing
* @param boolean $hideallparticipants If true, this prevents the 'All participants'
* @param bool $return return as string instead of printing
* @param bool $hideallparticipants If true, this prevents the 'All participants'
* option from appearing in cases where it normally would. This is intended for
* use only by activities that cannot display all groups together. (Note that
* selecting this option does not prevent groups_get_activity_group from
@ -551,8 +556,9 @@ function groups_print_activity_menu($cm, $urlroot, $return=false, $hideallpartic
/**
* Returns group active in course, changes the group by default if 'group' page param present
*
* @category group
* @param stdClass $course course bject
* @param boolean $update change active group if group param submitted
* @param bool $update change active group if group param submitted
* @param array $allowedgroups list of groups user may access (INTERNAL, to be used only from groups_print_course_menu())
* @return mixed false if groups not used, int if groups used, 0 means all groups (access must be verified in SEPARATE mode)
*/
@ -602,8 +608,9 @@ function groups_get_course_group($course, $update=false, $allowedgroups=null) {
/**
* Returns group active in activity, changes the group by default if 'group' page param present
*
* @category group
* @param stdClass $cm course module object
* @param boolean $update change active group if group param submitted
* @param bool $update change active group if group param submitted
* @param array $allowedgroups list of groups user may access (INTERNAL, to be used only from groups_print_activity_menu())
* @return mixed false if groups not used, int if groups used, 0 means all groups (access must be verified in SEPARATE mode)
*/
@ -654,7 +661,8 @@ function groups_get_activity_group($cm, $update=false, $allowedgroups=null) {
* Gets a list of groups that the user is allowed to access within the
* specified activity.
*
* @param object $cm Course-module
* @category group
* @param stdClass $cm Course-module
* @param int $userid User ID (defaults to current user)
* @return array An array of group objects, or false if none
*/
@ -684,9 +692,10 @@ function groups_get_activity_allowed_groups($cm,$userid=0) {
*
* $USER If $userid is null, use the global object.
*
* @param int $cm The course module
* @category group
* @param stdClass $cm The course module
* @param int $userid The user to check against the group.
* @return boolean True if the user can view the course module, false otherwise.
* @return bool True if the user can view the course module, false otherwise.
*/
function groups_course_module_visible($cm, $userid=null) {
global $CFG, $USER;
@ -709,12 +718,10 @@ function groups_course_module_visible($cm, $userid=null) {
/**
* Internal method, sets up $SESSION->activegroup and verifies previous value
*
* @private
* @param int $courseid
* @param int|string $groupmode SEPARATEGROUPS, VISIBLEGROUPS or 'aag' (access all groups)
* @param int $groupingid 0 means all groups
* @param all $allowedgroups list of groups user can see
* @return void
* @param array $allowedgroups list of groups user can see
*/
function _group_verify_activegroup($courseid, $groupmode, $groupingid, array $allowedgroups) {
global $SESSION, $USER;