-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
87 lines (67 loc) · 3.54 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Config settings
*
* @package local
* @subpackage snapp
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Config settings used in snapp,
* Should be saved in config_plugins table under local_snapp.
*
* Links to admin external pages used to manage plugin (local/snapp:administer capability)
*/
defined('MOODLE_INTERNAL') || die;
if ($hassiteconfig) {//Stops errors when tree not available, but still allows external pages to work
require_once(dirname(__FILE__).'/settingslib.php');
//SNAPP tree
$ADMIN->add('localplugins', new admin_category('local_snapp', get_string('socialnetworkapps', 'local_snapp')));
//Config page
$configpage = new admin_settingpage('local_snapp_config', get_string('configsettings', 'local_snapp'));
//DEFINE PLUGIN CONFIG SETTINGS HERE
//enabled: determines if feature is turned 'on' or not.
$enabled = new admin_setting_configcheckbox('enabled', get_string('snapp_admin_enabled', 'local_snapp'),
get_string('snapp_admin_enabled_desc', 'local_snapp'), 0);
$enabled->plugin = 'local_snapp';
$configpage->add($enabled);
//accesskey: Security salt used in token generation etc
$accesskey = new admin_setting_configtext('accesskey', get_string('snapp_admin_accesskey', 'local_snapp'),
get_string('snapp_admin_accesskey_desc', 'local_snapp'), '');
$accesskey->plugin = 'local_snapp';
$configpage->add($accesskey);
//secretkey: Secret key used for hash token generation
$secretkey = new admin_setting_configtext('secretkey', get_string('snapp_admin_secretkey', 'local_snapp'),
get_string('snapp_admin_secretkey_desc', 'local_snapp'), '');
$secretkey->plugin = 'local_snapp';
$configpage->add($secretkey);
$wsuser = new local_snapp_configselect('wsuser', get_string('snapp_admin_wsuser', 'local_snapp'),
get_string('snapp_admin_wsuser_desc', 'local_snapp'), 0, null);
$wsuser->plugin = 'local_snapp';
$configpage->add($wsuser);
$anycert = new admin_setting_configcheckbox('anycert', get_string('snapp_admin_anycert', 'local_snapp'),
get_string('snapp_admin_anycert_desc', 'local_snapp'), 0);
$anycert->plugin = 'local_snapp';
$configpage->add($anycert);
$ADMIN->add('local_snapp', $configpage);
//External pages (non config settings e.g. data management) should use local/snapp:administer capability
$ADMIN->add('local_snapp', new admin_externalpage('snapp_manage', get_string('managepage', 'local_snapp'),
$CFG->wwwroot.'/local/snapp/admin_auth.php', 'local/snapp:administer'));
$ADMIN->add('local_snapp', new admin_externalpage('snapp_manageusers', get_string('manageuserspage', 'local_snapp'),
$CFG->wwwroot.'/local/snapp/admin_users.php', 'local/snapp:vieweditusermapping'));
}