1 |
efrain |
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 |
defined('MOODLE_INTERNAL') || die();
|
|
|
18 |
|
|
|
19 |
/**
|
|
|
20 |
* No setting - just html
|
|
|
21 |
* Note: since admin_setting is not namespaced, this can not be namespaced and put into a class
|
|
|
22 |
*/
|
|
|
23 |
class admin_setting_html extends admin_setting {
|
|
|
24 |
|
|
|
25 |
private $hubinfo;
|
|
|
26 |
|
|
|
27 |
/**
|
|
|
28 |
* not a setting, just html
|
|
|
29 |
*
|
|
|
30 |
* @param string $name unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting' for ones in config_plugins.
|
|
|
31 |
*/
|
|
|
32 |
public function __construct($name, $translation, $hubinfo) {
|
|
|
33 |
$this->nosave = true;
|
|
|
34 |
$this->hubinfo = $hubinfo;
|
|
|
35 |
parent::__construct($name, $translation, '', '');
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
/**
|
|
|
39 |
* Always returns true
|
|
|
40 |
* @return bool Always returns true
|
|
|
41 |
*/
|
|
|
42 |
public function get_setting() {
|
|
|
43 |
return true;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
/**
|
|
|
47 |
* Always returns true
|
|
|
48 |
* @return bool Always returns true
|
|
|
49 |
*/
|
|
|
50 |
public function get_defaultsetting() {
|
|
|
51 |
return true;
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
/**
|
|
|
55 |
* Never write settings
|
|
|
56 |
* @return string Always returns an empty string
|
|
|
57 |
*/
|
|
|
58 |
public function write_setting($data) {
|
|
|
59 |
// Do not write any setting.
|
|
|
60 |
return '';
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
/**
|
|
|
64 |
* Returns an HTML string
|
|
|
65 |
* @return string Returns an HTML string
|
|
|
66 |
*/
|
|
|
67 |
public function output_html($data, $query = '') {
|
|
|
68 |
global $OUTPUT;
|
|
|
69 |
$registrationurl = new moodle_url('/mod/hvp/content_hub_registration.php');
|
|
|
70 |
if ($this->hubinfo === false) {
|
|
|
71 |
$this->hubinfo = (object) [];
|
|
|
72 |
}
|
|
|
73 |
$this->hubinfo->registrationurl = $registrationurl->out(false);
|
|
|
74 |
return $OUTPUT->render_from_template('mod_hvp/content_hub_registration_box', $this->hubinfo);
|
|
|
75 |
}
|
|
|
76 |
}
|