public function init() { $this->name = \Yii::t('skeeks/cms', 'Elements'); $this->modelShowAttribute = "name"; $this->modelClassName = CmsContentElement::className(); parent::init(); }
public function init() { $this->name = "Элементы"; $this->modelShowAttribute = "name"; $this->modelClassName = CmsContentElement::className(); parent::init(); }
public function init() { $this->name = \skeeks\cms\shop\Module::t('app', 'Elements'); $this->modelShowAttribute = "name"; $this->modelClassName = CmsContentElement::className(); parent::init(); }
/** * @return \yii\db\ActiveQuery */ public function getCmsContentElement() { return $this->hasOne(CmsContentElement::className(), ['id' => 'shop_product_id']); }
/** * @return \yii\db\ActiveQuery */ public function getContentElement() { return $this->hasOne(CmsContentElement::className(), ['id' => 'content_element_id']); }
/** * @return \yii\db\ActiveQuery */ public function getCmsContentElements() { return $this->hasMany(CmsContentElement::className(), ['content_id' => 'id']); }
public function initDataProvider() { $this->search = new Search(CmsContentElement::className()); $this->dataProvider = $this->search->getDataProvider(); if ($this->enabledPaging == Cms::BOOL_Y) { $this->dataProvider->getPagination()->defaultPageSize = $this->pageSize; $this->dataProvider->getPagination()->pageParam = $this->pageParamName; $this->dataProvider->getPagination()->pageSizeLimit = [(int) $this->pageSizeLimitMin, (int) $this->pageSizeLimitMax]; } else { $this->dataProvider->pagination = false; } if ($this->orderBy) { $this->dataProvider->getSort()->defaultOrder = [$this->orderBy => (int) $this->order]; } return $this; }
?> <?php $content_id = $content->id; ?> <?php } } ?> <?php if ($content_id) { ?> <?php $dataProvider = new \yii\data\ActiveDataProvider(['query' => \skeeks\cms\models\CmsContentElement::find()]); $search = new \skeeks\cms\models\Search(\skeeks\cms\models\CmsContentElement::className()); $dataProvider = $search->search(\Yii::$app->request->queryParams); $searchModel = $search->loadedModel; $dataProvider->setSort(['defaultOrder' => ['published_at' => SORT_DESC]]); if ($content_id = \Yii::$app->request->get('content_id')) { $dataProvider->query->andWhere(['content_id' => $content_id]); } $autoColumns = []; $model = \skeeks\cms\models\CmsContentElement::find()->where(['content_id' => $content_id])->one(); if (is_array($model) || is_object($model)) { //Добавление колонок по моделе элемента foreach ($model as $name => $value) { $autoColumns[] = ['attribute' => $name, 'visible' => false, 'format' => 'raw', 'class' => \yii\grid\DataColumn::className(), 'value' => function ($model, $key, $index) use($name) { if (is_array($model->{$name})) { return implode(",", $model->{$name}); } else {
/** * @return \yii\db\ActiveQuery */ public function getStore() { return $this->hasOne(CmsContentElement::className(), ['id' => 'store_id']); }
/** * @return \yii\db\ActiveQuery */ public function getFavoriteCmsContentElements() { return $this->hasMany(CmsContentElement::className(), ['id' => 'cms_content_element_id'])->via('cmsContentElement2cmsUsers'); }
/** * @return \yii\db\ActiveQuery */ public function getValueCmsContentElements() { return $this->hasMany(CmsContentElement::className(), ['id' => 'value_enum']); }