mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Don't display blocks that have no content at all. I 'm not sure if this
could cause any confusion, but it solves the problem with the admin block being displayed to guests. The thought about a "display only to X and Y kinds of users" feature came to mind, but maybe that would be more confusing than useful.
This commit is contained in:
parent
82b181f265
commit
ca319818fc
1 changed files with 9 additions and 1 deletions
|
@ -49,15 +49,20 @@ class MoodleBlock {
|
||||||
return $this->get_content();
|
return $this->get_content();
|
||||||
}
|
}
|
||||||
function print_block() {
|
function print_block() {
|
||||||
// Wrap it up, in case we have buttons too
|
// Wrap the title in a floating DIV, in case we have edit controls to display
|
||||||
|
// These controls will always be wrapped on a right-floating DIV
|
||||||
$title = '<div style="float: left;">'.$this->title.'</div>';
|
$title = '<div style="float: left;">'.$this->title.'</div>';
|
||||||
if($this->edit_controls !== NULL) {
|
if($this->edit_controls !== NULL) {
|
||||||
$title .= $this->edit_controls;
|
$title .= $this->edit_controls;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->get_content();
|
$this->get_content();
|
||||||
|
|
||||||
switch($this->content_type) {
|
switch($this->content_type) {
|
||||||
case BLOCK_TYPE_TEXT:
|
case BLOCK_TYPE_TEXT:
|
||||||
|
if(empty($this->content->text)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if ($this->edit_controls !== NULL || !$this->hide_header()) {
|
if ($this->edit_controls !== NULL || !$this->hide_header()) {
|
||||||
print_side_block($title, $this->content->text, NULL, NULL, $this->content->footer);
|
print_side_block($title, $this->content->text, NULL, NULL, $this->content->footer);
|
||||||
} else {
|
} else {
|
||||||
|
@ -65,6 +70,9 @@ class MoodleBlock {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BLOCK_TYPE_LIST:
|
case BLOCK_TYPE_LIST:
|
||||||
|
if(empty($this->content->items)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if ($this->edit_controls !== NULL || !$this->hide_header()) {
|
if ($this->edit_controls !== NULL || !$this->hide_header()) {
|
||||||
print_side_block($title, '', $this->content->items, $this->content->icons, $this->content->footer);
|
print_side_block($title, '', $this->content->items, $this->content->icons, $this->content->footer);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue