Fix for bug 2925:
When editing is turned on, the Main Menu should always display and give the option of adding resources/activities in section 0 of the site. Bad optimization code caused the drop downs to not be shown if there was no section 0 (i.e., the site never had a news forum or an activity in the Main Menu block). FINALLY! :) PS: Version bump, so that we know if people have the latest version of the block. I 'm going to bump versions from now on when bugs are fixed.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
class block_site_main_menu extends block_list {
|
||||
function init() {
|
||||
$this->title = get_string('mainmenu');
|
||||
$this->version = 2004052700;
|
||||
$this->version = 2005061300;
|
||||
}
|
||||
|
||||
function applicable_formats() {
|
||||
@@ -17,7 +17,7 @@ class block_site_main_menu extends block_list {
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
$this->content = New stdClass;
|
||||
$this->content = new stdClass;
|
||||
$this->content->items = array();
|
||||
$this->content->icons = array();
|
||||
$this->content->footer = '';
|
||||
@@ -33,13 +33,12 @@ class block_site_main_menu extends block_list {
|
||||
$ismoving = ismoving($this->instance->pageid);
|
||||
|
||||
$sections = get_all_sections($this->instance->pageid);
|
||||
if(empty($sections) or !isset($sections[0])) {
|
||||
return $this->content;
|
||||
|
||||
if(!empty($sections) && isset($sections[0])) {
|
||||
$section = $sections[0];
|
||||
}
|
||||
|
||||
$section = $sections[0];
|
||||
|
||||
if (!empty($section->sequence) || $isediting) {
|
||||
if (!empty($section) || $isediting) {
|
||||
get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||
}
|
||||
|
||||
@@ -61,7 +60,7 @@ class block_site_main_menu extends block_list {
|
||||
$this->content->items[] = $USER->activitycopyname.' (<a href="'.$CFG->wwwroot.'/course/mod.php?cancelcopy=true&sesskey='.$USER->sesskey.'">'.$strcancel.'</a>)';
|
||||
}
|
||||
|
||||
if (!empty($section->sequence)) {
|
||||
if (!empty($section) && !empty($section->sequence)) {
|
||||
$sectionmods = explode(',', $section->sequence);
|
||||
foreach ($sectionmods as $modnumber) {
|
||||
if (empty($mods[$modnumber])) {
|
||||
|
||||
Reference in New Issue
Block a user