Пример #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);
 }
Пример #2
0
 public function reduce(array $params = array())
 {
     /* keep object in registry */
     $this->setContextData('uuid', Core\Registry::set($this->_obj));
     $fullAction = $this->_id;
     if ($this->_action) {
         $fullAction .= '/' . $this->_action;
     }
     $array = array('event' => 'click', 'action' => $fullAction, 'data' => $this->getContext());
     if ($this->_callbacks) {
         $array['callbacks'] = $this->_callbacks;
     }
     // add or replace data with optional $params['data'] content
     if (isset($params['extra'])) {
         foreach ((array) $params['extra'] as $key => $val) {
             $array[$key] = $val;
         }
     }
     // return reduced action without parameters
     return $array;
 }
Пример #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)));
 }
Пример #4
0
 /**
  * (non-PHPdoc)
  * @see t41\ObjectModel.ObjectModelAbstract::reduce()
  */
 public function reduce(array $params = array(), $cache = true)
 {
     /* keep object in registry (force refresh) */
     $uuid = $cache ? Core\Registry::set($this, null, true) : null;
     // build an array with remotely callable methods
     $methods = array();
     //		foreach (get_class_methods($this) as $method) {
     //			if (substr($method,0,1) == '_') continue;
     //$methods[] = $method;
     //		}
     $array = $uuid ? array('uuid' => $uuid) : array();
     $array['value'] = $this->__toString();
     return array_merge($this->_dataObject->reduce($params, false), $array);
 }
Пример #5
0
 /**
  * (non-PHPdoc)
  * @see t41\Core.ClientSideInterface::reduce()
  */
 public function reduce(array $params = array())
 {
     return Core\Registry::set($this);
     //return $this->asString();
 }
Пример #6
0
 /**
  * (non-PHPdoc)
  * @see t41\ObjectModel.ObjectModelAbstract::reduce()
  */
 public function reduce(array $params = array(), $cache = true)
 {
     //$uuid = ($this->_uri instanceof ObjectUri) ? $this->_uri->reduce($params) : null;
     $uuid = $cache ? Registry::set($this) : null;
     $props = array();
     foreach ($this->_data as $key => $property) {
         if (isset($params['props']) && !in_array($key, $params['props'])) {
             continue;
         }
         $constraints = $property->getParameter('constraints');
         // ignore stricly server-side properties
         if (isset($constraints['serverside'])) {
             continue;
         }
         $props[$key] = $property->reduce($params, $cache);
     }
     return array_merge(parent::reduce($params), array('uuid' => $uuid, 'props' => $props));
 }
Пример #7
0
 public function reduce(array $params = array(), $cache = true)
 {
     if (!$this->_value) {
         return parent::reduce($params, $cache);
     } else {
         // @todo improve performances !!
         $uuid = Core\Registry::set($this->getValue(ObjectModel::DATA));
         if (isset($params['extprops']) && ($params['extprops'] === true || array_key_exists($this->_id, $params['extprops']))) {
             $value = $this->getValue(ObjectModel::DATA)->reduce(array('props' => $params['extprops'][$this->_id], 'extprops' => $params['extprops']), $cache);
         } else {
             $value = $this->getDisplayValue();
         }
         return array_merge(parent::reduce($params, $cache), array('value' => $value, 'uuid' => $uuid));
     }
 }