Skip to content

Commit

Permalink
MDL-73906 core_my: default dashboard page header
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas Brands committed Mar 1, 2022
1 parent 9cd77c4 commit 62fadb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions my/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,12 @@
$context = context_system::instance();
$PAGE->set_blocks_editing_capability('moodle/my:configsyspages'); // unlikely :)
$strguest = get_string('guest');
$header = "$SITE->shortname: $strmymoodle ($strguest)";
$pagetitle = $header;
$pagetitle = "$strmymoodle ($strguest)";

} else { // We are trying to view or edit our own My Moodle page
$userid = $USER->id; // Owner of the page
$context = context_user::instance($USER->id);
$PAGE->set_blocks_editing_capability('moodle/my:manageblocks');
$header = "$SITE->shortname: $strmymoodle";
$pagetitle = $strmymoodle;
}

Expand Down
18 changes: 9 additions & 9 deletions my/indexsys.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,21 @@

$resetall = optional_param('resetall', false, PARAM_BOOL);

$header = "$SITE->shortname: ".get_string('myhome')." (".get_string('mypage', 'admin').")";
$pagetitle = get_string('mypage', 'admin');

$PAGE->set_blocks_editing_capability('moodle/my:configsyspages');
admin_externalpage_setup('mypage', '', null, '', array('pagelayout' => 'mydashboard'));
$PAGE->add_body_class('limitedwidth');
$PAGE->set_pagetype('my-index');
$PAGE->blocks->add_region('content');
$PAGE->set_title($pagetitle);
$PAGE->set_heading($pagetitle);
$PAGE->has_secondary_navigation_setter(false);
$PAGE->set_primary_active_tab('myhome');

// If we are resetting all, just output a progress bar.
if ($resetall && confirm_sesskey()) {
echo $OUTPUT->header($header);
echo $OUTPUT->header($pagetitle);
echo $OUTPUT->heading(get_string('resettingdashboards', 'my'), 3);

$progressbar = new progress_bar();
Expand All @@ -63,13 +70,6 @@
die();
}

// Override pagetype to show blocks properly.
$PAGE->set_pagetype('my-index');

$PAGE->set_title($header);
$PAGE->set_heading($header);
$PAGE->blocks->add_region('content');

// Get the My Moodle page info. Should always return something unless the database is broken.
if (!$currentpage = my_get_page(null, MY_PAGE_PRIVATE)) {
print_error('mymoodlesetup');
Expand Down

0 comments on commit 62fadb8

Please sign in to comment.