- required_param calls - added parameter type.
  - put 'require' first.
  - use @header, added charset.
(Bug MDL-7380 "groups".)
This commit is contained in:
nfreear 2006-11-08 12:26:17 +00:00
parent 1059371053
commit 7fd4d8d0ef
21 changed files with 166 additions and 158 deletions

View File

@ -1,18 +1,22 @@
<?php
/**********************************************
* Adds an existing group to a grouping
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
/**
* Adds an existing group to a grouping.
*
* @copyright &copy; 2006 The Open University
* @author J.White AT open.ac.uk
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
*/
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$courseid = required_param('courseid', PARAM_INT);
$groupingid = required_param('groupingid', PARAM_INT);
$groups = required_param('groups');
$courseid = required_param('courseid', PARAM_INT);
$groups = required_param('groups', PARAM_SEQUENCE); //TODO: check.
require_login($courseid);

View File

@ -2,17 +2,17 @@
/**********************************************
* Adds users to a group
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
$groupid = required_param('groupid', PARAM_INT);
$users = required_param('users');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$courseid = required_param('courseid', PARAM_INT);
$groupid = required_param('groupid', PARAM_INT);
$users = required_param('users', PARAM_SEQUENCE);
require_login($courseid);

View File

@ -3,30 +3,30 @@
* Sets up an automatic grouping
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
require_login($courseid);
groups_seed_random_number_generator();
$courseid = required_param('courseid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$noofstudents = required_param('noofstudents', PARAM_INT);
$noofgroups = required_param('noofgroups', PARAM_INT);
$distribevenly = required_param('distribevenly');
$alphabetical = required_param('alphabetical');
$generationtype = required_param('generationtype');
$distribevenly = required_param('distribevenly', PARAM_INT); //TODO: PARAM_BOOL ?
$alphabetical = required_param('alphabetical', PARAM_INT);
$generationtype = required_param('generationtype', PARAM_ALPHA);
$groupingsettings->name =required_param('name');
$groupingsettings->description = required_param('description');
$groupingsettings->name = required_param('name', PARAM_ALPHANUM);
$groupingsettings->description = required_param('description', PARAM_ALPHANUM);
$groupingsettings->prefix = required_param('prefix');
$groupingsettings->defaultgroupdescription = required_param('defaultgroupdescription');
if (confirm_sesskey() and isteacheredit($courseid)) {
if ($generationtype == 'nogroups') {

View File

@ -1,20 +1,21 @@
<div id="creategroupform" class="popup">
<h3><?php print_string('creategroup', 'group'); ?> <span id="selectedgroupingforcreatinggroup"></span></h3>
<form action="">
<p><?php print_string('groupname', 'groups');?></p>
<p><label for="newgroupname"><?php print_string('groupname', 'group'); ?></label></p>
<p><input id="newgroupname" type="text" size="40" value="<?php print_string('defaultgroupname', 'group'); ?>" />
<p><?php print_string("groupingdescription", 'groups') ?><br />
<p><?php print_string('groupingdescription', 'group'); ?><br />
<?php helpbutton("text", get_string("helptext")) ?></p>
<p><?php print_textarea($usehtmleditor, 5, 45, 200, 400, "newgroupdescription");?></p>
<p><?php print_string('enrolmentkey', 'groups') ?></p>
<p><?php print_string('enrolmentkey', 'group'); ?></p>
<p><input type="text" id="newgroupenrolmentkey" size="25" /></p>
<?php if ($printuploadpicture) { ?>
<p><?php print_string('hidepicture', 'groups') ?></p>
<p><?php $options = NULL; $options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu ($options, "newgrouphidepicture", $group->hidepicture, "");?>
></p>
<p><?php print_string('hidepicture', 'group'); ?></p>
<p><?php $options = NULL; $options[0] = get_string("no");
$options[1] = get_string("yes");
$group->hidepicture = 1;
choose_from_menu ($options, "newgrouphidepicture", isset($group)? $group->hidepicture: 1, '');?></p>
<p><?php print_string("newpicture", 'groups') ?></p>
<p><?php print_string('newpicture', 'group'); ?></p>
<p><?php upload_print_form_fragment(1,array('newgroupicon'),null,false,null,0,0,false);
helpbutton("picture", get_string("helppicture"));
print_string("maxsize", "", display_size($maxbytes), 'group'); ?>

View File

@ -2,20 +2,22 @@
/**********************************************
* Adds a new group to a grouping
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$courseid = required_param('courseid', PARAM_INT);
$groupingid = required_param('groupingid', PARAM_INT);
$groupsettings->name = required_param('groupname');
$courseid = required_param('courseid', PARAM_INT);
$groupsettings->description = required_param('description');
$groupsettings->enrolmentkey = required_param('enrolmentkey', PARAM_ALPHANUM);
$groupsettings->hidepicture = optional_param('hidepicture');
$groupsettings->name = required_param('groupname', PARAM_ALPHANUM);
$groupsettings->description = required_param('description', PARAM_ALPHANUM);
$groupsettings->enrolmentkey= required_param('enrolmentkey', PARAM_ALPHANUM);
$groupsettings->hidepicture = optional_param('hidepicture', PARAM_INT);
require_login($courseid);

View File

@ -2,18 +2,18 @@
/**********************************************
* Adds a new grouping
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
$courseid= required_param('courseid', PARAM_INT);
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$groupingsettings->name =required_param('groupingname');
$groupingsettings->description = required_param('description');
$courseid = required_param('courseid', PARAM_INT);
$groupingsettings->name = required_param('groupingname', PARAM_ALPHANUM);
$groupingsettings->description= required_param('description', PARAM_ALPHANUM);
require_login($courseid);

View File

@ -2,14 +2,15 @@
/**********************************************
* Deletes a group
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
$groupid = required_param('groupid', PARAM_INT);
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$groupid = required_param('groupid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
require_login($courseid);

View File

@ -3,15 +3,15 @@
* Deletes a specified grouping
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$groupingid = required_param('groupingid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
require_login($courseid);

View File

@ -2,22 +2,23 @@
/**********************************************
* Adds a new grouping
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
$groupingid = required_param('groupingid');
$courseid = required_param('courseid', PARAM_INT);
$groupingsettings->viewowngroup = required_param('viewowngroup');
$groupingsettings->viewallgroupsmembers = required_param('viewallgroupsmembers');
$groupingsettings->viewallgroupsactivities = required_param('viewallgroupsactivities');
$groupingsettings->teachersgroupmark = required_param('teachersgroupmark');
$groupingsettings->teachersgroupview = required_param('teachersgroupview');
$groupingsettings->teachersoverride = required_param('teachersoverride');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$groupingid = required_param('groupingid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$groupingsettings->viewowngroup = required_param('viewowngroup', PARAM_INT); //TODO: PARAM_BOOL ??
$groupingsettings->viewallgroupsmembers = required_param('viewallgroupsmembers', PARAM_INT);
$groupingsettings->viewallgroupsactivities = required_param('viewallgroupsactivities', PARAM_INT);
$groupingsettings->teachersgroupmark = required_param('teachersgroupmark', PARAM_INT);
$groupingsettings->teachersgroupview = required_param('teachersgroupview', PARAM_INT);
$groupingsettings->teachersoverride = required_param('teachersoverride', PARAM_INT);
require_login($courseid);

View File

@ -2,18 +2,19 @@
/**********************************************
* Adds a new grouping
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
$groupingid = required_param('groupingid');
$courseid = required_param('courseid', PARAM_INT);
$groupingsettings->name =required_param('groupingname');
$groupingsettings->description = required_param('description');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$groupingid = required_param('groupingid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$groupingsettings->name = required_param('groupingname', PARAM_ALPHANUM);
$groupingsettings->description= required_param('description', PARAM_ALPHANUM);
require_login($courseid);

View File

@ -3,18 +3,19 @@
* Adds a new grouping
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
$groupid = required_param('groupid');
$groupname = required_param('groupname');
$description = required_param('description');
$enrolmentkey = required_param('enrolmentkey');
$hidepicture = required_param('hidepicture');
$courseid = required_param('courseid', PARAM_INT);
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$groupid = required_param('groupid', PARAM_INT);
$groupname = required_param('groupname', PARAM_ALPHANUM);
$description = required_param('description', PARAM_ALPHANUM);
$enrolmentkey= required_param('enrolmentkey', PARAM_ALPHANUM);
$hidepicture = required_param('hidepicture', PARAM_INT); //TODO: PARAM_BOOL ??
$courseid = required_param('courseid', PARAM_INT);
require_login($courseid);

View File

@ -4,15 +4,14 @@
* them in an XML format
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$courseid = required_param('courseid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$groupingid = required_param('groupingid', PARAM_INT);
require_login($courseid);

View File

@ -4,12 +4,12 @@
* and returns them in an XML format
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
require_once("../../config.php");
require_once("../lib/lib.php");
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$courseid = required_param('courseid', PARAM_INT);

View File

@ -3,16 +3,15 @@
* Fetches the settings of a grouping and returns
* them in an XML format
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
echo '<groupsresponse>';
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
$courseid = required_param('courseid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$groupingid = required_param('groupingid', PARAM_INT);
require_login($courseid);

View File

@ -3,18 +3,17 @@
* Fetches the settings of a grouping and returns
* them in an XML format
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
require_once("../../config.php");
require_once("../lib/lib.php");
$courseid = required_param('courseid', PARAM_INT);
$groupid = required_param('groupid', PARAM_INT);
$groupid = required_param('groupid', PARAM_INT);
require_login($courseid);
if (confirm_sesskey() and isteacheredit($courseid)) {

View File

@ -2,15 +2,16 @@
/**********************************************
* Adds an existing group to a grouping
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
require_once("../../config.php");
require_once("../lib/lib.php");
$groupingid = required_param('groupingid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
require_login($courseid);

View File

@ -3,15 +3,16 @@
* Gets the groups not in a grouping for a course
* and returns them in an XML format
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
require_once('../lib/lib.php');
require_once('../../config.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
require_once("../lib/lib.php");
require_once("../../config.php");
$groupingid = required_param('groupingid');
$courseid = required_param('courseid');
$groupingid = required_param('groupingid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
require_login($courseid);

View File

@ -3,16 +3,15 @@
* Gets the members of a group and returns them
* in an XMl format
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
require_once("../../config.php");
require_once("../lib/lib.php");
$groupid = required_param('groupid', PARAM_INT);
$groupid = required_param('groupid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
require_login($courseid);

View File

@ -5,17 +5,17 @@
* their detailsin an XML format.
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
require_once("../../config.php");
require_once("../lib/lib.php");
$groupid = required_param('groupid', PARAM_INT);
$groupid = required_param('groupid', PARAM_INT);
$groupingid = required_param('groupingid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$showall = required_param('showall', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$showall = required_param('showall', PARAM_INT);
require_login($courseid);

View File

@ -4,16 +4,16 @@
* (but does not delete the group)
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
require_once("../../config.php");
require_once("../lib/lib.php");
$groupid = required_param('groupid', PARAM_INT);
$groupid = required_param('groupid', PARAM_INT);
$groupingid = required_param('groupingid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT);
require_login($courseid);

View File

@ -1,20 +1,19 @@
<?php
/**********************************************
* Takes a groupid and comma-separated list of
* userids, and removes each of those userids
* from the specified group
**********************************************/
header("Content-Type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
require_once('../../config.php');
require_once('../lib/lib.php');
@header('Content-Type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<groupsresponse>';
require_once("../../config.php");
require_once("../lib/lib.php");
$groupid = required_param('groupid', PARAM_INT);
$users = required_param('users');
$groupid = required_param('groupid', PARAM_INT);
$users = required_param('users', PARAM_SEQUENCE);
$courseid = required_param('courseid', PARAM_INT);
require_login($courseid);