Пример #1
0
 /**
  * Returns the valid choices for the number of decimal places for showing
  * question marks. For use in the user interface.
  * @return array suitable for passing to {@link html_writer::select()} or similar.
  */
 public static function get_dp_options()
 {
     return question_display_options::get_dp_options();
 }
Пример #2
0
 /**
  * Make any changes to the display options before a question is rendered, so
  * that it can be displayed in a way that is appropriate for the statue it is
  * currently in. For example, by default, if the question is finished, we
  * ensure that it is only ever displayed read-only.
  * @param question_display_options $options the options to adjust. Just change
  * the properties of this object - objects are passed by referece.
  */
 public function adjust_display_options(question_display_options $options) {
     if (!$this->qa->has_marks()) {
         $options->correctness = false;
         $options->numpartscorrect = false;
     }
     if ($this->qa->get_state()->is_finished()) {
         $options->readonly = true;
         $options->numpartscorrect = $options->numpartscorrect &&
                 $this->qa->get_state()->is_partially_correct() &&
                 !empty($this->question->shownumcorrect);
     } else {
         $options->hide_all_feedback();
     }
 }
 /**
  * sets up the display options for the question
  *
  * @return \question_display_options
  */
 protected function get_display_options($review = false, $reviewoptions = '')
 {
     $options = new \question_display_options();
     $options->flags = \question_display_options::HIDDEN;
     $options->context = $this->context;
     // if we're reviewing set up display options for review
     if ($review) {
         // default display options for review
         $options->readonly = true;
         $options->marks = \question_display_options::HIDDEN;
         $options->hide_all_feedback();
         // special case for "edit" reviewoptions value
         if ($reviewoptions === 'edit') {
             $options->correctness = \question_display_options::VISIBLE;
             $options->marks = \question_display_options::MARK_AND_MAX;
             $options->feedback = \question_display_options::VISIBLE;
             $options->numpartscorrect = \question_display_options::VISIBLE;
             $options->manualcomment = \question_display_options::EDITABLE;
             $options->generalfeedback = \question_display_options::VISIBLE;
             $options->rightanswer = \question_display_options::VISIBLE;
             $options->history = \question_display_options::VISIBLE;
         } else {
             if ($reviewoptions instanceof \stdClass) {
                 foreach (\mod_activequiz\activequiz::$reviewfields as $field => $notused) {
                     if ($reviewoptions->{$field} == 1) {
                         if ($field == 'specificfeedback') {
                             $field = 'feedback';
                         }
                         if ($field == 'marks') {
                             $options->{$field} = \question_display_options::MARK_AND_MAX;
                         } else {
                             $options->{$field} = \question_display_options::VISIBLE;
                         }
                     }
                 }
             }
         }
     } else {
         // otherwise default options for during quiz
         $options->rightanswer = \question_display_options::HIDDEN;
         $options->numpartscorrect = \question_display_options::HIDDEN;
         $options->manualcomment = \question_display_options::HIDDEN;
         $options->manualcommentlink = \question_display_options::HIDDEN;
     }
     return $options;
 }