コード例 #1
0
ファイル: collection_types.php プロジェクト: Zyqsempai/amanet
 public static function exportList($xml)
 {
     $list = self::getList(false, true);
     $nxml = $xml->addChild('pagetypes');
     foreach ($list as $ct) {
         $type = $nxml->addChild('pagetype');
         $type->addAttribute('handle', $ct->getCollectionTypeHandle());
         $type->addAttribute('name', $ct->getCollectionTypeName());
         $type->addAttribute('internal', $ct->isCollectionTypeInternal());
         $type->addAttribute('icon', $ct->getCollectionTypeIcon());
         $type->addAttribute('package', $ct->getPackageHandle());
         if ($ct->isCollectionTypeIncludedInComposer()) {
             $composer = $type->addChild('composer');
             $composer->addAttribute('method', $ct->getCollectionTypeComposerPublishMethod());
             $parent = '';
             $pagetype = '';
             if ($ct->getCollectionTypeComposerPublishPageTypeID() > 0) {
                 $pagetype = ContentExporter::replacePageTypeWithPlaceHolder($ct->getCollectionTypeComposerPublishPageTypeID());
             }
             if ($ct->getCollectionTypeComposerPublishPageParentID() > 0) {
                 $parent = ContentExporter::replacePageWithPlaceHolder($ct->getCollectionTypeComposerPublishPageParentID());
             }
             $composer->addAttribute('pagetype', $pagetype);
             $composer->addAttribute('parent', $parent);
             $items = $ct->getComposerContentItems();
             if (count($items) > 0) {
                 $itemNode = $composer->addChild('items');
                 foreach ($items as $ci) {
                     $ci->export($itemNode, 'composer');
                 }
             }
         }
         $mcID = $ct->getMasterCollectionID();
         if ($mcID > 0) {
             $mc = Page::getByID($mcID);
             $mc->export($type);
         }
     }
 }
コード例 #2
0
ファイル: block.php プロジェクト: nveid/concrete5
	public function export($node, $exportType = 'full') {
		if (!$this->isAliasOfMasterCollection()) {
			$blockNode = $node->addChild('block');
			$blockNode->addAttribute('type', $this->getBlockTypeHandle());
			$blockNode->addAttribute('name', $this->getBlockName());
			if ($this->getBlockFilename() != '') {
				$blockNode->addAttribute('custom-template', $this->getBlockFilename());
			}
			if (is_object($this->c) && $this->c->isMasterCollection()) {
				$mcBlockID = Loader::helper('validation/identifier')->getString(8);
				ContentExporter::addMasterCollectionBlockID($this, $mcBlockID);
				$blockNode->addAttribute('mc-block-id', $mcBlockID);
			}			

			if ($exportType == 'composer') {
				$db = Loader::db();
				$cbFilename = $db->GetOne('select ccFilename from ComposerContentLayout where bID = ?', array($this->getBlockID()));
				if ($cbFilename) {
					$blockNode->addAttribute("composer-template", $cbFilename);
				}
			}
			
			if ($exportType == 'full') {
				$bc = $this->getInstance();
				$bc->export($blockNode);
			}
		} else {
			$blockNode = $node->addChild('block');
			$blockNode->addAttribute('mc-block-id', ContentExporter::getMasterCollectionTemporaryBlockID($this));			
		}
	}
コード例 #3
0
 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));
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: image_file.php プロジェクト: ronlobo/concrete5
	public function exportValue($akn) {
		$av = $akn->addChild('value');
		$av->addChild('fID', ContentExporter::replaceFileWithPlaceHolder($this->getValue()->getFileID()));
	}