|
Moodle
2.2.1
http://www.collinsharper.com
|
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 mod_quiz_report_overview_settings extends moodleform { 00039 00040 protected function definition() { 00041 $mform = $this->_form; 00042 00043 $mform->addElement('header', 'preferencespage', 00044 get_string('preferencespage', 'quiz_overview')); 00045 00046 if (!$this->_customdata['currentgroup']) { 00047 $studentsstring = get_string('participants'); 00048 } else { 00049 $a = new stdClass(); 00050 $a->coursestudent = get_string('participants'); 00051 $a->groupname = groups_get_group_name($this->_customdata['currentgroup']); 00052 if (20 < strlen($a->groupname)) { 00053 $studentsstring = get_string('studentingrouplong', 'quiz_overview', $a); 00054 } else { 00055 $studentsstring = get_string('studentingroup', 'quiz_overview', $a); 00056 } 00057 } 00058 $options = array(); 00059 if (!$this->_customdata['currentgroup']) { 00060 $options[QUIZ_REPORT_ATTEMPTS_ALL] = get_string('optallattempts', 'quiz_overview'); 00061 } 00062 if ($this->_customdata['currentgroup'] || 00063 !is_inside_frontpage($this->_customdata['context'])) { 00064 $options[QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS] = 00065 get_string('optallstudents', 'quiz_overview', $studentsstring); 00066 $options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH] = 00067 get_string('optattemptsonly', 'quiz_overview', $studentsstring); 00068 $options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO] = 00069 get_string('optnoattemptsonly', 'quiz_overview', $studentsstring); 00070 } 00071 $mform->addElement('select', 'attemptsmode', get_string('show', 'quiz_overview'), $options); 00072 00073 $showattemptsgrp = array(); 00074 if ($this->_customdata['qmsubselect']) { 00075 $gm = '<span class="highlight">' . 00076 quiz_get_grading_option_name($this->_customdata['quiz']->grademethod) . 00077 '</span>'; 00078 $showattemptsgrp[] = $mform->createElement('advcheckbox', 'qmfilter', 00079 get_string('showattempts', 'quiz_overview'), 00080 get_string('optonlygradedattempts', 'quiz_overview', $gm), null, array(0, 1)); 00081 } 00082 if (has_capability('mod/quiz:regrade', $this->_customdata['context'])) { 00083 $showattemptsgrp[] = $mform->createElement('advcheckbox', 'regradefilter', 00084 get_string('showattempts', 'quiz_overview'), 00085 get_string('optonlyregradedattempts', 'quiz_overview'), null, array(0, 1)); 00086 } 00087 if ($showattemptsgrp) { 00088 $mform->addGroup($showattemptsgrp, null, 00089 get_string('showattempts', 'quiz_overview'), '<br />', false); 00090 } 00091 00092 $mform->addElement('header', 'preferencesuser', 00093 get_string('preferencesuser', 'quiz_overview')); 00094 00095 $mform->addElement('text', 'pagesize', get_string('pagesize', 'quiz_overview')); 00096 $mform->setType('pagesize', PARAM_INT); 00097 00098 $mform->addElement('selectyesno', 'detailedmarks', 00099 get_string('showdetailedmarks', 'quiz_overview')); 00100 00101 $mform->addElement('submit', 'submitbutton', 00102 get_string('preferencessave', 'quiz_overview')); 00103 } 00104 }