public function importValue(SimpleXMLElement $akv) { if (isset($akv->value->fID)) { $fIDVal = (string) $akv->value->fID; $fID = ContentImporter::getValue($fIDVal); if ($fID) { return File::getByID($fID); } } }
public function importComposerSettings(SimpleXMLElement $sx) { $db = Loader::db(); if ($sx['method'] == 'PAGE_TYPE') { $ctID = ContentImporter::getValue($sx['pagetype']); $cta = CollectionType::getByID($ctID); $this->saveComposerPublishTargetPageType($cta); } else { if ($sx['method'] == 'PARENT') { $cID = ContentImporter::getValue($sx['parent']); $c = Page::getByID($cID); $this->saveComposerPublishTargetPage($c); } else { $this->saveComposerPublishTargetAll(); } } if (isset($sx->items)) { foreach ($sx->items->children() as $node) { $displayOrder = $db->GetOne('select max(displayOrder) as displayOrder from ComposerContentLayout where ctID = ?', array($this->ctID)); if ($displayOrder !== false) { if ($displayOrder > 0) { $displayOrder++; } else { $displayOrder = 1; } } else { $displayOrder = 0; } if ($node->getName() == 'attributekey') { $ak = CollectionAttributeKey::getByHandle((string) $node['handle']); $v = array($ak->getAttributeKeyID(), $displayOrder, $this->ctID); $db->Execute('insert into ComposerContentLayout (akID, displayOrder, ctID) values (?, ?, ?)', $v); } if ($node->getName() == 'block') { $mcID = $this->getMasterCollectionID(); $bID = $db->GetOne('select Blocks.bID from CollectionVersionBlocks inner join Blocks on CollectionVersionBlocks.bID = Blocks.bID where cID = ? and Blocks.bName = ?', array($mcID, (string) $node['name'])); $v = array($bID, $displayOrder, (string) $node['composer-template'], $this->ctID); $db->Execute('insert into ComposerContentLayout (bID, displayOrder, ccFilename, ctID) values (?, ?, ?, ?)', $v); } } } }
protected function importAdditionalData($b, $blockNode) { if (isset($blockNode->data)) { foreach ($blockNode->data as $data) { if (strtoupper($data['table']) != strtoupper($this->getBlockTypeDatabaseTable())) { $table = (string) $data['table']; if (isset($data->record)) { foreach ($data->record as $record) { $aar = new ADODB_Active_Record($table); $aar->bID = $b->getBlockID(); foreach ($record->children() as $node) { $nodeName = $node->getName(); $aar->{$nodeName} = ContentImporter::getValue((string) $node); } $aar->Save(); } } } } } }