示例#1
0
 public function build()
 {
     $control = parent::build();
     $instance = ActiveObject::createObject($this->config);
     $instance->run();
     $control['data'] = $instance->getResponse();
     return $control;
 }
示例#2
0
 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];
 }
示例#3
0
 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;
     }
 }
示例#4
0
 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;
 }
示例#5
0
 public function load()
 {
     $instance = ActiveObject::createObject($this->config);
     $instance->run();
     return ['data' => $instance->getResponse()];
 }
示例#6
0
 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'];
 }