MDL-63708 tool_mobile: Add options for disabling blocks

Now that we are supporting the new dashboard and site home blocks on the mobile app,
we need options to allow admin to forbid certain blocks to be displayed on the app.
This commit is contained in:
Juan Leyva
2018-11-07 00:32:32 +01:00
committed by Eloy Lafuente (stronk7)
parent e862985a69
commit c1720141fd
2 changed files with 23 additions and 0 deletions
+21
View File
@@ -336,6 +336,7 @@ class api {
$mainmenu = new lang_string('mainmenu', 'tool_mobile');
$course = new lang_string('course');
$modules = new lang_string('managemodules');
$blocks = new lang_string('blocks');
$user = new lang_string('user');
$files = new lang_string('files');
$remoteaddons = new lang_string('remoteaddons', 'tool_mobile');
@@ -359,6 +360,25 @@ class api {
}
// Display blocks.
$availableblocks = core_plugin_manager::instance()->get_plugins_of_type('block');
$courseblocks = array();
$appsupportedblocks = array(
'activity_modules' => 'CoreBlockDelegate_AddonBlockActivityModules',
'site_main_menu' => 'CoreBlockDelegate_AddonBlockSiteMainMenu',
'myoverview' => 'CoreBlockDelegate_AddonBlockMyOverview',
'timeline' => 'CoreBlockDelegate_AddonBlockTimeline',
'recentlyaccessedcourses' => 'CoreBlockDelegate_AddonBlockRecentlyAccessedCourses',
'starredcourses' => 'CoreBlockDelegate_AddonBlockStarredCourses',
'recentlyaccesseditems' => 'CoreBlockDelegate_AddonBlockRecentlyAccessedItems',
);
foreach ($availableblocks as $block) {
if (isset($appsupportedblocks[$block->name])) {
$courseblocks[$appsupportedblocks[$block->name]] = $block->displayname;
}
}
$features = array(
'NoDelegate_CoreOffline' => new lang_string('offlineuse', 'tool_mobile'),
'$mmLoginEmailSignup' => new lang_string('startsignup'),
@@ -401,6 +421,7 @@ class api {
'files_upload' => new lang_string('upload'),
),
"$modules" => $coursemodules,
"$blocks" => $courseblocks,
);
if (!empty($remoteaddonslist)) {