Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/blocks/quiz_results/edit_form.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00026 defined('MOODLE_INTERNAL') || die();
00027 
00028 
00035 class block_quiz_results_edit_form extends block_edit_form {
00036     protected function specific_definition($mform) {
00037         global $DB;
00038 
00039         // Fields for editing HTML block title and contents.
00040         $mform->addElement('header', 'configheader', get_string('blocksettings', 'block'));
00041 
00042         if (!$this->block->get_owning_quiz()) {
00043             $quizzes = $DB->get_records_menu('quiz', array('course' => $this->page->course->id), '', 'id, name');
00044             if(empty($quizzes)) {
00045                 $mform->addElement('static', 'noquizzeswarning', get_string('config_select_quiz', 'block_quiz_results'),
00046                         get_string('config_no_quizzes_in_course', 'block_quiz_results'));
00047             } else {
00048                 foreach($quizzes as $id => $name) {
00049                     $quizzes[$id] = strip_tags(format_string($name));
00050                 }
00051                 $mform->addElement('select', 'config_quizid', get_string('config_select_quiz', 'block_quiz_results'), $quizzes);
00052             }
00053         }
00054 
00055         $mform->addElement('text', 'config_showbest', get_string('config_show_best', 'block_quiz_results'), array('size' => 3));
00056         $mform->setDefault('config_showbest', 3);
00057         $mform->setType('config_showbest', PARAM_INTEGER);
00058 
00059         $mform->addElement('text', 'config_showworst', get_string('config_show_worst', 'block_quiz_results'), array('size' => 3));
00060         $mform->setDefault('config_showworst', 0);
00061         $mform->setType('config_showworst', PARAM_INTEGER);
00062 
00063         $mform->addElement('selectyesno', 'config_usegroups', get_string('config_use_groups', 'block_quiz_results'));
00064 
00065         $nameoptions = array(
00066             B_QUIZRESULTS_NAME_FORMAT_FULL => get_string('config_names_full', 'block_quiz_results'),
00067             B_QUIZRESULTS_NAME_FORMAT_ID => get_string('config_names_id', 'block_quiz_results'),
00068             B_QUIZRESULTS_NAME_FORMAT_ANON => get_string('config_names_anon', 'block_quiz_results')
00069         );
00070         $mform->addElement('select', 'config_nameformat', get_string('config_name_format', 'block_quiz_results'), $nameoptions);
00071         $mform->setDefault('config_nameformat', B_QUIZRESULTS_NAME_FORMAT_FULL);
00072 
00073         $gradeeoptions = array(
00074             B_QUIZRESULTS_GRADE_FORMAT_PCT => get_string('config_format_percentage', 'block_quiz_results'),
00075             B_QUIZRESULTS_GRADE_FORMAT_FRA => get_string('config_format_fraction', 'block_quiz_results'),
00076             B_QUIZRESULTS_GRADE_FORMAT_ABS => get_string('config_format_absolute', 'block_quiz_results')
00077         );
00078         $mform->addElement('select', 'config_gradeformat', get_string('config_grade_format', 'block_quiz_results'), $gradeeoptions);
00079         $mform->setDefault('config_gradeformat', B_QUIZRESULTS_GRADE_FORMAT_PCT);
00080     }
00081 }
 All Data Structures Namespaces Files Functions Variables Enumerations