MDL-19976 Changing redirect($url->out()) to redirect($url). NEVER, NEVER use redirect...
[moodle.git] / mod / quiz / report / overview / overviewsettings_form.php
1 <?php  // $Id$
2 require_once "$CFG->libdir/formslib.php";
3 class mod_quiz_report_overview_settings extends moodleform {
5     function definition() {
6         global $COURSE;
7         $mform    =& $this->_form;
8 //-------------------------------------------------------------------------------
9         $mform->addElement('header', 'preferencespage', get_string('preferencespage', 'quiz_overview'));
11         if (!$this->_customdata['currentgroup']){
12             $studentsstring = get_string('participants');
13         } else {
14             $a = new object();
15             $a->coursestudent = get_string('participants');
16             $a->groupname = groups_get_group_name($this->_customdata['currentgroup']);
17             if (20 < strlen($a->groupname)){
18               $studentsstring = get_string('studentingrouplong', 'quiz_overview', $a);
19             } else {
20               $studentsstring = get_string('studentingroup', 'quiz_overview', $a);
21             }
22         }
23         $options = array();
24         if (!$this->_customdata['currentgroup']){
25             $options[QUIZ_REPORT_ATTEMPTS_ALL] = get_string('optallattempts','quiz_overview');
26         }
27         if ($this->_customdata['currentgroup'] || $COURSE->id != SITEID) {
28             $options[QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS] = get_string('optallstudents','quiz_overview', $studentsstring);
29             $options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH] =
30                      get_string('optattemptsonly','quiz_overview', $studentsstring);
31             $options[QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO] = get_string('optnoattemptsonly', 'quiz_overview', $studentsstring);
32         }
33         $mform->addElement('select', 'attemptsmode', get_string('show', 'quiz_overview'), $options);
35         $showattemptsgrp = array();
36         if ($this->_customdata['qmsubselect']){
37             $gm = '<span class="highlight">'.quiz_get_grading_option_name($this->_customdata['quiz']->grademethod).'</span>';
38             $showattemptsgrp[] =& $mform->createElement('advcheckbox', 'qmfilter', get_string('showattempts', 'quiz_overview'), get_string('optonlygradedattempts', 'quiz_overview', $gm), null, array(0,1));
39         }
40         if (has_capability('mod/quiz:regrade', $this->_customdata['context'])){
41             $showattemptsgrp[] =& $mform->createElement('advcheckbox', 'regradefilter', get_string('showattempts', 'quiz_overview'), get_string('optonlyregradedattempts', 'quiz_overview'), null, array(0,1));
42         }
43         if ($showattemptsgrp){
44             $mform->addGroup($showattemptsgrp, null, get_string('showattempts', 'quiz_overview'), '<br />', false);
45         } 
46 //-------------------------------------------------------------------------------
47         $mform->addElement('header', 'preferencesuser', get_string('preferencesuser', 'quiz_overview'));
49         $mform->addElement('text', 'pagesize', get_string('pagesize', 'quiz_overview'));
50         $mform->setType('pagesize', PARAM_INT);
52         $mform->addElement('selectyesno', 'detailedmarks', get_string('showdetailedmarks', 'quiz_overview'));
54         $this->add_action_buttons(false, get_string('preferencessave', 'quiz_overview'));
55     }
56 }
57 ?>