Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chamilo-lms/tests/scripts/update_course_settings.php

46 lines
858 B

<?php
/* For licensing terms, see /license.txt */
/**
* Bulk update course settings.
*/
exit;
require __DIR__.'/../../main/inc/global.inc.php';
// params
$settingsWithValues = [
//'student_delete_own_publication' => 1,
];
$courseIdList = [
];
// process
if (empty($courseIdList)) {
$result = Database::select(
'id',
Database::get_main_table(TABLE_MAIN_COURSE)
);
$courseIdList = array_column($result, 'id');
}
$appPlugin = new AppPlugin();
foreach ($courseIdList as $courseId) {
echo "Course ID: $courseId".PHP_EOL;
foreach ($settingsWithValues as $setting => $value) {
CourseManager::saveCourseConfigurationSetting(
$appPlugin,
$setting,
$value,
$courseId
);
echo "\tSetting: $setting <- value: ".((string) $value).PHP_EOL;
}
}