public function actionGetProjects() { $this->layout = false; $product = new ProductSearch(); list($pages, $models) = $product->search(); return $this->render('products', ['resultFillter' => $models, 'pages' => $pages]); }
/** * Lists all Product models. * @return mixed */ public function actionIndex() { $searchModel = new ProductSearch(); $searchModel->provider_id = $this->getProvider()->id; $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Lists all Product models. * @return mixed */ public function actionIndex() { $this->checkLogin(); $this->layout = 'admin'; $searchModel = new ProductSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
public function actionService() { $searchModel = new ProductSearch(); $dataProvider = $searchModel->search_service(Yii::$app->request->queryParams); $uid = Yii::$app->user->identity->user_id; $accessView = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 9])->one(); $accessCreate = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 10])->one(); $accessUpdate = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 11])->one(); $accessDelete = Access2::find()->where(['user_id' => $uid, 'sub_module_id' => 12])->one(); return $this->render('service', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'accessView' => $accessView, 'accessCreate' => $accessCreate, 'accessUpdate' => $accessUpdate, 'accessDelete' => $accessDelete]); }
/** * Lists all Product models. * @return mixed */ public function actionIndex() { $searchModel = new ProductSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $dataProvider->sort = ['defaultOrder' => ['title' => SORT_ASC]]; // data provider used for export $exportDataProvider = $dataProvider; if (Yii::$app->request->isPost) { $exportDataProvider = $searchModel->search(Yii::$app->request->queryParams); $exportDataProvider->sort = ['defaultOrder' => ['id' => SORT_DESC]]; $exportDataProvider->pagination->pageSize = 0; } return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'exportDataProvider' => $exportDataProvider]); }
/** * Lists all Product models. * @return mixed */ public function actionIndex() { if (!Yii::$app->user->can('product/index')) { Yii::$app->session->setFlash('error', 'Нет доступа!'); return $this->redirect('/'); } $searchModel = new ProductSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); if (isset($_POST['hasEditable'])) { $model = Product::find()->where(['id' => Yii::$app->request->post('editableKey')])->one(); $posted = current($_POST['Product']); \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; if (isset($posted['status'])) { return $model->saveStatusOrName($posted['status'], 'status'); } elseif (isset($posted['name'])) { return $model->saveStatusOrName($posted['name'], 'name'); } } return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
<?php use app\models\ProductSearch; $product = new ProductSearch(); ?> <div class="row"> <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2"> <strong>Сортировать:</strong> </div> <div class="btn-toolbar" role="toolbar"> <div class="btn-group select-filter" id="sort"><?php foreach (ProductSearch::getSort() as $sort) { ?> <button type="submit" class="btn <?php echo $product->selectSort($sort['sort']); ?> btn-filter" data-target="<?php echo $sort['sort']; ?> "> <?php echo $sort['label']; ?> </button> <?php } ?> </div> </div>
<?php /** * Group partial */ use yii\grid\GridView; use yii\helpers\Html; use yii\helpers\Url; use app\models\ProductSearch; $app = \Yii::$app; $productSearch = new ProductSearch(); $productDataProvider = $productSearch->search($app->request->queryParams); $productDataProvider->pagination = ['pageParam' => 'product-page', 'pageSizeParam' => 'product-per-page', 'pageSize' => 5]; echo GridView::widget(['dataProvider' => $productDataProvider, 'filterModel' => $productSearch, 'summary' => '', 'columns' => [['attribute' => 'id'], ['attribute' => 'name'], ['attribute' => 'description'], ['class' => 'yii\\grid\\ActionColumn', 'buttons' => ['view' => function ($url, $model, $key) { return ''; }, 'update' => function ($url, $model, $key) { $url = Url::to(['/product/update', 'id' => $key]); return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['data' => ['ajax-get' => '#product-form']]); }, 'delete' => function ($url, $model, $key) { $url = Url::to(['product/delete', 'id' => $key]); return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['data' => ['pjax' => '0', 'method' => 'post', 'confirm' => Yii::t('app/views', 'Are you sure you want to delete this record?')]]); }], 'contentOptions' => ['style' => 'width: 50px;']]]]); if (\Yii::$app->request->isPjax) { $this->clear(); }
<?php use app\models\ProductSearch; $product = new ProductSearch(); foreach (ProductSearch::getFilters() as $key => $data) { ?> <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2" id="<?php echo $key; ?> "> <?php foreach ($data as $k => $value) { $k++; if (is_array($value)) { ?> <button type="submit" class="btn <?php echo $product->selectFilter($key, $k); ?> btn-filter btn-margin <?php if (isset($value['class'])) { echo $value['class']; } if ($value['init'] === true) { echo ' btn-success '; } ?> " data-target="<?php echo $k; ?> "> <?php