From 63d142e2cdd3d40cc5f6512542bd094558fe2cf5 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Wed, 11 Jan 2017 15:04:58 +0100 Subject: [PATCH] MDL-57410 tool_mobile: New setting for adding menu items in the app --- admin/tool/mobile/classes/api.php | 1 + admin/tool/mobile/lang/en/tool_mobile.php | 9 +++++++++ admin/tool/mobile/settings.php | 4 ++++ admin/tool/mobile/tests/externallib_test.php | 1 + admin/tool/mobile/version.php | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/admin/tool/mobile/classes/api.php b/admin/tool/mobile/classes/api.php index dee797a8502..5e5836b07db 100644 --- a/admin/tool/mobile/classes/api.php +++ b/admin/tool/mobile/classes/api.php @@ -210,6 +210,7 @@ class api { $settings->tool_mobile_forcelogout = get_config('tool_mobile', 'forcelogout'); $settings->tool_mobile_customlangstrings = get_config('tool_mobile', 'customlangstrings'); $settings->tool_mobile_disabledfeatures = get_config('tool_mobile', 'disabledfeatures'); + $settings->tool_mobile_custommenuitems = get_config('tool_mobile', 'custommenuitems'); } return $settings; diff --git a/admin/tool/mobile/lang/en/tool_mobile.php b/admin/tool/mobile/lang/en/tool_mobile.php index fca608f8155..40b198598ea 100644 --- a/admin/tool/mobile/lang/en/tool_mobile.php +++ b/admin/tool/mobile/lang/en/tool_mobile.php @@ -33,6 +33,15 @@ mm.user.student|Learner|en mm.user.student|Aprendiz|es For a complete list of string identifiers and more information, see the documentation page.'; +$string['custommenuitems'] = 'Custom menu items'; +$string['custommenuitems_desc'] = 'Additional items can be added to the app\'s main menu by specifying them here. Enter each custom menu item on a new line with format: item text, link URL, link-opening method (inappbrowser, browser or embedded) and language code (optional, for displaying the item to users of the specified language only), separated by pipe characters. For example: +
+App\'s help | https://someurl.xyz/help | inappbrowser | en
+Visit our SIS | https://someurl.xyz | browser | en
+My grades | https://someurl.xyz/local/mygrades/index.php | embedded | en
+Mis calificaciones | https://someurl.xyz/local/mygrades/index.php | embedded | es
+
+Use inappbrowser when you want to open the link in a browser without leaving the app, use browser for opening the link in the device default browser and embedded if you want to display the link embedded in a new page in the app.'; $string['disabledfeatures'] = 'Disabled features'; $string['disabledfeatures_desc'] = 'Select here the features you want to disable in the Mobile app for your site. Please note that some features listed here could be already disabled via other site settings. You will have to log out and log in again in the app to see the changes.'; $string['enablesmartappbanners'] = 'Enable Smart App Banners'; diff --git a/admin/tool/mobile/settings.php b/admin/tool/mobile/settings.php index c55e3682a46..11e3c98bcbd 100644 --- a/admin/tool/mobile/settings.php +++ b/admin/tool/mobile/settings.php @@ -100,6 +100,10 @@ if ($hassiteconfig) { new lang_string('disabledfeatures', 'tool_mobile'), new lang_string('disabledfeatures_desc', 'tool_mobile'), array(), $options)); + $temp->add(new admin_setting_configtextarea('tool_mobile/custommenuitems', + new lang_string('custommenuitems', 'tool_mobile'), + new lang_string('custommenuitems_desc', 'tool_mobile'), '', PARAM_RAW, '50', '10')); + $temp->add(new admin_setting_heading('tool_mobile/language', new lang_string('language'), '')); diff --git a/admin/tool/mobile/tests/externallib_test.php b/admin/tool/mobile/tests/externallib_test.php index d8e6aa48c87..6cf0f49a141 100644 --- a/admin/tool/mobile/tests/externallib_test.php +++ b/admin/tool/mobile/tests/externallib_test.php @@ -148,6 +148,7 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase { array('name' => 'tool_mobile_forcelogout', 'value' => 0), array('name' => 'tool_mobile_customlangstrings', 'value' => ''), array('name' => 'tool_mobile_disabledfeatures', 'value' => ''), + array('name' => 'tool_mobile_custommenuitems', 'value' => ''), ); $this->assertCount(0, $result['warnings']); $this->assertEquals($expected, $result['settings']); diff --git a/admin/tool/mobile/version.php b/admin/tool/mobile/version.php index 5fdb190a2c6..c83e26ade4f 100644 --- a/admin/tool/mobile/version.php +++ b/admin/tool/mobile/version.php @@ -23,7 +23,7 @@ */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2016120503; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2016120504; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2016112900; // Requires this Moodle version. $plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics). $plugin->dependencies = array(