Automatic installer.php lang files by installer_builder (20081208)
[moodle.git] / mod / survey / mod_form.php
blob48242ccc404c56f5ecaa0ec429436dbb00161ed8
1 <?php
2 require_once ($CFG->dirroot.'/course/moodleform_mod.php');
4 class mod_survey_mod_form extends moodleform_mod {
6 function definition() {
8 global $CFG;
9 $mform =& $this->_form;
11 $strrequired = get_string('required');
13 //-------------------------------------------------------------------------------
14 $mform->addElement('header', 'general', get_string('general', 'form'));
16 $mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
17 if (!empty($CFG->formatstringstriptags)) {
18 $mform->setType('name', PARAM_TEXT);
19 } else {
20 $mform->setType('name', PARAM_CLEAN);
22 $mform->addRule('name', null, 'required', null, 'client');
24 if (!$options = get_records_menu("survey", "template", 0, "name", "id, name")) {
25 error('No survey templates found!');
28 foreach ($options as $id => $name) {
29 $options[$id] = get_string($name, "survey");
31 $options = array(''=>get_string('choose').'...') + $options;
32 $mform->addElement('select', 'template', get_string("surveytype", "survey"), $options);
33 $mform->addRule('template', $strrequired, 'required', null, 'client');
34 $mform->setHelpButton('template', array('surveys', get_string('helpsurveys', 'survey')));
37 $mform->addElement('textarea', 'intro', get_string('customintro', 'survey'), 'wrap="virtual" rows="20" cols="75"');
38 $mform->setType('intro', PARAM_RAW);
40 $features = new stdClass;
41 $features->groups = true;
42 $features->groupings = true;
43 $features->groupmembersonly = true;
44 $this->standard_coursemodule_elements($features);
46 //-------------------------------------------------------------------------------
47 // buttons
48 $this->add_action_buttons();