|
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($CFG->libdir . '/formslib.php'); // parent class definition 00030 00040 class workshop_assessment_form extends moodleform { 00041 00052 public function definition() { 00053 global $CFG; 00054 00055 $mform = $this->_form; 00056 $this->mode = $this->_customdata['mode']; // influences the save buttons 00057 $this->strategy = $this->_customdata['strategy']; // instance of the strategy api class 00058 $this->workshop = $this->_customdata['workshop']; // instance of the workshop api class 00059 $this->options = $this->_customdata['options']; // array with addiotional options 00060 00061 // add the strategy-specific fields 00062 $this->definition_inner($mform); 00063 00064 // add the data common for all subplugins 00065 $mform->addElement('hidden', 'strategy', $this->workshop->strategy); 00066 $mform->setType('strategy', PARAM_PLUGIN); 00067 00068 if (!empty($this->options['editableweight']) and !$mform->isFrozen()) { 00069 $mform->addElement('header', 'assessmentsettings', get_string('assessmentweight', 'workshop')); 00070 $mform->addElement('select', 'weight', 00071 get_string('assessmentweight', 'workshop'), workshop::available_assessment_weights_list()); 00072 $mform->setDefault('weight', 1); 00073 } 00074 00075 $buttonarray = array(); 00076 if ($this->mode == 'preview') { 00077 $buttonarray[] = $mform->createElement('cancel', 'backtoeditform', get_string('backtoeditform', 'workshop')); 00078 } 00079 if ($this->mode == 'assessment') { 00080 $buttonarray[] = $mform->createElement('submit', 'saveandcontinue', get_string('saveandcontinue', 'workshop')); 00081 $buttonarray[] = $mform->createElement('submit', 'saveandclose', get_string('saveandclose', 'workshop')); 00082 $buttonarray[] = $mform->createElement('cancel'); 00083 } 00084 $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); 00085 $mform->closeHeaderBefore('buttonar'); 00086 } 00087 00093 protected function definition_inner(&$mform) { 00094 // By default, do nothing. 00095 } 00096 00097 }