MDL-55059 tool_mobile: Support Smart App Banners for iOs

This commit is contained in:
Juan Leyva 2016-08-01 11:25:16 +02:00 committed by Dan Poltawski
parent 43cb92b4b0
commit 5c6daf139d
4 changed files with 25 additions and 1 deletions

View File

@ -23,11 +23,16 @@
*/
$string['clickheretolaunchtheapp'] = 'Click here if the app does not open automatically.';
$string['enablesmartappbanners'] = 'Enable Smart App Banners';
$string['enablesmartappbanners_desc'] = 'This will display a banner promoting the Moodle Mobile app when visiting the site in Mobile Safari.';
$string['forcedurlscheme'] = 'The URL scheme allows to open the mobile app from other apps like the browser. Use this setting if you want to allow only your custom branded app to be opened by the browser.';
$string['forcedurlscheme_key'] = 'URL scheme';
$string['iosappid'] = 'App\'s unique identifier';
$string['iosappid_desc'] = 'You only need to change this value if you have a custom iOS app';
$string['loginintheapp'] = 'Via the app';
$string['logininthebrowser'] = 'Via a browser window (for SSO plugins)';
$string['loginintheembeddedbrowser'] = 'Via an embedded browser (for SSO plugins)';
$string['pluginname'] = 'Moodle Mobile tools';
$string['smartappbanners'] = 'Smart App Banners (iOS only)';
$string['typeoflogin'] = 'Type of login';
$string['typeoflogin_desc'] = 'Choose the type of login.';

View File

@ -58,5 +58,15 @@ if ($hassiteconfig) {
new lang_string('forcedurlscheme_key', 'tool_mobile'),
new lang_string('forcedurlscheme', 'tool_mobile'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_heading('tool_mobile/smartappbanners',
new lang_string('smartappbanners', 'tool_mobile'), ''));
$temp->add(new admin_setting_configcheckbox('tool_mobile/enablesmartappbanners',
new lang_string('enablesmartappbanners', 'tool_mobile'),
new lang_string('enablesmartappbanners_desc', 'tool_mobile'), 0));
$temp->add(new admin_setting_configtext('tool_mobile/iosappid', new lang_string('iosappid', 'tool_mobile'),
new lang_string('iosappid_desc', 'tool_mobile'), '633359593', PARAM_ALPHANUM));
$ADMIN->add('webservicesettings', $temp);
}

View File

@ -23,6 +23,6 @@
*/
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016052302; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2016052303; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2016051900; // Requires this Moodle version.
$plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics).

View File

@ -540,6 +540,15 @@ class core_renderer extends renderer_base {
$output .= '<meta http-equiv="refresh" content="'.$this->page->periodicrefreshdelay.';url='.$this->page->url->out().'" />';
}
// Smart App Banners meta tag is only displayed if mobile services are enabled and configured.
if ($CFG->enablemobilewebservice) {
$mobilesettings = get_config('tool_mobile');
if ($mobilesettings->enablesmartappbanners and $mobilesettings->iosappid) {
$output .= '<meta name="apple-itunes-app" content="app-id=' . s($mobilesettings->iosappid) . ', ';
$output .= 'app-argument=' . $this->page->url->out() . '"/>';
}
}
// flow player embedding support
$this->page->requires->js_function_call('M.util.load_flowplayer');