示例#1
0
    if ($bitwise & SYNCH_RESTORE_MERGED_BACKUP_TO_REMOTE_HOST) {
        $restoredMergedBackupToRemoteHost = $SynchManager->restoreMergedBackupToRemoteHost($page->id, $files, $page->session);
    }
    /*
     * Clean up afterwards. Remove the backup files that have been created.
     */
    $SynchManager->clearSessionBackups($page->session);
    /*
     * Restore max execution time to its original value
     */
    set_time_limit($originalMaxExecutionTime);
    // We don't have merging working so assume the synching worked and set the completed flag in the session
    $page->session->finished = true;
}
// Save the session
synch_Session_controller::saveSession($session);
// If we're on a secure page ensure all urls are secure to prevent browser error
$securewwwroot = synch_get_http_prefix();
$featuretitle = get_string('synchronise', 'synch');
if ($page->session->finished) {
    $pagetitle = get_string('session_finish', 'synch');
} else {
    $pagetitle = get_string('session_start', 'synch');
}
// Create the navigation menu
$nav = '<a href="' . $securewwwroot . '/synch/">' . get_string('synchronise', 'synch') . '</a> -> ' . $pagetitle;
/// Print header.
$navlinks = array();
$navlinks[] = array('name' => $featuretitle, 'link' => 'index.php', 'type' => 'activity');
$navlinks[] = array('name' => format_string($pagetitle), 'link' => 'session_start.php?id=' . $page->id, 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
示例#2
0
文件: lib.php 项目: r007/PMoodle
function backupCourseByCourseId($courseId)
{
    global $SynchManager;
    global $Out;
    // Ok the course has now been created so let's backup it up
    $sessionId = null;
    $type = synch_view_controller::$TYPE_ID_COURSE;
    /*
     * Begin the process of restoring the session
     * 
     * Load the session using the session id. If no session exists, create one.
     */
    $session = synch_Session_controller::loadSession($sessionId);
    //$Out->append('$type = '.$type);
    //$Out->flush();
    $created = $SynchManager->createBackupByIdAndType($session, $courseId, $type);
}
示例#3
0
        print_error('coursenotcreated');
    }
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    // assign default role to creator if not already having permission to manage course assignments
    if (!has_capability('moodle/course:view', $context) or !has_capability('moodle/role:assign', $context)) {
        role_assign($CFG->creatornewroleid, $USER->id, 0, $context->id);
    }
    // ensure we can use the course right after creating it
    // this means trigger a reload of accessinfo...
    mark_context_dirty($context->path);
    print_box('course successfully created.');
} else {
    if (!update_course($data)) {
        print_error('coursenotupdated');
    }
    // MDL-9983
    events_trigger('course_updated', $data);
}
// Ok the course has now been created so let's backup it up
$sessionId = null;
$id = $course->id;
$type = synch_view_controller::$TYPE_ID_COURSE;
/*
 * Begin the process of restoring the session
 * 
 * Load the session using the session id. If no session exists, create one.
 */
$session = synch_Session_controller::loadSession($sessionId);
$Out->append('$type = ' . $type);
$Out->flush();
$created = $SynchManager->createBackupByIdAndType($session, $id, $type);