From: defacer Date: Fri, 28 May 2004 13:57:09 +0000 (+0000) Subject: Bugfix: blocks with no content at all show up as shadows when editing. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=22931cf410bd3c6efc4edf85d121046e71fe56b7;p=moodle.git Bugfix: blocks with no content at all show up as shadows when editing. --- diff --git a/blocks/course_summary/block_course_summary.php b/blocks/course_summary/block_course_summary.php index 86963a5eb6..f35427fbb5 100644 --- a/blocks/course_summary/block_course_summary.php +++ b/blocks/course_summary/block_course_summary.php @@ -18,7 +18,7 @@ class CourseBlock_course_summary extends MoodleBlock { return $this->content; } - $this->content = New object; + $this->content = New stdClass; $this->content->text = format_text($this->course->summary, FORMAT_HTML); $this->content->footer = ''; diff --git a/blocks/moodleblock.class.php b/blocks/moodleblock.class.php index 0940956812..8896a40bf1 100644 --- a/blocks/moodleblock.class.php +++ b/blocks/moodleblock.class.php @@ -66,22 +66,46 @@ class MoodleBlock { case BLOCK_TYPE_NUKE: case BLOCK_TYPE_TEXT: if(empty($this->content->text) && empty($this->content->footer)) { - break; + if(empty($this->edit_controls)) { + // No content, no edit controls, so just shut up + break; + } + else { + // No content but editing, so show something at least + $this->print_shadow(); + } } - if ($this->edit_controls !== NULL || !$this->hide_header()) { - print_side_block($title, $this->content->text, NULL, NULL, $this->content->footer, $this->html_attributes()); - } else { - print_side_block(NULL, $this->content->text, NULL, NULL, $this->content->footer, $this->html_attributes()); + else { + if($this->hide_header() && empty($this->edit_controls)) { + // Header wants to hide, no edit controls to show, so no header it is + print_side_block(NULL, $this->content->text, NULL, NULL, $this->content->footer, $this->html_attributes()); + } + else { + // The full treatment, please + print_side_block($title, $this->content->text, NULL, NULL, $this->content->footer, $this->html_attributes()); + } } break; case BLOCK_TYPE_LIST: - if(empty($this->content->items) && empty($this->content->footer)) { - break; + if(empty($this->content->text) && empty($this->content->footer)) { + if(empty($this->edit_controls)) { + // No content, no edit controls, so just shut up + break; + } + else { + // No content but editing, so show something at least + $this->print_shadow(); + } } - if ($this->edit_controls !== NULL || !$this->hide_header()) { - print_side_block($title, '', $this->content->items, $this->content->icons, $this->content->footer, $this->html_attributes()); - } else { - print_side_block(NULL, '', $this->content->items, $this->content->icons, $this->content->footer, $this->html_attributes()); + else { + if($this->hide_header() && empty($this->edit_controls)) { + // Header wants to hide, no edit controls to show, so no header it is + print_side_block(NULL, '', $this->content->items, $this->content->icons, $this->content->footer, $this->html_attributes()); + } + else { + // The full treatment, please + print_side_block($title, '', $this->content->items, $this->content->icons, $this->content->footer, $this->html_attributes()); + } } break; }