MDL-13000 Adding support for developers to add their own capabilities to local/db/access.php

This relies on a local/ language pack as well for the capability names.
Notes on implementation are in lib/locallib.php
This commit is contained in:
mjollnir_
2008-01-15 04:20:02 +00:00
parent 0972aa2291
commit 33c34c5705
3 changed files with 33 additions and 1 deletions
+11 -1
View File
@@ -3141,6 +3141,9 @@ function get_cached_capabilities($component='moodle') {
if ($component == 'moodle') {
$storedcaps = get_records_select('capabilities',
"name LIKE 'moodle/%:%'");
} else if ($component == 'local') {
$storedcaps = get_records_select('capabilities',
"name LIKE 'moodle/local:%'");
} else {
$storedcaps = get_records_select('capabilities',
"name LIKE '$component:%'");
@@ -3787,7 +3790,11 @@ function get_capability_string($capabilityname) {
break;
case 'moodle':
$string = get_string($stringname, 'role');
if ($componentname == 'local') {
$string = get_string($stringname, 'local');
} else {
$string = get_string($stringname, 'role');
}
break;
case 'enrol':
@@ -3835,6 +3842,9 @@ function get_component_string($component, $contextlevel) {
} else if (preg_match('|^block/|', $component)) {
$langname = str_replace('/', '_', $component);
$string = get_string('blockname', $langname);
} else if (preg_match('|^local|', $component)) {
$langname = str_replace('/', '_', $component);
$string = get_string('local');
} else {
$string = get_string('coresystem');
}