Exemplo n.º 1
0
 /**
  * Use magic stuff for generating operations
  *
  * @param $method
  * @param $arguments
  *
  * @return mixed
  */
 public function __call($method, $arguments)
 {
     if (strncmp($method, 'operationCallback', 17) === 0) {
         $operationName = substr($method, 17);
         $definition = Definition::getOperation($arguments[6], $operationName);
         $dispatcher = $GLOBALS['container']['event-dispatcher'];
         $controller = new Operation\Controller($definition, $dispatcher);
         $row = array_shift($arguments);
         $model = ModelFactory::create($arguments[5], $row['id'], $row);
         $controller->setModel($model);
         $view = new Operation\View();
         $view->setHref($arguments[0]);
         $view->setLabel($arguments[1]);
         $view->setTitle($arguments[2]);
         $view->setIcon($arguments[3]);
         $view->setAttributes($arguments[4]);
         $controller->setView($view);
         $config = array();
         $config['rootIds'] = $arguments[6];
         $config['childRecordIds'] = $arguments[7];
         $config['circularReference'] = $arguments[8];
         $config['previous'] = $arguments[9];
         $config['next'] = $arguments[10];
         $controller->setConfig($config);
         return $controller->generate();
     } elseif (strncmp($method, 'globalOperationCallback', 23) === 0) {
         $operationName = substr($method, 23);
         $definition = Definition::getGlobalOperation($arguments[5], $operationName);
         $dispatcher = $GLOBALS['container']['event-dispatcher'];
         $controller = new GlobalOperation\Controller($definition, $dispatcher);
         $view = new GlobalOperation\View();
         $view->setHref($arguments[0]);
         $view->setLabel($arguments[1]);
         $view->setTitle($arguments[2]);
         $view->setIcon($arguments[3]);
         $view->setAttributes($arguments[4]);
         $controller->setView($view);
         $config = array();
         $config['rootIds'] = $arguments[6];
         $config['childRecordIds'] = $arguments[7];
         $config['circularReference'] = $arguments[8];
         $config['previous'] = $arguments[9];
         $config['next'] = $arguments[10];
         $controller->setConfig($config);
         return $controller->generate();
     }
     return null;
 }
Exemplo n.º 2
0
 /**
  * Compile plain view. This can be used if not the table and id should be add by default.
  */
 protected function compilePlainView()
 {
     if ($this->getConfigAttribute('table') === true) {
         $this->setConfigAttribute('table', $this->model->getProviderName());
     }
     if ($this->getConfigAttribute('id') === true) {
         $this->setConfigAttribute('id', $this->model->getId());
     }
     if ($this->getConfigAttribute('rt')) {
         $this->setConfigAttribute('rt', \RequestToken::get());
     }
     if (!$this->getConfigAttribute('append')) {
         $href = $this->buildHref();
         if ($href) {
             $this->view->setHref($href);
         }
     } else {
         $this->view->setHref(\Controller::addToUrl($this->buildHref()));
     }
 }