Merge branch 'MDL-57162-master' of git://github.com/jleyva/moodle
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['androidappid'] = 'Android app\'s unique identifier';
|
||||
$string['androidappid_desc'] = 'This setting may be left as default unless you have a custom Android app.';
|
||||
$string['autologinkeygenerationlockout'] = 'Auto-login key generation is blocked because of too many requests within an hour.';
|
||||
$string['autologinnotallowedtoadmins'] = 'Auto-login is not allowed for site admins.';
|
||||
$string['clickheretolaunchtheapp'] = 'Click here if the app does not open automatically.';
|
||||
@@ -44,15 +46,15 @@ Mis calificaciones | https://someurl.xyz/local/mygrades/index.php | embedded | e
|
||||
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';
|
||||
$string['enablesmartappbanners_desc'] = 'This will display a banner promoting the Moodle Mobile app when visiting the site in Mobile Safari.';
|
||||
$string['enablesmartappbanners'] = 'Enable App Banners';
|
||||
$string['enablesmartappbanners_desc'] = 'This will display a banner promoting the Moodle Mobile app when visiting the site in a Mobile browser.';
|
||||
$string['forcedurlscheme'] = 'If you want to allow only your custom branded app to be opened via a browser window, then specify its URL scheme here; otherwise leave the field empty.';
|
||||
$string['forcedurlscheme_key'] = 'URL scheme';
|
||||
$string['forcelogout'] = 'Force log out';
|
||||
$string['forcelogout_desc'] = 'If enabled, the app option \'Change site\' is replaced by \'Log out\'. This results in the user being completely logged out. They must then re-enter their password the next time they wish to access the site.';
|
||||
$string['httpsrequired'] = 'HTTPS required';
|
||||
$string['invalidprivatetoken'] = 'Invalid private token. Token should not be empty or passed via GET parameter.';
|
||||
$string['iosappid'] = 'App\'s unique identifier';
|
||||
$string['iosappid'] = 'iOS app\'s unique identifier';
|
||||
$string['iosappid_desc'] = 'This setting may be left as default unless you have a custom iOS app.';
|
||||
$string['loginintheapp'] = 'Via the app';
|
||||
$string['logininthebrowser'] = 'Via a browser window (for SSO plugins)';
|
||||
@@ -65,7 +67,7 @@ $string['mobilecssurl'] = 'CSS';
|
||||
$string['mobilefeatures'] = 'Mobile features';
|
||||
$string['mobilesettings'] = 'Mobile settings';
|
||||
$string['pluginname'] = 'Moodle Mobile tools';
|
||||
$string['smartappbanners'] = 'Smart App Banners (iOS only)';
|
||||
$string['smartappbanners'] = 'App Banners';
|
||||
$string['pluginnotenabledorconfigured'] = 'Plugin not enabled or configured.';
|
||||
$string['remoteaddons'] = 'Remote add-ons';
|
||||
$string['typeoflogin'] = 'Type of login';
|
||||
|
||||
@@ -36,9 +36,16 @@ function tool_mobile_before_standard_html_head() {
|
||||
// Smart App Banners meta tag is only displayed if mobile services are enabled and configured.
|
||||
if (!empty($CFG->enablemobilewebservice)) {
|
||||
$mobilesettings = get_config('tool_mobile');
|
||||
if (!empty($mobilesettings->enablesmartappbanners) and !empty($mobilesettings->iosappid)) {
|
||||
$output .= '<meta name="apple-itunes-app" content="app-id=' . s($mobilesettings->iosappid) . ', ';
|
||||
$output .= 'app-argument=' . $PAGE->url->out() . '"/>';
|
||||
if (!empty($mobilesettings->enablesmartappbanners)) {
|
||||
if (!empty($mobilesettings->iosappid)) {
|
||||
$output .= '<meta name="apple-itunes-app" content="app-id=' . s($mobilesettings->iosappid) . ', ';
|
||||
$output .= 'app-argument=' . $PAGE->url->out() . '"/>';
|
||||
}
|
||||
|
||||
if (!empty($mobilesettings->androidappid)) {
|
||||
$mobilemanifesturl = "$CFG->wwwroot/$CFG->admin/tool/mobile/mobile.webmanifest.php";
|
||||
$output .= '<link rel="manifest" href="'.$mobilemanifesturl.'" />';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Web manifest for including a native app banner.
|
||||
*
|
||||
* The banner is only displayed if the user has visited the site twice over two separate days during the course of two weeks.
|
||||
* More information here: https://developer.android.com/distribute/users/banners.html
|
||||
*
|
||||
* @package tool_mobile
|
||||
* @copyright 2017 Juan Leyva
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('NO_DEBUG_DISPLAY', true);
|
||||
define('NO_MOODLE_COOKIES', true);
|
||||
|
||||
require_once(__DIR__ . '/../../../config.php');
|
||||
use tool_mobile\api;
|
||||
|
||||
header('Content-Type: application/json; charset: utf-8');
|
||||
|
||||
$mobilesettings = get_config('tool_mobile');
|
||||
// Display manifest contents only if all the required conditions are met.
|
||||
if (!empty($CFG->enablemobilewebservice) && !empty($mobilesettings->enablesmartappbanners) &&
|
||||
!empty($mobilesettings->androidappid)) {
|
||||
|
||||
$manifest = new StdClass;
|
||||
$manifest->short_name = format_string($SITE->shortname);
|
||||
$manifest->prefer_related_applications = true;
|
||||
$manifest->icons = [(object)
|
||||
[
|
||||
'sizes' => '144x144',
|
||||
'type' => 'image/png',
|
||||
'src' => "$CFG->wwwroot/$CFG->admin/tool/mobile/pix/icon_144.png"
|
||||
]
|
||||
];
|
||||
$manifest->related_applications = [(object)
|
||||
[
|
||||
'platform' => 'play',
|
||||
'id' => $mobilesettings->androidappid,
|
||||
]
|
||||
];
|
||||
echo json_encode($manifest);
|
||||
}
|
||||
die;
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -80,6 +80,9 @@ if ($hassiteconfig) {
|
||||
$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));
|
||||
|
||||
$temp->add(new admin_setting_configtext('tool_mobile/androidappid', new lang_string('androidappid', 'tool_mobile'),
|
||||
new lang_string('androidappid_desc', 'tool_mobile'), 'com.moodle.moodlemobile', PARAM_NOTAGS));
|
||||
|
||||
$ADMIN->add('mobileapp', $temp);
|
||||
|
||||
// Features related settings.
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
$plugin->version = 2016120504; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2016120505; // 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(
|
||||
|
||||
Reference in New Issue
Block a user