Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/workshop/form/comments/assessment_form.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00027 defined('MOODLE_INTERNAL') || die();
00028 
00029 require_once(dirname(dirname(__FILE__)).'/assessment_form.php');    // parent class definition
00030 
00036 class workshop_comments_assessment_form extends workshop_assessment_form {
00037 
00045     protected function definition_inner(&$mform) {
00046         $fields     = $this->_customdata['fields'];
00047         $current    = $this->_customdata['current'];
00048         $nodims     = $this->_customdata['nodims'];     // number of assessment dimensions
00049 
00050         $mform->addElement('hidden', 'nodims', $nodims);
00051         $mform->setType('nodims', PARAM_INT);
00052 
00053         for ($i = 0; $i < $nodims; $i++) {
00054             // dimension header
00055             $dimtitle = get_string('dimensionnumber', 'workshopform_comments', $i+1);
00056             $mform->addElement('header', 'dimensionhdr__idx_'.$i, $dimtitle);
00057 
00058             // dimension id
00059             $mform->addElement('hidden', 'dimensionid__idx_'.$i, $fields->{'dimensionid__idx_'.$i});
00060             $mform->setType('dimensionid__idx_'.$i, PARAM_INT);
00061 
00062             // grade id
00063             $mform->addElement('hidden', 'gradeid__idx_'.$i);   // value set by set_data() later
00064             $mform->setType('gradeid__idx_'.$i, PARAM_INT);
00065 
00066             // dimension description
00067             $desc = '<div id="id_dim_'.$fields->{'dimensionid__idx_'.$i}.'_desc" class="fitem description comments">'."\n";
00068             $desc .= format_text($fields->{'description__idx_'.$i}, $fields->{'description__idx_'.$i.'format'});
00069             $desc .= "\n</div>";
00070             $mform->addElement('html', $desc);
00071 
00072             // comment
00073             $label = get_string('dimensioncomment', 'workshopform_comments');
00074             //$mform->addElement('editor', 'peercomment__idx_' . $i, $label, null, array('maxfiles' => 0));
00075             $mform->addElement('textarea', 'peercomment__idx_' . $i, $label, array('cols' => 60, 'rows' => 10));
00076             $mform->addRule('peercomment__idx_' . $i, null, 'required', null, 'client');
00077         }
00078         $this->set_data($current);
00079     }
00080 }
 All Data Structures Namespaces Files Functions Variables Enumerations