/** * Lists all Layout record models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => LayoutRecord::find()]); return $this->render('index', compact('dataProvider')); }
/** * Returns layout list options for dropdown * @return array */ public function getLayoutListOptions() { $session = Yii::$app->session; if (!$session['language_id']) { $session['language_id'] = LanguageRecord::getMainLanguageId(); } $items = []; switch ($this->content_type) { case MenuItemRecord::CONTENT_PAGE: $items = ArrayHelper::map(LayoutRecord::find()->where(['content' => LayoutRecord::CONTENT_PAGE])->activeStatus()->orderBy(['main' => SORT_DESC])->all(), 'id', 'title'); break; case MenuItemRecord::CONTENT_CATEGORY: $items = ArrayHelper::map(LayoutRecord::find()->where(['content' => LayoutRecord::CONTENT_CATEGORY])->activeStatus()->orderBy(['main' => SORT_DESC])->all(), 'id', 'title'); break; default: break; } return $items; }
/** * Returns layout options for dropdown * @return array */ public function getLayoutListOptions() { return ArrayHelper::map(LayoutRecord::find()->where(['content' => LayoutRecord::CONTENT_ARTICLE])->activeStatus()->orderBy(['main' => SORT_DESC, 'title' => SORT_ASC])->all(), 'id', 'title'); }
/** * Returns dropdown layout list options * @param $tid integer content type id * @return \yii\console\Response|Response */ public function actionLayoutListOptions($tid) { $items = null; switch ($tid) { case MenuItemRecord::CONTENT_PAGE: $items = LayoutRecord::find()->where(['content' => LayoutRecord::CONTENT_PAGE])->activeStatus()->orderBy(['main' => SORT_DESC])->all(); break; case MenuItemRecord::CONTENT_CATEGORY: $items = LayoutRecord::find()->where(['content' => LayoutRecord::CONTENT_CATEGORY])->activeStatus()->orderBy(['main' => SORT_DESC])->all(); break; default: break; } $itemsOptions = ['arr' => false, 'prompt' => false]; return $this->renderPartial('_listOptions', compact('items', 'itemsOptions')); }