Merge branch 'MDL-60774-master' of git://github.com/jleyva/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2018-04-10 00:02:49 +02:00
commit 90ce448189
3 changed files with 30 additions and 2 deletions

View file

@ -90,6 +90,25 @@ class api {
require("$path/db/mobile.php"); require("$path/db/mobile.php");
foreach ($addons as $addonname => $addoninfo) { foreach ($addons as $addonname => $addoninfo) {
// Add handlers (for site add-ons).
$handlers = !empty($addoninfo['handlers']) ? $addoninfo['handlers'] : array();
$handlers = json_encode($handlers); // JSON formatted, since it is a complex structure that may vary over time.
// Now language strings used by the app.
$lang = array();
if (!empty($addoninfo['lang'])) {
$stringmanager = get_string_manager();
$langs = $stringmanager->get_list_of_translations();
foreach ($langs as $langid => $langname) {
foreach ($addoninfo['lang'] as $stringinfo) {
$lang[$langid][$stringinfo[0]] =
$stringmanager->get_string($stringinfo[0], $stringinfo[1], null, $langid);
}
}
}
$lang = json_encode($lang);
$plugininfo = array( $plugininfo = array(
'component' => $component, 'component' => $component,
'version' => $version, 'version' => $version,
@ -97,7 +116,9 @@ class api {
'dependencies' => !empty($addoninfo['dependencies']) ? $addoninfo['dependencies'] : array(), 'dependencies' => !empty($addoninfo['dependencies']) ? $addoninfo['dependencies'] : array(),
'fileurl' => '', 'fileurl' => '',
'filehash' => '', 'filehash' => '',
'filesize' => 0 'filesize' => 0,
'handlers' => $handlers,
'lang' => $lang,
); );
// All the mobile packages must be under the plugin mobile directory. // All the mobile packages must be under the plugin mobile directory.

View file

@ -91,7 +91,9 @@ class external extends external_api {
'fileurl' => new external_value(PARAM_URL, 'The addon package url for download 'fileurl' => new external_value(PARAM_URL, 'The addon package url for download
or empty if it doesn\'t exist.'), or empty if it doesn\'t exist.'),
'filehash' => new external_value(PARAM_RAW, 'The addon package hash or empty if it doesn\'t exist.'), 'filehash' => new external_value(PARAM_RAW, 'The addon package hash or empty if it doesn\'t exist.'),
'filesize' => new external_value(PARAM_INT, 'The addon package size or empty if it doesn\'t exist.') 'filesize' => new external_value(PARAM_INT, 'The addon package size or empty if it doesn\'t exist.'),
'handlers' => new external_value(PARAM_RAW, 'Handlers definition (JSON)', VALUE_OPTIONAL),
'lang' => new external_value(PARAM_RAW, 'Language strings used by the handlers (JSON)', VALUE_OPTIONAL),
) )
) )
), ),

View file

@ -1,6 +1,11 @@
This files describes changes in tool_mobile code. This files describes changes in tool_mobile code.
Information provided here is intended especially for developers. Information provided here is intended especially for developers.
=== 3.5 ===
* External function tool_mobile::tool_mobile_get_plugins_supporting_mobile now returns additional plugins information required by
Moodle Mobile 3.5.0.
=== 3.4 === === 3.4 ===
* External function tool_mobile::tool_mobile_get_plugins_supporting_mobile is now available via AJAX for not logged users. * External function tool_mobile::tool_mobile_get_plugins_supporting_mobile is now available via AJAX for not logged users.