See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 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 * Tour. 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 defined('MOODLE_INTERNAL') || die(); 26 27 use tool_usertours\helper; 28 29 /** 30 * Manage inplace editable saves. 31 * 32 * @param string $itemtype The type of item. 33 * @param int $itemid The ID of the item. 34 * @param mixed $newvalue The new value 35 * @return string 36 */ 37 function tool_usertours_inplace_editable($itemtype, $itemid, $newvalue) { 38 $context = \context_system::instance(); 39 external_api::validate_context($context); 40 require_capability('tool/usertours:managetours', $context); 41 42 if ($itemtype === 'tourname') { 43 $tour = helper::get_tour($itemid); 44 $tour->set_name($newvalue)->persist(); 45 46 return helper::render_tourname_inplace_editable($tour); 47 } else if ($itemtype === 'tourdescription') { 48 $tour = helper::get_tour($itemid); 49 $tour->set_description($newvalue)->persist(); 50 51 return helper::render_tourdescription_inplace_editable($tour); 52 } else if ($itemtype === 'tourenabled') { 53 $tour = helper::get_tour($itemid); 54 $tour->set_enabled(!!$newvalue)->persist(); 55 return helper::render_tourenabled_inplace_editable($tour); 56 } else if ($itemtype === 'stepname') { 57 $step = helper::get_step($itemid); 58 $step->set_title($newvalue)->persist(); 59 60 return helper::render_stepname_inplace_editable($step); 61 } 62 } 63 64 /** 65 * Extend the user navigation to bootstrap tours. 66 */ 67 function tool_usertours_extend_navigation_user() { 68 \tool_usertours\helper::bootstrap(); 69 } 70 71 /** 72 * Add JS to bootstrap tours. Only in Moodle 3.3+ 73 */ 74 function tool_usertours_before_footer() { 75 \tool_usertours\helper::bootstrap(); 76 } 77 78 /** 79 * Map icons for font-awesome themes. 80 */ 81 function tool_usertours_get_fontawesome_icon_map() { 82 return [ 83 'tool_usertours:t/export' => 'fa-download', 84 'tool_usertours:i/reload' => 'fa-refresh', 85 'tool_usertours:t/filler' => 'fa-spacer', 86 ]; 87 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body