MDL-67767 tool_mobile: Allow using more characters in forcedurlscheme
[moodle.git] / admin / tool / mobile / settings.php
CommitLineData
8a0a7414
JL
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 * Settings
19 *
20 * This file contains settings used by tool_mobile
21 *
22 * @package tool_mobile
23 * @copyright 2016 Juan Leyva
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 */
26
27defined('MOODLE_INTERNAL') || die();
28
29if ($hassiteconfig) {
30
0c6c8664
JL
31 $ADMIN->add('root', new admin_category('mobileapp', new lang_string('mobileapp', 'tool_mobile')), 'development');
32
33 $temp = new admin_settingpage('mobilesettings', new lang_string('mobilesettings', 'tool_mobile'), 'moodle/site:config', false);
8a0a7414
JL
34
35 // We should wait to the installation to finish since we depend on some configuration values that are set once
36 // the admin user profile is configured.
37 if (!during_initial_install()) {
38 $enablemobiledocurl = new moodle_url(get_docs_url('Enable_mobile_web_services'));
39 $enablemobiledoclink = html_writer::link($enablemobiledocurl, new lang_string('documentation'));
40 $default = is_https() ? 1 : 0;
41 $temp->add(new admin_setting_enablemobileservice('enablemobilewebservice',
42 new lang_string('enablemobilewebservice', 'admin'),
43 new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), $default));
44 }
45
acee8311
JL
46 $temp->add(new admin_setting_configtext('tool_mobile/apppolicy', new lang_string('apppolicy', 'tool_mobile'),
47 new lang_string('apppolicy_help', 'tool_mobile'), '', PARAM_URL));
48
0c6c8664
JL
49 $ADMIN->add('mobileapp', $temp);
50
51 // Show only mobile settings if the mobile service is enabled.
52 if (!empty($CFG->enablemobilewebservice)) {
53 // Type of login.
54 $temp = new admin_settingpage('mobileauthentication', new lang_string('mobileauthentication', 'tool_mobile'));
55 $options = array(
56 tool_mobile\api::LOGIN_VIA_APP => new lang_string('loginintheapp', 'tool_mobile'),
57 tool_mobile\api::LOGIN_VIA_BROWSER => new lang_string('logininthebrowser', 'tool_mobile'),
58 tool_mobile\api::LOGIN_VIA_EMBEDDED_BROWSER => new lang_string('loginintheembeddedbrowser', 'tool_mobile'),
59 );
60 $temp->add(new admin_setting_configselect('tool_mobile/typeoflogin',
61 new lang_string('typeoflogin', 'tool_mobile'),
62 new lang_string('typeoflogin_desc', 'tool_mobile'), 1, $options));
63
64 $temp->add(new admin_setting_configtext('tool_mobile/forcedurlscheme',
65 new lang_string('forcedurlscheme_key', 'tool_mobile'),
12da324f 66 new lang_string('forcedurlscheme', 'tool_mobile'), 'moodlemobile', PARAM_NOTAGS));
c951f1fe 67
4bf08f5b
JL
68 $temp->add(new admin_setting_configtext('tool_mobile/minimumversion',
69 new lang_string('minimumversion_key', 'tool_mobile'),
70 new lang_string('minimumversion', 'tool_mobile'), '', PARAM_NOTAGS));
71
0c6c8664 72 $ADMIN->add('mobileapp', $temp);
c951f1fe 73
0c6c8664
JL
74 // Appearance related settings.
75 $temp = new admin_settingpage('mobileappearance', new lang_string('mobileappearance', 'tool_mobile'));
c951f1fe 76
0c6c8664
JL
77 $temp->add(new admin_setting_configtext('mobilecssurl', new lang_string('mobilecssurl', 'tool_mobile'),
78 new lang_string('configmobilecssurl', 'tool_mobile'), '', PARAM_URL));
5c6daf13 79
f765fb38
AA
80 // Reference to Branded Mobile App.
81 if (empty($CFG->disableserviceads_branded)) {
82 $temp->add(new admin_setting_description('moodlebrandedappreference',
83 new lang_string('moodlebrandedapp', 'admin'),
84 new lang_string('moodlebrandedappreference', 'admin')
85 ));
86 }
87
0c6c8664
JL
88 $temp->add(new admin_setting_heading('tool_mobile/smartappbanners',
89 new lang_string('smartappbanners', 'tool_mobile'), ''));
5c6daf13 90
0c6c8664
JL
91 $temp->add(new admin_setting_configcheckbox('tool_mobile/enablesmartappbanners',
92 new lang_string('enablesmartappbanners', 'tool_mobile'),
93 new lang_string('enablesmartappbanners_desc', 'tool_mobile'), 0));
5c6daf13 94
0c6c8664
JL
95 $temp->add(new admin_setting_configtext('tool_mobile/iosappid', new lang_string('iosappid', 'tool_mobile'),
96 new lang_string('iosappid_desc', 'tool_mobile'), '633359593', PARAM_ALPHANUM));
97
e8eb8893
JL
98 $temp->add(new admin_setting_configtext('tool_mobile/androidappid', new lang_string('androidappid', 'tool_mobile'),
99 new lang_string('androidappid_desc', 'tool_mobile'), 'com.moodle.moodlemobile', PARAM_NOTAGS));
100
6dfb4ff2
SL
101 $temp->add(new admin_setting_configtext('tool_mobile/setuplink', new lang_string('setuplink', 'tool_mobile'),
102 new lang_string('setuplink_desc', 'tool_mobile'), 'https://download.moodle.org/mobile', PARAM_URL));
103
0c6c8664 104 $ADMIN->add('mobileapp', $temp);
fb0add04
JL
105
106 // Features related settings.
107 $temp = new admin_settingpage('mobilefeatures', new lang_string('mobilefeatures', 'tool_mobile'));
108
109 $temp->add(new admin_setting_heading('tool_mobile/logout',
110 new lang_string('logout'), ''));
111
112 $temp->add(new admin_setting_configcheckbox('tool_mobile/forcelogout',
113 new lang_string('forcelogout', 'tool_mobile'),
114 new lang_string('forcelogout_desc', 'tool_mobile'), 0));
115
b2551b4c
JL
116 $temp->add(new admin_setting_heading('tool_mobile/features',
117 new lang_string('mobilefeatures', 'tool_mobile'), ''));
118
119 $options = tool_mobile\api::get_features_list();
120 $temp->add(new admin_setting_configmultiselect('tool_mobile/disabledfeatures',
121 new lang_string('disabledfeatures', 'tool_mobile'),
122 new lang_string('disabledfeatures_desc', 'tool_mobile'), array(), $options));
123
63d142e2
JL
124 $temp->add(new admin_setting_configtextarea('tool_mobile/custommenuitems',
125 new lang_string('custommenuitems', 'tool_mobile'),
126 new lang_string('custommenuitems_desc', 'tool_mobile'), '', PARAM_RAW, '50', '10'));
127
af1b6043
JL
128 $temp->add(new admin_setting_heading('tool_mobile/language',
129 new lang_string('language'), ''));
130
131 $temp->add(new admin_setting_configtextarea('tool_mobile/customlangstrings',
132 new lang_string('customlangstrings', 'tool_mobile'),
bae88061 133 new lang_string('customlangstrings_desc', 'tool_mobile'), '', PARAM_RAW, '50', '10'));
af1b6043 134
fb0add04 135 $ADMIN->add('mobileapp', $temp);
0c6c8664 136 }
8a0a7414 137}