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); }
$page->sessionId = $sessionId; /* * @var string $page->id The data item id that we are about to synchronise. * Data item id's contain data about the type of content they represent and * correspondingly denote the moodle db table they refer to along with the * Moodle instance ie offline moodle or the remote moodle. */ $page->id = $id; // Log that we've made it this far add_to_log($id, 'synch', 'synch', 'session_start.php?id=' . $id, null); /* * 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($page->sessionId); /* * Assign the session object to the page object to make it easy to find * within the page */ $page->session = $session; /* * Load the session object with details that define the synchronisation * session. the intention is that once the details have been defined once in * the session they shouldn't need to be defined again and will be * available through out the session. Currently they are defined every time. * This will be addressed in future. * * @var string $session->dataItemId data item id for the current session */ $session->dataItemId = $page->id;