|
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->dirroot.'/lib/formslib.php'); 00030 00039 class workshop_random_allocator_form extends moodleform { 00040 00044 public function definition() { 00045 $mform = $this->_form; 00046 $workshop = $this->_customdata['workshop']; 00047 $plugindefaults = get_config('workshopallocation_random'); 00048 00049 $mform->addElement('header', 'settings', get_string('allocationsettings', 'workshopallocation_random')); 00050 00051 $gmode = groups_get_activity_groupmode($workshop->cm, $workshop->course); 00052 switch ($gmode) { 00053 case NOGROUPS: 00054 $grouplabel = get_string('groupsnone', 'group'); 00055 break; 00056 case VISIBLEGROUPS: 00057 $grouplabel = get_string('groupsvisible', 'group'); 00058 break; 00059 case SEPARATEGROUPS: 00060 $grouplabel = get_string('groupsseparate', 'group'); 00061 break; 00062 } 00063 $mform->addElement('static', 'groupmode', get_string('groupmode', 'group'), $grouplabel); 00064 00065 $options_numper = array( 00066 workshop_random_allocator::USERTYPE_AUTHOR => get_string('numperauthor', 'workshopallocation_random'), 00067 workshop_random_allocator::USERTYPE_REVIEWER => get_string('numperreviewer', 'workshopallocation_random') 00068 ); 00069 $grpnumofreviews = array(); 00070 $grpnumofreviews[] = $mform->createElement('select', 'numofreviews', '', 00071 workshop_random_allocator::available_numofreviews_list()); 00072 $mform->setDefault('numofreviews', $plugindefaults->numofreviews); 00073 $grpnumofreviews[] = $mform->createElement('select', 'numper', '', $options_numper); 00074 $mform->setDefault('numper', workshop_random_allocator::USERTYPE_AUTHOR); 00075 $mform->addGroup($grpnumofreviews, 'grpnumofreviews', get_string('numofreviews', 'workshopallocation_random'), 00076 array(' '), false); 00077 00078 if (VISIBLEGROUPS == $gmode) { 00079 $mform->addElement('checkbox', 'excludesamegroup', get_string('excludesamegroup', 'workshopallocation_random')); 00080 $mform->setDefault('excludesamegroup', 0); 00081 } else { 00082 $mform->addElement('hidden', 'excludesamegroup', 0); 00083 } 00084 00085 $mform->addElement('checkbox', 'removecurrent', get_string('removecurrentallocations', 'workshopallocation_random')); 00086 $mform->setDefault('removecurrent', 0); 00087 00088 $mform->addElement('checkbox', 'assesswosubmission', get_string('assesswosubmission', 'workshopallocation_random')); 00089 $mform->setDefault('assesswosubmission', 0); 00090 00091 if (empty($workshop->useselfassessment)) { 00092 $mform->addElement('static', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random'), 00093 get_string('selfassessmentdisabled', 'workshop')); 00094 } else { 00095 $mform->addElement('checkbox', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random')); 00096 } 00097 00098 $this->add_action_buttons(); 00099 } 00100 }