예제 #1
0
 /**
  * view_attempt_button
  *
  * @param xxx $hotpot
  * @return xxx
  */
 function view_attempt_button($hotpot)
 {
     $output = '';
     // Initialize button text. This will be set something
     // if as start/continue attempt button should appear.
     $buttontext = '';
     if ($hotpot->can_preview()) {
         $buttontext = get_string('previewquiznow', 'quiz');
     } else {
         if ($hotpot->can_start()) {
             if ($hotpot->count_distinct_clickreportids()) {
                 $buttontext = get_string('reattemptquiz', 'quiz');
             } else {
                 $buttontext = get_string('attemptquiznow', 'quiz');
             }
         }
     }
     $output .= $this->box_start('hotpotviewbutton');
     if ($buttontext) {
         $url = $hotpot->attempt_url();
         $button = new single_button($url, $buttontext);
         $button->class .= ' hotpotviewbutton';
         $output .= $this->render($button);
     } else {
         $url = new moodle_url('/course/view.php', array('id' => $hotpot->course->id));
         $output .= $this->continue_button($url);
     }
     $output .= $this->box_end();
     return $output;
 }