Merge branch 'MDL-35655' of git://github.com/itamart/moodle

This commit is contained in:
Dan Poltawski
2012-10-16 09:49:28 +08:00
+16 -4
View File
@@ -177,9 +177,10 @@ class block_navigation extends block_base {
$trimlength = (int)$this->config->trimlength;
}
// Initialise (only actually happens if it hasn't already been done yet
$this->page->navigation->initialise();
$navigation = clone($this->page->navigation);
// Get the navigation object or don't display the block if none provided.
if (!$navigation = $this->get_navigation()) {
return null;
}
$expansionlimit = null;
if (!empty($this->config->expansionlimit)) {
$expansionlimit = $this->config->expansionlimit;
@@ -204,7 +205,7 @@ class block_navigation extends block_base {
$options['linkcategories'] = (!empty($this->config->linkcategories) && $this->config->linkcategories == 'yes');
// Grab the items to display
$renderer = $this->page->get_renderer('block_navigation');
$renderer = $this->page->get_renderer($this->blockname);
$this->content = new stdClass();
$this->content->text = $renderer->navigation_tree($navigation, $expansionlimit, $options);
@@ -214,6 +215,17 @@ class block_navigation extends block_base {
return $this->content;
}
/**
* Returns the navigation
*
* @return navigation_node The navigation object to display
*/
protected function get_navigation() {
// Initialise (only actually happens if it hasn't already been done yet)
$this->page->navigation->initialise();
return clone($this->page->navigation);
}
/**
* Returns the attributes to set for this block
*