weekly release 4.0dev
[moodle.git] / admin / tool / licensemanager / index.php
CommitLineData
1dce6261 1<?php
1dce6261
DC
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/**
4399e475
TD
18 * License manager page.
19 *
20 * @package tool_licensemanager
21 * @copyright 2019 Tom Dickman <tomdickman@catalyst-au.net>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
1dce6261
DC
23 */
24
4399e475
TD
25require_once('../../../config.php');
26require_once($CFG->libdir . '/adminlib.php');
27require_once($CFG->libdir . '/licenselib.php');
1dce6261 28
1fc0c4bd 29require_admin();
1dce6261 30
4399e475 31$returnurl = \tool_licensemanager\helper::get_licensemanager_url();
1dce6261 32
405aca35 33$action = optional_param('action', '', PARAM_ALPHANUMEXT);
1dce6261
DC
34$license = optional_param('license', '', PARAM_SAFEDIR);
35
1dce6261
DC
36if (!confirm_sesskey()) {
37 redirect($returnurl);
38}
39
4399e475
TD
40// Route via the manager.
41$licensemanager = new \tool_licensemanager\manager();
42$PAGE->set_context(context_system::instance());
43$PAGE->set_url(\tool_licensemanager\helper::get_licensemanager_url());
44$PAGE->set_title(get_string('licensemanager', 'tool_licensemanager'));
1dce6261 45
4399e475 46$licensemanager->execute($action, $license);