/** * Handle tour import. */ protected function import_tour() { global $PAGE; $PAGE->navbar->add(get_string('importtour', 'tool_usertours'), helper::get_import_tour_link()); $form = new forms\importtour(); if ($form->is_cancelled()) { redirect(helper::get_list_tour_link()); } else { if ($form->get_data()) { // Importing a tour. $tourconfigraw = $form->get_file_content('tourconfig'); $tour = self::import_tour_from_json($tourconfigraw); redirect($tour->get_view_link()); } else { $this->header(); $form->display(); $this->footer(); } } }
/** * Create the import tour form. */ public function __construct() { parent::__construct(\tool_usertours\helper::get_import_tour_link()); }