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 * Tour Step Renderable. 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\output; 26 27 defined('MOODLE_INTERNAL') || die(); 28 29 require_once($CFG->libdir . "/filelib.php"); 30 31 use tool_usertours\helper; 32 use tool_usertours\step as stepsource; 33 34 /** 35 * Tour Step Renderable. 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 step implements \renderable { 41 42 /** 43 * @var The step instance. 44 */ 45 protected $step; 46 47 /** 48 * The step output. 49 * 50 * @param stepsource $step The step being output. 51 */ 52 public function __construct(stepsource $step) { 53 $this->step = $step; 54 } 55 56 /** 57 * Export the step configuration. 58 * 59 * @param renderer_base $output The renderer. 60 * @return object 61 */ 62 public function export_for_template(\renderer_base $output) { 63 global $PAGE; 64 $step = $this->step; 65 66 $content = $step->get_content(); 67 $systemcontext = \context_system::instance(); 68 $content = file_rewrite_pluginfile_urls($content, 'pluginfile.php', $systemcontext->id, 69 'tool_usertours', 'stepcontent', $step->get_id()); 70 71 $content = helper::get_string_from_input($content); 72 $content = $step::get_step_image_from_input($content); 73 74 $result = (object) [ 75 'stepid' => $step->get_id(), 76 'title' => \core_external\util::format_text( 77 helper::get_string_from_input($step->get_title()), 78 FORMAT_HTML, 79 $PAGE->context->id, 80 'tool_usertours' 81 )[0], 82 'content' => \core_external\util::format_text( 83 $content, 84 $step->get_contentformat(), 85 $PAGE->context->id, 86 'tool_usertours' 87 )[0], 88 'element' => $step->get_target()->convert_to_css(), 89 ]; 90 91 foreach ($step->get_config_keys() as $key) { 92 $result->$key = $step->get_config($key); 93 } 94 95 return $result; 96 } 97 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body