Beispiel #1
0
$PAGE->set_pagelayout('standard');
$PAGE->set_url($url);
$PAGE->set_title($title);
$PAGE->set_heading(get_string('pluginname', 'tool_lpmigrate'));
$output = $PAGE->get_renderer('tool_lpmigrate');
echo $output->header();
echo $output->heading($title);
$form = new \tool_lpmigrate\form\migrate_framework($context);
if ($form->is_cancelled()) {
    redirect($url);
} else {
    if ($data = $form->get_data()) {
        // Map competencies from both framework.
        $mapper = new \tool_lpmigrate\framework_mapper($data->from, $data->to);
        $mapper->automap();
        $progress = new \core\progress\display();
        $progress->set_display_names(true);
        $processor = new \tool_lpmigrate\framework_processor($mapper, $progress);
        if (!empty($data->allowedcourses)) {
            $processor->set_allowedcourses($data->allowedcourses);
        }
        if (!empty($data->disallowedcourses)) {
            $processor->set_disallowedcourses($data->disallowedcourses);
        }
        $processor->set_course_start_date_from($data->coursestartdate);
        $processor->proceed();
        $unmappedfrom = $mapper->get_unmapped_objects_from();
        $unmappedto = $mapper->get_unmapped_objects_to();
        $renderable = new \tool_lpmigrate\output\migrate_framework_results($context, $processor, \core_competency\api::read_framework($data->from), \core_competency\api::read_framework($data->to), $unmappedfrom, $unmappedto);
        echo $output->render($renderable);
    } else {
Beispiel #2
0
// Prepare the import UI
$backup = new import_ui($bc, array('importid' => $importcourse->id, 'target' => $restoretarget));
// Process the current stage
$backup->process();
// If this is the confirmation stage remove the filename setting
if ($backup->get_stage() == backup_ui::STAGE_CONFIRMATION) {
    $backup->get_setting('filename')->set_visibility(backup_setting::HIDDEN);
}
// If it's the final stage process the import
if ($backup->get_stage() == backup_ui::STAGE_FINAL) {
    echo $OUTPUT->header();
    // Display an extra progress bar so that we can show the current stage.
    echo html_writer::start_div('', array('id' => 'executionprogress'));
    echo $renderer->progress_bar($backup->get_progress_bar());
    // Start the progress display - we split into 2 chunks for backup and restore.
    $progress = new \core\progress\display();
    $progress->start_progress('', 2);
    $backup->get_controller()->set_progress($progress);
    // Prepare logger for backup.
    $logger = new core_backup_html_logger($CFG->debugdeveloper ? backup::LOG_DEBUG : backup::LOG_INFO);
    $backup->get_controller()->add_logger($logger);
    // First execute the backup
    $backup->execute();
    $backup->destroy();
    unset($backup);
    // Note that we've done that progress.
    $progress->progress(1);
    // Check whether the backup directory still exists. If missing, something
    // went really wrong in backup, throw error. Note that backup::MODE_IMPORT
    // backups don't store resulting files ever
    $tempdestination = $CFG->tempdir . '/backup/' . $backupid;