| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Summary view] [Print] [Text view]
1 <?php //$Id: grouping_form.php,v 1.1.2.2 2007/11/23 22:12:35 skodak Exp $ 2 3 require_once($CFG->dirroot.'/lib/formslib.php'); 4 5 /// get url variables 6 class grouping_form extends moodleform { 7 8 // Define the form 9 function definition () { 10 global $USER, $CFG, $COURSE; 11 12 $mform =& $this->_form; 13 14 $mform->addElement('text','name', get_string('groupingname', 'group'),'maxlength="254" size="50"'); 15 $mform->addRule('name', get_string('required'), 'required', null, 'server'); 16 $mform->setType('name', PARAM_MULTILANG); 17 18 $mform->addElement('htmleditor', 'description', get_string('groupingdescription', 'group'), array('rows'=> '15', 'course' => $COURSE->id, 'cols'=>'45')); 19 $mform->setType('description', PARAM_RAW); 20 21 $mform->addElement('hidden','id'); 22 $mform->setType('id', PARAM_INT); 23 24 $mform->addElement('hidden', 'courseid'); 25 $mform->setType('courseid', PARAM_INT); 26 27 $this->add_action_buttons(); 28 } 29 30 function validation($data, $files) { 31 global $COURSE; 32 33 $errors = parent::validation($data, $files); 34 35 $name = trim(stripslashes($data['name'])); 36 if ($data['id'] and $grouping = get_record('groupings', 'id', $data['id'])) { 37 if ($grouping->name != $name) { 38 if (groups_get_grouping_by_name($COURSE->id, $name)) { 39 $errors['name'] = get_string('groupingnameexists', 'group', $name); 40 } 41 } 42 43 } else if (groups_get_grouping_by_name($COURSE->id, $name)) { 44 $errors['name'] = get_string('groupingnameexists', 'group', $name); 45 } 46 47 return $errors; 48 } 49 50 } 51 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |