Esempio n. 1
0
 public static function exportList(\SimpleXMLElement $node)
 {
     $child = $node->addChild('pagefeeds');
     $list = static::getList();
     foreach ($list as $feed) {
         $feedNode = $child->addChild('feed');
         if ($feed->getParentID()) {
             $feedNode->addChild('parent', ContentExporter::replacePageWithPlaceHolder($feed->getParentID()));
         }
         $feedNode->addChild('title', $feed->getTitle());
         $feedNode->addChild('description', $feed->getDescription());
         $feedNode->addChild('handle', $feed->getHandle());
         if ($feed->getIncludeAllDescendents()) {
             $feedNode->addChild('descendents', 1);
         }
         if ($feed->getDisplayAliases()) {
             $feedNode->addChild('aliases', 1);
         }
         if ($feed->getDisplayFeaturedOnly()) {
             $feedNode->addChild('featured', 1);
         }
         if ($feed->getPageTypeID()) {
             $feedNode->addChild('pagetype', ContentExporter::replacePageTypeWithPlaceHolder($feed->getPageTypeID()));
         }
         if ($feed->getTypeOfContentToDisplay() == 'S') {
             $type = $feedNode->addChild('contenttype');
             $type->addAttribute('type', 'description');
         } else {
             $area = $feedNode->addChild('contenttype');
             $area->addAttribute('type', 'area');
             $area->addAttribute('handle', $feed->getAreaHandleToDisplay());
         }
     }
 }
Esempio n. 2
0
 public function export(\SimpleXMLElement $blockNode)
 {
     $tables[] = $this->getBlockTypeDatabaseTable();
     if (isset($this->btExportTables)) {
         $tables = $this->btExportTables;
     }
     $db = Database::connection();
     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[strtolower($key)])) {
                     if (in_array($key, $this->btExportPageColumns)) {
                         $tableRecord->addChild($key, ContentExporter::replacePageWithPlaceHolder($value));
                     } elseif (in_array($key, $this->btExportFileColumns)) {
                         $tableRecord->addChild($key, ContentExporter::replaceFileWithPlaceHolder($value));
                     } elseif (in_array($key, $this->btExportPageTypeColumns)) {
                         $tableRecord->addChild($key, ContentExporter::replacePageTypeWithPlaceHolder($value));
                     } elseif (in_array($key, $this->btExportPageFeedColumns)) {
                         $tableRecord->addChild($key, ContentExporter::replacePageFeedWithPlaceHolder($value));
                     } else {
                         $cnode = $tableRecord->addChild($key);
                         $node = dom_import_simplexml($cnode);
                         $no = $node->ownerDocument;
                         $node->appendChild($no->createCDataSection($value));
                     }
                 }
             }
         }
     }
 }