Exemple #1
0
 /**
  * Make some text into a link to review the quiz, if that is appropriate.
  *
  * @param string $linktext some text.
  * @param object $attempt the attempt object
  * @return string some HTML, the $linktext either unmodified or wrapped in a
  *      link to the review page.
  */
 public function make_review_link($attempt, $canpreview, $reviewoptions)
 {
     global $CFG;
     // If review of responses is not allowed, or the attempt is still open, don't link.
     if (!$attempt->timefinish) {
         return '';
     }
     $when = quiz_attempt_state($this->_readerobj->get_reader(), $attempt);
     $reviewoptions = mod_reader_display_options::make_from_quiz($this->_readerobj->get_reader(), $when);
     if (!$reviewoptions->attempt) {
         $message = $this->cannot_review_message($when, true);
         if ($message) {
             return '<span class="noreviewmessage">' . $message . '</span>';
         } else {
             return '';
         }
     }
     $linktext = get_string('review', 'quiz');
     // It is OK to link, does it need to be in a secure window?
     if ($this->securewindow_required($canpreview)) {
         return $this->_securewindowrule->make_review_link($linktext, $attempt->id);
     } else {
         return '<a href="' . $this->_readerobj->review_url($attempt->id) . '" title="' . get_string('reviewthisattempt', 'quiz') . '">' . $linktext . '</a>';
     }
 }
Exemple #2
0
 /**
  * Wrapper that the correct mod_reader_display_options for this reader at the
  * moment.
  *
  * @return question_display_options the render options for this user on this attempt.
  */
 public function get_display_options($reviewing)
 {
     if ($reviewing) {
         if (is_null($this->reviewoptions)) {
             $this->reviewoptions = reader_get_review_options($this->get_reader(), $this->attempt, $this->readerobj->get_context());
         }
         return $this->reviewoptions;
     } else {
         $options = mod_reader_display_options::make_from_reader($this->get_quiz(), mod_reader_display_options::DURING, $this->readerobj->course->showgrades);
         $options->flags = 'question_display_options::HIDDEN';
         return $options;
     }
 }