예제 #1
0
 /**
  * Display an icon to split or join two pages of the quiz.
  *
  * @param structure $structure object containing the structure of the quiz.
  * @param int $slot the first slot on the page we are outputting.
  * @return string HTML to output.
  */
 public function page_split_join_button($structure, $slot)
 {
     $insertpagebreak = !$structure->is_last_slot_on_page($slot);
     $url = new \moodle_url('repaginate.php', array('quizid' => $structure->get_quizid(), 'slot' => $slot, 'repag' => $insertpagebreak ? 2 : 1, 'sesskey' => sesskey()));
     if ($insertpagebreak) {
         $title = get_string('addpagebreak', 'quiz');
         $image = $this->pix_icon('e/insert_page_break', $title);
         $action = 'addpagebreak';
     } else {
         $title = get_string('removepagebreak', 'quiz');
         $image = $this->pix_icon('e/remove_page_break', $title);
         $action = 'removepagebreak';
     }
     // Disable the link if quiz has attempts.
     $disabled = null;
     if (!$structure->can_be_edited()) {
         $disabled = 'disabled';
     }
     return html_writer::span($this->action_link($url, $image, null, array('title' => $title, 'class' => 'page_split_join cm-edit-action', 'disabled' => $disabled, 'data-action' => $action)), 'page_split_join_wrapper');
 }