MDL-18910 moving modedit features to modname_supports()
[moodle.git] / mod / survey / mod_form.php
CommitLineData
4d7a4019 1<?php
23a7718b 2require_once ($CFG->dirroot.'/course/moodleform_mod.php');
4d7a4019 3
4class mod_survey_mod_form extends moodleform_mod {
5
6 function definition() {
7
f33e1ed4 8 global $CFG, $DB;
4d7a4019 9 $mform =& $this->_form;
10
11 $strrequired = get_string('required');
12
13//-------------------------------------------------------------------------------
14 $mform->addElement('header', 'general', get_string('general', 'form'));
15
16 $mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
8eb1d25f 17 if (!empty($CFG->formatstringstriptags)) {
18 $mform->setType('name', PARAM_TEXT);
19 } else {
20 $mform->setType('name', PARAM_CLEAN);
21 }
4d7a4019 22 $mform->addRule('name', null, 'required', null, 'client');
23
f33e1ed4 24 if (!$options = $DB->get_records_menu("survey", array("template"=>0), "name", "id, name")) {
83b10e57 25 print_error('cannotfindsurveytmpt', 'survey');
4d7a4019 26 }
27
28 foreach ($options as $id => $name) {
29 $options[$id] = get_string($name, "survey");
30 }
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')));
35
36
37 $mform->addElement('textarea', 'intro', get_string('customintro', 'survey'), 'wrap="virtual" rows="20" cols="75"');
38 $mform->setType('intro', PARAM_RAW);
39
42f103be 40 $this->standard_coursemodule_elements();
4d7a4019 41
42//-------------------------------------------------------------------------------
43 // buttons
44 $this->add_action_buttons();
45 }
46
47
48}
83b10e57 49?>