Permalink
Browse files

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.
  • Loading branch information...
1 parent 51f4d70 commit fa62ca18e863689fc33cfbcc4ee0208a8c1db901 defacer committed Jun 13, 2005
Showing with 7 additions and 8 deletions.
  1. +7 −8 blocks/site_main_menu/block_site_main_menu.php
@@ -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 @@ function get_content() {
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 @@ function get_content() {
$ismoving = ismoving($this->instance->pageid);
$sections = get_all_sections($this->instance->pageid);
- if(empty($sections) or !isset($sections[0])) {
- return $this->content;
- }
- $section = $sections[0];
+ if(!empty($sections) && isset($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 @@ function get_content() {
$this->content->items[] = $USER->activitycopyname.'&nbsp;(<a href="'.$CFG->wwwroot.'/course/mod.php?cancelcopy=true&amp;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])) {

0 comments on commit fa62ca1

Please sign in to comment.