Ejemplo n.º 1
0
 public function postDispatch()
 {
     if ($this->_uuid && $this->_refreshCache === true) {
         Registry::set($this->_obj, $this->_uuid, true);
     }
     // reinject some data
     foreach ($this->_post as $key => $val) {
         if (substr($key, 0, 1) == '_') {
             $this->_data[$key] = $val;
         }
     }
     // if a redirect is available for the status, add it to the data
     if (isset($this->_redirects[strtolower($this->_status)])) {
         // declare object in tag parsing class to use it for tag substitution on redirect urls
         if ($this->_obj instanceof ObjectModel\BaseObject || $this->_obj instanceof ObjectModel\DataObject) {
             Core\Tag\ObjectTag::$object = $this->_obj;
         } else {
             if ($this->_obj instanceof Action\AbstractAction) {
                 Core\Tag\ObjectTag::$object = $this->_obj->getObject();
             }
         }
         $this->_context['redirect'] = Core\Tag::parse($this->_redirects[strtolower($this->_status)]);
     }
     if (isset($this->_post['_debug'])) {
         $this->_context['debug'] = Backend::getLastQuery();
     }
     $this->_setResponse($this->_status, $this->_data, $this->_context);
 }
Ejemplo n.º 2
0
 /**
  * Parse given object properties to return a string version
  * @param ObjectModelAbstract $object
  * @param string $display
  * @return mixed|string
  */
 public static function parseDisplayProperty(ObjectModelAbstract $object, $display = null)
 {
     if (is_null($display) && $object instanceof BaseObject) {
         return $object->__toString();
     }
     if (substr($display, 0, 1) == '[') {
         // mask
         Tag\ObjectTag::$object = $object;
         return Tag::parse(substr($display, 1, strlen($display) - 2));
     } else {
         $displayProps = explode(',', $display);
         if (count($displayProps) == 1 && $displayProps[0] == '') {
             return $object instanceof BaseObject ? $object->__toString() : null;
             //self::UNDEFINED_LABEL;
         } else {
             $displayValue = array();
             foreach ($displayProps as $disProp) {
                 // display the identifier part of an uri
                 if ($disProp == ObjectUri::IDENTIFIER) {
                     $displayValue[] = $object->getUri() ? $object->getUri()->getIdentifier() : '';
                 } else {
                     // display property value, if property exists!
                     if (($prop = $object->getProperty($disProp)) !== false) {
                         $displayValue[] = $prop->getDisplayValue();
                     }
                 }
             }
             return implode(' ', $displayValue);
         }
     }
 }
Ejemplo n.º 3
0
 protected function _parseDisplayProperty()
 {
     $display = $this->getParameter('display');
     if (!$display) {
         $this->_displayValue = $this->getValue(ObjectModel::MODEL)->__toString();
         return true;
     }
     if (substr($display, 0, 1) == '[') {
         // mask @todo have distinct parameter ?
         Tag\ObjectTag::$object = $this->getValue();
         $this->_displayValue = Tag::parse(substr($display, 1, strlen($display) - 2));
     } else {
         $displayProps = explode(',', $display);
         if (count($displayProps) == 1 && $displayProps[0] == '') {
             $this->_displayValue = Property::UNDEFINED_LABEL;
         } else {
             $this->_displayValue = array();
             foreach ($displayProps as $disProp) {
                 if ($this->_value->getProperty($disProp)) {
                     $this->_displayValue[] = $this->_value->getProperty($disProp)->getDisplayValue();
                 } elseif ($disProp == ObjectUri::IDENTIFIER) {
                     //@todo refactor this
                     $this->_displayValue[] = $this->_value->getIdentifier();
                 }
             }
             $this->_displayValue = implode(' ', $this->_displayValue);
         }
     }
 }