/** * Import a directories that contain metadata.xml files * * @param string $directory * @param optional object Asset $parentAsset * @return void * @access public * @since 12/7/06 */ function importDirectory($directory, $parentAsset = null) { $importer = XMLRepositoryImporter::withObject($this->_ignore, $this->_repository, $directory . "/metadata.xml", $this->_importType); if ($parentAsset) { $importer->setParent($parentAsset); } $importer->parseAndImportBelow("asset", 100); // something happened so tell the end user if ($importer->hasErrors()) { $importer->printErrorMessages(); $this->_hasErrors = true; } unset($importer); }
$results->free(); $db->commitTransaction(IMPORTER_CONNECTION); // Check for the dublin core record structure $dcId = $idManager->getId('dc'); $dcExists = FALSE; $recStructs = $repository->getRecordStructures(); while ($recStructs->hasNext()) { $recStruct = $recStructs->next(); if ($dcId->isEqual($recStruct->getId())) { $dcExists = true; break; } } if (!$dcExists) { $array = array(); $importer = XMLRepositoryImporter::withObject($array, $repository, MYDIR . "/sampledata/SchemaInstallCollection.xml", "insert"); $importer->parseAndImportBelow("recordstructure"); if ($importer->hasErrors()) { $importer->printErrorMessages(); exit; } } /********************************************************* * Segue "CourseGroups" group *********************************************************/ $agentMgr = Services::getService("Agent"); if (!$agentMgr->isGroup($idManager->getId("edu.middlebury.segue.coursegroups"))) { $groupType = new Type("System", "edu.middlebury", "SystemGroups", "Groups for administrators and others with special privileges."); $nullType = new Type("System", "edu.middlebury.harmoni", "NULL"); $properties = new HarmoniProperties($nullType); $agentMgr->createGroup("Segue Course-Groups", $groupType, "Groupings of Segue Course-Sections.", $properties, $idManager->getId("edu.middlebury.segue.coursegroups"));