mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-10870 All files updated to new build_navigation() method.
This commit is contained in:
parent
5bf243d131
commit
73c24ef80b
12 changed files with 161 additions and 98 deletions
|
@ -80,8 +80,6 @@
|
|||
$title = $strlanguage;
|
||||
break;
|
||||
}
|
||||
$navigation = "<a href=\"lang.php\">$strlanguage</a> -> $title";
|
||||
|
||||
$crumbs[] = array('name' => $strlanguage, 'link' => "$CFG->wwwroot/admin/lang.php");
|
||||
$navigation = build_navigation($crumbs);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ define('BLOCK_L_MIN_WIDTH', $lmin);
|
|||
define('BLOCK_L_MAX_WIDTH', $lmax);
|
||||
define('BLOCK_R_MIN_WIDTH', $rmin);
|
||||
define('BLOCK_R_MAX_WIDTH', $rmax);
|
||||
|
||||
|
||||
page_map_class(PAGE_ADMIN, 'page_admin');
|
||||
|
||||
class page_admin extends page_base {
|
||||
|
@ -27,7 +27,7 @@ class page_admin extends page_base {
|
|||
// hack alert!
|
||||
// this function works around the inability to store the section name
|
||||
// in default block, maybe we should "improve" the blocks a bit?
|
||||
function init_extra($section) {
|
||||
function init_extra($section) {
|
||||
global $CFG;
|
||||
|
||||
if($this->full_init_done) {
|
||||
|
@ -40,7 +40,7 @@ class page_admin extends page_base {
|
|||
$this->section = $section;
|
||||
|
||||
$this->visiblepathtosection = array();
|
||||
|
||||
|
||||
// this part is (potentially) processor-intensive... there's gotta be a better way
|
||||
// of handling this
|
||||
if ($this->pathtosection = $adminroot->path($this->section)) {
|
||||
|
@ -54,24 +54,24 @@ class page_admin extends page_base {
|
|||
// all done
|
||||
$this->full_init_done = true;
|
||||
}
|
||||
|
||||
|
||||
function blocks_get_default() {
|
||||
return 'admin_tree,admin_bookmarks';
|
||||
}
|
||||
|
||||
// seems reasonable that the only people that can edit blocks on the admin pages
|
||||
// are the admins... but maybe we want a role for this?
|
||||
function user_allowed_editing() {
|
||||
function user_allowed_editing() {
|
||||
return has_capability('moodle/site:manageblocks', get_context_instance(CONTEXT_SYSTEM, SITEID));
|
||||
}
|
||||
|
||||
// has to be fixed. i know there's a "proper" way to do this
|
||||
function user_is_editing() {
|
||||
function user_is_editing() {
|
||||
global $USER;
|
||||
return $USER->adminediting;
|
||||
}
|
||||
|
||||
function url_get_path() {
|
||||
function url_get_path() {
|
||||
global $CFG;
|
||||
|
||||
$adminroot = admin_get_root();
|
||||
|
@ -88,11 +88,11 @@ class page_admin extends page_base {
|
|||
return array('section' => (isset($this->section) ? $this->section : ''));
|
||||
}
|
||||
|
||||
function blocks_get_positions() {
|
||||
function blocks_get_positions() {
|
||||
return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT);
|
||||
}
|
||||
|
||||
function blocks_default_position() {
|
||||
function blocks_default_position() {
|
||||
return BLOCK_POS_LEFT;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ class page_admin extends page_base {
|
|||
$this->init_full($section); // we're trusting that init_full() has already been called by now; it should have.
|
||||
// if not, print_header() has to be called with a $section parameter
|
||||
|
||||
// The search page currently doesn't handle block editing
|
||||
// The search page currently doesn't handle block editing
|
||||
if ($this->section != 'search' and $this->user_allowed_editing()) {
|
||||
$buttons = '<div><form '.$CFG->frametarget.' method="get" action="' . $this->url_get_path() . '">'.
|
||||
'<div><input type="hidden" name="adminedit" value="'.($this->user_is_editing()?'off':'on').'" />'.
|
||||
|
@ -126,8 +126,13 @@ class page_admin extends page_base {
|
|||
$buttons = ' ';
|
||||
}
|
||||
|
||||
print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname,
|
||||
implode(" -> ",$this->visiblepathtosection),'', '', true, $buttons, '');
|
||||
$navlinks = array();
|
||||
foreach ($this->visiblepathtosection as $element) {
|
||||
$navlinks[] = array('name' => $element, 'link' => null, 'type' => 'misc');
|
||||
}
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
print_header("$SITE->shortname: " . implode(": ",$this->visiblepathtosection), $SITE->fullname, $navigation,'', '', true, $buttons, '');
|
||||
}
|
||||
|
||||
function get_type() {
|
||||
|
|
|
@ -7,6 +7,7 @@ if (!defined('MOODLE_INTERNAL')) {
|
|||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
$navlinks = array();
|
||||
if ($currenttab != 'update') {
|
||||
switch ($context->contextlevel) {
|
||||
|
||||
|
@ -27,8 +28,16 @@ if ($currenttab != 'update') {
|
|||
$strcategories = get_string("categories");
|
||||
$strcategory = get_string("category");
|
||||
$strcourses = get_string("courses");
|
||||
print_header("$SITE->shortname: $category->name", "$SITE->fullname: $strcourses",
|
||||
"<a href=\"$CFG->wwwroot/course/index.php\">$strcategories</a> -> <a href=\"$CFG->wwwroot/course/category.php?id=$category->id\">$category->name</a> -> $straction", "", "", true);
|
||||
|
||||
$navlinks[] = array('name' => $strcategories,
|
||||
'link' => "$CFG->wwwroot/course/index.php",
|
||||
'type' => 'misc');
|
||||
$navlinks[] = array('name' => $category->name,
|
||||
'link' => "$CFG->wwwroot/course/category.php?id=$category->id",
|
||||
'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
print_header("$SITE->shortname: $category->name", "$SITE->fullname: $strcourses", $navigation, "", "", true);
|
||||
break;
|
||||
|
||||
case CONTEXT_COURSE:
|
||||
|
@ -38,9 +47,11 @@ if ($currenttab != 'update') {
|
|||
$course = get_record('course', 'id', $context->instanceid);
|
||||
|
||||
require_login($course);
|
||||
|
||||
print_header($streditcoursesettings, $course->fullname,
|
||||
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $straction");
|
||||
$navlinks[] = array('name' => $course->shortname,
|
||||
'link' => "$CFG->wwwroot/course/view.php?id=$course->id",
|
||||
'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header($streditcoursesettings, $course->fullname, $navigation);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -64,9 +75,8 @@ if ($currenttab != 'update') {
|
|||
|
||||
require_login($course);
|
||||
|
||||
$strnav = "<a href=\"$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id\">$instance->name</a> ->";
|
||||
$fullmodulename = get_string("modulename", $module->name);
|
||||
$streditinga = get_string("editinga", "moodle", $fullmodulename);
|
||||
$fullmodulename = get_string("modulename", $module->name);
|
||||
$streditinga = get_string("editinga", "moodle", $fullmodulename);
|
||||
$strmodulenameplural = get_string("modulenameplural", $module->name);
|
||||
|
||||
if ($module->name == "label") {
|
||||
|
@ -75,9 +85,21 @@ if ($currenttab != 'update') {
|
|||
$focuscursor = "form.name";
|
||||
}
|
||||
|
||||
print_header_simple($streditinga, '',
|
||||
"<a href=\"$CFG->wwwroot/mod/$module->name/index.php?id=$course->id\">$strmodulenameplural</a> ->
|
||||
$strnav <a href=\"$CFG->wwwroot/course/mod.php?update=$cm->id&sesskey=".sesskey()."\">$streditinga</a> -> $straction", $focuscursor, "", false);
|
||||
$navlinks[] = array('name' => $strmodulenameplural,
|
||||
'link' => "$CFG->wwwroot/mod/$module->name/index.php?id=$course->id",
|
||||
'type' => 'misc');
|
||||
|
||||
$navlinks[] = array('name' => $instance->name,
|
||||
'link' => "$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id";
|
||||
'type' => 'misc');
|
||||
|
||||
$navlinks[] = array('name' => $streditinga,
|
||||
'link' => "$CFG->wwwroot/course/mod.php?update=$cm->id&sesskey=".sesskey(),
|
||||
'type' => 'misc');
|
||||
|
||||
$navigation = build_navigation($navlinks);
|
||||
|
||||
print_header_simple($streditinga, '', $navigation, $focuscursor, "", false);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -85,7 +107,10 @@ if ($currenttab != 'update') {
|
|||
if ($blockinstance = get_record('block_instance', 'id', $context->instanceid)) {
|
||||
if ($block = get_record('block', 'id', $blockinstance->blockid)) {
|
||||
$blockname = print_context_name($context);
|
||||
$navigation = $blockname. ' -> '.$straction;
|
||||
|
||||
// Prepare the last part of the breadcrumbs first
|
||||
$navlinks[98] = array('name' => $blockname, 'link' => null, 'type' => 'misc');
|
||||
$navlinks[99] = array('name' => $straction, 'link' => null, 'type' => 'misc');
|
||||
|
||||
switch ($blockinstance->pagetype) {
|
||||
case 'course-view':
|
||||
|
@ -94,16 +119,21 @@ if ($currenttab != 'update') {
|
|||
require_login($course);
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
|
||||
$navlinks[0] = array('name' => $course->shortname,
|
||||
'link' => "$CFG->wwwroot/course/view.php?id=$course->id",
|
||||
'type' => 'misc');
|
||||
}
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$straction: $blockname", $course->fullname, $navigation);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'blog-view':
|
||||
$strblogs = get_string('blogs','blog');
|
||||
$navigation = '<a href="'.$CFG->wwwroot.'/blog/index.php">'.
|
||||
$strblogs.'</a> -> '.$navigation;
|
||||
$navlinks[0] = array('name' => $strblogs,
|
||||
'link' => $CFG->wwwroot.'/blog/index.php',
|
||||
'type' => 'misc');
|
||||
$navigation = build_navigation($navlinks);
|
||||
print_header("$straction: $strblogs", $SITE->fullname, $navigation);
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue