Merge branch 'MDL-27675_master' of git://github.com/grabs/moodle
[moodle.git] / mod / feedback / item / textarea / textarea_form.php
CommitLineData
6ee09cfe 1<?php
9c5bc7a5
AG
2// This file is part of Moodle - http://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
6ee09cfe 16
a627a9c1 17require_once($CFG->dirroot.'/mod/feedback/item/feedback_item_form_class.php');
6ee09cfe 18
a627a9c1 19class feedback_textarea_form extends feedback_item_form {
9c5bc7a5 20 protected $type = "textarea";
1adbd2c3 21
9c5bc7a5 22 public function definition() {
271fdd62
AG
23 $item = $this->_customdata['item'];
24 $common = $this->_customdata['common'];
25 $positionlist = $this->_customdata['positionlist'];
26 $position = $this->_customdata['position'];
27
6ee09cfe 28 $mform =& $this->_form;
1adbd2c3 29
6ee09cfe 30 $mform->addElement('header', 'general', get_string($this->type, 'feedback'));
271fdd62 31 $mform->addElement('checkbox', 'required', get_string('required', 'feedback'));
1adbd2c3 32
af26e345
AG
33 $mform->addElement('text',
34 'name',
35 get_string('item_name', 'feedback'),
36 array('size'=>FEEDBACK_ITEM_NAME_TEXTBOX_SIZE, 'maxlength'=>255));
37 $mform->addElement('text',
38 'label',
39 get_string('item_label', 'feedback'),
40 array('size'=>FEEDBACK_ITEM_LABEL_TEXTBOX_SIZE, 'maxlength'=>255));
1adbd2c3 41
271fdd62
AG
42 $mform->addElement('select',
43 'itemwidth',
44 get_string('textarea_width', 'feedback').'&nbsp;',
9c5bc7a5 45 array_slice(range(0, 80), 5, 80, true));
6ee09cfe 46
271fdd62
AG
47 $mform->addElement('select',
48 'itemheight',
49 get_string('textarea_height', 'feedback').'&nbsp;',
9c5bc7a5 50 array_slice(range(0, 40), 5, 40, true));
6ee09cfe 51
5e97c34d 52 parent::definition();
271fdd62 53 $this->set_data($item);
51859310 54
6ee09cfe 55 }
9c5bc7a5
AG
56
57 public function get_data() {
58 if (!$item = parent::get_data()) {
271fdd62
AG
59 return false;
60 }
9c5bc7a5 61
271fdd62
AG
62 $item->presentation = $item->itemwidth . '|'. $item->itemheight;
63 return $item;
64 }
6ee09cfe 65}
1adbd2c3 66