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:
committed by
Eloy Lafuente (stronk7)
parent
e862985a69
commit
c1720141fd
@@ -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)) {
|
||||
|
||||
@@ -109,6 +109,7 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
set_config('agedigitalconsentverification', 1);
|
||||
set_config('autolang', 1);
|
||||
set_config('lang', 'a_b'); // Set invalid lang.
|
||||
set_config('disabledfeatures', 'myoverview', 'tool_mobile');
|
||||
|
||||
list($authinstructions, $notusedformat) = external_format_text($authinstructions, FORMAT_MOODLE, $context->id);
|
||||
$expected['registerauth'] = 'email';
|
||||
@@ -120,6 +121,7 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
$expected['supportemail'] = $CFG->supportemail;
|
||||
$expected['autolang'] = '1';
|
||||
$expected['lang'] = ''; // Expect empty because it was set to an invalid lang.
|
||||
$expected['tool_mobile_disabledfeatures'] = 'myoverview';
|
||||
|
||||
if ($logourl = $OUTPUT->get_logo_url()) {
|
||||
$expected['logourl'] = $logourl->out(false);
|
||||
|
||||
Reference in New Issue
Block a user