diff --git a/public/admin/tool/mobile/classes/api.php b/public/admin/tool/mobile/classes/api.php index 5f380d6725104..27e24653df074 100644 --- a/public/admin/tool/mobile/classes/api.php +++ b/public/admin/tool/mobile/classes/api.php @@ -95,7 +95,7 @@ public static function get_plugins_supporting_mobile() { $pluginsinfo = []; // For not logged users return only auth plugins. - // This is to avoid anyone (not being a registered user) to obtain and download all the site remote add-ons. + // This is to prevent anyone (not being a registered user) from obtaining and downloading all the site plugins. if (!isloggedin()) { $plugintypes = array('auth' => $CFG->dirroot.'/auth'); } else { @@ -114,11 +114,11 @@ public static function get_plugins_supporting_mobile() { foreach ($addons as $addonname => $addoninfo) { // Add handlers (for site add-ons). - $handlers = !empty($addoninfo['handlers']) ? $addoninfo['handlers'] : array(); + $handlers = !empty($addoninfo['handlers']) ? $addoninfo['handlers'] : []; $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(); + $lang = []; if (!empty($addoninfo['lang'])) { $stringmanager = get_string_manager(); $langs = $stringmanager->get_list_of_translations(true); @@ -139,7 +139,7 @@ public static function get_plugins_supporting_mobile() { 'component' => $component, 'version' => $version, 'addon' => $addonname, - 'dependencies' => !empty($addoninfo['dependencies']) ? $addoninfo['dependencies'] : array(), + 'dependencies' => !empty($addoninfo['dependencies']) ? $addoninfo['dependencies'] : [], 'fileurl' => '', 'filehash' => '', 'filesize' => 0, @@ -504,34 +504,39 @@ public static function get_features_list() { $useraccount = new lang_string('useraccount'); $participants = new lang_string('participants'); $files = new lang_string('files'); - $remoteaddons = new lang_string('remoteaddons', 'tool_mobile'); + $siteplugins = new lang_string('siteplugins', 'tool_mobile'); $identityproviders = new lang_string('oauth2identityproviders', 'tool_mobile'); $availablemods = core_plugin_manager::instance()->get_plugins_of_type('mod'); - $coursemodules = array(); - $appsupportedmodules = array( + $coursemodules = []; + $appsupportedmodules = [ 'assign', 'bigbluebuttonbn', 'book', 'choice', 'data', 'feedback', 'folder', 'forum', 'glossary', 'h5pactivity', - 'imscp', 'label', 'lesson', 'lti', 'page', 'quiz', 'resource', 'scorm', 'url', 'wiki', 'workshop'); + 'imscp', 'label', 'lesson', 'lti', 'page', 'quiz', 'resource', 'scorm', 'url', 'wiki', 'workshop']; foreach ($availablemods as $mod) { if (in_array($mod->name, $appsupportedmodules)) { - $coursemodules['$mmCourseDelegate_mmaMod' . ucfirst($mod->name)] = $mod->displayname; + $modfeaturename = ucfirst($mod->name); + if ($mod->name === 'bigbluebuttonbn') { + $modfeaturename = 'BBB'; + } else if ($mod->name === 'h5pactivity') { + $modfeaturename = 'H5PActivity'; + } + $coursemodules['CoreCourseModuleDelegate_AddonMod' . $modfeaturename] = $mod->displayname; } } asort($coursemodules); - $remoteaddonslist = array(); + $sitepluginslist = []; $mobileplugins = self::get_plugins_supporting_mobile(); foreach ($mobileplugins as $plugin) { $displayname = core_plugin_manager::instance()->plugin_name($plugin['component']) . " - " . $plugin['addon']; - $remoteaddonslist['sitePlugin_' . $plugin['component'] . '_' . $plugin['addon']] = $displayname; - + $sitepluginslist['sitePlugin_' . $plugin['component'] . '_' . $plugin['addon']] = $displayname; } // Display blocks. $availableblocks = core_plugin_manager::instance()->get_plugins_of_type('block'); - $courseblocks = array(); - $appsupportedblocks = array( + $courseblocks = []; + $appsupportedblocks = [ 'activity_results' => 'CoreBlockDelegate_AddonBlockActivityResults', 'site_main_menu' => 'CoreBlockDelegate_AddonBlockSiteMainMenu', 'myoverview' => 'CoreBlockDelegate_AddonBlockMyOverview', @@ -561,7 +566,7 @@ public static function get_features_list() { 'search_forums' => 'CoreBlockDelegate_AddonBlockSearchForums', 'selfcompletion' => 'CoreBlockDelegate_AddonBlockSelfCompletion', 'tags' => 'CoreBlockDelegate_AddonBlockTags', - ); + ]; foreach ($availableblocks as $block) { if (isset($appsupportedblocks[$block->name])) { @@ -570,14 +575,14 @@ public static function get_features_list() { } asort($courseblocks); - $features = array( - "$general" => array( + $features = [ + "$general" => [ 'NoDelegate_CoreOffline' => new lang_string('offlineuse', 'tool_mobile'), 'NoDelegate_SiteBlocks' => new lang_string('blocks'), 'NoDelegate_CoreComments' => new lang_string('comments'), 'NoDelegate_CoreRating' => new lang_string('ratings', 'rating'), 'NoDelegate_CoreTag' => new lang_string('tags'), - '$mmLoginEmailSignup' => new lang_string('startsignup'), + 'CoreLoginEmailSignup' => new lang_string('startsignup'), 'NoDelegate_ForgottenPassword' => new lang_string('forgotten'), 'NoDelegate_ResponsiveMainMenuItems' => new lang_string('responsivemainmenuitems', 'tool_mobile'), 'NoDelegate_H5POffline' => new lang_string('h5poffline', 'tool_mobile'), @@ -586,62 +591,62 @@ public static function get_features_list() { 'CoreReportBuilderDelegate' => new lang_string('reportbuilder', 'core_reportbuilder'), 'NoDelegate_CoreUserSupport' => new lang_string('contactsitesupport', 'admin'), 'NoDelegate_GlobalSearch' => new lang_string('globalsearch', 'search'), - ), - "$mainmenu" => array( - '$mmSideMenuDelegate_mmaFrontpage' => new lang_string('sitehome'), + ], + "$mainmenu" => [ + 'CoreMainMenuDelegate_CoreSiteHome' => new lang_string('sitehome'), 'CoreMainMenuDelegate_CoreCoursesDashboard' => new lang_string('myhome'), - '$mmSideMenuDelegate_mmCourses' => new lang_string('mycourses'), - '$mmSideMenuDelegate_mmaMessages' => new lang_string('messages', 'message'), - '$mmSideMenuDelegate_mmaNotifications' => new lang_string('notifications', 'message'), - '$mmSideMenuDelegate_mmaCalendar' => new lang_string('calendar', 'calendar'), + 'CoreMainMenuDelegate_CoreCourses' => new lang_string('mycourses'), + 'CoreMainMenuDelegate_AddonMessages' => new lang_string('messages', 'message'), + 'CoreMainMenuDelegate_AddonNotifications' => new lang_string('notifications', 'message'), + 'CoreMainMenuDelegate_AddonCalendar' => new lang_string('calendar', 'calendar'), 'CoreMainMenuDelegate_AddonBlog' => new lang_string('blog', 'blog'), 'CoreMainMenuDelegate_CoreTag' => new lang_string('tags'), 'CoreMainMenuDelegate_QrReader' => new lang_string('scanqrcode', 'tool_mobile'), - ), - "$useraccount" => array( - '$mmSideMenuDelegate_mmaGrades' => new lang_string('grades', 'grades'), - '$mmSideMenuDelegate_mmaFiles' => new lang_string('files'), + ], + "$useraccount" => [ + 'CoreUserDelegate_CoreGrades' => new lang_string('grades', 'grades'), + 'CoreUserDelegate_AddonPrivateFiles' => new lang_string('files'), 'CoreUserDelegate_AddonBadges:account' => new lang_string('badges', 'badges'), 'CoreUserDelegate_AddonBlog:account' => new lang_string('blog', 'blog'), - '$mmSideMenuDelegate_mmaCompetency' => new lang_string('myplans', 'tool_lp'), + 'CoreUserDelegate_AddonCompetency' => new lang_string('myplans', 'tool_lp'), 'CoreUserDelegate_CorePolicy' => new lang_string('policiesagreements', 'tool_policy'), 'CoreUserDelegate_CoreDataPrivacy' => new lang_string('pluginname', 'tool_dataprivacy'), 'NoDelegate_SwitchAccount' => new lang_string('switchaccount', 'tool_mobile'), - ), - "$course" => array( - '$mmCoursesDelegate_mmaParticipants' => new lang_string('participants'), - '$mmCoursesDelegate_mmaGrades' => new lang_string('grades', 'grades'), - '$mmCoursesDelegate_mmaCompetency' => new lang_string('competencies', 'competency'), - '$mmCoursesDelegate_mmaNotes' => new lang_string('notes', 'notes'), - '$mmCoursesDelegate_mmaCourseCompletion' => new lang_string('coursecompletion', 'completion'), + ], + "$course" => [ + 'CoreCourseOptionsDelegate_CoreUserParticipants' => new lang_string('participants'), + 'CoreCourseOptionsDelegate_CoreGrades' => new lang_string('grades', 'grades'), + 'CoreCourseOptionsDelegate_AddonCompetency' => new lang_string('competencies', 'competency'), + 'CoreCourseOptionsDelegate_AddonNotes' => new lang_string('notes', 'notes'), + 'CoreCourseOptionsDelegate_AddonCourseCompletion' => new lang_string('coursecompletion', 'completion'), 'NoDelegate_CourseBlocks' => new lang_string('blocks'), 'CoreCourseOptionsDelegate_AddonBlog' => new lang_string('blog', 'blog'), - '$mmCoursesDelegate_search' => new lang_string('search'), + 'CoreCourseOptionsDelegate_search' => new lang_string('search'), 'NoDelegate_CoreCourseDownload' => new lang_string('downloadcourse', 'tool_mobile'), 'NoDelegate_CoreCoursesDownload' => new lang_string('downloadcourses', 'tool_mobile'), 'CoreCourseOptionsDelegate_CoreCourseOverview' => new lang_string('activitiesoverview', 'tool_mobile'), - ), - "$participants" => array( - '$mmUserDelegate_mmaGrades:viewGrades' => new lang_string('grades', 'grades'), - '$mmUserDelegate_mmaCourseCompletion:viewCompletion' => new lang_string('coursecompletion', 'completion'), - '$mmUserDelegate_mmaBadges' => new lang_string('badges', 'badges'), - '$mmUserDelegate_mmaNotes:addNote' => new lang_string('notes', 'notes'), + ], + "$participants" => [ + 'CoreUserDelegate_CoreGrades:viewGrades' => new lang_string('grades', 'grades'), + 'CoreUserDelegate_AddonCourseCompletion:viewCompletion' => new lang_string('coursecompletion', 'completion'), + 'CoreUserDelegate_AddonBadges' => new lang_string('badges', 'badges'), + 'CoreUserDelegate_AddonNotes:notes' => new lang_string('notes', 'notes'), 'CoreUserDelegate_AddonBlog:blogs' => new lang_string('blog', 'blog'), - '$mmUserDelegate_mmaCompetency:learningPlan' => new lang_string('competencies', 'competency'), - '$mmUserDelegate_mmaMessages:sendMessage' => new lang_string('sendmessage', 'message'), - '$mmUserDelegate_picture' => new lang_string('userpic'), - ), - "$files" => array( - 'files_privatefiles' => new lang_string('privatefiles'), - 'files_sitefiles' => new lang_string('sitefiles'), - 'files_upload' => new lang_string('upload'), - ), + 'CoreUserDelegate_AddonCompetency:learningPlan' => new lang_string('competencies', 'competency'), + 'CoreUserDelegate_AddonMessages:sendMessage' => new lang_string('sendmessage', 'message'), + 'CoreUserDelegate_picture' => new lang_string('userpic'), + ], + "$files" => [ + 'AddonPrivateFilesPrivateFiles' => new lang_string('privatefiles'), + 'AddonPrivateFilesSiteFiles' => new lang_string('sitefiles'), + 'AddonPrivateFilesUpload' => new lang_string('upload'), + ], "$modules" => $coursemodules, "$blocks" => $courseblocks, - ); + ]; - if (!empty($remoteaddonslist)) { - $features["$remoteaddons"] = $remoteaddonslist; + if (!empty($sitepluginslist)) { + $features["$siteplugins"] = $sitepluginslist; } if (!empty($availablemods['lti'])) { @@ -652,7 +657,7 @@ public static function get_features_list() { // Display OAuth 2 identity providers. if (is_enabled_auth('oauth2')) { - $identityproviderslist = array(); + $identityproviderslist = []; $idps = \auth_plugin_base::get_identity_providers(['oauth2']); foreach ($idps as $idp) { @@ -664,7 +669,7 @@ public static function get_features_list() { } if (!empty($identityproviderslist)) { - $features["$identityproviders"] = array(); + $features["$identityproviders"] = []; if (count($identityproviderslist) > 1) { // Include an option to disable them all. @@ -689,7 +694,7 @@ public static function get_potential_config_issues() { require_once($CFG->dirroot . "/lib/filelib.php"); require_once($CFG->dirroot . '/message/lib.php'); - $warnings = array(); + $warnings = []; if (is_https()) { $curl = new curl(); diff --git a/public/admin/tool/mobile/db/upgrade.php b/public/admin/tool/mobile/db/upgrade.php index be4536edd40e7..0276d37e5dfc7 100644 --- a/public/admin/tool/mobile/db/upgrade.php +++ b/public/admin/tool/mobile/db/upgrade.php @@ -40,6 +40,68 @@ function xmldb_tool_mobile_upgrade($oldversion) { // Automatically generated Moodle v5.1.0 release upgrade line. // Put any upgrade step following this. + if ($oldversion < 2026031000) { + $config = get_config('tool_mobile', 'disabledfeatures'); + if (!empty($config)) { + + $replacements = [ + '$mmLoginEmailSignup' => 'CoreLoginEmailSignup', + '$mmSideMenuDelegate' => 'CoreMainMenuDelegate', + '$mmCoursesDelegate' => 'CoreCourseOptionsDelegate', + '$mmUserDelegate' => 'CoreUserDelegate', + '$mmCourseDelegate' => 'CoreCourseModuleDelegate', + '_mmCourses' => '_CoreCourses', + '_mmaFrontpage' => '_CoreSiteHome', + '_mmaGrades' => '_CoreGrades', + '_mmaCompetency' => '_AddonCompetency', + '_mmaNotifications' => '_AddonNotifications', + '_mmaMessages' => '_AddonMessages', + '_mmaCalendar' => '_AddonCalendar', + '_mmaFiles' => '_AddonPrivateFiles', + '_mmaParticipants' => '_CoreUserParticipants', + '_mmaCourseCompletion' => '_AddonCourseCompletion', + '_mmaNotes' => '_AddonNotes', + '_mmaBadges' => '_AddonBadges', + 'files_privatefiles' => 'AddonPrivateFilesPrivateFiles', + 'files_sitefiles' => 'AddonPrivateFilesSiteFiles', + 'files_upload' => 'AddonPrivateFilesUpload', + '_mmaModAssign' => '_AddonModAssign', + '_mmaModBigbluebuttonbn' => '_AddonModBBB', + '_mmaModBook' => '_AddonModBook', + '_mmaModChat' => '_AddonModChat', + '_mmaModChoice' => '_AddonModChoice', + '_mmaModData' => '_AddonModData', + '_mmaModFeedback' => '_AddonModFeedback', + '_mmaModFolder' => '_AddonModFolder', + '_mmaModForum' => '_AddonModForum', + '_mmaModGlossary' => '_AddonModGlossary', + '_mmaModH5pactivity' => '_AddonModH5PActivity', + '_mmaModImscp' => '_AddonModImscp', + '_mmaModLabel' => '_AddonModLabel', + '_mmaModLesson' => '_AddonModLesson', + '_mmaModLti' => '_AddonModLti', + '_mmaModPage' => '_AddonModPage', + '_mmaModQuiz' => '_AddonModQuiz', + '_mmaModResource' => '_AddonModResource', + '_mmaModScorm' => '_AddonModScorm', + '_mmaModSurvey' => '_AddonModSurvey', + '_mmaModUrl' => '_AddonModUrl', + '_mmaModWiki' => '_AddonModWiki', + '_mmaModWorkshop' => '_AddonModWorkshop', + 'AddonNotes:addNote' => 'AddonNotes:notes', + 'CoreMainMenuDelegate_AddonCompetency' => 'CoreUserDelegate_AddonCompetency', + 'CoreMainMenuDelegate_AddonPrivateFiles' => 'CoreUserDelegate_AddonPrivateFiles', + 'CoreMainMenuDelegate_CoreGrades' => 'CoreUserDelegate_CoreGrades', + ]; + + foreach ($replacements as $old => $new) { + $config = str_replace($old, $new, $config); + } + set_config('disabledfeatures', $config, 'tool_mobile'); + } + + upgrade_plugin_savepoint(true, 2026031000, 'tool', 'mobile'); + } return true; } diff --git a/public/admin/tool/mobile/lang/en/tool_mobile.php b/public/admin/tool/mobile/lang/en/tool_mobile.php index 19dd8c6f9f83f..afa5eace7d7e0 100644 --- a/public/admin/tool/mobile/lang/en/tool_mobile.php +++ b/public/admin/tool/mobile/lang/en/tool_mobile.php @@ -148,7 +148,7 @@ $string['qrsameipcheck'] = 'QR authentication same IP check'; $string['qrsameipcheck_desc'] = 'Whether users must use the same network for both generating and scanning a QR code for login. Only disable it if users report issues with the QR login.'; $string['readingthisemailgettheapp'] = 'Are you reading this in an email? Download the mobile app and receive notifications on your mobile device.'; -$string['remoteaddons'] = 'Remote add-ons'; +$string['siteplugins'] = 'Site plugins'; $string['scanqrcode'] = 'Scan QR code'; $string['selfsignedoruntrustedcertificatewarning'] = 'It seems that the HTTPS certificate is self-signed or not trusted. The mobile app will only work with trusted sites. Please use any online SSL checker to diagnose the problem. If it indicates that your certificate is OK, you can ignore this warning.'; $string['setuplink'] = 'App download page'; @@ -171,3 +171,6 @@ $string['responsivemainmenuitems'] = 'Responsive menu items'; $string['switchaccount'] = 'Switch account'; $string['viewqrcode'] = 'View QR code'; + +// Deprecated since Moodle 5.2. +$string['remoteaddons'] = 'Remote add-ons'; diff --git a/public/admin/tool/mobile/version.php b/public/admin/tool/mobile/version.php index aa53d5395838d..8c49300021e88 100644 --- a/public/admin/tool/mobile/version.php +++ b/public/admin/tool/mobile/version.php @@ -23,7 +23,7 @@ */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2025102200; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2026031000; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2025092600; // Requires this Moodle version. $plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics). $plugin->dependencies = [