diff --git a/mod/quiz/accessrule/openclosedate/rule.php b/mod/quiz/accessrule/openclosedate/rule.php index 20b7f00e94a..2a33a1f1c8a 100644 --- a/mod/quiz/accessrule/openclosedate/rule.php +++ b/mod/quiz/accessrule/openclosedate/rule.php @@ -101,7 +101,7 @@ class quizaccess_openclosedate extends quiz_access_rule_base { } // Otherwise, return to the time left until the close date, providing - // that is less than QUIZ_SHOW_TIME_BEFORE_DEADLINE + // that is less than QUIZ_SHOW_TIME_BEFORE_DEADLINE. if ($this->quiz->timeclose) { $timeleft = $this->quiz->timeclose - $timenow; if ($timeleft < QUIZ_SHOW_TIME_BEFORE_DEADLINE) { diff --git a/mod/quiz/accessrule/password/rule.php b/mod/quiz/accessrule/password/rule.php index 369012d536d..a7490d9dc97 100644 --- a/mod/quiz/accessrule/password/rule.php +++ b/mod/quiz/accessrule/password/rule.php @@ -61,7 +61,7 @@ class quizaccess_password extends quiz_access_rule_base { $mform->addElement('static', 'passwordmessage', '', get_string('requirepasswordmessage', 'quizaccess_password')); - // don't use the 'proper' field name of 'password' since that get's + // Don't use the 'proper' field name of 'password' since that get's // Firefox's password auto-complete over-excited. $mform->addElement('password', 'quizpassword', get_string('quizpassword', 'quizaccess_password')); @@ -74,7 +74,7 @@ class quizaccess_password extends quiz_access_rule_base { return $errors; // Password is OK. } else if (isset($this->quiz->extrapasswords)) { - // Group overrides may have additional passwords + // Group overrides may have additional passwords. foreach ($this->quiz->extrapasswords as $password) { if (strcmp($password, $enteredpassword) === 0) { return $errors; // Password is OK. diff --git a/mod/quiz/accessrule/securewindow/rule.php b/mod/quiz/accessrule/securewindow/rule.php index fb5ae669ebc..ede3f934de2 100644 --- a/mod/quiz/accessrule/securewindow/rule.php +++ b/mod/quiz/accessrule/securewindow/rule.php @@ -70,7 +70,7 @@ class quizaccess_securewindow extends quiz_access_rule_base { } public function setup_attempt_page($page) { - $page->set_popup_notification_allowed(false); // Prevent message notifications + $page->set_popup_notification_allowed(false); // Prevent message notifications. $page->set_title($this->quizobj->get_course()->shortname . ': ' . $page->title); $page->set_cacheable(false); $page->set_pagelayout('popup'); diff --git a/mod/quiz/addrandom.php b/mod/quiz/addrandom.php index 32a1f2cfdc5..48f363157fc 100644 --- a/mod/quiz/addrandom.php +++ b/mod/quiz/addrandom.php @@ -34,7 +34,7 @@ list($thispageurl, $contexts, $cmid, $cm, $quiz, $pagevars) = question_edit_setup('editq', '/mod/quiz/addrandom.php', true); // These params are only passed from page request to request while we stay on -// this page otherwise they would go in question_edit_setup +// this page otherwise they would go in question_edit_setup. $returnurl = optional_param('returnurl', '', PARAM_LOCALURL); $addonpage = optional_param('addonpage', 0, PARAM_INT); $category = optional_param('category', 0, PARAM_INT); diff --git a/mod/quiz/addrandomform.php b/mod/quiz/addrandomform.php index 0abecb3e534..3b37a1d4de3 100644 --- a/mod/quiz/addrandomform.php +++ b/mod/quiz/addrandomform.php @@ -44,7 +44,7 @@ class quiz_add_random_form extends moodleform { $contexts = $this->_customdata; $usablecontexts = $contexts->having_cap('moodle/question:useall'); - //-------------------------------------------------------------------------------- + // Random from existing category section. $mform->addElement('header', 'categoryheader', get_string('randomfromexistingcategory', 'quiz')); @@ -55,7 +55,7 @@ class quiz_add_random_form extends moodleform { $mform->addElement('submit', 'existingcategory', get_string('addrandomquestion', 'quiz')); - //-------------------------------------------------------------------------------- + // Random from a new category section. $mform->addElement('header', 'categoryheader', get_string('randomquestionusinganewcategory', 'quiz')); @@ -69,7 +69,7 @@ class quiz_add_random_form extends moodleform { $mform->addElement('submit', 'newcategory', get_string('createcategoryandaddrandomquestion', 'quiz')); - //-------------------------------------------------------------------------------- + // Submit buttons. $mform->addElement('cancel'); $mform->closeHeaderBefore('cancel'); diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index fba97122439..bb8c01f1c88 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -25,7 +25,7 @@ require_once(dirname(__FILE__) . '/../../config.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); -// Look for old-style URLs, such as may be in the logs, and redirect them to startattemtp.php +// Look for old-style URLs, such as may be in the logs, and redirect them to startattemtp.php. if ($id = optional_param('id', 0, PARAM_INTEGER)) { redirect($CFG->wwwroot . '/mod/quiz/startattempt.php?cmid=' . $id . '&sesskey=' . sesskey()); } else if ($qid = optional_param('q', 0, PARAM_INTEGER)) { @@ -55,7 +55,7 @@ if ($attemptobj->get_userid() != $USER->id) { } } -// Check capabilities and block settings +// Check capabilities and block settings. if (!$attemptobj->is_preview_user()) { $attemptobj->require_capability('mod/quiz:attempt'); if (empty($attemptobj->get_quiz()->showblocks)) { @@ -97,10 +97,10 @@ if (empty($slots)) { throw new moodle_quiz_exception($attemptobj->get_quizobj(), 'noquestionsfound'); } -// Update attempt page +// Update attempt page. if ($attemptobj->get_currentpage() != $page) { if ($attemptobj->get_navigation_method() == QUIZ_NAVMETHOD_SEQ && $attemptobj->get_currentpage() > $page) { - // Prevent out of sequence access + // Prevent out of sequence access. redirect($attemptobj->start_attempt_url(null, $attemptobj->get_currentpage())); } $DB->set_field('quiz_attempts', 'currentpage', $page); diff --git a/mod/quiz/attemptlib.php b/mod/quiz/attemptlib.php index ca0cf0d4094..1de37c1b0cb 100644 --- a/mod/quiz/attemptlib.php +++ b/mod/quiz/attemptlib.php @@ -72,7 +72,7 @@ class quiz { protected $accessmanager = null; protected $ispreviewuser = null; - // Constructor ========================================================================= + // Constructor ============================================================= /** * Constructor, assuming we already have the necessary data loaded. * @@ -111,7 +111,7 @@ class quiz { $course = $DB->get_record('course', array('id' => $quiz->course), '*', MUST_EXIST); $cm = get_coursemodule_from_instance('quiz', $quiz->id, $course->id, false, MUST_EXIST); - // Update quiz with override information + // Update quiz with override information. $quiz = quiz_update_effective_access($quiz, $userid); return new quiz($quiz, $cm, $course); @@ -126,7 +126,7 @@ class quiz { return new quiz_attempt($attemptdata, $this->quiz, $this->cm, $this->course); } - // Functions for loading more data ===================================================== + // Functions for loading more data ========================================= /** * Load just basic information about all the questions in this quiz. @@ -160,7 +160,7 @@ class quiz { get_question_options($questionstoprocess); } - // Simple getters ====================================================================== + // Simple getters ========================================================== /** @return int the course id. */ public function get_courseid() { return $this->course->id; @@ -282,7 +282,7 @@ class quiz { return require_capability($capability, $this->context, $userid, $doanything); } - // URLs related to this attempt ======================================================== + // URLs related to this attempt ============================================ /** * @return string the URL of this quiz's view page. */ @@ -340,7 +340,7 @@ class quiz { return new moodle_url('/mod/quiz/summary.php', array('attempt' => $attemptid)); } - // Bits of content ===================================================================== + // Bits of content ========================================================= /** * @param bool $unfinished whether there is currently an unfinished attempt active. @@ -405,7 +405,7 @@ class quiz { return ''; } - // Private methods ===================================================================== + // Private methods ========================================================= /** * Check that the definition of a particular question is loaded, and if not throw an exception. * @param $id a questionid. @@ -437,16 +437,16 @@ class quiz_attempt { /** @var string to identify the abandoned state. */ const ABANDONED = 'abandoned'; - // Basic data + // Basic data. protected $quizobj; protected $attempt; // More details of what happened for each question. protected $quba; - protected $pagelayout; // array page no => array of numbers on the page in order. + protected $pagelayout; // Array page no => array of numbers on the page in order. protected $reviewoptions = null; - // Constructor ========================================================================= + // Constructor ============================================================= /** * Constructor assuming we already have the necessary data loaded. * @@ -482,7 +482,7 @@ class quiz_attempt { $course = $DB->get_record('course', array('id' => $quiz->course), '*', MUST_EXIST); $cm = get_coursemodule_from_instance('quiz', $quiz->id, $course->id, false, MUST_EXIST); - // Update quiz with override information + // Update quiz with override information. $quiz = quiz_update_effective_access($quiz, $attempt->userid); return new quiz_attempt($attempt, $quiz, $cm, $course); @@ -555,7 +555,7 @@ class quiz_attempt { } } - // Simple getters ====================================================================== + // Simple getters ========================================================== public function get_quiz() { return $this->quizobj->get_quiz(); } @@ -998,7 +998,7 @@ class quiz_attempt { * student should next do something. * @return int timestamp by which the student needs to do something. */ - function get_due_date() { + public function get_due_date() { $deadlines = array(); if ($this->quizobj->get_quiz()->timelimit) { $deadlines[] = $this->attempt->timestart + $this->quizobj->get_quiz()->timelimit; @@ -1024,7 +1024,7 @@ class quiz_attempt { } } - // URLs related to this attempt ======================================================== + // URLs related to this attempt ============================================ /** * @return string quiz view url. */ @@ -1086,7 +1086,7 @@ class quiz_attempt { return $this->page_and_question_url('review', $slot, $page, $showall, $thispage); } - // Bits of content ===================================================================== + // Bits of content ========================================================= /** * If $reviewoptions->attempt is false, meaning that students can't review this @@ -1259,7 +1259,7 @@ class quiz_attempt { } // If the attempt is already overdue, look to see if it should be abandoned ... - if ($this->attempt->state == quiz_attempt::OVERDUE) { + if ($this->attempt->state == self::OVERDUE) { $timeoverdue = -$timeleft; if ($timeoverdue > $this->quizobj->get_quiz()->graceperiod) { $this->process_abandon($timestamp, $studentisonline); @@ -1268,7 +1268,7 @@ class quiz_attempt { return; // ... and we are done. } - if ($this->attempt->state != quiz_attempt::IN_PROGRESS) { + if ($this->attempt->state != self::IN_PROGRESS) { return; // Attempt is already in a final state. } @@ -1313,7 +1313,7 @@ class quiz_attempt { $DB->update_record('quiz_attempts', $this->attempt); } - if (!$this->is_preview() && $this->attempt->state == quiz_attempt::FINISHED) { + if (!$this->is_preview() && $this->attempt->state == self::FINISHED) { quiz_save_best_grade($this->get_quiz(), $this->get_userid()); } @@ -1352,7 +1352,7 @@ class quiz_attempt { if (!$this->is_preview()) { quiz_save_best_grade($this->get_quiz(), $this->attempt->userid); - // Trigger event + // Trigger event. $this->fire_state_transition_event('quiz_attempt_submitted', $timestamp); // Tell any access rules that care that the attempt is over. @@ -1406,7 +1406,7 @@ class quiz_attempt { protected function fire_state_transition_event($event, $timestamp) { global $USER; - // Trigger event + // Trigger event. $eventdata = new stdClass(); $eventdata->component = 'mod_quiz'; $eventdata->attemptid = $this->attempt->id; @@ -1451,7 +1451,7 @@ class quiz_attempt { get_string('gradingattempt', 'quiz_grading', $a)); } - // Private methods ===================================================================== + // Private methods ========================================================= /** * Get a URL for a particular question on a particular page of the quiz. @@ -1468,7 +1468,7 @@ class quiz_attempt { * @return The requested URL. */ protected function page_and_question_url($script, $slot, $page, $showall, $thispage) { - // Fix up $page + // Fix up $page. if ($page == -1) { if (!is_null($slot) && !$showall) { $page = $this->quba->get_question($slot)->_page; diff --git a/mod/quiz/backup/moodle1/lib.php b/mod/quiz/backup/moodle1/lib.php index 4f43ef225a4..2e25b40a77c 100644 --- a/mod/quiz/backup/moodle1/lib.php +++ b/mod/quiz/backup/moodle1/lib.php @@ -18,8 +18,7 @@ * Provides support for the conversion of moodle1 backup to the moodle2 format * Based off of a template @ http://docs.moodle.org/dev/Backup_1.9_conversion_for_developers * - * @package mod - * @subpackage quiz + * @package mod_quiz * @copyright 2011 Aparup Banerjee * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -87,38 +86,38 @@ class moodle1_mod_quiz_handler extends moodle1_mod_handler { public function process_quiz($data) { global $CFG; - // replay the upgrade step 2008081501 + // Replay the upgrade step 2008081501. if (is_null($data['sumgrades'])) { $data['sumgrades'] = 0; - //@todo for user data: quiz_attempts SET sumgrades=0 WHERE sumgrades IS NULL - //@todo for user data: quiz_grades.grade should be not be null , convert to default 0 + // TODO for user data: quiz_attempts SET sumgrades=0 WHERE sumgrades IS NULL. + // TODO for user data: quiz_grades.grade should be not be null , convert to default 0. } - // replay the upgrade step 2009042000 + // Replay the upgrade step 2009042000. if ($CFG->texteditors !== 'textarea') { $data['intro'] = text_to_html($data['intro'], false, false, true); $data['introformat'] = FORMAT_HTML; } - // replay the upgrade step 2009031001 + // Replay the upgrade step 2009031001. $data['timelimit'] *= 60; - // get the course module id and context id + // Get the course module id and context id. $instanceid = $data['id']; $cminfo = $this->get_cminfo($instanceid); $this->moduleid = $cminfo['id']; $contextid = $this->converter->get_contextid(CONTEXT_MODULE, $this->moduleid); - // get a fresh new file manager for this instance + // Get a fresh new file manager for this instance. $this->fileman = $this->converter->get_file_manager($contextid, 'mod_quiz'); - // convert course files embedded into the intro + // Convert course files embedded into the intro. $this->fileman->filearea = 'intro'; $this->fileman->itemid = 0; $data['intro'] = moodle1_converter::migrate_referenced_files( $data['intro'], $this->fileman); - // start writing quiz.xml + // Start writing quiz.xml. $this->open_xml_writer("activities/quiz_{$this->moduleid}/quiz.xml"); $this->xmlwriter->begin_tag('activity', array('id' => $instanceid, 'moduleid' => $this->moduleid, 'modulename' => 'quiz', @@ -155,7 +154,7 @@ class moodle1_mod_quiz_handler extends moodle1_mod_handler { } public function process_quiz_feedback($data) { - // replay the upgrade step 2010122302 + // Replay the upgrade step 2010122302. if (is_null($data['mingrade'])) { $data['mingrade'] = 0; } @@ -171,15 +170,15 @@ class moodle1_mod_quiz_handler extends moodle1_mod_handler { */ public function on_quiz_end() { - // append empty subpath element + // Append empty subpath element. $this->write_xml('overrides', array()); - // finish writing quiz.xml + // Finish writing quiz.xml. $this->xmlwriter->end_tag('quiz'); $this->xmlwriter->end_tag('activity'); $this->close_xml_writer(); - // write inforef.xml + // Write inforef.xml. $this->open_xml_writer("activities/quiz_{$this->moduleid}/inforef.xml"); $this->xmlwriter->begin_tag('inforef'); $this->xmlwriter->begin_tag('fileref'); diff --git a/mod/quiz/backup/moodle2/backup_quiz_activity_task.class.php b/mod/quiz/backup/moodle2/backup_quiz_activity_task.class.php index 0acf1be07a6..846f0abb15a 100644 --- a/mod/quiz/backup/moodle2/backup_quiz_activity_task.class.php +++ b/mod/quiz/backup/moodle2/backup_quiz_activity_task.class.php @@ -46,21 +46,21 @@ class backup_quiz_activity_task extends backup_activity_task { */ protected function define_my_steps() { // Generate the quiz.xml file containing all the quiz information - // and annotating used questions + // and annotating used questions. $this->add_step(new backup_quiz_activity_structure_step('quiz_structure', 'quiz.xml')); // Note: Following steps must be present // in all the activities using question banks (only quiz for now) - // TODO: Specialise these step to a new subclass of backup_activity_task + // TODO: Specialise these step to a new subclass of backup_activity_task. // Process all the annotated questions to calculate the question // categories needing to be included in backup for this activity - // plus the categories belonging to the activity context itself + // plus the categories belonging to the activity context itself. $this->add_step(new backup_calculate_question_categories('activity_question_categories')); // Clean backup_temp_ids table from questions. We already // have used them to detect question_categories and aren't - // needed anymore + // needed anymore. $this->add_step(new backup_delete_temp_questions('clean_temp_questions')); } @@ -75,15 +75,15 @@ class backup_quiz_activity_task extends backup_activity_task { $base = preg_quote($CFG->wwwroot, '/'); - // Link to the list of quizzes + // Link to the list of quizzes. $search="/(".$base."\/mod\/quiz\/index.php\?id\=)([0-9]+)/"; $content= preg_replace($search, '$@QUIZINDEX*$2@$', $content); - // Link to quiz view by moduleid + // Link to quiz view by moduleid. $search="/(".$base."\/mod\/quiz\/view.php\?id\=)([0-9]+)/"; $content= preg_replace($search, '$@QUIZVIEWBYID*$2@$', $content); - // Link to quiz view by quizid + // Link to quiz view by quizid. $search="/(".$base."\/mod\/quiz\/view.php\?q\=)([0-9]+)/"; $content= preg_replace($search, '$@QUIZVIEWBYQ*$2@$', $content); diff --git a/mod/quiz/backup/moodle2/backup_quiz_stepslib.php b/mod/quiz/backup/moodle2/backup_quiz_stepslib.php index 0d7799c6d30..80f3e6eb665 100644 --- a/mod/quiz/backup/moodle2/backup_quiz_stepslib.php +++ b/mod/quiz/backup/moodle2/backup_quiz_stepslib.php @@ -35,10 +35,10 @@ class backup_quiz_activity_structure_step extends backup_questions_activity_stru protected function define_structure() { - // To know if we are including userinfo + // To know if we are including userinfo. $userinfo = $this->get_setting_value('userinfo'); - // Define each element separated + // Define each element separated. $quiz = new backup_nested_element('quiz', array('id'), array( 'name', 'intro', 'introformat', 'timeopen', 'timeclose', 'timelimit', 'overduehandling', 'graceperiod', 'preferredbehaviour', 'attempts_number', @@ -82,14 +82,13 @@ class backup_quiz_activity_structure_step extends backup_questions_activity_stru 'state', 'timestart', 'timefinish', 'timemodified', 'sumgrades')); // This module is using questions, so produce the related question states and sessions - // attaching them to the $attempt element based in 'uniqueid' matching + // attaching them to the $attempt element based in 'uniqueid' matching. $this->add_question_usages($attempt, 'uniqueid'); // Define elements for access rule subplugin attempt data. $this->add_subplugin_structure('quizaccess', $attempt, true); - // Build the tree - + // Build the tree. $quiz->add_child($qinstances); $qinstances->add_child($qinstance); @@ -105,7 +104,7 @@ class backup_quiz_activity_structure_step extends backup_questions_activity_stru $quiz->add_child($attempts); $attempts->add_child($attempt); - // Define sources + // Define sources. $quiz->set_source_table('quiz', array('id' => backup::VAR_ACTIVITYID)); $qinstance->set_source_table('quiz_question_instances', @@ -114,15 +113,15 @@ class backup_quiz_activity_structure_step extends backup_questions_activity_stru $feedback->set_source_table('quiz_feedback', array('quizid' => backup::VAR_PARENTID)); - // Quiz overrides to backup are different depending of user info + // Quiz overrides to backup are different depending of user info. $overrideparams = array('quiz' => backup::VAR_PARENTID); - if (!$userinfo) { // Without userinfo, skip user overrides + if (!$userinfo) { // Without userinfo, skip user overrides. $overrideparams['userid'] = backup_helper::is_sqlparam(null); } $override->set_source_table('quiz_overrides', $overrideparams); - // All the rest of elements only happen if we are including user info + // All the rest of elements only happen if we are including user info. if ($userinfo) { $grade->set_source_table('quiz_grades', array('quiz' => backup::VAR_PARENTID)); $attempt->set_source_sql(' @@ -132,23 +131,23 @@ class backup_quiz_activity_structure_step extends backup_questions_activity_stru array('quiz' => backup::VAR_PARENTID)); } - // Define source alias + // Define source alias. $quiz->set_source_alias('attempts', 'attempts_number'); $grade->set_source_alias('grade', 'gradeval'); $attempt->set_source_alias('attempt', 'attemptnum'); - // Define id annotations + // Define id annotations. $qinstance->annotate_ids('question', 'question'); $override->annotate_ids('user', 'userid'); $override->annotate_ids('group', 'groupid'); $grade->annotate_ids('user', 'userid'); $attempt->annotate_ids('user', 'userid'); - // Define file annotations - $quiz->annotate_files('mod_quiz', 'intro', null); // This file area hasn't itemid + // Define file annotations. + $quiz->annotate_files('mod_quiz', 'intro', null); // This file area hasn't itemid. $feedback->annotate_files('mod_quiz', 'feedback', 'id'); - // Return the root element (quiz), wrapped into standard activity structure + // Return the root element (quiz), wrapped into standard activity structure. return $this->prepare_activity_structure($quiz); } } diff --git a/mod/quiz/backup/moodle2/restore_quiz_activity_task.class.php b/mod/quiz/backup/moodle2/restore_quiz_activity_task.class.php index 0bad77d9809..90bf8da4cf7 100644 --- a/mod/quiz/backup/moodle2/restore_quiz_activity_task.class.php +++ b/mod/quiz/backup/moodle2/restore_quiz_activity_task.class.php @@ -25,7 +25,6 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . '/mod/quiz/backup/moodle2/restore_quiz_stepslib.php'); -// Because it exists (must) /** @@ -41,14 +40,14 @@ class restore_quiz_activity_task extends restore_activity_task { * Define (add) particular settings this activity can have */ protected function define_my_settings() { - // No particular settings for this activity + // No particular settings for this activity. } /** * Define (add) particular steps this activity can have */ protected function define_my_steps() { - // quiz only has one structure step + // Quiz only has one structure step. $this->add_step(new restore_quiz_activity_structure_step('quiz_structure', 'quiz.xml')); } @@ -120,44 +119,44 @@ class restore_quiz_activity_task extends restore_activity_task { $rules[] = new restore_log_rule('quiz', 'manualgrading', 'report.php?mode=grading&q={quiz}', '{quiz}'); // All the ones calling to review.php have two rules to handle both old and new urls - // in any case they are always converted to new urls on restore - // TODO: In Moodle 2.x (x >= 5) kill the old rules + // in any case they are always converted to new urls on restore. + // TODO: In Moodle 2.x (x >= 5) kill the old rules. // Note we are using the 'quiz_attempt_id' mapping because that is the - // one containing the quiz_attempt->ids old an new for quiz-attempt + // one containing the quiz_attempt->ids old an new for quiz-attempt. $rules[] = new restore_log_rule('quiz', 'attempt', 'review.php?id={course_module}&attempt={quiz_attempt}', '{quiz}', null, null, 'review.php?attempt={quiz_attempt}'); - // old an new for quiz-submit + // Old an new for quiz-submit. $rules[] = new restore_log_rule('quiz', 'submit', 'review.php?id={course_module}&attempt={quiz_attempt_id}', '{quiz}', null, null, 'review.php?attempt={quiz_attempt_id}'); $rules[] = new restore_log_rule('quiz', 'submit', 'review.php?attempt={quiz_attempt_id}', '{quiz}'); - // old an new for quiz-review + // Old an new for quiz-review. $rules[] = new restore_log_rule('quiz', 'review', 'review.php?id={course_module}&attempt={quiz_attempt_id}', '{quiz}', null, null, 'review.php?attempt={quiz_attempt_id}'); $rules[] = new restore_log_rule('quiz', 'review', 'review.php?attempt={quiz_attempt_id}', '{quiz}'); - // old an new for quiz-start attemp + // Old an new for quiz-start attemp. $rules[] = new restore_log_rule('quiz', 'start attempt', 'review.php?id={course_module}&attempt={quiz_attempt_id}', '{quiz}', null, null, 'review.php?attempt={quiz_attempt_id}'); $rules[] = new restore_log_rule('quiz', 'start attempt', 'review.php?attempt={quiz_attempt_id}', '{quiz}'); - // old an new for quiz-close attemp + // Old an new for quiz-close attemp. $rules[] = new restore_log_rule('quiz', 'close attempt', 'review.php?id={course_module}&attempt={quiz_attempt_id}', '{quiz}', null, null, 'review.php?attempt={quiz_attempt_id}'); $rules[] = new restore_log_rule('quiz', 'close attempt', 'review.php?attempt={quiz_attempt_id}', '{quiz}'); - // old an new for quiz-continue attempt + // Old an new for quiz-continue attempt. $rules[] = new restore_log_rule('quiz', 'continue attempt', 'review.php?id={course_module}&attempt={quiz_attempt_id}', '{quiz}', null, null, 'review.php?attempt={quiz_attempt_id}'); $rules[] = new restore_log_rule('quiz', 'continue attempt', 'review.php?attempt={quiz_attempt_id}', '{quiz}'); - // old an new for quiz-continue attemp + // Old an new for quiz-continue attemp. $rules[] = new restore_log_rule('quiz', 'continue attemp', 'review.php?id={course_module}&attempt={quiz_attempt_id}', '{quiz}', null, 'continue attempt', 'review.php?attempt={quiz_attempt_id}'); diff --git a/mod/quiz/backup/moodle2/restore_quiz_stepslib.php b/mod/quiz/backup/moodle2/restore_quiz_stepslib.php index c8d9d8be70e..036b4e2d57e 100644 --- a/mod/quiz/backup/moodle2/restore_quiz_stepslib.php +++ b/mod/quiz/backup/moodle2/restore_quiz_stepslib.php @@ -59,7 +59,7 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st '/activity/quiz/attempts/attempt'); $paths[] = $quizattempt; - // Add states and sessions + // Add states and sessions. $this->add_question_usages($quizattempt, $paths); // A chance for access subplugings to set up their attempt data. @@ -76,7 +76,7 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st } } - // Return the paths wrapped into standard activity structure + // Return the paths wrapped into standard activity structure. return $this->prepare_activity_structure($paths); } @@ -92,19 +92,19 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st $data->timecreated = $this->apply_date_offset($data->timecreated); $data->timemodified = $this->apply_date_offset($data->timemodified); - // Needed by {@link process_quiz_attempt_legacy} + // Needed by {@link process_quiz_attempt_legacy}. $this->oldquizlayout = $data->questions; $data->questions = $this->questions_recode_layout($data->questions); - // quiz->attempts can come both in data->attempts and - // data->attempts_number, handle both. MDL-26229 + // The setting quiz->attempts can come both in data->attempts and + // data->attempts_number, handle both. MDL-26229. if (isset($data->attempts_number)) { $data->attempts = $data->attempts_number; unset($data->attempts_number); } // The old optionflags and penaltyscheme from 2.0 need to be mapped to - // the new preferredbehaviour. MDL-20636 + // the new preferredbehaviour. See MDL-20636. if (!isset($data->preferredbehaviour)) { if (empty($data->optionflags)) { $data->preferredbehaviour = 'deferredfeedback'; @@ -118,7 +118,7 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st } // The old review column from 2.0 need to be split into the seven new - // review columns. MDL-20636 + // review columns. See MDL-20636. if (isset($data->review)) { require_once($CFG->dirroot . '/mod/quiz/locallib.php'); @@ -206,7 +206,7 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st } // The old popup column from from <= 2.1 need to be mapped to - // the new browsersecurity. MDL-29627 + // the new browsersecurity. See MDL-29627. if (!isset($data->browsersecurity)) { if (empty($data->popup)) { $data->browsersecurity = '-'; @@ -220,9 +220,9 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st unset($data->popup); } - // insert the quiz record + // Insert the quiz record. $newitemid = $DB->insert_record('quiz', $data); - // immediately after inserting "activity" record, call this + // Immediately after inserting "activity" record, call this. $this->apply_activity_instance($newitemid); } @@ -248,7 +248,7 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st $data->quizid = $this->get_new_parentid('quiz'); $newitemid = $DB->insert_record('quiz_feedback', $data); - $this->set_mapping('quiz_feedback', $oldid, $newitemid, true); // Has related files + $this->set_mapping('quiz_feedback', $oldid, $newitemid, true); // Has related files. } protected function process_quiz_override($data) { @@ -257,10 +257,10 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st $data = (object)$data; $oldid = $data->id; - // Based on userinfo, we'll restore user overides or no + // Based on userinfo, we'll restore user overides or no. $userinfo = $this->get_setting_value('userinfo'); - // Skip user overrides if we are not restoring userinfo + // Skip user overrides if we are not restoring userinfo. if (!$userinfo && !is_null($data->userid)) { return; } @@ -275,7 +275,7 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st $newitemid = $DB->insert_record('quiz_overrides', $data); - // Add mapping, restore of logs needs it + // Add mapping, restore of logs needs it. $this->set_mapping('quiz_override', $oldid, $newitemid); } @@ -331,15 +331,15 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st $newitemid = $DB->insert_record('quiz_attempts', $data); - // Save quiz_attempt->id mapping, because logs use it + // Save quiz_attempt->id mapping, because logs use it. $this->set_mapping('quiz_attempt', $oldid, $newitemid, false); } protected function after_execute() { parent::after_execute(); - // Add quiz related files, no need to match by itemname (just internally handled context) + // Add quiz related files, no need to match by itemname (just internally handled context). $this->add_related_files('mod_quiz', 'intro', null); - // Add feedback related files, matching by itemname = 'quiz_feedback' + // Add feedback related files, matching by itemname = 'quiz_feedback'. $this->add_related_files('mod_quiz', 'feedback', 'quiz_feedback'); } } diff --git a/mod/quiz/comment.php b/mod/quiz/comment.php index 2249da3cb21..8ac1f10a14d 100644 --- a/mod/quiz/comment.php +++ b/mod/quiz/comment.php @@ -27,8 +27,8 @@ require_once('../../config.php'); require_once('locallib.php'); -$attemptid = required_param('attempt', PARAM_INT); // attempt id -$slot = required_param('slot', PARAM_INT); // question number in attempt +$attemptid = required_param('attempt', PARAM_INT); +$slot = required_param('slot', PARAM_INT); // The question number in the attempt. $PAGE->set_url('/mod/quiz/comment.php', array('attempt' => $attemptid, 'slot' => $slot)); @@ -48,7 +48,7 @@ add_to_log($attemptobj->get_courseid(), 'quiz', 'manualgrade', 'comment.php?atte $attemptobj->get_attemptid() . '&slot=' . $slot, $attemptobj->get_quizid(), $attemptobj->get_cmid()); -// Print the page header +// Print the page header. $PAGE->set_pagelayout('popup'); echo $OUTPUT->header(); echo $OUTPUT->heading(format_string($attemptobj->get_question_name($slot))); diff --git a/mod/quiz/db/access.php b/mod/quiz/db/access.php index 882cc494aff..21c29bc790a 100644 --- a/mod/quiz/db/access.php +++ b/mod/quiz/db/access.php @@ -85,7 +85,7 @@ $capabilities = array( ) ), - // Edit the quiz overrides + // Edit the quiz overrides. 'mod/quiz:manageoverrides' => array( 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php index a7e63951cba..760ce4c2a8f 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -36,42 +36,41 @@ function xmldb_quiz_upgrade($oldversion) { $dbman = $DB->get_manager(); - - // Moodle v2.2.0 release upgrade line - // Put any upgrade step following this + // Moodle v2.2.0 release upgrade line. + // Put any upgrade step following this. if ($oldversion < 2011120700) { - // Define field lastcron to be dropped from quiz_reports + // Define field lastcron to be dropped from quiz_reports. $table = new xmldb_table('quiz_reports'); $field = new xmldb_field('lastcron'); - // Conditionally launch drop field lastcron + // Conditionally launch drop field lastcron. if ($dbman->field_exists($table, $field)) { $dbman->drop_field($table, $field); } - // quiz savepoint reached + // Quiz savepoint reached. upgrade_mod_savepoint(true, 2011120700, 'quiz'); } if ($oldversion < 2011120701) { - // Define field cron to be dropped from quiz_reports + // Define field cron to be dropped from quiz_reports. $table = new xmldb_table('quiz_reports'); $field = new xmldb_field('cron'); - // Conditionally launch drop field cron + // Conditionally launch drop field cron. if ($dbman->field_exists($table, $field)) { $dbman->drop_field($table, $field); } - // quiz savepoint reached + // Quiz savepoint reached. upgrade_mod_savepoint(true, 2011120701, 'quiz'); } if ($oldversion < 2011120703) { - // Track page of quiz attempts + // Track page of quiz attempts. $table = new xmldb_table('quiz_attempts'); $field = new xmldb_field('currentpage', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0); @@ -83,7 +82,7 @@ function xmldb_quiz_upgrade($oldversion) { } if ($oldversion < 2012030901) { - // Configuration option for navigation method + // Configuration option for navigation method. $table = new xmldb_table('quiz'); $field = new xmldb_field('navmethod', XMLDB_TYPE_CHAR, '16', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 'free'); @@ -95,59 +94,59 @@ function xmldb_quiz_upgrade($oldversion) { } if ($oldversion < 2012040200) { - // Define index quiz-userid-attempt (unique) to be dropped form quiz_attempts + // Define index quiz-userid-attempt (unique) to be dropped form quiz_attempts. $table = new xmldb_table('quiz_attempts'); $index = new xmldb_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid')); - // Conditionally launch drop index quiz-userid-attempt + // Conditionally launch drop index quiz-userid-attempt. if ($dbman->index_exists($table, $index)) { $dbman->drop_index($table, $index); } - // quiz savepoint reached + // Quiz savepoint reached. upgrade_mod_savepoint(true, 2012040200, 'quiz'); } if ($oldversion < 2012040201) { - // Define key userid (foreign) to be added to quiz_attempts + // Define key userid (foreign) to be added to quiz_attempts. $table = new xmldb_table('quiz_attempts'); $key = new xmldb_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id')); - // Launch add key userid + // Launch add key userid. $dbman->add_key($table, $key); - // quiz savepoint reached + // Quiz savepoint reached. upgrade_mod_savepoint(true, 2012040201, 'quiz'); } if ($oldversion < 2012040202) { - // Define index quiz-userid-attempt (unique) to be added to quiz_attempts + // Define index quiz-userid-attempt (unique) to be added to quiz_attempts. $table = new xmldb_table('quiz_attempts'); $index = new xmldb_index('quiz-userid-attempt', XMLDB_INDEX_UNIQUE, array('quiz', 'userid', 'attempt')); - // Conditionally launch add index quiz-userid-attempt + // Conditionally launch add index quiz-userid-attempt. if (!$dbman->index_exists($table, $index)) { $dbman->add_index($table, $index); } - // quiz savepoint reached + // Quiz savepoint reached. upgrade_mod_savepoint(true, 2012040202, 'quiz'); } if ($oldversion < 2012040203) { - // Define field state to be added to quiz_attempts + // Define field state to be added to quiz_attempts. $table = new xmldb_table('quiz_attempts'); $field = new xmldb_field('state', XMLDB_TYPE_CHAR, '16', null, XMLDB_NOTNULL, null, 'inprogress', 'preview'); - // Conditionally launch add field state + // Conditionally launch add field state. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - // quiz savepoint reached + // Quiz savepoint reached. upgrade_mod_savepoint(true, 2012040203, 'quiz'); } @@ -159,37 +158,37 @@ function xmldb_quiz_upgrade($oldversion) { // Other, more complex transitions (basically abandoned attempts), will // be handled by cron later. - // quiz savepoint reached + // Quiz savepoint reached. upgrade_mod_savepoint(true, 2012040204, 'quiz'); } if ($oldversion < 2012040205) { - // Define field overduehandling to be added to quiz + // Define field overduehandling to be added to quiz. $table = new xmldb_table('quiz'); $field = new xmldb_field('overduehandling', XMLDB_TYPE_CHAR, '16', null, XMLDB_NOTNULL, null, 'autoabandon', 'timelimit'); - // Conditionally launch add field overduehandling + // Conditionally launch add field overduehandling. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - // quiz savepoint reached + // Quiz savepoint reached. upgrade_mod_savepoint(true, 2012040205, 'quiz'); } if ($oldversion < 2012040206) { - // Define field graceperiod to be added to quiz + // Define field graceperiod to be added to quiz. $table = new xmldb_table('quiz'); $field = new xmldb_field('graceperiod', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'overduehandling'); - // Conditionally launch add field graceperiod + // Conditionally launch add field graceperiod. if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } - // quiz savepoint reached + // Quiz savepoint reached. upgrade_mod_savepoint(true, 2012040206, 'quiz'); } diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php index bb14e552f49..503999fd7f9 100644 --- a/mod/quiz/edit.php +++ b/mod/quiz/edit.php @@ -111,8 +111,8 @@ function module_specific_controls($totalnumber, $recurse, $category, $cmid, $cmo return $out; } -//these params are only passed from page request to request while we stay on -//this page otherwise they would go in question_edit_setup +// These params are only passed from page request to request while we stay on +// this page otherwise they would go in question_edit_setup. $quiz_reordertool = optional_param('reordertool', -1, PARAM_BOOL); $quiz_qbanktool = optional_param('qbanktool', -1, PARAM_BOOL); $scrollpos = optional_param('scrollpos', '', PARAM_INT); @@ -204,7 +204,7 @@ if (($down = optional_param('down', false, PARAM_INT)) && confirm_sesskey()) { } if (optional_param('repaginate', false, PARAM_BOOL) && confirm_sesskey()) { - // Re-paginate the quiz + // Re-paginate the quiz. $questionsperpage = optional_param('questionsperpage', $quiz->questionsperpage, PARAM_INT); $quiz->questions = quiz_repaginate($quiz->questions, $questionsperpage ); $DB->set_field('quiz', 'questions', $quiz->questions, array('id' => $quiz->id)); @@ -213,7 +213,7 @@ if (optional_param('repaginate', false, PARAM_BOOL) && confirm_sesskey()) { } if (($addquestion = optional_param('addquestion', 0, PARAM_INT)) && confirm_sesskey()) { - // Add a single question to the current quiz + // Add a single question to the current quiz. quiz_require_question_use($addquestion); $addonpage = optional_param('addonpage', 0, PARAM_INT); quiz_add_quiz_question($addquestion, $quiz, $addonpage); @@ -224,9 +224,9 @@ if (($addquestion = optional_param('addquestion', 0, PARAM_INT)) && confirm_sess } if (optional_param('add', false, PARAM_BOOL) && confirm_sesskey()) { - // Add selected questions to the current quiz + // Add selected questions to the current quiz. $rawdata = (array) data_submitted(); - foreach ($rawdata as $key => $value) { // Parse input for question ids + foreach ($rawdata as $key => $value) { // Parse input for question ids. if (preg_match('!^q([0-9]+)$!', $key, $matches)) { $key = $matches[1]; quiz_require_question_use($key); @@ -239,7 +239,7 @@ if (optional_param('add', false, PARAM_BOOL) && confirm_sesskey()) { } if ((optional_param('addrandom', false, PARAM_BOOL)) && confirm_sesskey()) { - // Add random questions to the quiz + // Add random questions to the quiz. $recurse = optional_param('recurse', 0, PARAM_BOOL); $addonpage = optional_param('addonpage', 0, PARAM_INT); $categoryid = required_param('categoryid', PARAM_INT); @@ -305,8 +305,8 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) { $deletepreviews = false; $recomputesummarks = false; - $oldquestions = explode(',', $quiz->questions); // the questions in the old order - $questions = array(); // for questions in the new order + $oldquestions = explode(',', $quiz->questions); // The questions in the old order. + $questions = array(); // For questions in the new order. $rawdata = (array) data_submitted(); $moveonpagequestions = array(); $moveselectedonpage = optional_param('moveselectedonpagetop', 0, PARAM_INT); @@ -316,7 +316,7 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) { foreach ($rawdata as $key => $value) { if (preg_match('!^g([0-9]+)$!', $key, $matches)) { - // Parse input for question -> grades + // Parse input for question -> grades. $questionid = $matches[1]; $quiz->grades[$questionid] = clean_param($value, PARAM_FLOAT); quiz_update_question_instance($quiz->grades[$questionid], $questionid, $quiz); @@ -324,7 +324,7 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) { $recomputesummarks = true; } else if (preg_match('!^o(pg)?([0-9]+)$!', $key, $matches)) { - // Parse input for ordering info + // Parse input for ordering info. $questionid = $matches[2]; // Make sure two questions don't overwrite each other. If we get a second // question with the same position, shift the second one along to the next gap. @@ -342,7 +342,7 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) { } } - // If ordering info was given, reorder the questions + // If ordering info was given, reorder the questions. if ($questions) { ksort($questions); $questions[] = 0; @@ -351,12 +351,12 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) { $deletepreviews = true; } - //get a list of questions to move, later to be added in the appropriate - //place in the string + // Get a list of questions to move, later to be added in the appropriate + // place in the string. if ($moveselectedonpage) { $questions = explode(',', $quiz->questions); $newquestions = array(); - //remove the questions from their original positions first + // Remove the questions from their original positions first. foreach ($questions as $questionid) { if (!in_array($questionid, $selectedquestionids)) { $newquestions[] = $questionid; @@ -364,7 +364,7 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) { } $questions = $newquestions; - //move to the end of the selected page + // Move to the end of the selected page. $pagebreakpositions = array_keys($questions, 0); $numpages = count($pagebreakpositions); @@ -384,7 +384,7 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) { $deletepreviews = true; } - // If rescaling is required save the new maximum + // If rescaling is required save the new maximum. $maxgrade = optional_param('maxgrade', -1, PARAM_FLOAT); if ($maxgrade >= 0) { quiz_set_grade($maxgrade, $quiz); @@ -539,8 +539,7 @@ if ($quiz_reordertool) { echo '
'; echo html_writer::input_hidden_params($thispageurl); echo ''; - //YUI does not submit the value of the submit button so - //we need to add the value: + // YUI does not submit the value of the submit button so we need to add the value. echo ''; $attributes = array(); $attributes['disabled'] = $repaginatingdisabledhtml ? 'disabled' : null; @@ -563,7 +562,7 @@ quiz_print_question_list($quiz, $thispageurl, true, $quiz_reordertool, $quiz_qba $quizhasattempts, $defaultcategoryobj, $canaddquestion, $canaddrandom); echo ''; -// Close
: +// Close
. echo '
'; if (!$quiz_reordertool && $canaddrandom) { diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index b5128c66869..06aa54547e1 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -120,9 +120,9 @@ function quiz_add_quiz_question($id, $quiz, $page = 0) { return false; } - // remove ending page break if it is not needed + // Remove ending page break if it is not needed. if ($breaks = array_keys($questions, 0)) { - // determine location of the last two page breaks + // Determine location of the last two page breaks. $end = end($breaks); $last = prev($breaks); $last = $last ? $last : -1; @@ -133,19 +133,19 @@ function quiz_add_quiz_question($id, $quiz, $page = 0) { if (is_int($page) && $page >= 1) { $numofpages = quiz_number_of_pages($quiz->questions); if ($numofpages<$page) { - //the page specified does not exist in quiz + // The page specified does not exist in quiz. $page = 0; } else { - // add ending page break - the following logic requires doing - //this at this point + // Add ending page break - the following logic requires doing + // this at this point. $questions[] = 0; $currentpage = 1; $addnow = false; foreach ($questions as $question) { if ($question == 0) { $currentpage++; - //The current page is the one after the one we want to add on, - //so we add the question before adding the current page. + // The current page is the one after the one we want to add on, + // so we add the question before adding the current page. if ($currentpage == $page + 1) { $questions_new[] = $id; } @@ -156,13 +156,13 @@ function quiz_add_quiz_question($id, $quiz, $page = 0) { } } if ($page == 0) { - // add question + // Add question. $questions[] = $id; - // add ending page break + // Add ending page break. $questions[] = 0; } - // Save new questionslist in database + // Save new questionslist in database. $quiz->questions = implode(',', $questions); $DB->set_field('quiz', 'questions', $quiz->questions, array('id' => $quiz->id)); @@ -216,7 +216,7 @@ function quiz_add_random_questions($quiz, $addonpage, $categoryid, $number, $form->category = $category->id . ',' . $category->contextid; $form->defaultmark = 1; $form->hidden = 1; - $form->stamp = make_unique_id_code(); // Set the unique code (not to be changed) + $form->stamp = make_unique_id_code(); // Set the unique code (not to be changed). $question = new stdClass(); $question->qtype = 'random'; $question = question_bank::get_qtype('random')->save_question($question, $form); @@ -468,11 +468,11 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool, echo $reordercontrolstop; } - //the current question ordinal (no descriptions) + // The current question ordinal (no descriptions). $qno = 1; - //the current question (includes questions and descriptions) + // The current question (includes questions and descriptions). $questioncount = 0; - //the current page number in iteration + // The current page number in iteration. $pagecount = 0; $pageopen = false; @@ -486,7 +486,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool, $reordercheckboxlabel = ''; $reordercheckboxlabelclose = ''; - // If the questiontype is missing change the question type + // If the questiontype is missing change the question type. if ($qnum && !array_key_exists($qnum, $questions)) { $fakequestion = new stdClass(); $fakequestion->id = $qnum; @@ -504,10 +504,9 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool, } if ($qnum != 0 || ($qnum == 0 && !$pageopen)) { - //this is either a question or a page break after another - // (no page is currently open) + // This is either a question or a page break after another (no page is currently open). if (!$pageopen) { - //if no page is open, start display of a page + // If no page is open, start display of a page. $pagecount++; echo '
' . get_string('page') . ' ' . $pagecount . @@ -540,9 +539,8 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool, $questionurl = new moodle_url('/question/question.php', $questionparams); $questioncount++; - //this is an actual question - /* Display question start */ + // This is an actual question. ?>
@@ -604,7 +602,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool, } if ($allowdelete && ($question->qtype == 'missingtype' || question_has_capability_on($question, 'use', $question->category))) { - // remove from quiz, not question delete. + // Remove from quiz, not question delete. if (!$hasattempts) { echo $OUTPUT->action_icon($pageurl->out(true, array('remove' => $question->id, 'sesskey'=>sesskey())), @@ -663,13 +661,13 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool, ?>
qtype == 'random') { // it is a random question + if ($question->qtype == 'random') { // It is a random question. if (!$reordertool) { quiz_print_randomquestion($question, $pageurl, $quiz, $quiz_qbanktool); } else { quiz_print_randomquestion_reordertool($question, $pageurl, $quiz); } - } else { // it is a single question + } else { // It is a single question. if (!$reordertool) { quiz_print_singlequestion($question, $returnurl, $quiz); } else { @@ -685,7 +683,7 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool, shufflequestions && @@ -693,8 +691,8 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool, quiz_print_pagecontrols($quiz, $pageurl, $pagecount, $hasattempts, $defaultcategoryobj, $canaddquestion, $canaddrandom); } else if ($count < $questiontotalcount - 1) { - //do not include the last page break for reordering - //to avoid creating a new extra page in the end + // Do not include the last page break for reordering + // to avoid creating a new extra page in the end. echo ''; } @@ -745,7 +743,7 @@ function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts, $randombuttoncount++; echo '
'; - // Get the current context + // Get the current context. $thiscontext = get_context_instance(CONTEXT_COURSE, $quiz->course); $contexts = new question_edit_contexts($thiscontext); @@ -756,7 +754,7 @@ function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts, } if ($canaddquestion) { - // Create the url the question page will return to + // Create the url the question page will return to. $returnurladdtoquiz = new moodle_url($pageurl, array('addonpage' => $page)); // Print a button linking to the choose question type page. @@ -863,33 +861,33 @@ function quiz_print_randomquestion(&$question, &$pageurl, &$quiz, $quiz_qbanktoo echo '
'; if ($questioncount == 0) { - // No questions in category, give an error plus instructions + // No questions in category, give an error plus instructions. echo ''; print_string('noquestionsnotinuse', 'quiz'); echo ''; echo '
'; - // Embed the link into the string with instructions + // Embed the link into the string with instructions. $a = new stdClass(); $a->catname = '' . $category->name . ''; $a->link = $linkcategorycontents; echo get_string('addnewquestionsqbank', 'quiz', $a); } else { - // Category has questions + // Category has questions. - // Get a sample from the database, + // Get a sample from the database. $questionidstoshow = array_slice($questionids, 0, NUM_QS_TO_SHOW_IN_RANDOM); $questionstoshow = $DB->get_records_list('question', 'id', $questionidstoshow, '', 'id, qtype, name, questiontext, questiontextformat'); - // list them, + // Then list them. echo '