Exemplo n.º 1
0
 /**
  * Print the the list of tours.
  */
 protected function print_tour_list()
 {
     global $PAGE, $OUTPUT;
     $this->header();
     echo \html_writer::span(get_string('tourlist_explanation', 'tool_usertours'));
     $table = new table\tour_list();
     $tours = helper::get_tours();
     foreach ($tours as $tour) {
         $table->add_data_keyed($table->format_row($tour));
     }
     $table->finish_output();
     $actions = [(object) ['link' => helper::get_edit_tour_link(), 'linkproperties' => [], 'img' => 'b/tour-new', 'title' => get_string('newtour', 'tool_usertours')], (object) ['link' => helper::get_import_tour_link(), 'linkproperties' => [], 'img' => 'b/tour-import', 'title' => get_string('importtour', 'tool_usertours')], (object) ['link' => new \moodle_url('https://moodle.net/tours'), 'linkproperties' => ['target' => '_blank'], 'img' => 'b/tour-shared', 'title' => get_string('sharedtourslink', 'tool_usertours')]];
     echo \html_writer::start_tag('div', ['class' => 'tour-actions']);
     echo \html_writer::start_tag('ul');
     foreach ($actions as $config) {
         $action = \html_writer::start_tag('li');
         $linkproperties = $config->linkproperties;
         $linkproperties['href'] = $config->link;
         $action .= \html_writer::start_tag('a', $linkproperties);
         $action .= \html_writer::img($OUTPUT->pix_url($config->img, 'tool_usertours'), $config->title);
         $action .= \html_writer::div($config->title);
         $action .= \html_writer::end_tag('a');
         $action .= \html_writer::end_tag('li');
         echo $action;
     }
     echo \html_writer::end_tag('ul');
     echo \html_writer::end_tag('div');
     // JS for Tour management.
     $PAGE->requires->js_call_amd('tool_usertours/managetours', 'setup');
     $this->footer();
 }