コード例 #1
0
ファイル: Content.php プロジェクト: gotcms/gotcms
 /**
  * Load Document data
  *
  * @return string
  */
 public function createDocument()
 {
     $documents = new Document\Collection();
     $rows = $documents->fetchAll($documents->select(function ($select) {
         $select->order('sort_order ASC');
         $select->order('created_at ASC');
     }));
     if (empty($rows)) {
         return '';
     }
     $documentArray = array();
     foreach ($rows as $row) {
         $documentArray[] = Document\Model::fromArray((array) $row);
     }
     $propertiyCollection = new Property\Collection();
     foreach ($documentArray as $document) {
         $array = array();
         $properties = $propertiyCollection->load(null, null, $document->getId())->getProperties();
         foreach ($properties as $property) {
             $value = $property->getValueModel()->getValue();
             $property->getValueModel()->setValue(base64_encode($value));
             $array[] = $property->getValueModel();
         }
         $document->setProperties($array);
     }
     return $documents->toXml($documentArray, 'documents');
 }