Exemple #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;
 }
 /**
  * Combine
  */
 protected function compileDefaultView()
 {
     if (!$this->getConfigAttribute('table')) {
         $this->setConfigAttribute('table', $this->model->getProviderName());
     }
     if (!$this->getConfigAttribute('id') && !$this->getConfigAttribute('id') !== false) {
         $this->setConfigAttribute('id', $this->model->getId());
     }
     $this->setConfigAttribute('rt', \RequestToken::get());
     $href = \Environment::get('script') . '?do=' . \Input::get('do');
     if ($this->getConfigAttribute('id') === false) {
         $add = $this->buildHref(array('table', 'rt'));
     } else {
         $add = $this->buildHref();
     }
     if ($this->view->getHref()) {
         $href .= '&' . $this->view->getHref();
     }
     if ($add) {
         $href .= '&' . $add;
     }
     $this->view->setHref($href);
 }
Exemple #3
0
 /**
  * Construct
  */
 public function __construct()
 {
     parent::__construct();
     $this->template->setName('dcatools_global_operation');
 }