本文整理汇总了PHP中upgrade_extra_credit_weightoverride函数的典型用法代码示例。如果您正苦于以下问题:PHP upgrade_extra_credit_weightoverride函数的具体用法?PHP upgrade_extra_credit_weightoverride怎么用?PHP upgrade_extra_credit_weightoverride使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upgrade_extra_credit_weightoverride函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: xmldb_main_upgrade
//.........这里部分代码省略.........
// See if it exists.
if (strpos($oldconfig, $messagesconfig) === false) {
// See if preferences exists.
if (strpos($oldconfig, "preferences,moodle|/user/preferences.php|preferences") !== false) {
// Insert it before preferences.
$newconfig = str_replace($preferencesconfig, $messagesconfig . "\n" . $preferencesconfig, $oldconfig);
} else {
// Custom config - we can only insert it at the end.
$newconfig = $oldconfig . "\n" . $messagesconfig;
}
set_config('customusermenuitems', $newconfig);
}
upgrade_main_savepoint(true, 2015050401.0);
}
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2015060400.02) {
// Sites that were upgrading from 2.7 and older will ignore this step.
if (empty($CFG->upgrade_minmaxgradestepignored)) {
upgrade_minmaxgrade();
// Flags this upgrade step as already run to prevent it from running multiple times.
set_config('upgrade_minmaxgradestepignored', 1);
}
upgrade_main_savepoint(true, 2015060400.02);
}
if ($oldversion < 2015061900.0) {
// MDL-49257. Changed the algorithm of calculating automatic weights of extra credit items.
// Before the change, in case when grade category (in "Natural" agg. method) had items with
// overridden weights, the automatic weight of extra credit items was illogical.
// In order to prevent grades changes after the upgrade we need to freeze gradebook calculation
// for the affected courses.
// This script in included in each major version upgrade process so make sure we don't run it twice.
if (empty($CFG->upgrade_extracreditweightsstepignored)) {
upgrade_extra_credit_weightoverride();
// To skip running the same script on the upgrade to the next major release.
set_config('upgrade_extracreditweightsstepignored', 1);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2015061900.0);
}
if ($oldversion < 2015062500.01) {
// MDL-48239. Changed calculated grade items so that the maximum and minimum grade can be set.
// If the changes are accepted and a regrade is done on the gradebook then some grades may change significantly.
// This is here to freeze the gradebook in affected courses.
// This script is included in each major version upgrade process so make sure we don't run it twice.
if (empty($CFG->upgrade_calculatedgradeitemsignored)) {
upgrade_calculated_grade_items();
// To skip running the same script on the upgrade to the next major release.
set_config('upgrade_calculatedgradeitemsignored', 1);
// This config value is never used again.
unset_config('upgrade_calculatedgradeitemsonlyregrade');
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2015062500.01);
}
if ($oldversion < 2015081300.01) {
// Define field importtype to be added to grade_import_values.
$table = new xmldb_table('grade_import_values');
$field = new xmldb_field('importonlyfeedback', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'importer');
// Conditionally launch add field importtype.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2015081300.01);
}
开发者ID:isuruAb,项目名称:moodle,代码行数:67,代码来源:upgrade.php
示例2: test_upgrade_extra_credit_weightoverride
public function test_upgrade_extra_credit_weightoverride()
{
global $DB, $CFG;
$this->resetAfterTest(true);
$c = array();
$a = array();
$gi = array();
for ($i = 0; $i < 5; $i++) {
$c[$i] = $this->getDataGenerator()->create_course();
$a[$i] = array();
$gi[$i] = array();
for ($j = 0; $j < 3; $j++) {
$a[$i][$j] = $this->getDataGenerator()->create_module('assign', array('course' => $c[$i], 'grade' => 100));
$giparams = array('itemtype' => 'mod', 'itemmodule' => 'assign', 'iteminstance' => $a[$i][$j]->id, 'courseid' => $c[$i]->id, 'itemnumber' => 0);
$gi[$i][$j] = grade_item::fetch($giparams);
}
}
// Case 1: Course $c[0] has aggregation method different from natural.
$coursecategory = grade_category::fetch_course_category($c[0]->id);
$coursecategory->aggregation = GRADE_AGGREGATE_WEIGHTED_MEAN;
$coursecategory->update();
$gi[0][1]->aggregationcoef = 1;
$gi[0][1]->update();
$gi[0][2]->weightoverride = 1;
$gi[0][2]->update();
// Case 2: Course $c[1] has neither extra credits nor overrides
// Case 3: Course $c[2] has extra credits but no overrides
$gi[2][1]->aggregationcoef = 1;
$gi[2][1]->update();
// Case 4: Course $c[3] has no extra credits and has overrides
$gi[3][2]->weightoverride = 1;
$gi[3][2]->update();
// Case 5: Course $c[4] has both extra credits and overrides
$gi[4][1]->aggregationcoef = 1;
$gi[4][1]->update();
$gi[4][2]->weightoverride = 1;
$gi[4][2]->update();
// Run the upgrade script and make sure only course $c[4] was marked as needed to be fixed.
upgrade_extra_credit_weightoverride();
$this->assertTrue(empty($CFG->{'gradebook_calculations_freeze_' . $c[0]->id}));
$this->assertTrue(empty($CFG->{'gradebook_calculations_freeze_' . $c[1]->id}));
$this->assertTrue(empty($CFG->{'gradebook_calculations_freeze_' . $c[2]->id}));
$this->assertTrue(empty($CFG->{'gradebook_calculations_freeze_' . $c[3]->id}));
$this->assertEquals(20150619, $CFG->{'gradebook_calculations_freeze_' . $c[4]->id});
set_config('gradebook_calculations_freeze_' . $c[4]->id, null);
// Run the upgrade script for a single course only.
upgrade_extra_credit_weightoverride($c[0]->id);
$this->assertTrue(empty($CFG->{'gradebook_calculations_freeze_' . $c[0]->id}));
upgrade_extra_credit_weightoverride($c[4]->id);
$this->assertEquals(20150619, $CFG->{'gradebook_calculations_freeze_' . $c[4]->id});
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:51,代码来源:upgradelib_test.php
示例3: xmldb_main_upgrade
//.........这里部分代码省略.........
// See if it exists.
if (strpos($oldconfig, $messagesconfig) === false) {
// See if preferences exists.
if (strpos($oldconfig, "preferences,moodle|/user/preferences.php|preferences") !== false) {
// Insert it before preferences.
$newconfig = str_replace($preferencesconfig, $messagesconfig . "\n" . $preferencesconfig, $oldconfig);
} else {
// Custom config - we can only insert it at the end.
$newconfig = $oldconfig . "\n" . $messagesconfig;
}
set_config('customusermenuitems', $newconfig);
}
upgrade_main_savepoint(true, 2015050401.0);
}
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2015060400.02) {
// Sites that were upgrading from 2.7 and older will ignore this step.
if (empty($CFG->upgrade_minmaxgradestepignored)) {
upgrade_minmaxgrade();
// Flags this upgrade step as already run to prevent it from running multiple times.
set_config('upgrade_minmaxgradestepignored', 1);
}
upgrade_main_savepoint(true, 2015060400.02);
}
if ($oldversion < 2015061900.0) {
// MDL-49257. Changed the algorithm of calculating automatic weights of extra credit items.
// Before the change, in case when grade category (in "Natural" agg. method) had items with
// overridden weights, the automatic weight of extra credit items was illogical.
// In order to prevent grades changes after the upgrade we need to freeze gradebook calculation
// for the affected courses.
// This script in included in each major version upgrade process so make sure we don't run it twice.
if (empty($CFG->upgrade_extracreditweightsstepignored)) {
upgrade_extra_credit_weightoverride();
// To skip running the same script on the upgrade to the next major release.
set_config('upgrade_extracreditweightsstepignored', 1);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2015061900.0);
}
if ($oldversion < 2015062500.01) {
// MDL-48239. Changed calculated grade items so that the maximum and minimum grade can be set.
// If the changes are accepted and a regrade is done on the gradebook then some grades may change significantly.
// This is here to freeze the gradebook in affected courses.
// This script is included in each major version upgrade process so make sure we don't run it twice.
if (empty($CFG->upgrade_calculatedgradeitemsignored)) {
upgrade_calculated_grade_items();
// To skip running the same script on the upgrade to the next major release.
set_config('upgrade_calculatedgradeitemsignored', 1);
// This config value is never used again.
unset_config('upgrade_calculatedgradeitemsonlyregrade');
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2015062500.01);
}
if ($oldversion < 2015081300.01) {
// Define field importtype to be added to grade_import_values.
$table = new xmldb_table('grade_import_values');
$field = new xmldb_field('importonlyfeedback', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'importer');
// Conditionally launch add field importtype.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2015081300.01);
}
开发者ID:aleph-n,项目名称:lms.aaenl,代码行数:67,代码来源:upgrade.php
示例4: gradebook_calculation_freeze
/**
* Freeze gradebook calculation if needed.
*
* This is similar to various upgrade scripts that check if the freeze is needed.
*/
protected function gradebook_calculation_freeze()
{
global $CFG;
$gradebookcalculationsfreeze = get_config('core', 'gradebook_calculations_freeze_' . $this->get_courseid());
preg_match('/(\\d{8})/', $this->get_task()->get_info()->moodle_release, $matches);
$backupbuild = (int) $matches[1];
// The function floatval will return a float even if there is text mixed with the release number.
$backuprelease = floatval($this->get_task()->get_info()->backup_release);
// Extra credits need adjustments only for backups made between 2.8 release (20141110) and the fix release (20150619).
if (!$gradebookcalculationsfreeze && $backupbuild >= 20141110 && $backupbuild < 20150619) {
require_once $CFG->libdir . '/db/upgradelib.php';
upgrade_extra_credit_weightoverride($this->get_courseid());
}
// Calculated grade items need recalculating for backups made between 2.8 release (20141110) and the fix release (20150627).
if (!$gradebookcalculationsfreeze && $backupbuild >= 20141110 && $backupbuild < 20150627) {
require_once $CFG->libdir . '/db/upgradelib.php';
upgrade_calculated_grade_items($this->get_courseid());
}
// Courses from before 3.1 (20160518) may have a letter boundary problem and should be checked for this issue.
// Backups from before and including 2.9 could have a build number that is greater than 20160518 and should
// be checked for this problem.
if (!$gradebookcalculationsfreeze && ($backupbuild < 20160518 || $backuprelease <= 2.9)) {
require_once $CFG->libdir . '/db/upgradelib.php';
upgrade_course_letter_boundary($this->get_courseid());
}
}
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:restore_stepslib.php
示例5: gradebook_calculation_freeze
/**
* Freeze gradebook calculation if needed.
*
* This is similar to various upgrade scripts that check if the freeze is needed.
*/
protected function gradebook_calculation_freeze()
{
global $CFG;
$gradebookcalculationsfreeze = get_config('core', 'gradebook_calculations_freeze_' . $this->get_courseid());
preg_match('/(\\d{8})/', $this->get_task()->get_info()->moodle_release, $matches);
$backupbuild = (int) $matches[1];
// Extra credits need adjustments only for backups made between 2.8 release (20141110) and the fix release (20150619).
if (!$gradebookcalculationsfreeze && $backupbuild >= 20141110 && $backupbuild < 20150619) {
require_once $CFG->libdir . '/db/upgradelib.php';
upgrade_extra_credit_weightoverride($this->get_courseid());
}
// Calculated grade items need recalculating for backups made between 2.8 release (20141110) and the fix release (20150627).
if (!$gradebookcalculationsfreeze && $backupbuild >= 20141110 && $backupbuild < 20150627) {
require_once $CFG->libdir . '/db/upgradelib.php';
upgrade_calculated_grade_items($this->get_courseid());
}
}
开发者ID:reconnectmedia,项目名称:moodle,代码行数:22,代码来源:restore_stepslib.php
示例6: xmldb_main_upgrade
//.........这里部分代码省略.........
// See if it exists.
if (strpos($oldconfig, $messagesconfig) === false) {
// See if preferences exists.
if (strpos($oldconfig, "preferences,moodle|/user/preferences.php|preferences") !== false) {
// Insert it before preferences.
$newconfig = str_replace($preferencesconfig, $messagesconfig . "\n" . $preferencesconfig, $oldconfig);
} else {
// Custom config - we can only insert it at the end.
$newconfig = $oldconfig . "\n" . $messagesconfig;
}
set_config('customusermenuitems', $newconfig);
}
upgrade_main_savepoint(true, 2015050401.0);
}
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2015060400.02) {
// Sites that were upgrading from 2.7 and older will ignore this step.
if (empty($CFG->upgrade_minmaxgradestepignored)) {
upgrade_minmaxgrade();
// Flags this upgrade step as already run to prevent it from running multiple times.
set_config('upgrade_minmaxgradestepignored', 1);
}
upgrade_main_savepoint(true, 2015060400.02);
}
if ($oldversion < 2015061900.0) {
// MDL-49257. Changed the algorithm of calculating automatic weights of extra credit items.
// Before the change, in case when grade category (in "Natural" agg. method) had items with
// overridden weights, the automatic weight of extra credit items was illogical.
// In order to prevent grades changes after the upgrade we need to freeze gradebook calculation
// for the affected courses.
// This script in included in each major version upgrade process so make sure we don't run it twice.
if (empty($CFG->upgrade_extracreditweightsstepignored)) {
upgrade_extra_credit_weightoverride();
// To skip running the same script on the upgrade to the next major release.
set_config('upgrade_extracreditweightsstepignored', 1);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2015061900.0);
}
if ($oldversion < 2015062500.01) {
// MDL-48239. Changed calculated grade items so that the maximum and minimum grade can be set.
// If the changes are accepted and a regrade is done on the gradebook then some grades may change significantly.
// This is here to freeze the gradebook in affected courses.
// This script is included in each major version upgrade process so make sure we don't run it twice.
if (empty($CFG->upgrade_calculatedgradeitemsignored)) {
upgrade_calculated_grade_items();
// To skip running the same script on the upgrade to the next major release.
set_config('upgrade_calculatedgradeitemsignored', 1);
// This config value is never used again.
unset_config('upgrade_calculatedgradeitemsonlyregrade');
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2015062500.01);
}
if ($oldversion < 2015081300.01) {
// Define field importtype to be added to grade_import_values.
$table = new xmldb_table('grade_import_values');
$field = new xmldb_field('importonlyfeedback', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'importer');
// Conditionally launch add field importtype.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2015081300.01);
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:67,代码来源:upgrade.php
注:本文中的upgrade_extra_credit_weightoverride函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论