public function build() { $control = parent::build(); $instance = ActiveObject::createObject($this->config); $instance->run(); $control['data'] = $instance->getResponse(); return $control; }
public function load() { if (isset($this->_value)) { $this->config['data'] = $this->getValue(); } $this->component = ActiveObject::createObject($this->config); $this->component->run(); return ['data' => $this->component->getResponse(), 'component' => $this->component->componentName]; }
protected function createObject($item) { //create dialog component if (empty($item['name']) || is_int($item['name'])) { throw new \Exception('Please get the name for step'); } $step = ActiveObject::createObject(array_merge($item, $this->_config)); if ($step && $step->visible) { //todo add && $step->privilege return $step; } }
public function actionIndex() { Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; Yii::$app->response->headers->add('Access-Control-Allow-Origin', '*'); $dialog = null; $response = []; try { $data = json_decode(urldecode(file_get_contents("php://input")), true); unset($data['permissions'], $data['actions'], $data['controls']); $dialog = ActiveObject::createObject($data); $response = json_encode($dialog->run()); } catch (ConfirmException $e) { $confirm['confirm'] = ArrayHelper::getValue($data, 'confirm', []); $confirm['confirm'][$e->id] = ['message' => $e->getMessage(), 'buttons' => $e->buttons]; $response = json_encode($confirm); } catch (ValidationException $e) { $response = json_encode(['error' => $e->getMessage(), 'validation' => $e->validation]); } catch (HttpException $e) { throw $e; } Yii::$app->response->format = 'html'; return $response; }
public function load() { $instance = ActiveObject::createObject($this->config); $instance->run(); return ['data' => $instance->getResponse()]; }
protected function redirect($config) { if (empty($config['action'])) { $config['action'] = 'load'; } if (empty($config['key'])) { $config['key'] = $this->key; } if (empty($config['filter'])) { $config['filter'] = $this->filter; } $dialog = ActiveObject::createObject($config); $this->response = $dialog->run(); if (!$this->response->params) { $this->response->params = new \stdClass(); } $this->response->params->class = $config['class']; }