Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/feedback/item/textarea/textarea_form.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 require_once($CFG->dirroot.'/mod/feedback/item/feedback_item_form_class.php');
00018 
00019 class feedback_textarea_form extends feedback_item_form {
00020     protected $type = "textarea";
00021 
00022     public function definition() {
00023         $item = $this->_customdata['item'];
00024         $common = $this->_customdata['common'];
00025         $positionlist = $this->_customdata['positionlist'];
00026         $position = $this->_customdata['position'];
00027 
00028         $mform =& $this->_form;
00029 
00030         $mform->addElement('header', 'general', get_string($this->type, 'feedback'));
00031         $mform->addElement('checkbox', 'required', get_string('required', 'feedback'));
00032 
00033         $mform->addElement('text',
00034                             'name',
00035                             get_string('item_name', 'feedback'),
00036                             array('size'=>FEEDBACK_ITEM_NAME_TEXTBOX_SIZE, 'maxlength'=>255));
00037         $mform->addElement('text',
00038                             'label',
00039                             get_string('item_label', 'feedback'),
00040                             array('size'=>FEEDBACK_ITEM_LABEL_TEXTBOX_SIZE, 'maxlength'=>255));
00041 
00042         $mform->addElement('select',
00043                             'itemwidth',
00044                             get_string('textarea_width', 'feedback').'&nbsp;',
00045                             array_slice(range(0, 80), 5, 80, true));
00046 
00047         $mform->addElement('select',
00048                             'itemheight',
00049                             get_string('textarea_height', 'feedback').'&nbsp;',
00050                             array_slice(range(0, 40), 5, 40, true));
00051 
00052         parent::definition();
00053         $this->set_data($item);
00054 
00055     }
00056 
00057     public function get_data() {
00058         if (!$item = parent::get_data()) {
00059             return false;
00060         }
00061 
00062         $item->presentation = $item->itemwidth . '|'. $item->itemheight;
00063         return $item;
00064     }
00065 }
00066 
 All Data Structures Namespaces Files Functions Variables Enumerations