MDL-19676 Properly hiding blog_menu from block dropdown when blogs are disabled. Also showing "Blogs are disabled" in existing blog_menu blocks and removing old bloglevel options from subsystems settings

This commit is contained in:
nicolasconnault
2009-09-15 07:19:03 +00:00
parent 0352a31904
commit ca497f4f7c
4 changed files with 28 additions and 6 deletions
+24
View File
@@ -2748,6 +2748,30 @@ class admin_setting_sitesetselect extends admin_setting_configselect {
}
}
/**
* Select for blog's bloglevel setting: if set to 0, will set blog_menu
* block to hidden.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_setting_bloglevel extends admin_setting_configselect {
/**
* Updates the database and save the setting
*
* @param string data
* @return string empty or error message
*/
public function write_setting($data) {
global $DB;
if ($data['bloglevel'] == 0) {
$DB->set_field('block', 'visible', 0, array('name' => 'blog_menu'));
} else {
$DB->set_field('block', 'visible', 1, array('name' => 'blog_menu'));
}
return parent::write_setting($data);
}
}
/**
* Special select - lists on the frontpage - hacky
*