本文整理汇总了PHP中backup_controller::get_mode方法的典型用法代码示例。如果您正苦于以下问题:PHP backup_controller::get_mode方法的具体用法?PHP backup_controller::get_mode怎么用?PHP backup_controller::get_mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backup_controller
的用法示例。
在下文中一共展示了backup_controller::get_mode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apply_config_defaults
/**
* Sets the default values for the settings in a backup operation
*
* Based on the mode of the backup it will load proper defaults
* using {@link apply_admin_config_defaults}.
*
* @param backup_controller $controller
*/
public static function apply_config_defaults(backup_controller $controller)
{
// Based on the mode of the backup (general, automated, import, hub...)
// decide the action to perform to get defaults loaded
$mode = $controller->get_mode();
switch ($mode) {
case backup::MODE_GENERAL:
// Load the general defaults
$settings = array('backup_general_users' => 'users', 'backup_general_anonymize' => 'anonymize', 'backup_general_role_assignments' => 'role_assignments', 'backup_general_activities' => 'activities', 'backup_general_blocks' => 'blocks', 'backup_general_filters' => 'filters', 'backup_general_comments' => 'comments', 'backup_general_badges' => 'badges', 'backup_general_calendarevents' => 'calendarevents', 'backup_general_userscompletion' => 'userscompletion', 'backup_general_logs' => 'logs', 'backup_general_histories' => 'grade_histories', 'backup_general_questionbank' => 'questionbank', 'backup_general_groups' => 'groups', 'backup_general_competencies' => 'competencies');
self::apply_admin_config_defaults($controller, $settings, true);
break;
case backup::MODE_IMPORT:
// Load the import defaults.
$settings = array('backup_import_activities' => 'activities', 'backup_import_blocks' => 'blocks', 'backup_import_filters' => 'filters', 'backup_import_calendarevents' => 'calendarevents', 'backup_import_questionbank' => 'questionbank', 'backup_import_groups' => 'groups', 'backup_import_competencies' => 'competencies');
self::apply_admin_config_defaults($controller, $settings, true);
break;
case backup::MODE_AUTOMATED:
// Load the automated defaults.
$settings = array('backup_auto_users' => 'users', 'backup_auto_role_assignments' => 'role_assignments', 'backup_auto_activities' => 'activities', 'backup_auto_blocks' => 'blocks', 'backup_auto_filters' => 'filters', 'backup_auto_comments' => 'comments', 'backup_auto_badges' => 'badges', 'backup_auto_calendarevents' => 'calendarevents', 'backup_auto_userscompletion' => 'userscompletion', 'backup_auto_logs' => 'logs', 'backup_auto_histories' => 'grade_histories', 'backup_auto_questionbank' => 'questionbank', 'backup_auto_groups' => 'groups', 'backup_auto_competencies' => 'competencies');
self::apply_admin_config_defaults($controller, $settings, false);
break;
default:
// Nothing to do for other modes (HUB...). Some day we
// can define defaults (admin UI...) for them if we want to
}
}
示例2: apply_config_defaults
/**
* Sets the default values for the settings in a backup operation
*
* Based on the mode of the backup it will delegate the process to
* other methods like {@link apply_general_config_defaults} ...
* to get proper defaults loaded
*
* @param backup_controller $controller
*/
public static function apply_config_defaults(backup_controller $controller)
{
// Based on the mode of the backup (general, automated, import, hub...)
// decide the action to perform to get defaults loaded
$mode = $controller->get_mode();
switch ($mode) {
case backup::MODE_GENERAL:
// Load the general defaults
self::apply_general_config_defaults($controller);
break;
case backup::MODE_AUTOMATED:
// TODO: Move the loading from automatic stuff to here
break;
default:
// Nothing to do for other modes (IMPORT/HUB...). Some day we
// can define defaults (admin UI...) for them if we want to
}
}