adding some strings
[moodle-linuxchix.git] / group / edit_form.php
blobf1d9a33505924eb66ff184f045b98a5cc034d506
1 <?php //$Id$
3 require_once($CFG->dirroot.'/lib/formslib.php');
5 /// get url variables
6 class group_edit_form extends moodleform {
8 // Define the form
9 function definition () {
10 global $USER, $CFG, $COURSE;
12 $strrequired = get_string('required');
13 $buttonstr = get_string('creategroup', 'group');
15 if (isset($this->_customdata['group'])) {
16 $group = $this->_customdata['group'];
17 } else {
18 $group = false;
21 $groupingid = $this->_customdata['groupingid'];
22 $newgrouping = $this->_customdata['newgrouping'];
23 $courseid = $this->_customdata['courseid'];
25 $mform =& $this->_form;
27 $mform->addElement('text','name', get_string('groupname', 'group'),'maxlength="254" size="50"');
28 $mform->setDefault('name', get_string('defaultgroupname', 'group'));
29 $mform->addRule('name', get_string('missingname'), 'required', null, 'client');
30 $mform->setType('name', PARAM_MULTILANG);
32 $mform->addElement('htmleditor', 'description', get_string('groupdescription', 'group'), array('rows'=> '15', 'course' => $courseid, 'cols'=>'45'));
33 $mform->setType('description', PARAM_RAW);
35 $mform->addElement('passwordunmask', 'enrolmentkey', get_string('enrolmentkey', 'group'), 'maxlength="254" size="24"', get_string('enrolmentkey'));
36 $mform->setHelpButton('enrolmentkey', array('groupenrolmentkey', get_string('enrolmentkey', 'group')), true);
37 $mform->setType('enrolmentkey', PARAM_RAW);
39 $maxbytes = get_max_upload_file_size($CFG->maxbytes, $COURSE->maxbytes);
41 if (!empty($CFG->gdversion) and $maxbytes) {
42 $options = array(get_string('no'), get_string('yes'));
43 $mform->addElement('select', 'hidepicture', get_string('hidepicture'), $options);
45 $this->set_upload_manager(new upload_manager('imagefile', false, false, null, false, 0, true, true, false));
46 $mform->addElement('file', 'imagefile', get_string('newpicture', 'group'));
47 $mform->setHelpButton('imagefile', array ('picture', get_string('helppicture')), true);
51 if ($group) {
52 $buttonstr = get_string('save', 'group');
53 $mform->addElement('hidden','id', null);
54 $mform->setType('id', PARAM_INT);
55 if (empty($CFG->enablegroupings)) {
56 // NO GROUPINGS YET!
57 $mform->addElement('hidden', 'newgrouping', GROUP_NOT_IN_GROUPING);
58 $mform->setType('newgrouping', PARAM_INT);
59 } else {
60 // Options to move group to another grouping
61 $groupingids = groups_get_groupings($courseid);
63 // Add pseudo-grouping "Not in a grouping"
64 $groupingids[] = GROUP_NOT_IN_GROUPING;
65 if ($groupingids) {
66 // Put the groupings into a hash and sort them
67 foreach($groupingids as $id) {
68 $listgroupings[$id] = groups_get_grouping_displayname($id, $courseid);
70 natcasesort($listgroupings);
71 $mform->addElement('select', 'newgrouping', get_string('addgroupstogrouping', 'group'), $listgroupings);
72 $mform->setDefault('newgrouping', $groupingid);
77 if($groupingid) {
78 $mform->addElement('hidden', 'grouping', $groupingid);
79 $mform->setType('grouping', PARAM_INT);
82 $this->add_action_buttons(true, $buttonstr);
83 $mform->addElement('hidden', 'courseid', $courseid);
86 function definition_after_data() {
87 global $USER, $CFG;
90 function get_um() {
91 return $this->_upload_manager;