/** * Definition of the setting form elements */ public function definition() { $mform = $this->_form; $workshop = $this->_customdata['workshop']; $plugindefaults = get_config('workshopallocation_random'); $mform->addElement('header', 'randomallocationsettings', get_string('allocationsettings', 'workshopallocation_random')); $gmode = groups_get_activity_groupmode($workshop->cm, $workshop->course); switch ($gmode) { case NOGROUPS: $grouplabel = get_string('groupsnone', 'group'); break; case VISIBLEGROUPS: $grouplabel = get_string('groupsvisible', 'group'); break; case SEPARATEGROUPS: $grouplabel = get_string('groupsseparate', 'group'); break; } $mform->addElement('static', 'groupmode', get_string('groupmode', 'group'), $grouplabel); $options_numper = array( workshop_random_allocator_setting::NUMPER_SUBMISSION => get_string('numperauthor', 'workshopallocation_random'), workshop_random_allocator_setting::NUMPER_REVIEWER => get_string('numperreviewer', 'workshopallocation_random') ); $grpnumofreviews = array(); $grpnumofreviews[] = $mform->createElement('select', 'numofreviews', '', workshop_random_allocator::available_numofreviews_list()); $mform->setDefault('numofreviews', $plugindefaults->numofreviews); $grpnumofreviews[] = $mform->createElement('select', 'numper', '', $options_numper); $mform->setDefault('numper', workshop_random_allocator_setting::NUMPER_SUBMISSION); $mform->addGroup($grpnumofreviews, 'grpnumofreviews', get_string('numofreviews', 'workshopallocation_random'), array(' '), false); if (VISIBLEGROUPS == $gmode) { $mform->addElement('checkbox', 'excludesamegroup', get_string('excludesamegroup', 'workshopallocation_random')); $mform->setDefault('excludesamegroup', 0); } else { $mform->addElement('hidden', 'excludesamegroup', 0); } $mform->addElement('checkbox', 'removecurrent', get_string('removecurrentallocations', 'workshopallocation_random')); $mform->setDefault('removecurrent', 0); $mform->addElement('checkbox', 'assesswosubmission', get_string('assesswosubmission', 'workshopallocation_random')); $mform->setDefault('assesswosubmission', 0); if (empty($workshop->useselfassessment)) { $mform->addElement('static', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random'), get_string('selfassessmentdisabled', 'workshop')); } else { $mform->addElement('checkbox', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random')); } $this->add_action_buttons(); }
/** * Definition of the setting form elements */ public function definition() { $mform = $this->_form; $workshop = $this->_customdata['workshop']; $plugindefaults = get_config('workshopallocation_random'); $mform->addElement('header', 'randomallocationsettings', get_string('allocationsettings', 'workshopallocation_random')); $options_numper = array( workshop_random_allocator_setting::NUMPER_SUBMISSION => get_string('numperauthor', 'workshopallocation_random'), workshop_random_allocator_setting::NUMPER_REVIEWER => get_string('numperreviewer', 'workshopallocation_random') ); $grpnumofreviews = array(); $grpnumofreviews[] = $mform->createElement('select', 'numofreviews', '', workshop_random_allocator::available_numofreviews_list()); $mform->setDefault('numofreviews', $plugindefaults->numofreviews); $grpnumofreviews[] = $mform->createElement('select', 'numper', '', $options_numper); $mform->setDefault('numper', workshop_random_allocator_setting::NUMPER_SUBMISSION); $mform->addGroup($grpnumofreviews, 'grpnumofreviews', get_string('numofreviews', 'workshopallocation_random'), array(' '), false); $mform->addElement('checkbox', 'removecurrent', get_string('removecurrentallocations', 'workshopallocation_random')); $mform->setDefault('removecurrent', 0); $mform->addElement('checkbox', 'assesswosubmission', get_string('assesswosubmission', 'workshopallocation_random')); $mform->setDefault('assesswosubmission', 0); if (empty($workshop->useselfassessment)) { $mform->addElement('static', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random'), get_string('selfassessmentdisabled', 'workshop')); } else { $mform->addElement('checkbox', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random')); } $this->add_action_buttons(); }
public function definition() { global $PAGE; $mform = $this->_form; $workshop = $this->_customdata['workshop']; $plugindefaults = get_config('workshopallocation_random'); // Check late submissions setting if (!$workshop->latesubmissions) { $settingsurl = new moodle_url('/course/modedit.php', array('update' => $workshop->cm->id, 'return' => 1)); $settingslink = html_writer::link($settingsurl, get_string('workshopsettings', 'workshopallocation_live')); $latesubmissions = html_writer::tag('strong', get_string('latesubmissions', 'workshop')); $a = array('latesubmissions' => $latesubmissions, 'workshopsettings' => $settingslink); $message = get_string('latesubmissionsdisabled', 'workshopallocation_live', $a); $mform->addElement('html', html_writer::tag('p', $message)); return; } $strenbaled = get_string('enabled', 'workshopallocation_live'); $cm = get_coursemodule_from_instance('workshop', $workshop->id, 0, false, MUST_EXIST); $url = new moodle_url($PAGE->url, array('method' => 'scheduled', 'cmid' => $cm->id)); $strenabledinfo = get_string('enabledinfo', 'workshopallocation_live', $url->out()); $mform->addElement('checkbox', 'enabled', $strenbaled, $strenabledinfo); // Number of reviews $group = array(); $options = workshop_random_allocator::available_numofreviews_list(); $group[] = $mform->createElement('select', 'numofreviews', '', $options); $mform->setDefault('numofreviews', $plugindefaults->numofreviews); $options = array(workshop_random_allocator_setting::NUMPER_SUBMISSION => get_string('numperauthor', 'workshopallocation_random'), workshop_random_allocator_setting::NUMPER_REVIEWER => get_string('numperreviewer', 'workshopallocation_random')); $group[] = $mform->createElement('select', 'numper', '', $options); $mform->setDefault('numper', workshop_random_allocator_setting::NUMPER_SUBMISSION); $label = get_string('numofreviews', 'workshopallocation_random'); $mform->addGroup($group, 'groupnumofreviews', $label, array(' '), false); // Group mode $groupmode = groups_get_activity_groupmode($workshop->cm, $workshop->course); switch ($groupmode) { case NOGROUPS: $grouplabel = get_string('groupsnone', 'group'); break; case VISIBLEGROUPS: $grouplabel = get_string('groupsvisible', 'group'); break; case SEPARATEGROUPS: $grouplabel = get_string('groupsseparate', 'group'); break; } // Exclude same group $mform->addElement('static', 'groupmode', get_string('groupmode', 'group'), $grouplabel); if (VISIBLEGROUPS == $groupmode) { $label = get_string('excludesamegroup', 'workshopallocation_random'); $mform->addElement('checkbox', 'excludesamegroup', $label); $mform->setDefault('excludesamegroup', 0); } else { $mform->addElement('hidden', 'excludesamegroup', 0); $mform->setType('excludesamegroup', PARAM_BOOL); } // Self assessment if (empty($workshop->useselfassessment)) { $label = get_string('addselfassessment', 'workshopallocation_random'); $content = get_string('selfassessmentdisabled', 'workshop'); $mform->addElement('static', 'addselfassessment', $label, $content); } else { $label = get_string('addselfassessment', 'workshopallocation_random'); $mform->addElement('checkbox', 'addselfassessment', $label); } $this->add_action_buttons(); }
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * The configuration variables for "Random allocation" subplugin * * @package workshopallocation * @subpackage random * @copyright 2009 David Mudrak <*****@*****.**> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die; require_once dirname(__FILE__) . '/lib.php'; $settings->add(new admin_setting_configselect('workshopallocation_random/numofreviews', get_string('numofreviews', 'workshopallocation_random'), get_string('confignumofreviews', 'workshopallocation_random'), 5, workshop_random_allocator::available_numofreviews_list()));