MDL-50015 mod_imscp: New WS mod_imscp_view_imscp
[moodle.git] / mod / survey / mod_form.php
CommitLineData
4d7a4019 1<?php
bfebaf64
MD
2if (!defined('MOODLE_INTERNAL')) {
3 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
4}
5
23a7718b 6require_once ($CFG->dirroot.'/course/moodleform_mod.php');
4d7a4019 7
8class mod_survey_mod_form extends moodleform_mod {
9
10 function definition() {
f33e1ed4 11 global $CFG, $DB;
ac3668bf 12
4d7a4019 13 $mform =& $this->_form;
14
15 $strrequired = get_string('required');
16
17//-------------------------------------------------------------------------------
18 $mform->addElement('header', 'general', get_string('general', 'form'));
19
20 $mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
8eb1d25f 21 if (!empty($CFG->formatstringstriptags)) {
22 $mform->setType('name', PARAM_TEXT);
23 } else {
b8ea3041 24 $mform->setType('name', PARAM_CLEANHTML);
8eb1d25f 25 }
4d7a4019 26 $mform->addRule('name', null, 'required', null, 'client');
27
f33e1ed4 28 if (!$options = $DB->get_records_menu("survey", array("template"=>0), "name", "id, name")) {
83b10e57 29 print_error('cannotfindsurveytmpt', 'survey');
4d7a4019 30 }
31
32 foreach ($options as $id => $name) {
33 $options[$id] = get_string($name, "survey");
34 }
35 $options = array(''=>get_string('choose').'...') + $options;
36 $mform->addElement('select', 'template', get_string("surveytype", "survey"), $options);
37 $mform->addRule('template', $strrequired, 'required', null, 'client');
54033df5 38 $mform->addHelpButton('template', 'surveytype', 'survey');
4d7a4019 39
6398ff53 40 $this->standard_intro_elements(get_string('customintro', 'survey'));
4d7a4019 41
42f103be 42 $this->standard_coursemodule_elements();
4d7a4019 43
44//-------------------------------------------------------------------------------
45 // buttons
46 $this->add_action_buttons();
47 }
48
49
50}
e5dd8e3b 51