MDL-19124 Removed the my_syspage_block_manager hacks from sys pages and completed the 0->null migration in userid

This commit is contained in:
Martin Dougiamas 2010-05-05 05:52:10 +00:00
parent ad336228be
commit b8fa1826a2
3 changed files with 4 additions and 16 deletions

View File

@ -60,10 +60,10 @@ $PAGE->set_title($header);
$PAGE->set_heading($header);
$PAGE->blocks->add_region('content');
// TODO: Make the page be selected properly in the Settings block
admin_externalpage_setup('mypage');
// Get the My Moodle page info. Should always return something unless the database is broken.
if (!$currentpage = my_get_page(0, MY_PAGE_PRIVATE)) {
if (!$currentpage = my_get_page(null, MY_PAGE_PRIVATE)) {
print_error('mymoodlesetup');
}
$PAGE->set_subpage($currentpage->id);
@ -98,12 +98,6 @@ if ($PAGE->user_allowed_editing()) {
$USER->editing = $edit = 0;
}
// HACK WARNING! This loads up all this page's blocks in the system context
if ($currentpage->userid == 0) {
$CFG->blockmanagerclass = 'my_syspage_block_manager';
}
echo $OUTPUT->header();
echo $OUTPUT->blocks_for_region('content');

View File

@ -39,7 +39,7 @@ require_once("$CFG->libdir/blocklib.php");
function my_get_page($userid, $private=MY_PAGE_PRIVATE) {
global $DB, $CFG;
if (empty($CFG->forcedefaultmymoodle)) { // We ignore custom My Moodle pages if admin has forced them
if (empty($CFG->forcedefaultmymoodle) && $userid) { // Ignore custom My Moodle pages if admin has forced them
// Does the user have their own page defined? If so, return it.
if ($customised = $DB->get_record('my_pages', array('userid' => $userid, 'private' => $private))) {
return $customised;

View File

@ -57,7 +57,7 @@ $PAGE->blocks->add_region('content');
// TODO: Make the page be selected properly in the Settings block
// Get the Public Profile page info. Should always return something unless the database is broken.
if (!$currentpage = my_get_page(0, MY_PAGE_PUBLIC)) {
if (!$currentpage = my_get_page(null, MY_PAGE_PUBLIC)) {
print_error('publicprofilesetup');
}
$PAGE->set_subpage($currentpage->id);
@ -92,12 +92,6 @@ if ($PAGE->user_allowed_editing()) {
$USER->editing = $edit = 0;
}
// HACK WARNING! This loads up all this page's blocks in the system context
if ($currentpage->userid == 0) {
$CFG->blockmanagerclass = 'my_syspage_block_manager';
}
echo $OUTPUT->header();
echo $OUTPUT->blocks_for_region('content');