|
Moodle
2.2.1
http://www.collinsharper.com
|
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_accumulative_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 // minimal grade value to select - used by the 'compare' rule below 00054 // (just an implementation detail to make the rule work, this element is 00055 // not processed by the server) 00056 $mform->addElement('hidden', 'minusone', -1); 00057 $mform->setType('minusone', PARAM_INT); 00058 00059 for ($i = 0; $i < $nodims; $i++) { 00060 // dimension header 00061 $dimtitle = get_string('dimensionnumber', 'workshopform_accumulative', $i+1); 00062 $mform->addElement('header', 'dimensionhdr__idx_'.$i, $dimtitle); 00063 00064 // dimension id 00065 $mform->addElement('hidden', 'dimensionid__idx_'.$i, $fields->{'dimensionid__idx_'.$i}); 00066 $mform->setType('dimensionid__idx_'.$i, PARAM_INT); 00067 00068 // grade id 00069 $mform->addElement('hidden', 'gradeid__idx_'.$i); // value set by set_data() later 00070 $mform->setType('gradeid__idx_'.$i, PARAM_INT); 00071 00072 // dimension description 00073 $desc = '<div id="id_dim_'.$fields->{'dimensionid__idx_'.$i}.'_desc" class="fitem description accumulative">'."\n"; 00074 $desc .= format_text($fields->{'description__idx_'.$i}, $fields->{'description__idx_'.$i.'format'}); 00075 $desc .= "\n</div>"; 00076 $mform->addElement('html', $desc); 00077 00078 // grade for this aspect 00079 $label = get_string('dimensiongrade', 'workshopform_accumulative'); 00080 $options = make_grades_menu($fields->{'grade__idx_' . $i}); 00081 $options = array('-1' => get_string('choosedots')) + $options; 00082 $mform->addElement('select', 'grade__idx_' . $i, $label, $options); 00083 $mform->addRule(array('grade__idx_' . $i, 'minusone') , get_string('mustchoosegrade', 'workshopform_accumulative'), 'compare', 'gt'); 00084 00085 // comment 00086 $label = get_string('dimensioncomment', 'workshopform_accumulative'); 00087 //$mform->addElement('editor', 'peercomment__idx_' . $i, $label, null, array('maxfiles' => 0)); 00088 $mform->addElement('textarea', 'peercomment__idx_' . $i, $label, array('cols' => 60, 'rows' => 5)); 00089 } 00090 $this->set_data($current); 00091 } 00092 }