Commit b58961ac authored by nicolasconnault's avatar nicolasconnault
Browse files

MDL-20565 When editing is off, hiding blocks whose sub-system is disabled at...

MDL-20565 When editing is off, hiding blocks whose sub-system is disabled at site level. When editing is on, printing a "[subsytem] is disabled" message.
parent 1488bf1f
......@@ -56,14 +56,12 @@ class block_blog_menu extends block_base {
$context = $PAGE->get_context();
if (empty($CFG->bloglevel)) {
$this->content->text = get_string('blogdisable', 'blog');
return $this->content;
}
// don't display menu block if block is set at site level, and user is not logged in
if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL && !(isloggedin() && !isguestuser())) {
$this->content->text = get_string('blogdisable', 'blog');
if (empty($CFG->bloglevel) || ($CFG->bloglevel < BLOG_GLOBAL_LEVEL && !(isloggedin() && !isguestuser()))) {
$this->content->text = '';
if ($this->page->user_is_editing()) {
$this->content->text = get_string('blogdisable', 'blog');
}
return $this->content;
}
......
......@@ -22,6 +22,14 @@ class block_comments extends block_base {
}
function get_content() {
global $CFG;
if (!$CFG->usecomments) {
$this->content->text = '';
if ($this->page->user_is_editing()) {
$this->content->text = get_string('disabledcomments');
}
return $this->content;
}
if ($this->content !== NULL) {
return $this->content;
}
......@@ -37,7 +45,7 @@ class block_comments extends block_base {
$cmt->itemid = $this->instance->id;
$cmt->course = $this->page->course;
// this is a hack to adjust commenting UI
// in block_comments
// in block_comments
$cmt->env = 'block_comments';
$cmt->linktext = get_string('showcomments');
$comment = new comment($cmt);
......
......@@ -10,7 +10,11 @@ class block_messages extends block_base {
global $USER, $CFG, $DB, $OUTPUT;
if (!$CFG->messaging) {
return '';
$this->content->text = '';
if ($this->page->user_is_editing()) {
$this->content->text = get_string('disabled', 'message');
}
return $this->content;
}
if ($this->content !== NULL) {
......
......@@ -57,6 +57,14 @@
return $this->content;
}
if (!$CFG->enablerssfeeds) {
$this->content->text = '';
if ($this->page->user_is_editing()) {
$this->content->text = get_string('disabledrssfeeds', 'block_rss_client');
}
return $this->content;
}
// initalise block content object
$this->content = new stdClass;
$this->content->text = '';
......
......@@ -42,6 +42,9 @@ class block_tags extends block_base {
if (empty($CFG->usetags)) {
$this->content->text = '';
if ($this->page->user_is_editing()) {
$this->content->text = get_string('disabledtags', 'block_tags');
}
return $this->content;
}
......
......@@ -17,6 +17,7 @@ $string['configblock'] = 'Configure this block';
$string['couldnotfindfeed'] = 'Could not find feed with id';
$string['customtitlelabel'] = 'Custom title (leave blank to use title supplied by feed):';
$string['deletefeedconfirm'] = 'Are you sure you want to delete this feed?';
$string['disabledrssfeeds'] = 'RSS feeds are disabled';
$string['displaydescriptionlabel'] = 'Display each link\'s description?';
$string['editafeed'] = 'Edit a feed';
$string['editfeeds'] = 'Edit, subscribe or unsubsribe from RSS/Atom news feeds';
......
......@@ -14,6 +14,7 @@ $string['communitytags2'] = 'Show all user created course tags';
$string['coursetags'] = 'Course tags:';
$string['coursetags1'] = 'course tags';
$string['coursetags2'] = 'Show tags for this course';
$string['disabledtags'] = 'Tags are disabled';
$string['edit'] = 'edit...';
$string['editdeletemytag'] = 'Delete tag from this course:';
$string['editmytags'] = 'My tags - shortcuts to all your tagged courses.';
......
......@@ -445,6 +445,7 @@ $string['detailedmore'] = 'More detailed';
$string['directory'] = 'Directory';
$string['directorypaths'] = 'Directory Paths';
$string['disable'] = 'Disable';
$string['disabledcomments'] = 'Comments are disabled';
$string['displayingfirst'] = 'Only the first $a->count $a->things are displayed';
$string['displayingrecords'] = 'Displaying $a records';
$string['displayingusers'] = 'Displaying users $a->start to $a->end';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment