public static function getAllClassesXML() { $dom = new DOMDocument('1.0', 'utf-8'); $dom->formatOutput = true; $root = $dom->createElement('classes'); $dom->appendChild($root); $classes = eZContentClass::fetchList(); foreach ($classes as $class) { $classNode = eZContentClassPackageHandler::classDOMTree($class); $classNode = $dom->importNode($classNode, true); $root->appendChild($classNode); } return $dom; }
static function addClass($package, $classID, $classIdentifier = false) { $class = false; if (is_numeric($classID)) { $class = eZContentClass::fetch($classID); } if (!$class) { return; } $classNode = eZContentClassPackageHandler::classDOMTree($class); if (!$classNode) { return; } if (!$classIdentifier) { $classIdentifier = $class->attribute('identifier'); } $package->appendInstall('ezcontentclass', false, false, true, 'class-' . $classIdentifier, 'ezcontentclass', array('content' => $classNode)); $package->appendProvides('ezcontentclass', 'contentclass', $class->attribute('identifier')); $package->appendInstall('ezcontentclass', false, false, false, 'class-' . $classIdentifier, 'ezcontentclass', array('content' => false)); }
function generatePackage( $package, $options ) { $this->Package = $package; $remoteIDArray = array(); $this->NodeIDArray = array_unique( $this->NodeIDArray ); foreach( $this->NodeIDArray as $nodeID ) { $this->NodeObjectArray[(string)$nodeID] = eZContentObjectTreeNode::fetch( $nodeID ); } foreach( $this->RootNodeIDArray as $nodeID ) { $this->RootNodeObjectArray[(string)$nodeID] = eZContentObjectTreeNode::fetch( $nodeID ); } $this->generateObjectArray( $options['node_assignment'] ); $classIDArray = false; if ( $options['include_classes'] ) { $remoteIDArray['class'] = array(); $classIDArray = $this->generateClassIDArray(); foreach ( $classIDArray as $classID ) { eZContentClassPackageHandler::addClass( $package, $classID ); } } $dom = new DOMDocument( '1.0', 'utf-8' ); $packageRoot = $dom->createElement( 'content-object' ); $dom->appendChild( $packageRoot ); $objectListDOMNode = $this->createObjectListNode( $options ); $importedObjectListDOMNode = $dom->importNode( $objectListDOMNode, true ); $packageRoot->appendChild( $importedObjectListDOMNode ); $overrideSettingsArray = false; $templateFilenameArray = false; if ( $options['include_templates'] ) { $overrideSettingsListNode = $this->generateOverrideSettingsArray( $options['site_access_array'], $options['minimal_template_set'] ); $importedOverrideSettingsListNode = $dom->importNode( $overrideSettingsListNode, true ); $packageRoot->appendChild( $importedOverrideSettingsListNode ); $designTemplateListNode = $this->generateTemplateFilenameArray(); $importedDesignTemplateListNode = $dom->importNode( $designTemplateListNode, true ); $packageRoot->appendChild( $importedDesignTemplateListNode ); $fetchAliasListNode = $this->generateFetchAliasArray(); $importedFetchAliasListNode = $dom->importNode( $fetchAliasListNode, true ); $packageRoot->appendChild( $importedFetchAliasListNode ); } $siteAccessListDOMNode = $this->createSiteAccessListNode( $options ); $importedSiteAccessListDOMNode = $dom->importNode( $siteAccessListDOMNode, true ); $packageRoot->appendChild( $importedSiteAccessListDOMNode ); $topNodeListDOMNode = $this->createTopNodeListDOMNode( $options ); $importedTopNodeListDOMNode = $dom->importNode( $topNodeListDOMNode, true ); $packageRoot->appendChild( $importedTopNodeListDOMNode ); //$filename = substr( md5( mt_rand() ), 0, 8 ); $filename = 'contentobjects'; $this->Package->appendInstall( 'ezcontentobject', false, false, true, $filename, $this->contentObjectDirectory(), array( 'content' => $packageRoot ) ); $this->Package->appendInstall( 'ezcontentobject', false, false, false, $filename, $this->contentObjectDirectory(), array( 'content' => false ) ); }