MDL-22180 - Implementing new selector names for page layout
[moodle.git] / mod / feedback / item / captcha / captcha_form.php
CommitLineData
6ee09cfe 1<?php
2
a627a9c1 3require_once($CFG->dirroot.'/mod/feedback/item/feedback_item_form_class.php');
6ee09cfe 4
a627a9c1 5class feedback_captcha_form extends feedback_item_form {
6ee09cfe 6 var $type = "captcha";
7 var $requiredcheck;
8 var $itemname;
b7a47958 9 var $itemlabel;
6ee09cfe 10 var $select;
1adbd2c3 11
6ee09cfe 12 function definition() {
13 $mform =& $this->_form;
1adbd2c3 14
6ee09cfe 15 $mform->addElement('header', 'general', get_string($this->type, 'feedback'));
16 $this->requiredcheck = $mform->addElement('checkbox', 'required', get_string('required', 'feedback'));
1adbd2c3 17
ed93c78b 18 $this->itemname = $mform->addElement('text', 'itemname', get_string('item_name', 'feedback'), array('size="'.FEEDBACK_ITEM_NAME_TEXTBOX_SIZE.'"','maxlength="255"'));
b7a47958 19 $this->itemlabel = $mform->addElement('text', 'itemlabel', get_string('item_label', 'feedback'), array('size="'.FEEDBACK_ITEM_LABEL_TEXTBOX_SIZE.'"','maxlength="255"'));
1adbd2c3 20
6ee09cfe 21 $this->select = $mform->addElement('select',
1adbd2c3
PS
22 'count_of_nums',
23 get_string('count_of_nums', 'feedback').'&nbsp;',
6ee09cfe 24 array_slice(range(0,10),3,10,true));
1adbd2c3 25
51859310
AG
26
27 ////////////////////////////////////////////////////////////////////////
28 //the following is used in all itemforms
29 ////////////////////////////////////////////////////////////////////////
30 $item = $this->_customdata['item'];
31 $common = $this->_customdata['common'];
32
33 $mform->addElement('hidden', 'cmid', $common['cmid']);
34 $mform->setType('cmid', PARAM_INT);
35 $mform->addElement('hidden', 'id', $common['id']);
36 $mform->setType('id', PARAM_INT);
37 $mform->addElement('hidden', 'typ', $common['typ']);
38 $mform->setType('typ', PARAM_ALPHA);
39 $mform->addElement('hidden', 'feedbackid', $common['feedbackid']);
40 $mform->setType('feedbackid', PARAM_INT);
41
42 $position_select = $mform->addElement('select',
43 'position',
44 get_string('position', 'feedback').'&nbsp;',
45 $this->_customdata['positionlist']);
46 $position_select->setValue($this->_customdata['position']);
47
48
49 $buttonarray = array();
50 if(!empty($item->id)){
51 $mform->addElement('hidden', 'updateitem', '1');
52 $mform->setType('updateitem', PARAM_INT);
53 // $i_form->addElement('submit', 'update_item', get_string('update_item', 'feedback'));
54 $buttonarray[] = &$mform->createElement('submit', 'update_item', get_string('update_item', 'feedback'));
55 }else{
56 $mform->addElement('hidden', 'saveitem', '1');
57 $mform->setType('saveitem', PARAM_INT);
58 // $i_form->addElement('submit', 'save_item', get_string('save_item', 'feedback'));
59 $buttonarray[] = &$mform->createElement('submit', 'save_item', get_string('save_item', 'feedback'));
60 }
61 // $i_form->addElement('cancel');
62 $buttonarray[] = &$mform->createElement('cancel');
63 $mform->addGroup($buttonarray, 'buttonar', '&nbsp;', array(' '), false);
64
6ee09cfe 65 }
66}
1adbd2c3 67