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 namespace enrol_lti\local\ltiadvantage\admin; 18 use enrol_lti\local\ltiadvantage\repository\application_registration_repository; 19 20 /** 21 * The admin_setting_registeredplatforms class, for rendering a table of platforms which have been registered. 22 * 23 * This setting is useful for LTI 1.3 only. 24 * 25 * @package enrol_lti 26 * @copyright 2021 Jake Dallimore <jrhdallimore@gmail.com> 27 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 28 */ 29 class admin_setting_registeredplatforms extends \admin_setting { 30 /** 31 * Calls parent::__construct with specific arguments 32 */ 33 public function __construct() { 34 $this->nosave = true; 35 parent::__construct('enrol_lti_tool_registered_platforms', get_string('registeredplatforms', 'enrol_lti'), '', 36 ''); 37 } 38 39 /** 40 * Always returns true, does nothing. 41 * 42 * @return bool true. 43 */ 44 public function get_setting() { 45 return true; 46 } 47 48 /** 49 * Always returns true, does nothing. 50 * 51 * @return bool true. 52 */ 53 public function get_defaultsetting() { 54 return true; 55 } 56 57 /** 58 * Always returns '', does not write anything. 59 * 60 * @param string|array $data the data 61 * @return string Always returns ''. 62 */ 63 public function write_setting($data) { 64 return ''; 65 } 66 67 /** 68 * Checks if $query is one of the available external services 69 * 70 * @param string $query The string to search for 71 * @return bool Returns true if found, false if not 72 */ 73 public function is_related($query) { 74 if (parent::is_related($query)) { 75 return true; 76 } 77 78 $appregistrationrepo = new application_registration_repository(); 79 $registrations = $appregistrationrepo->find_all(); 80 foreach ($registrations as $reg) { 81 if (stripos($reg->get_name(), $query) !== false) { 82 return true; 83 } 84 } 85 return false; 86 } 87 88 /** 89 * Builds the HTML to display the table. 90 * 91 * @param string $data Unused 92 * @param string $query 93 * @return string 94 */ 95 public function output_html($data, $query='') { 96 global $PAGE; 97 98 $appregistrationrepo = new application_registration_repository(); 99 $renderer = $PAGE->get_renderer('enrol_lti'); 100 $return = $renderer->render_admin_setting_registered_platforms($appregistrationrepo->find_all()); 101 return highlight($query, $return); 102 } 103 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body