1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- // This file is part of
- //
- // 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/>.
- defined('MOODLE_INTERNAL') || die();
- require_once($CFG->dirroot.'/course/moodleform_mod.php');
- require_once("$CFG->libdir/formslib.php");
- class mod_gradeimporter_submission_form extends moodleform {
- public function definition() {
- global $CFG, $DB;
- $mform = $this->_form;
- // Custom data
- $submission = $this->_customdata['submission']; // Load fields data
- $filemanageroptions = $this->_customdata['filemanageroptions'];
- // ----------------------------------------------------------------
- // General information
- // Header
- $mform->addElement('header', 'newsub', get_string('newsubmission', 'gradeimporter'));
- // Submission name field
- $mform->addElement('text', 'name', get_string('submissionname', 'gradeimporter'));
- $mform->setType('name', PARAM_TEXT);
- $mform->addRule('name', null, 'required', null, 'client');
- $mform->addElement('editor', 'description', get_string('description'));
- $mform->setType('description', PARAM_TEXT);
- $mform->addElement('filemanager', 'submissionfiles_filemanager', get_string('submissionfiles', 'gradeimporter'),
- null, $filemanageroptions);
- $mform->addHelpButton('submissionfiles_filemanager', 'submissionfiles', 'gradeimporter');
- $selectvalues = array('red', 'green', 'blue');
- $select = $mform->addElement('select', 'type', get_string('submissiontype', 'gradeimporter'), $selectvalues);
- $mform->addElement('selectyesno', 'visibility', get_string('visibility', 'gradeimporter'));
- $mform->setDefault('visibility', array('value' => 1));
- $mform->addHelpButton('visibility', 'visibility', 'gradeimporter');
- $mform->addElement('selectyesno', 'gradebook', get_string('gradebook', 'gradeimporter'));
- $mform->setDefault('gradebook', array('value' => 0));
- $mform->addHelpButton('gradebook', 'gradebook', 'gradeimporter');
- // -----------------------------
- // Hidden fields
- $mform->addElement('hidden', 'id');
- $mform->setType('id', PARAM_INT);
- $mform->addElement('hidden', 'cmid');
- $mform->setType('cmid', PARAM_INT);
- // ------------------------------
- // Save and cancel buttons
- $this->add_action_buttons();
- // ------------------------------
- // Sets preloaded data to fields
- $this->set_data($submission);
- }
- }
|