moodle/site:manageblocks tweak

This commit is contained in:
vyshane 2006-09-13 03:56:38 +00:00
parent 260a56b114
commit 0c4d9f492e

View file

@ -1341,10 +1341,20 @@ function load_capability_def($component) {
if ($component == 'moodle') { if ($component == 'moodle') {
$defpath = $CFG->libdir.'/db/access.php'; $defpath = $CFG->libdir.'/db/access.php';
$varprefix = 'moodle'; $varprefix = 'moodle';
} else {
$compparts = explode('/', $component);
if ($compparts[0] == 'block') {
// Blocks are an exception. Blocks directory is 'blocks', and not
// 'block'. So we need to jump through hoops.
$defpath = $CFG->dirroot.'/'.$compparts[0].
's/'.$compparts[1].'/db/access.php';
$varprefix = $compparts[0].'_'.$compparts[1];
} else { } else {
$defpath = $CFG->dirroot.'/'.$component.'/db/access.php'; $defpath = $CFG->dirroot.'/'.$component.'/db/access.php';
$varprefix = str_replace('/', '_', $component); $varprefix = str_replace('/', '_', $component);
} }
}
$capabilities = array(); $capabilities = array();
if (file_exists($defpath)) { if (file_exists($defpath)) {