Exemplo n.º 1
0
 private function setSite()
 {
     if (!$this->siteId) {
         $this->siteId = $this->id;
     }
     $this->_site = Site::findOne($this->siteId);
     if (!$this->_site) {
         $this->_site = new Site();
         $this->_site->scenario = 'add';
         $this->_site->id = $this->siteId;
         $this->_site->powered = \Yii::t($this->messageCategory, 'Nanning Automan Technology Co., Ltd.');
         if (!$this->_site->commonHandler()) {
             \Yii::$app->end($this->_site->getFirstError('id'));
         }
     }
 }
Exemplo n.º 2
0
 public function actionSite()
 {
     $item = Site::findOne($this->module->siteId);
     $item->scenario = 'global';
     if (\Yii::$app->request->isPost) {
         $item->logo_id = null;
         $item->sub_logo_id = null;
         $item->weixin_id = null;
         if ($item->load(\Yii::$app->request->post())) {
             if ($item->commonHandler()) {
                 \Yii::$app->session->setFlash('item', '0|' . \Yii::t($this->module->messageCategory, 'operation succeeded'));
                 return $this->refresh();
             }
             \Yii::$app->session->setFlash('item', '1|' . $item->firstErrorInfirstErrors);
         }
     }
     return $this->render($this->action->id, ['item' => $item]);
 }
Exemplo n.º 3
0
 private function setSite()
 {
     if (!$this->siteId) {
         $this->siteId = $this->id;
     }
     $this->_site = Site::findOne(['id' => $this->siteId, 'status' => Site::STATUS_ENABLED]);
     if (!$this->_site || !$this->_site->name || !$this->_site->logo_id) {
         \Yii::$app->end(\Yii::t('yii', 'Page not found.'));
     }
 }