* if value associated to a key is not an array, or is an empty array * then all the course will be exported! * */ $exportCourse = isset($_GET['selCourse']) && intval($_GET['selCourse']) > 0 ? intval($_GET['selCourse']) : 0; $exportNode = isset($_GET['selNode']) && trim($_GET['selNode']) !== '' ? trim($_GET['selNode']) : ''; $exportMedia = !(isset($_GET['exportMedia']) && intval($_GET['exportMedia']) > 0); if ($exportCourse > 0 && $exportNode !== '') { $nodesToExport = array($exportCourse => array($exportNode)); } else { $nodesToExport = array(); } /** * exportHelper object to help us in the exporting process... */ $exportHelper = new exportHelper($exportCourse); /** * comment to be inserted as first line of XML document */ $commentStr = "Exported From " . PORTAL_NAME . " v" . ADA_VERSION; // create a dom document with encoding utf8 $domtree = new DOMDocument('1.0', ADA_CHARSET); $domtree->preserveWhiteSpace = false; $domtree->formatOutput = true; // generate and add comment, if any if (isset($commentStr)) { $domtree->appendChild($domtree->createComment($commentStr)); unset($commentStr); } // create the root element of the xml tree $xmlRoot = $domtree->createElement("ada_export");
* Clear node and layout variable in $_SESSION */ $variableToClearAR = array('node', 'layout', 'course', 'user'); /** * Users (types) allowed to access this module. */ $allowedUsersAr = array(AMA_TYPE_SWITCHER); /** * Get needed objects */ $neededObjAr = array(AMA_TYPE_SWITCHER => array('layout')); /** * Performs basic controls before entering this module */ require_once ROOT_DIR . '/include/module_init.inc.php'; require_once ROOT_DIR . '/browsing/include/browsing_functions.inc.php'; // MODULE's OWN IMPORTS require_once dirname(__FILE__) . '/config/config.inc.php'; require_once MODULES_IMPEXPORT_PATH . '/include/exportHelper.class.inc.php'; /** * this is called async by the tree view to populate itself */ $courseID = isset($_GET['courseID']) && intval($_GET['courseID']) > 0 ? intval($_GET['courseID']) : 0; if ($courseID > 0) { $rootNode = $courseID . exportHelper::$courseSeparator . "0"; // need an Import/Export DataHandler $dh = AMAImpExportDataHandler::instance(MultiPort::getDSN($_SESSION['sess_selected_tester'])); $exportHelper = new exportHelper($courseID); $a = $exportHelper->getAllChildrenArray($rootNode, $dh); echo json_encode(array($a)); }