Permalink
Browse files

MDL-31407 quiz: review all uses of global $USER

  • Loading branch information...
1 parent c31783b commit e1ded0ff555920b1eed4f8b986d94eec6f08a3b0 @timhunt timhunt committed Jan 30, 2012
Showing with 5 additions and 13 deletions.
  1. +2 −2 mod/quiz/editlib.php
  2. +1 −1 mod/quiz/lib.php
  3. +1 −4 mod/quiz/locallib.php
  4. +1 −1 mod/quiz/override_form.php
  5. +0 −5 mod/quiz/view.php
View
4 mod/quiz/editlib.php
@@ -346,7 +346,7 @@ function quiz_move_question_down($layout, $questionid) {
*/
function quiz_print_question_list($quiz, $pageurl, $allowdelete, $reordertool,
$quiz_qbanktool, $hasattempts, $defaultcategoryobj) {
- global $USER, $CFG, $DB, $OUTPUT;
+ global $CFG, $DB, $OUTPUT;
$strorder = get_string('order');
$strquestionname = get_string('questionname', 'quiz');
$strgrade = get_string('grade');
@@ -1212,7 +1212,7 @@ protected function display_options($recurse, $showhidden, $showquestiontext) {
* the last value used +1.
*/
function quiz_print_grading_form($quiz, $pageurl, $tabindex) {
- global $USER, $OUTPUT;
+ global $OUTPUT;
$strsave = get_string('save', 'quiz');
echo '<form method="post" action="edit.php" class="quizsavegradesform"><div>';
echo '<fieldset class="invisiblefieldset" style="display: block;">';
View
2 mod/quiz/lib.php
@@ -1720,7 +1720,7 @@ function quiz_pluginfile($course, $cm, $context, $filearea, $args, $forcedownloa
*/
function mod_quiz_question_pluginfile($course, $context, $component,
$filearea, $qubaid, $slot, $args, $forcedownload) {
- global $USER, $CFG;
+ global $CFG;
require_once($CFG->dirroot . '/mod/quiz/locallib.php');
$attemptobj = quiz_attempt::create_from_usage_id($qubaid);
View
5 mod/quiz/locallib.php
@@ -508,8 +508,7 @@ function quiz_set_grade($newgrade, $quiz) {
* @return bool Indicates success or failure.
*/
function quiz_save_best_grade($quiz, $userid = null, $attempts = array()) {
- global $DB;
- global $USER, $OUTPUT;
+ global $DB, $OUTPUT, $USER;
if (empty($userid)) {
$userid = $USER->id;
@@ -1149,8 +1148,6 @@ function quiz_send_confirmation($recipient, $a) {
*/
function quiz_send_notification($recipient, $submitter, $a) {
- global $USER;
-
// Recipient info for template
$a->useridnumber = $recipient->idnumber;
$a->username = fullname($recipient);
View
2 mod/quiz/override_form.php
@@ -58,7 +58,7 @@ public function __construct($submiturl, $cm, $quiz, $context, $groupmode, $overr
}
protected function definition() {
- global $CFG, $USER, $DB;
+ global $CFG, $DB;
$cm = $this->cm;
$mform = $this->_form;
View
5 mod/quiz/view.php
@@ -78,11 +78,6 @@
// Initialize $PAGE, compute blocks
$PAGE->set_url('/mod/quiz/view.php', array('id' => $cm->id));
-$edit = optional_param('edit', -1, PARAM_BOOL);
-if ($edit != -1 && $PAGE->user_allowed_editing()) {
- $USER->editing = $edit;
-}
-
// Get this user's attempts.
$attempts = quiz_get_user_attempts($quiz->id, $USER->id, 'finished', true);
$lastfinishedattempt = end($attempts);

0 comments on commit e1ded0f

Please sign in to comment.