From 7231e2de74e7aca7b8960dbb15d4efba9ce005a8 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Mon, 16 Nov 2009 01:12:16 +0000 Subject: [PATCH] navigation MDL-20833 Moved has_navbar from OUTPUT to PAGE as it is logic --- lib/outputrenderers.php | 12 ++---------- lib/pagelib.php | 11 +++++++++++ theme/standard/layout-popup.php | 2 +- theme/standard/layout-topframe.php | 2 +- theme/standard/layout.php | 2 +- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 2bfe56be4b..04e2264f65 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -742,7 +742,7 @@ class moodle_core_renderer extends moodle_renderer_base { $COURSE = $this->page->course; // Required for legacy template uses - $navigation = $this->has_navbar(); + $navigation = $this->page->has_navbar(); ob_start(); include($templatefile); @@ -789,7 +789,7 @@ class moodle_core_renderer extends moodle_renderer_base { $course = $this->page->course; $performanceinfo = self::PERFORMANCE_INFO_TOKEN; - $navigation = $this->has_navbar(); + $navigation = $this->page->has_navbar(); if (!$menu && $navigation) { $menu = $loggedinas; } @@ -2373,15 +2373,7 @@ class moodle_core_renderer extends moodle_renderer_base { public function navbar() { return $this->page->navbar->content(); } - - /** - * Checks to see if there are any items on the navbar object - * @return bool true if there are, false if not - */ - public function has_navbar() { - return $this->page->navbar->has_items(); } -} /// RENDERERS diff --git a/lib/pagelib.php b/lib/pagelib.php index 4cba5a38e1..a631656044 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -475,6 +475,17 @@ class moodle_page { return $this->_navbar; } + /** + * Checks to see if there are any items on the navbar object + * @return bool true if there are, false if not + */ + public function has_navbar() { + if ($this->_navbar === null) { + $this->_navbar = new navbar($this); + } + return $this->_navbar->has_items(); + } + /** * Returns the settings navigation object * @return settings_navigation diff --git a/theme/standard/layout-popup.php b/theme/standard/layout-popup.php index 9089fcb32c..8eaf1d9be3 100644 --- a/theme/standard/layout-popup.php +++ b/theme/standard/layout-popup.php @@ -17,7 +17,7 @@ -has_navbar()) { // This is the navigation bar with breadcrumbs ?> +has_navbar()) { // This is the navigation bar with breadcrumbs ?> -has_navbar()) { // This is the navigation bar with breadcrumbs ?> +has_navbar()) { // This is the navigation bar with breadcrumbs ?> -has_navbar()) { // This is the navigation bar with breadcrumbs ?> +has_navbar()) { // This is the navigation bar with breadcrumbs ?>