moodle_page: MDL-12212 eliminate page_my_moodle

This commit is contained in:
tjhunt
2009-05-06 09:23:37 +00:00
parent 5d3e9d9fe3
commit 1b6b940022
4 changed files with 28 additions and 81 deletions
+2 -3
View File
@@ -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',
+2 -20
View File
@@ -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);
}
}
+24 -11
View File
@@ -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');
@@ -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">';
-47
View File
@@ -1,47 +0,0 @@
<?php //$Id$
require_once($CFG->libdir.'/pagelib.php');
class page_my_moodle extends page_base {
function print_header($title) {
global $USER, $CFG;
$replacements = array(
'%fullname%' => get_string('mymoodle','my')
);
foreach($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
$site = get_site();
$button = update_mymoodle_icon($USER->id);
$nav = get_string('mymoodle','my');
$header = $site->shortname.': '.$nav;
$navlinks = array(array('name' => $nav, 'link' => '', 'type' => 'misc'));
$navigation = build_navigation($navlinks);
$loggedinas = user_login_string($site);
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($title, $header,$navigation,'','',true, $button, $loggedinas.$langmenu);
}
}
define('PAGE_MY_MOODLE', 'my-index');
define('MY_MOODLE_FORMAT', 'my'); //doing this so we don't run into problems with applicable formats.
page_map_class(PAGE_MY_MOODLE, 'page_my_moodle');
?>