Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Table to show the list of tours. 19 * 20 * @package tool_usertours 21 * @copyright 2016 Andrew Nicols <andrew@nicols.co.uk> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace tool_usertours\local\table; 26 27 defined('MOODLE_INTERNAL') || die(); 28 29 use tool_usertours\helper; 30 use tool_usertours\tour; 31 32 require_once($CFG->libdir . '/tablelib.php'); 33 34 /** 35 * Table to show the list of tours. 36 * 37 * @copyright 2016 Andrew Nicols <andrew@nicols.co.uk> 38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 39 */ 40 class tour_list extends \flexible_table { 41 42 /** @var int The count of all tours. */ 43 protected int $tourcount = 0; 44 45 /** 46 * Construct the tour table. 47 */ 48 public function __construct() { 49 parent::__construct('tours'); 50 51 $baseurl = new \moodle_url('/tool/usertours/configure.php'); 52 $this->define_baseurl($baseurl); 53 54 // Column definition. 55 $this->define_columns(array( 56 'name', 57 'description', 58 'appliesto', 59 'enabled', 60 'actions', 61 )); 62 63 $this->define_headers(array( 64 get_string('name', 'tool_usertours'), 65 get_string('description', 'tool_usertours'), 66 get_string('appliesto', 'tool_usertours'), 67 get_string('enabled', 'tool_usertours'), 68 get_string('actions', 'tool_usertours'), 69 )); 70 71 $this->set_attribute('class', 'admintable generaltable'); 72 $this->setup(); 73 74 $this->tourcount = helper::count_tours(); 75 } 76 77 /** 78 * Format the current row's name column. 79 * 80 * @param tour $tour The tour for this row. 81 * @return string 82 */ 83 protected function col_name(tour $tour) { 84 global $OUTPUT; 85 return $OUTPUT->render(helper::render_tourname_inplace_editable($tour)); 86 } 87 88 /** 89 * Format the current row's description column. 90 * 91 * @param tour $tour The tour for this row. 92 * @return string 93 */ 94 protected function col_description(tour $tour) { 95 global $OUTPUT; 96 return $OUTPUT->render(helper::render_tourdescription_inplace_editable($tour)); 97 } 98 99 /** 100 * Format the current row's appliesto column. 101 * 102 * @param tour $tour The tour for this row. 103 * @return string 104 */ 105 protected function col_appliesto(tour $tour) { 106 return $tour->get_pathmatch(); 107 } 108 109 /** 110 * Format the current row's enabled column. 111 * 112 * @param tour $tour The tour for this row. 113 * @return string 114 */ 115 protected function col_enabled(tour $tour) { 116 global $OUTPUT; 117 return $OUTPUT->render(helper::render_tourenabled_inplace_editable($tour)); 118 } 119 120 /** 121 * Format the current row's actions column. 122 * 123 * @param tour $tour The tour for this row. 124 * @return string 125 */ 126 protected function col_actions(tour $tour) { 127 $actions = []; 128 129 if ($tour->is_first_tour()) { 130 $actions[] = helper::get_filler_icon(); 131 } else { 132 $actions[] = helper::format_icon_link($tour->get_moveup_link(), 't/up', 133 get_string('movetourup', 'tool_usertours')); 134 } 135 136 if ($tour->is_last_tour($this->tourcount)) { 137 $actions[] = helper::get_filler_icon(); 138 } else { 139 $actions[] = helper::format_icon_link($tour->get_movedown_link(), 't/down', 140 get_string('movetourdown', 'tool_usertours')); 141 } 142 143 $actions[] = helper::format_icon_link($tour->get_view_link(), 't/viewdetails', get_string('view')); 144 $actions[] = helper::format_icon_link($tour->get_edit_link(), 't/edit', get_string('edit')); 145 $actions[] = helper::format_icon_link($tour->get_duplicate_link(), 't/copy', get_string('duplicate')); 146 $actions[] = helper::format_icon_link($tour->get_export_link(), 't/export', 147 get_string('exporttour', 'tool_usertours'), 'tool_usertours'); 148 $actions[] = helper::format_icon_link($tour->get_delete_link(), 't/delete', get_string('delete'), null, [ 149 'data-action' => 'delete', 150 'data-id' => $tour->get_id(), 151 ]); 152 153 return implode(' ', $actions); 154 } 155 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body