Exemple #1
0
 public function render()
 {
     $this->_collection = $this->_obj->getCollection();
     $this->_collection->setBoundaryBatch(-1);
     // set relevant uri adapter and get some identifiers
     /* @var $_uriAdapter t41\View\ViewUri\AbstractAdapter */
     if (!($this->_uriAdapter = ViewUri::getUriAdapter()) instanceof ViewUri\Adapter\GetAdapter) {
         $this->_uriAdapter = new ViewUri\Adapter\GetAdapter();
     }
     $this->_uriAdapter->setEnvData($this->_uriAdapter->getIdentifier('offset'), 0);
     $this->_obj->query($this->_uriAdapter);
     $row = '';
     $sep = str_replace('\\t', "\t", ",");
     // print out result rows
     foreach ($this->_obj->getCollection()->getMembers(ObjectModel::DATA) as $this->_do) {
         $p = null;
         foreach ($this->_obj->getColumns() as $key => $column) {
             if ($p) {
                 $p .= $sep;
             }
             if ($column instanceof Element\IdentifierElement) {
                 $value = $this->_do->getUri()->getIdentifier();
             } else {
                 if ($column instanceof Element\MetaElement) {
                     $value = $column->getDisplayValue($this->_do);
                 } else {
                     $property = $this->_do->getProperty($column->getParameter('property'));
                     $column->setValue($property->getValue());
                     if ($column->getParameter('recursion')) {
                         foreach ($column->getParameter('recursion') as $recursion) {
                             if ($property instanceof AbstractProperty) {
                                 $property = $property->getValue(ObjectModel::DATA);
                             }
                             if ($property instanceof ObjectModel || $property instanceof DataObject) {
                                 $property = $property->getProperty($recursion);
                             }
                         }
                     }
                     if ($property instanceof Property\MediaProperty) {
                         $value = '';
                     } else {
                         if ($property instanceof Property\CurrencyProperty) {
                             $value = $property->getValue();
                             // value formatting must not be converted
                         } else {
                             $value = $property instanceof Property\AbstractProperty ? $property->getDisplayValue() : null;
                         }
                     }
                 }
             }
             $fv = str_replace('\\r\\n', ', ', stripslashes($value));
             $p .= "\"" . str_replace('"', '""', $fv) . "\"";
         }
         $row .= $p . "\r\n";
         // preserve memory!
         $this->_do->reclaimMemory();
     }
     return $this->_drawHeaderRow() . $row;
 }
Exemple #2
0
 public function formatValue($key = null)
 {
     if ($key == null) {
         return '';
     }
     // value is already available (foreign key with no specific constraint in it
     if (isset($this->_enumValues[$key])) {
         return $this->_enumValues[$key];
     }
     // value no more available to select, though we need to display it !
     if (is_string($key)) {
         $uri = new ObjectModel\ObjectUri($key);
         $uri->setClass($this->getCollection()->getClass());
         $_do = clone $this->_collection->getDataObject();
         $_do->setUri($uri);
         Backend::read($_do);
     } else {
         $_do = $key->getDataObject();
     }
     return Property::parseDisplayProperty($_do, $this->getParameter('display'));
 }
Exemple #3
0
 public function reduce(array $params = array(), $cache = true)
 {
     $uuid = Registry::set($this, null, true);
     return array_merge(parent::reduce($params), array('uuid' => $uuid, 'obj' => $this->_collection->reduce($params, $cache)));
 }