MDL-7401 Course format database/backup/lang/stylesheet/capability support

This commit is contained in:
sam_marshall 2006-12-11 15:47:23 +00:00
parent b7e771ce20
commit ae628043a0
15 changed files with 344 additions and 10 deletions

View file

@ -2140,6 +2140,11 @@ function load_capability_def($component) {
$defpath = $CFG->dirroot.'/'.$compparts[0].
's/'.$compparts[1].'/db/access.php';
$varprefix = $compparts[0].'_'.$compparts[1];
} else if ($compparts[0] == 'format') {
// Similar to the above, course formats are 'format' while they
// are stored in 'course/format'.
$defpath = $CFG->dirroot.'/course/'.$component.'/db/access.php';
$varprefix = $compparts[0].'_'.$compparts[1];
} else {
$defpath = $CFG->dirroot.'/'.$component.'/db/access.php';
$varprefix = str_replace('/', '_', $component);
@ -2694,6 +2699,10 @@ function get_capability_string($capabilityname) {
case 'enrol':
$string = get_string($stringname, 'enrol_'.$componentname);
break;
case 'format':
$string = get_string($stringname, 'format_'.$componentname);
break;
default:
$string = get_string($stringname);

View file

@ -113,7 +113,7 @@ function upgrade_plugins($type, $dir, $return) {
if ($status) {
// OK so far, now update the plugins record
set_config($pluginversion, $plugin->version);
if (!update_capabilities($dir.'/'.$plug)) {
if (!update_capabilities($type.'/'.$plug)) {
error('Could not set up the capabilities for '.$module->name.'!');
}
notify(get_string('modulesuccess', '', $plugin->name), 'notifysuccess');
@ -150,7 +150,7 @@ function upgrade_plugins($type, $dir, $return) {
if ($oldupgrade_status && $newupgrade_status) { // No upgrading failed
// OK so far, now update the plugins record
set_config($pluginversion, $plugin->version);
if (!update_capabilities($dir.'/'.$plug)) {
if (!update_capabilities($type.'/'.$plug)) {
error('Could not update '.$plugin->name.' capabilities!');
}
notify(get_string('modulesuccess', '', $plugin->name), 'notifysuccess');

View file

@ -4310,6 +4310,8 @@ function get_string($identifier, $module='', $a=NULL, $extralocations=NULL) {
} else if (strpos($module, 'report_') === 0) { // It's a report lang file
$locations[] = $CFG->dirroot .'/'.$CFG->admin.'/report/'.substr($module, 7).'/lang/';
$locations[] = $CFG->dirroot .'/course/report/'.substr($module, 7).'/lang/';
} else if (strpos($module, 'format_') === 0) { // Course format
$locations[] = $CFG->dirroot .'/course/format/'.substr($module,7).'/lang/';
} else { // It's a normal activity
$locations[] = $CFG->dirroot .'/mod/'.$module.'/lang/';
}

View file

@ -2445,6 +2445,16 @@ function style_sheet_setup($lastmodified=0, $lifetime=300, $themename='', $force
}
}
if (!isset($THEME->courseformatsheets) || $THEME->courseformatsheets) { // Search for styles.php in course formats
if ($mods = get_list_of_plugins('format','',$CFG->dirroot.'/course')) {
foreach ($mods as $mod) {
if (file_exists($CFG->dirroot.'/course/format/'.$mod.'/styles.php')) {
$files[] = array($CFG->dirroot, '/course/format/'.$mod.'/styles.php');
}
}
}
}
if (!empty($THEME->langsheets)) { // Search for styles.php within the current language
if (file_exists($CFG->dirroot.'/lang/'.$lang.'/styles.php')) {
$files[] = array($CFG->dirroot, '/lang/'.$lang.'/styles.php');