public function addPageConfiguration($name, Template $t, $extension, $type) { if (trim($extension) == "") { throw new e\EmptyValueException(S_SPAN . c\M::EMPTY_FILE_EXTENSION . E_SPAN); } if (!c\SerializationTypeValues::isSerializationTypeValue($type)) { throw new e\WrongSerializationTypeException(S_SPAN . "The serialization type {$type} is not acceptable. " . E_SPAN); } $config = AssetTemplate::getPageConfiguration(); $config->name = $name; $config->templateId = $t->getId(); $config->templatePath = $t->getPath(); $config->pageRegions = $t->getPageRegionStdForPageConfiguration(); $config->outputExtension = $extension; $config->serializationType = $type; $p = new p\PageConfiguration($config, $this->getService(), NULL); $this->page_configurations[] = $p; $this->edit(); $this->processPageConfigurations($this->getProperty()->pageConfigurations->pageConfiguration); return $this; }
public function createXsltFormat(Folder $parent, $name, $xml) { if (trim($name) == "") { throw new e\CreationErrorException(S_SPAN . c\M::EMPTY_FORMAT_NAME . E_SPAN); } if (trim($xml) == "") { throw new e\CreationErrorException(S_SPAN . c\M::EMPTY_XML . E_SPAN); } $asset = AssetTemplate::getFormat(c\P::XSLTFORMAT); $asset->xsltFormat->name = $name; $asset->xsltFormat->parentFolderPath = $parent->getPath(); $asset->xsltFormat->siteName = $parent->getSiteName(); $asset->xsltFormat->xml = $xml; return $this->createAsset($asset, XsltFormat::TYPE, $this->getPath($parent, $name), $parent->getSiteName()); }
private function getStructuredDataNode($xml_element, $type, $identifier) { if (self::DEBUG) { u\DebugUtility::out("{$type}, {$identifier}"); } $obj = AssetTemplate::getStructuredDataNode(); if ($type == c\T::GROUP) { $obj->type = $type; $obj->identifier = $identifier; $obj->structuredDataNodes = new \stdClass(); $child_count = count($xml_element->children()); $more_than_one = $child_count > 1 ? true : false; if ($more_than_one) { $obj->structuredDataNodes->structuredDataNode = array(); foreach ($xml_element->children() as $child) { $child_type = $child->getName(); if (self::DEBUG) { u\DebugUtility::out("Child type in group: {$child_type}"); } if (isset($child[c\T::IDENTIFIER])) { $child_identifier = $child[c\T::IDENTIFIER]->__toString(); $child_std = $this->createChildStd($child, $child_type, $child_identifier); $obj->structuredDataNodes->structuredDataNode[] = $child_std; } } } else { $xml_array = $xml_element->children(); //var_dump( $xml_array ); $child = $xml_array[0]; $child_type = $child->getName(); if (self::DEBUG) { u\DebugUtility::out("Child type in group: {$child_type}"); } $child_identifier = $child[c\T::IDENTIFIER]->__toString(); $child_std = $this->createChildStd($child, $child_type, $child_identifier); $obj->structuredDataNodes->structuredDataNode = $child_std; } } else { $obj->type = $type; $obj->identifier = $identifier; } return $obj; }
<?php require_once 'cascade_ws_ns/auth_chanw.php'; use cascade_ws_AOHS as aohs; use cascade_ws_constants as c; use cascade_ws_asset as a; use cascade_ws_property as p; use cascade_ws_utility as u; use cascade_ws_exception as e; try { $block_id = "5bfdb6428b7f08ee6e9bc35c740caf9e"; // load the block with a phantom node $phantom_block = new a\DataDefinitionBlockPhantom($service, $service->createId(a\DataDefinitionBlockPhantom::TYPE, $block_id)); $block_property = $phantom_block->getProperty(); $sd_array = $block_property->structuredData->structuredDataNodes->structuredDataNode; // add another phantom node $phantom = new \stdClass(); $phantom->type = "text"; $phantom->identifier = "phantom"; $phantom->text = "Phantom value"; $sd_array[] = $phantom; $asset = a\AssetTemplate::getDataDefinitionBlock(); $asset->xhtmlDataDefinitionBlock = $block_property; $asset->xhtmlDataDefinitionBlock->structuredData->structuredDataNodes->structuredDataNode = $sd_array; $service->edit($asset); } catch (\Exception $e) { echo S_PRE . $e . E_PRE; }
public function getMetaData() { $m = AssetTemplate::getMetadata(); if (isset($this->getProperty()->dynamicMetadataFieldDefinitions->dynamicMetadataFieldDefinition) && is_array($this->getProperty()->dynamicMetadataFieldDefinitions->dynamicMetadataFieldDefinition)) { $defs = $this->getProperty()->dynamicMetadataFieldDefinitions->dynamicMetadataFieldDefinition; $a = array(); foreach ($defs as $def) { $df = new \stdClass(); $df->name = $def->name; $df->fieldValues = new \stdClass(); $df->fieldValues->fieldValue = array(); $a[] = $df; } $m->dynamicFields = new \stdClass(); $m->dynamicFields->dynamicField = $a; } return new p\Metadata($m, $this->getService(), $this->getId()); }