Skip to content

Commit

Permalink
moodle_page: MDL-12212 eliminate page_my_moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhunt committed May 6, 2009
1 parent 5d3e9d9 commit 1b6b940
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 81 deletions.
5 changes: 2 additions & 3 deletions admin/stickyblocks.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?PHP // $Id$

require_once('../config.php');
require_once($CFG->dirroot.'/my/pagelib.php');
require_once($CFG->dirroot.'/lib/pagelib.php');

$pt = optional_param('pt', null, PARAM_SAFEDIR); //alhanumeric and -

$pagetypes = array(PAGE_MY_MOODLE => array('id' => PAGE_MY_MOODLE,
'lib' => '/my/pagelib.php',
$pagetypes = array('my-index' => array('id' => 'my-index',
'lib' => '/lib/pagelib.php',
'name' => get_string('mymoodle','admin')),
PAGE_COURSE_VIEW => array('id' => PAGE_COURSE_VIEW,
'lib' => '/lib/pagelib.php',
Expand Down
22 changes: 2 additions & 20 deletions lib/blocklib.php
Original file line number Diff line number Diff line change
Expand Up @@ -718,26 +718,8 @@ function blocks_print_group($page, $blockmanager, $position) {
}
} // End foreach

// Check if
// we are on the default position/side AND
// we're editing the page AND
// (
// we have the capability to manage blocks OR
// we are in myMoodle page AND have the capibility to manage myMoodle blocks
// )

// for constant PAGE_MY_MOODLE
include_once($CFG->dirroot.'/my/pagelib.php');

$coursecontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
$myownblogpage = (isset($page->filtertype) && isset($page->filterselect) && $page->pagetype=='blog-view' && $page->filtertype=='user' && $page->filterselect == $USER->id);

$managecourseblocks = has_capability('moodle/site:manageblocks', $coursecontext);
$editmymoodle = $page->pagetype == PAGE_MY_MOODLE && has_capability('moodle/my:manageblocks', $coursecontext);

if ($page->blocks->get_default_region() == $position && $page->user_is_editing() &&
($managecourseblocks || $editmymoodle || $myownblogpage || defined('ADMIN_STICKYBLOCKS'))) {

if ($page->blocks->get_default_region() == $position &&
$page->user_is_editing() && $page->user_can_edit_blocks()) {
blocks_print_adminblock($page, $blockmanager);
}
}
Expand Down
35 changes: 24 additions & 11 deletions my/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@

// this is the 'my moodle' page

require_once('../config.php');
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once('pagelib.php');

require_login();

$mymoodlestr = get_string('mymoodle','my');
$strmymoodle = get_string('mymoodle','my');

if (isguest()) {
print_header($mymoodlestr);
notice_yesno(get_string('noguest', 'my').'<br /><br />'.get_string('liketologin'),
get_login_url(), $CFG->wwwroot);
print_header($strmymoodle);
notice_yesno(get_string('noguest', 'my') . '<br /><br />' .
get_string('liketologin'), get_login_url(), $CFG->wwwroot);
print_footer();
die();
die;
}


$edit = optional_param('edit', -1, PARAM_BOOL);
$edit = optional_param('edit', -1, PARAM_BOOL);
$blockaction = optional_param('blockaction', '', PARAM_ALPHA);

$PAGE = page_create_instance($USER->id);
$PAGE->set_context(get_context_instance(CONTEXT_USER, $USER->id));
$PAGE->set_url('my/index.php');
$PAGE->set_blocks_editing_capability('moodle/my:manageblocks');

Expand All @@ -32,7 +30,22 @@
$USER->editing = $edit;
}

$PAGE->print_header($mymoodlestr);
$button = update_mymoodle_icon($USER->id);
$header = $SITE->shortname . ': ' . $strmymoodle;
$navigation = build_navigation($strmymoodle);
$loggedinas = user_login_string();

if (empty($CFG->langmenu)) {
$langmenu = '';
} else {
$currlang = current_language();
$langs = get_list_of_languages();
$langlabel = get_accesshide(get_string('language'));
$langmenu = popup_form($CFG->wwwroot . '/my/index.php?lang=', $langs,
'chooselang', $currlang, '', '', '', true, 'self', $langlabel);
}

print_header($strmymoodle, $header, $navigation, '', '', true, $button, $loggedinas . $langmenu);

echo '<table id="layout-table">';
echo '<tr valign="top">';
Expand Down
47 changes: 0 additions & 47 deletions my/pagelib.php

This file was deleted.

0 comments on commit 1b6b940

Please sign in to comment.