Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/quiz/report/grading/gradingsettings_form.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00027 defined('MOODLE_INTERNAL') || die();
00028 
00029 require_once($CFG->libdir . '/formslib.php');
00030 
00031 
00038 class quiz_grading_settings extends moodleform {
00039     protected $includeauto;
00040     protected $hidden = array();
00041     protected $counts;
00042     protected $shownames;
00043     protected $showidnumbers;
00044 
00045     public function __construct($hidden, $counts, $shownames, $showidnumbers) {
00046         global $CFG;
00047         $this->includeauto = !empty($hidden['includeauto']);
00048         $this->hidden = $hidden;
00049         $this->counts = $counts;
00050         $this->shownames = $shownames;
00051         $this->showidnumbers = $showidnumbers;
00052         parent::__construct($CFG->wwwroot . '/mod/quiz/report.php', null, 'get');
00053     }
00054 
00055     protected function definition() {
00056         $mform =& $this->_form;
00057 
00058         $mform->addElement('header', 'options', get_string('options', 'quiz_grading'));
00059 
00060         $gradeoptions = array();
00061         foreach (array('needsgrading', 'manuallygraded', 'autograded', 'all') as $type) {
00062             if (empty($this->counts->$type)) {
00063                 continue;
00064             }
00065             if ($type == 'autograded' && !$this->includeauto) {
00066                 continue;
00067             }
00068             $gradeoptions[$type] = get_string('gradeattempts' . $type, 'quiz_grading',
00069                     $this->counts->$type);
00070         }
00071         $mform->addElement('select', 'grade', get_string('attemptstograde', 'quiz_grading'),
00072                 $gradeoptions);
00073 
00074         $mform->addElement('text', 'pagesize', get_string('questionsperpage', 'quiz_grading'),
00075                 array('size' => 3));
00076         $mform->setType('pagesize', PARAM_INT);
00077 
00078         $orderoptions = array(
00079             'random' => get_string('randomly', 'quiz_grading'),
00080             'date' => get_string('bydate', 'quiz_grading'),
00081         );
00082         if ($this->shownames) {
00083             $orderoptions['student'] = get_string('bystudentname', 'quiz_grading');
00084         }
00085         if ($this->showidnumbers) {
00086             $orderoptions['idnumber'] = get_string('bystudentidnumber', 'quiz_grading');
00087         }
00088         $mform->addElement('select', 'order', get_string('orderattempts', 'quiz_grading'),
00089                 $orderoptions);
00090 
00091         foreach ($this->hidden as $name => $value) {
00092             $mform->addElement('hidden', $name, $value);
00093         }
00094 
00095         $mform->addElement('submit', 'submitbutton', get_string('changeoptions', 'quiz_grading'));
00096     }
00097 }
 All Data Structures Namespaces Files Functions Variables Enumerations