MDL-68294 tool_mobile: Fix custom strings and limits calculation

This commit is contained in:
Juan Leyva 2020-05-19 11:54:53 +02:00 committed by Sara Arjona
parent fec9e9cce5
commit 82d5547b8f
2 changed files with 23 additions and 3 deletions

View File

@ -115,13 +115,33 @@ class subscription implements \renderable, \templatable {
break;
// Check menu items.
case 'custommenuitems':
$custommenuitems = [];
$els = rtrim($ms->custommenuitems, "\n");
$feature['status'] = empty($ms->custommenuitems) ? 0 : count(explode("\n", $els));
if (!empty($els)) {
$custommenuitems = explode("\n", $els);
// Get unique custom menu urls.
$custommenuitems = array_flip(
array_map(function($val) {
return explode('|', $val)[1];
}, $custommenuitems)
);
}
$feature['status'] = count($custommenuitems);
break;
// Check language strings.
case 'customlanguagestrings':
$langstrings = [];
$els = rtrim($ms->customlangstrings, "\n");
$feature['status'] = empty($ms->customlangstrings) ? 0 : count(explode("\n", $els));
if (!empty($els)) {
$langstrings = explode("\n", $els);
// Get unique language string ids.
$langstrings = array_flip(
array_map(function($val) {
return explode('|', $val)[0];
}, $langstrings)
);
}
$feature['status'] = count($langstrings);
break;
// Check disabled features strings.
case 'disabledfeatures':

View File

@ -98,7 +98,7 @@ $string['notifications'] = 'Notifications';
$string['notificationsactivedevices'] = 'Active devices';
$string['notificationsignorednotifications'] = 'Notifications not sent';
$string['notificationslimitreached'] = 'The monthly active user devices limit has been exceeded. Notifications for some users will not be sent. It is recommended that you upgrade your app plan in the <a href="{$a}" target="_blank">Moodle Apps Portal</a>.';
$string['notificationsmissingwarning'] = 'Moodle app notification statistics could not be retrieved. This is most likely because mobile notifications are not yet enabled on the site. You can enable them in Site Administration / Notifications / Mobile.';
$string['notificationsmissingwarning'] = 'Moodle app notification statistics could not be retrieved. This is most likely because mobile notifications are not yet enabled on the site. You can enable them in Site Administration / Messaging / Mobile.';
$string['notificationsnewdevices'] = 'New devices';
$string['notificationsseemore'] = 'Note: Moodle app usage statistics are not calculated in real time. To access more detailed statistics, including data from previous months, please log in to the <a href="{$a}" target="_blank">Moodle Apps Portal</a>.';
$string['notificationssentnotifications'] = 'Notifications sent';