See Release Notes
Long Term Support Release
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 * This page lets users manage categories. 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 25 require_once(__DIR__ . '/../../../config.php'); 26 27 require_login(null, false); 28 29 $id = optional_param('id', 0, PARAM_INT); 30 31 $url = new \moodle_url('/admin/tool/dataprivacy/editcategory.php', array('id' => $id)); 32 if ($id) { 33 $title = get_string('editcategory', 'tool_dataprivacy'); 34 } else { 35 $title = get_string('addcategory', 'tool_dataprivacy'); 36 } 37 \tool_dataprivacy\page_helper::setup($url, $title, 'dataregistry'); 38 39 $category = new \tool_dataprivacy\category($id); 40 $form = new \tool_dataprivacy\form\category($PAGE->url->out(false), 41 array('persistent' => $category, 'showbuttons' => true)); 42 43 $returnurl = new \moodle_url('/admin/tool/dataprivacy/categories.php'); 44 if ($form->is_cancelled()) { 45 redirect($returnurl); 46 } else if ($data = $form->get_data()) { 47 if (empty($data->id)) { 48 \tool_dataprivacy\api::create_category($data); 49 $messagesuccess = get_string('categorycreated', 'tool_dataprivacy'); 50 } else { 51 \tool_dataprivacy\api::update_category($data); 52 $messagesuccess = get_string('categoryupdated', 'tool_dataprivacy'); 53 } 54 redirect($returnurl, $messagesuccess, 0, \core\output\notification::NOTIFY_SUCCESS); 55 } 56 57 $output = $PAGE->get_renderer('tool_dataprivacy'); 58 echo $output->header(); 59 $form->display(); 60 echo $output->footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body