See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]
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 * Abstract renderer for independent renderable elements. 19 * 20 * @package tool_dataprivacy 21 * @copyright 2018 David Monllao 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 namespace tool_dataprivacy\output; 25 defined('MOODLE_INTERNAL') || die(); 26 27 use renderable; 28 use renderer_base; 29 use stdClass; 30 use templatable; 31 use tool_dataprivacy\external\purpose_exporter; 32 use tool_dataprivacy\external\category_exporter; 33 34 /** 35 * Abstract renderer for independent renderable elements. 36 * 37 * @copyright 2018 David Monllao 38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 39 */ 40 abstract class crud_element { 41 42 /** 43 * Returns the top navigation buttons. 44 * 45 * @return \action_link[] 46 */ 47 protected final function get_navigation() { 48 $back = new \action_link( 49 new \moodle_url('/admin/tool/dataprivacy/dataregistry.php'), 50 get_string('back'), 51 null, 52 ['class' => 'btn btn-primary'] 53 ); 54 return [$back]; 55 } 56 57 /** 58 * Adds an action menu for the provided element 59 * 60 * @param string $elementname 'purpose' or 'category'. 61 * @param \stdClass $exported 62 * @param \core\persistent $persistent 63 * @return \action_menu 64 */ 65 protected final function action_menu($elementname, $exported, $persistent) { 66 67 // Just in case, we are doing funny stuff below. 68 $elementname = clean_param($elementname, PARAM_ALPHA); 69 70 // Actions. 71 $actionmenu = new \action_menu(); 72 $actionmenu->set_menu_trigger(get_string('actions')); 73 $actionmenu->set_owner_selector($elementname . '-' . $exported->id . '-actions'); 74 75 $url = new \moodle_url('/admin/tool/dataprivacy/edit' . $elementname . '.php', 76 ['id' => $exported->id]); 77 $link = new \action_menu_link_secondary($url, new \pix_icon('t/edit', 78 get_string('edit')), get_string('edit')); 79 $actionmenu->add($link); 80 81 if (!$persistent->is_used()) { 82 $url = new \moodle_url('#'); 83 $attrs = ['data-id' => $exported->id, 'data-action' => 'delete' . $elementname, 'data-name' => $exported->name]; 84 $link = new \action_menu_link_secondary($url, new \pix_icon('t/delete', 85 get_string('delete')), get_string('delete'), $attrs); 86 $actionmenu->add($link); 87 } 88 89 return $actionmenu; 90 } 91 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body