Merge branch 'MDL-44278' of git://github.com/timhunt/moodle
authorDan Poltawski <dan@moodle.com>
Tue, 4 Mar 2014 07:43:23 +0000 (15:43 +0800)
committerDan Poltawski <dan@moodle.com>
Tue, 4 Mar 2014 07:43:23 +0000 (15:43 +0800)
1  2 
mod/quiz/override_form.php

@@@ -27,6 -27,7 +27,7 @@@
  defined('MOODLE_INTERNAL') || die();
  
  require_once($CFG->libdir . '/formslib.php');
+ require_once($CFG->dirroot . '/mod/quiz/mod_form.php');
  
  
  /**
@@@ -157,15 -158,10 +158,15 @@@ class quiz_override_form extends moodle
                  }
  
                  $userchoices = array();
 +                $canviewemail = in_array('email', get_extra_user_fields($this->context));
                  foreach ($users as $id => $user) {
                      if (empty($invalidusers[$id]) || (!empty($override) &&
                              $id == $override->userid)) {
 -                        $userchoices[$id] = fullname($user) . ', ' . $user->email;
 +                        if ($canviewemail) {
 +                            $userchoices[$id] = fullname($user) . ', ' . $user->email;
 +                        } else {
 +                            $userchoices[$id] = fullname($user);
 +                        }
                      }
                  }
                  unset($users);
  
          // Open and close dates.
          $mform->addElement('date_time_selector', 'timeopen',
-                 get_string('quizopen', 'quiz'), array('optional' => true));
+                 get_string('quizopen', 'quiz'), mod_quiz_mod_form::$datefieldoptions);
          $mform->setDefault('timeopen', $this->quiz->timeopen);
  
          $mform->addElement('date_time_selector', 'timeclose',
-                 get_string('quizclose', 'quiz'), array('optional' => true));
+                 get_string('quizclose', 'quiz'), mod_quiz_mod_form::$datefieldoptions);
          $mform->setDefault('timeclose', $this->quiz->timeclose);
  
          // Time limit.