예제 #1
0
 public function init()
 {
     parent::init();
     $this->language or $this->language = Yii::$app->language;
     $this->_tags = (new Query())->select('t.id, t.title, t.alias, t.language, count(t2m.item_id) AS weight')->from(Tag::tableName() . ' t')->innerJoin(Tag::pivotTableName() . ' t2m', 't.id=t2m.tag_id')->where(['t.language' => $this->language])->groupBy('t.id')->all();
     shuffle($this->_tags);
 }
예제 #2
0
 public function init()
 {
     parent::init();
     $this->setShowPanel(false);
     if (!isset($this->model)) {
         $this->model = new User();
     }
 }
예제 #3
0
 public function init()
 {
     parent::init();
     if (empty($this->type)) {
         throw new InvalidConfigException(Yii::t('gromver.platform', 'Menu type must be set.'));
     }
     $this->language or $this->language = Yii::$app->language;
     $this->_rawItems = Yii::$app->db->cache(function ($db) {
         return MenuItem::find()->type($this->type)->published()->language($this->language)->asArray()->orderBy('lft')->all($db);
     }, $this->cacheDuration, Table::dependency(MenuItem::tableName()));
     $i = 0;
     $this->_items = $this->prepareMenuItems($i, 2);
 }
예제 #4
0
 public function init()
 {
     parent::init();
     if (!isset($this->model)) {
         try {
             $attributes = \Yii::$app->user->getParamsArray();
         } catch (InvalidParamException $e) {
             $attributes = [];
         }
         $this->model = self::model();
         $this->model->setAttributes($attributes);
     }
     $visibleParams = $this->getVisibleParams();
     foreach ($this->model->attributes() as $attribute) {
         if (!in_array($attribute, $visibleParams)) {
             $this->model->undefineAttribute($attribute);
         }
     }
 }
예제 #5
0
 public function init()
 {
     parent::init();
 }
예제 #6
0
 public function init()
 {
     parent::init();
     if (!isset($this->types)) {
         $this->types = ActiveDocument::registeredTypes();
     }
     Search::getDb()->open();
     //проверяем коннект к elasticSearch
 }