Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403] [Versions 39 and 310]
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 27 defined('MOODLE_INTERNAL') || die(); 28 29 use core_admin\local\settings\autocomplete; 30 31 if ($hassiteconfig) { 32 33 $ADMIN->add('root', new admin_category('mobileapp', new lang_string('mobileapp', 'tool_mobile')), 'development'); 34 35 $temp = new admin_settingpage('mobilesettings', new lang_string('mobilesettings', 'tool_mobile'), 'moodle/site:config', false); 36 37 // We should wait to the installation to finish since we depend on some configuration values that are set once 38 // the admin user profile is configured. 39 if (!during_initial_install()) { 40 $enablemobiledocurl = new moodle_url(get_docs_url('Enable_mobile_web_services')); 41 $enablemobiledoclink = html_writer::link($enablemobiledocurl, new lang_string('documentation')); 42 $default = is_https() ? 1 : 0; 43 $temp->add(new admin_setting_enablemobileservice('enablemobilewebservice', 44 new lang_string('enablemobilewebservice', 'admin'), 45 new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), $default)); 46 } 47 48 $temp->add(new admin_setting_configtext('tool_mobile/apppolicy', new lang_string('apppolicy', 'tool_mobile'), 49 new lang_string('apppolicy_help', 'tool_mobile'), '', PARAM_URL)); 50 51 $ADMIN->add('mobileapp', $temp); 52 53 $featuresnotice = null; 54 if (empty($CFG->disablemobileappsubscription)) { 55 // General notification about limited features due to app restrictions. 56 $subscriptionurl = (new moodle_url("/$CFG->admin/tool/mobile/subscription.php"))->out(false); 57 $notify = new \core\output\notification( 58 get_string('moodleappsportalfeatureswarning', 'tool_mobile', $subscriptionurl), 59 \core\output\notification::NOTIFY_WARNING); 60 $featuresnotice = $OUTPUT->render($notify); 61 } 62 63 $hideappsubscription = empty($CFG->enablemobilewebservice); 64 $hideappsubscription = $hideappsubscription || (isset($CFG->disablemobileappsubscription) && !empty($CFG->disablemobileappsubscription)); 65 66 $ADMIN->add( 67 'mobileapp', 68 new admin_externalpage( 69 'mobileappsubscription', 70 new lang_string('mobileappsubscription', 'tool_mobile'), 71 "$CFG->wwwroot/$CFG->admin/tool/mobile/subscription.php", 72 'moodle/site:config', 73 $hideappsubscription 74 ) 75 ); 76 77 // Type of login. 78 $temp = new admin_settingpage( 79 'mobileauthentication', 80 new lang_string('mobileauthentication', 'tool_mobile'), 81 'moodle/site:config', 82 empty($CFG->enablemobilewebservice) 83 ); 84 85 $temp->add(new admin_setting_heading('tool_mobile/moodleappsportalfeaturesauth', '', $featuresnotice)); 86 87 $options = array( 88 tool_mobile\api::LOGIN_VIA_APP => new lang_string('loginintheapp', 'tool_mobile'), 89 tool_mobile\api::LOGIN_VIA_BROWSER => new lang_string('logininthebrowser', 'tool_mobile'), 90 tool_mobile\api::LOGIN_VIA_EMBEDDED_BROWSER => new lang_string('loginintheembeddedbrowser', 'tool_mobile'), 91 ); 92 $temp->add(new admin_setting_configselect('tool_mobile/typeoflogin', 93 new lang_string('typeoflogin', 'tool_mobile'), 94 new lang_string('typeoflogin_desc', 'tool_mobile'), 1, $options)); 95 96 $options = [ 97 tool_mobile\api::QR_CODE_DISABLED => new lang_string('qrcodedisabled', 'tool_mobile'), 98 tool_mobile\api::QR_CODE_URL => new lang_string('qrcodetypeurl', 'tool_mobile'), 99 ]; 100 $qrcodetypedefault = tool_mobile\api::QR_CODE_URL; 101 102 if (is_https()) { // Allow QR login for https sites. 103 $options[tool_mobile\api::QR_CODE_LOGIN] = new lang_string('qrcodetypelogin', 'tool_mobile'); 104 $qrcodetypedefault = tool_mobile\api::QR_CODE_LOGIN; 105 } 106 107 $temp->add(new admin_setting_configselect('tool_mobile/qrcodetype', 108 new lang_string('qrcodetype', 'tool_mobile'), 109 new lang_string('qrcodetype_desc', 'tool_mobile'), $qrcodetypedefault, $options)); 110 111 $temp->add(new admin_setting_configtext('tool_mobile/forcedurlscheme', 112 new lang_string('forcedurlscheme_key', 'tool_mobile'), 113 new lang_string('forcedurlscheme', 'tool_mobile'), 'moodlemobile', PARAM_NOTAGS)); 114 115 $temp->add(new admin_setting_configtext('tool_mobile/minimumversion', 116 new lang_string('minimumversion_key', 'tool_mobile'), 117 new lang_string('minimumversion', 'tool_mobile'), '', PARAM_NOTAGS)); 118 119 $ADMIN->add('mobileapp', $temp); 120 121 // Appearance related settings. 122 $temp = new admin_settingpage( 123 'mobileappearance', 124 new lang_string('mobileappearance', 'tool_mobile'), 125 'moodle/site:config', 126 empty($CFG->enablemobilewebservice) 127 ); 128 129 if (!empty($featuresnotice)) { 130 $temp->add(new admin_setting_heading('tool_mobile/moodleappsportalfeaturesappearance', '', $featuresnotice)); 131 } 132 133 $temp->add(new admin_setting_configtext('mobilecssurl', new lang_string('mobilecssurl', 'tool_mobile'), 134 new lang_string('configmobilecssurl', 'tool_mobile'), '', PARAM_URL)); 135 136 // Reference to Branded Mobile App. 137 if (empty($CFG->disableserviceads_branded)) { 138 $temp->add(new admin_setting_description('moodlebrandedappreference', 139 new lang_string('moodlebrandedapp', 'admin'), 140 new lang_string('moodlebrandedappreference', 'admin') 141 )); 142 } 143 144 $temp->add(new admin_setting_heading('tool_mobile/smartappbanners', 145 new lang_string('smartappbanners', 'tool_mobile'), '')); 146 147 $temp->add(new admin_setting_configcheckbox('tool_mobile/enablesmartappbanners', 148 new lang_string('enablesmartappbanners', 'tool_mobile'), 149 new lang_string('enablesmartappbanners_desc', 'tool_mobile'), 0)); 150 151 $temp->add(new admin_setting_configtext('tool_mobile/iosappid', new lang_string('iosappid', 'tool_mobile'), 152 new lang_string('iosappid_desc', 'tool_mobile'), tool_mobile\api::DEFAULT_IOS_APP_ID, PARAM_ALPHANUM)); 153 154 $temp->add(new admin_setting_configtext('tool_mobile/androidappid', new lang_string('androidappid', 'tool_mobile'), 155 new lang_string('androidappid_desc', 'tool_mobile'), tool_mobile\api::DEFAULT_ANDROID_APP_ID, PARAM_NOTAGS)); 156 157 $temp->add(new admin_setting_configtext('tool_mobile/setuplink', new lang_string('setuplink', 'tool_mobile'), 158 new lang_string('setuplink_desc', 'tool_mobile'), 'https://download.moodle.org/mobile', PARAM_URL)); 159 160 $ADMIN->add('mobileapp', $temp); 161 162 // Features related settings. 163 $temp = new admin_settingpage( 164 'mobilefeatures', 165 new lang_string('mobilefeatures', 'tool_mobile'), 166 'moodle/site:config', 167 empty($CFG->enablemobilewebservice) 168 ); 169 170 if (!empty($featuresnotice)) { 171 $temp->add(new admin_setting_heading('tool_mobile/moodleappsportalfeatures', '', $featuresnotice)); 172 } 173 174 $temp->add(new admin_setting_heading('tool_mobile/logout', 175 new lang_string('logout'), '')); 176 177 $temp->add(new admin_setting_configcheckbox('tool_mobile/forcelogout', 178 new lang_string('forcelogout', 'tool_mobile'), 179 new lang_string('forcelogout_desc', 'tool_mobile'), 0)); 180 181 $temp->add(new admin_setting_heading('tool_mobile/features', 182 new lang_string('mobilefeatures', 'tool_mobile'), '')); 183 184 $options = tool_mobile\api::get_features_list(); 185 $temp->add(new admin_setting_configmultiselect('tool_mobile/disabledfeatures', 186 new lang_string('disabledfeatures', 'tool_mobile'), 187 new lang_string('disabledfeatures_desc', 'tool_mobile'), array(), $options)); 188 189 $temp->add(new admin_setting_configtextarea('tool_mobile/custommenuitems', 190 new lang_string('custommenuitems', 'tool_mobile'), 191 new lang_string('custommenuitems_desc', 'tool_mobile'), '', PARAM_RAW, '50', '10')); 192 193 // File type exclusionlist. 194 $choices = []; 195 foreach (core_filetypes::get_types() as $key => $info) { 196 $text = '.' . $key; 197 if (!empty($info['type'])) { 198 $text .= ' (' . $info['type'] . ')'; 199 } 200 $choices[$key] = $text; 201 } 202 203 $attributes = [ 204 'manageurl' => new \moodle_url('/admin/tool/filetypes/index.php'), 205 'managetext' => get_string('managefiletypes', 'tool_mobile'), 206 'multiple' => true, 207 'delimiter' => ',', 208 'placeholder' => get_string('filetypeexclusionlistplaceholder', 'tool_mobile') 209 ]; 210 $temp->add(new autocomplete('tool_mobile/filetypeexclusionlist', 211 new lang_string('filetypeexclusionlist', 'tool_mobile'), 212 new lang_string('filetypeexclusionlist_desc', 'tool_mobile'), array(), $choices, $attributes)); 213 214 $temp->add(new admin_setting_heading('tool_mobile/language', 215 new lang_string('language'), '')); 216 217 $temp->add(new admin_setting_configtextarea('tool_mobile/customlangstrings', 218 new lang_string('customlangstrings', 'tool_mobile'), 219 new lang_string('customlangstrings_desc', 'tool_mobile'), '', PARAM_RAW, '50', '10')); 220 221 $ADMIN->add('mobileapp', $temp); 222 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body