| Línea 24... |
Línea 24... |
| 24 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
24 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| 25 |
*/
|
25 |
*/
|
| Línea 26... |
Línea 26... |
| 26 |
|
26 |
|
| Línea -... |
Línea 27... |
| - |
|
27 |
defined('MOODLE_INTERNAL') || die();
|
| - |
|
28 |
|
| - |
|
29 |
use core\di;
|
| - |
|
30 |
use core\hook\manager;
|
| 27 |
defined('MOODLE_INTERNAL') || die();
|
31 |
use core_backup\hook\after_restore_root_define_settings;
|
| 28 |
|
32 |
|
| 29 |
/**
|
33 |
/**
|
| 30 |
* Start task that provides all the settings common to all restores and other initial steps
|
34 |
* Start task that provides all the settings common to all restores and other initial steps
|
| 31 |
*
|
35 |
*
|
| Línea 298... |
Línea 302... |
| 298 |
$hascompetencies = !empty($rootsettings['competencies']);
|
302 |
$hascompetencies = !empty($rootsettings['competencies']);
|
| 299 |
$competencies = new restore_competencies_setting($hascompetencies);
|
303 |
$competencies = new restore_competencies_setting($hascompetencies);
|
| 300 |
$competencies->set_ui(new backup_setting_ui_checkbox($competencies, get_string('rootsettingcompetencies', 'backup')));
|
304 |
$competencies->set_ui(new backup_setting_ui_checkbox($competencies, get_string('rootsettingcompetencies', 'backup')));
|
| 301 |
$this->add_setting($competencies);
|
305 |
$this->add_setting($competencies);
|
| Línea -... |
Línea 306... |
| - |
|
306 |
|
| - |
|
307 |
// Custom fields.
|
| - |
|
308 |
$defaultvalue = false;
|
| - |
|
309 |
$changeable = false;
|
| - |
|
310 |
if (isset($rootsettings['customfield']) && $rootsettings['customfield']) { // Only enabled when available.
|
| - |
|
311 |
$defaultvalue = true;
|
| - |
|
312 |
$changeable = true;
|
| 302 |
|
313 |
}
|
| 303 |
$customfields = new restore_customfield_setting('customfields', base_setting::IS_BOOLEAN, $defaultvalue);
|
314 |
$customfields = new restore_customfield_setting('customfield', base_setting::IS_BOOLEAN, $defaultvalue);
|
| - |
|
315 |
$customfields->set_ui(new backup_setting_ui_checkbox($customfields, get_string('rootsettingcustomfield', 'backup')));
|
| 304 |
$customfields->set_ui(new backup_setting_ui_checkbox($customfields, get_string('rootsettingcustomfield', 'backup')));
|
316 |
$customfields->get_ui()->set_changeable($changeable);
|
| Línea 305... |
Línea 317... |
| 305 |
$this->add_setting($customfields);
|
317 |
$this->add_setting($customfields);
|
| 306 |
|
318 |
|
| 307 |
// Define Content bank content.
|
319 |
// Define Content bank content.
|
| Línea 333... |
Línea 345... |
| 333 |
$changeable = true;
|
345 |
$changeable = true;
|
| 334 |
$legacyfiles = new restore_generic_setting('legacyfiles', base_setting::IS_BOOLEAN, $defaultvalue);
|
346 |
$legacyfiles = new restore_generic_setting('legacyfiles', base_setting::IS_BOOLEAN, $defaultvalue);
|
| 335 |
$legacyfiles->set_ui(new backup_setting_ui_checkbox($legacyfiles, get_string('rootsettinglegacyfiles', 'backup')));
|
347 |
$legacyfiles->set_ui(new backup_setting_ui_checkbox($legacyfiles, get_string('rootsettinglegacyfiles', 'backup')));
|
| 336 |
$legacyfiles->get_ui()->set_changeable($changeable);
|
348 |
$legacyfiles->get_ui()->set_changeable($changeable);
|
| 337 |
$this->add_setting($legacyfiles);
|
349 |
$this->add_setting($legacyfiles);
|
| - |
|
350 |
|
| - |
|
351 |
// Create and dispatch a hook to allow plugins to add other settings for the restore process.
|
| - |
|
352 |
$hook = new after_restore_root_define_settings($this);
|
| - |
|
353 |
di::get(manager::class)->dispatch($hook);
|
| 338 |
}
|
354 |
}
|
| 339 |
}
|
355 |
}
|