Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/workshop/form/numerrors/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_numerrors_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_numerrors', $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 numerrors">'."\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             // evaluation of the assertion
00073             $label = get_string('dimensiongrade', 'workshopform_numerrors');
00074             $mform->addGroup(array(
00075                 $mform->createElement('radio', 'grade__idx_' . $i, '', $fields->{'grade0__idx_'.$i}, -1),
00076                 $mform->createElement('radio', 'grade__idx_' . $i, '', $fields->{'grade1__idx_'.$i}, 1),
00077             ), 'group_grade__idx_' . $i, get_string('yourassessment', 'workshop'), '<br />', false);
00078             $mform->addRule('group_grade__idx_' . $i, get_string('required'), 'required');
00079 
00080             // comment
00081             $label = get_string('dimensioncomment', 'workshopform_numerrors');
00082             $mform->addElement('textarea', 'peercomment__idx_' . $i, $label, array('cols' => 60, 'rows' => 5));
00083         }
00084         $this->set_data($current);
00085     }
00086 }
 All Data Structures Namespaces Files Functions Variables Enumerations