public function export(SimpleXMLElement $blockNode) { $tables[] = $this->getBlockTypeDatabaseTable(); if (isset($this->btExportTables)) { $tables = $this->btExportTables; } $db = Loader::db(); foreach ($tables as $tbl) { if (!$tbl) { continue; } $data = $blockNode->addChild('data'); $data->addAttribute('table', $tbl); $columns = $db->MetaColumns($tbl); // remove columns we don't want unset($columns['BID']); $r = $db->Execute('select * from ' . $tbl . ' where bID = ?', array($this->bID)); while ($record = $r->FetchRow()) { $tableRecord = $data->addChild('record'); foreach ($record as $key => $value) { if (isset($columns[strtoupper($key)])) { if (in_array($key, $this->btExportPageColumns)) { $tableRecord->addChild($key, ContentExporter::replacePageWithPlaceHolder($value)); } else { if (in_array($key, $this->btExportFileColumns)) { $tableRecord->addChild($key, ContentExporter::replaceFileWithPlaceHolder($value)); } else { if (in_array($key, $this->btExportPageTypeColumns)) { $tableRecord->addChild($key, ContentExporter::replacePageTypeWithPlaceHolder($value)); } else { $cnode = $tableRecord->addChild($key); $node = dom_import_simplexml($cnode); $no = $node->ownerDocument; $node->appendChild($no->createCDataSection($value)); } } } } } } } }
public function exportValue($akn) { $av = $akn->addChild('value'); $av->addChild('fID', ContentExporter::replaceFileWithPlaceHolder($this->getValue()->getFileID())); }