예제 #1
0
 /**
  * Displays one question with the surrounding controls.
  *
  * @param structure $structure object containing the structure of the quiz.
  * @param int $slot the first slot on the page we are outputting.
  * @param \question_edit_contexts $contexts the relevant question bank contexts.
  * @param array $pagevars the variables from {@link \question_edit_setup()}.
  * @param \moodle_url $pageurl the canonical URL of this page.
  * @return string HTML to output.
  */
 public function page_row(structure $structure, $slot, $contexts, $pagevars, $pageurl)
 {
     $output = '';
     $pagenumber = $structure->get_page_number_for_slot($slot);
     // Put page in a heading for accessibility and styling.
     $page = $this->heading(get_string('page') . ' ' . $pagenumber, 4);
     if ($structure->is_first_slot_on_page($slot)) {
         // Add the add-menu at the page level.
         $addmenu = html_writer::tag('span', $this->add_menu_actions($structure, $pagenumber, $pageurl, $contexts, $pagevars), array('class' => 'add-menu-outer'));
         $addquestionform = $this->add_question_form($structure, $pagenumber, $pageurl, $pagevars);
         $output .= html_writer::tag('li', $page . $addmenu . $addquestionform, array('class' => 'pagenumber activity yui3-dd-drop page', 'id' => 'page-' . $pagenumber));
     }
     return $output;
 }
 /**
  * Displays one question with the surrounding controls.
  *
  * @param structure $structure object containing the structure of the quiz.
  * @param \stdClass $question data from the question and quiz_slots tables.
  * @param \question_edit_contexts $contexts the relevant question bank contexts.
  * @param array $pagevars the variables from {@link \question_edit_setup()}.
  * @param \moodle_url $pageurl the canonical URL of this page.
  * @return string HTML to output.
  */
 public function page_row(structure $structure, $question, $contexts, $pagevars, $pageurl)
 {
     $output = '';
     // Put page in a span for easier styling.
     $page = html_writer::tag('span', get_string('page') . ' ' . $question->page, array('class' => 'text'));
     if ($structure->is_first_slot_on_page($question->slot)) {
         // Add the add-menu at the page level.
         $addmenu = html_writer::tag('span', $this->add_menu_actions($structure, $question->page, $pageurl, $contexts, $pagevars), array('class' => 'add-menu-outer'));
         $addquestionform = $this->add_question_form($structure, $question->page, $pageurl, $pagevars);
         $output .= html_writer::tag('li', $page . $addmenu . $addquestionform, array('class' => 'pagenumber activity yui3-dd-drop page', 'id' => 'page-' . $question->page));
     }
     return $output;
 }
예제 #3
0
 /**
  * Displays one question with the surrounding controls.
  *
  * @param structure $structure object containing the structure of the quiz.
  * @param \stdClass $question data from the question and quiz_slots tables.
  * @param \question_edit_contexts $contexts the relevant question bank contexts.
  * @param array $pagevars the variables from {@link \question_edit_setup()}.
  * @param \moodle_url $pageurl the canonical URL of this page.
  * @return string HTML to output.
  */
 public function question_row(structure $structure, $question, $contexts, $pagevars, $pageurl)
 {
     $output = '';
     // Put page in a span for easier styling.
     $page = html_writer::tag('span', get_string('page') . ' ' . $question->page, array('class' => 'text'));
     if ($structure->is_first_slot_on_page($question->slot)) {
         // Add the add-menu at the page level.
         $addmenu = html_writer::tag('span', $this->add_menu_actions($structure, $question->page, $pageurl, $contexts, $pagevars), array('class' => 'add-menu-outer'));
         $addquestionform = $this->add_question_form($structure, $question->page, $pageurl, $pagevars);
         $output .= html_writer::tag('li', $page . $addmenu . $addquestionform, array('class' => 'pagenumber activity yui3-dd-drop page', 'id' => 'page-' . $question->page));
     }
     // Page split/join icon.
     $joinhtml = '';
     if ($structure->can_be_edited() && !$structure->is_last_slot_in_quiz($question->slot)) {
         $joinhtml = $this->page_split_join_button($structure->get_quiz(), $question, !$structure->is_last_slot_on_page($question->slot));
     }
     // Question HTML.
     $questionhtml = $this->question($structure, $question, $pageurl);
     $questionclasses = 'activity ' . $question->qtype . ' qtype_' . $question->qtype . ' slot';
     $output .= html_writer::tag('li', $questionhtml . $joinhtml, array('class' => $questionclasses, 'id' => 'slot-' . $question->slotid));
     return $output;
 }