diff --git a/common/models/ProjectSearch.php b/common/models/ProjectSearch.php index 98ae2d5..7c2f51a 100644 --- a/common/models/ProjectSearch.php +++ b/common/models/ProjectSearch.php @@ -91,7 +91,7 @@ */ public function search($params) { - $query = Project::find(); + $query = Project::find()->with('comments'); // add conditions that should always apply here @@ -133,7 +133,6 @@ 'view_count' => $this->view_count, 'payment_variant' => $this->payment_variant, 'deadline' => $this->deadline, - 'contractual' => $this->contractual, ]); $query->andFilterWhere([ @@ -153,23 +152,18 @@ $query->andFilterWhere([ 'like', - 'name', - $this->name, + 'LOWER(name)', + mb_strtolower($this->name), ]) ->andFilterWhere([ 'like', - 'link', - $this->link, - ]) - ->andFilterWhere([ - 'like', 'budget', $this->budget, ]) ->andFilterWhere([ 'like', - 'city', - $this->city, + 'LOWER(city)', + mb_strtolower($this->city), ]) ->andFilterWhere([ 'like', @@ -197,6 +191,12 @@ $query->andWhere(['not', ['contractual' => 1]]); } + if($this->contractual == 1) { + $query->andWhere(['contractual' => 1]); + } elseif($this->contractual == 2) { + $query->andWhere(['not', ['contractual' => 1]]); + } + return $dataProvider; } } diff --git a/common/models/Team.php b/common/models/Team.php index 48ac79e..eab42bd 100644 --- a/common/models/Team.php +++ b/common/models/Team.php @@ -139,7 +139,7 @@ public function getUser() { - return $this->lastname. ' ' . $this->firstname . ' ' . $this->middlename; + return $this->lastname. ' ' . $this->firstname; } } diff --git a/common/models/TenderSearch.php b/common/models/TenderSearch.php index df6cb04..d431cfa 100644 --- a/common/models/TenderSearch.php +++ b/common/models/TenderSearch.php @@ -117,7 +117,8 @@ { $query = Project::find() ->joinWith('projectSpecializations') - ->joinWith('projectPayments'); + ->joinWith('projectPayments') + ->andWhere([ 'hidden' => 0 ]); $dataProvider = new ActiveDataProvider([ 'query' => $query, diff --git a/frontend/controllers/AccountsController.php b/frontend/controllers/AccountsController.php index 5a039e1..7ddc565 100755 --- a/frontend/controllers/AccountsController.php +++ b/frontend/controllers/AccountsController.php @@ -70,7 +70,7 @@ 'portfolio-delete' => [ 'POST' ], 'projects-delete' => [ 'POST' ], 'blog-delete' => [ 'POST' ], - 'gallery-cover' => [ 'POST' ], + 'gallery-cover' => [ 'POST' ], ], ], ]; @@ -970,14 +970,9 @@ ->column(); $post = \Yii::$app->request->post(); if($team->load($post) && $team->save()) { - return $this->render('_team_form', [ - 'team' => $team, - 'department' => $department, - 'country' => $country, + return $this->redirect([ + 'team', ]); - // return $this->redirect([ - // 'team', - // ]); } else { return $this->render('_team_form', [ 'team' => $team, @@ -1179,13 +1174,15 @@ } } - public function actionGalleryCover() { $gallery_id = Yii::$app->request->post('gallery_id'); - $cover = Gallery::find()->select('cover')->where(['gallery_id'=>$gallery_id])->column(); - die($cover[0]); + $cover = Gallery::find() + ->select('cover') + ->where([ 'gallery_id' => $gallery_id ]) + ->column(); + die( $cover[ 0 ] ); } diff --git a/frontend/controllers/TenderController.php b/frontend/controllers/TenderController.php index 47bab2d..8b4d64f 100755 --- a/frontend/controllers/TenderController.php +++ b/frontend/controllers/TenderController.php @@ -52,6 +52,8 @@ 'class' => \yii\filters\VerbFilter::className(), 'actions' => [ 'change-state' => [ 'post' ], + 'offer-form' => [ 'post' ], + 'offer' => [ 'post' ], ], ], 'access' => [ @@ -68,8 +70,9 @@ } /** - * Displays homepage. - * @return mixed + * Redirect to search page. + * + * @return string */ public function actionIndex() { @@ -78,7 +81,13 @@ public function actionView($tender_id) { + /** + * @var Project $model + */ $model = Project::findOne($tender_id); + if(!empty($model)) { + $model->updateCounters(['view_count' => 1]); + } return $this->render('view', [ 'model' => $model, @@ -160,8 +169,8 @@ $projects = $user->getProjects() ->with('parent') ->all(); - if(empty($projects)) { - return ['error' => 'У Вас еще нету проектов']; + if(empty( $projects )) { + return [ 'error' => 'У Вас еще нету проектов' ]; } return [ 'message' => $this->renderAjax('forms-modal-offer', [ diff --git a/frontend/views/accounts/_projects_form.php b/frontend/views/accounts/_projects_form.php index d7c2f3d..e497dc5 100644 --- a/frontend/views/accounts/_projects_form.php +++ b/frontend/views/accounts/_projects_form.php @@ -248,7 +248,7 @@
{$model->firstname}
"; + } + ?> + firstname)) { + echo "{$model->lastname}
"; + } + ?> department->name )) { ?> diff --git a/frontend/views/search/_projects_list_view.php b/frontend/views/search/_projects_list_view.php index 92b8467..8bb5260 100644 --- a/frontend/views/search/_projects_list_view.php +++ b/frontend/views/search/_projects_list_view.php @@ -16,8 +16,10 @@ use yii\helpers\Url; Бюджет: contractual)) { + if(empty($model->contractual) && !empty($model->budget)) { echo $model->budget.' '.$model->budgetCurrency->label; + } elseif(empty($model->budget)) { + echo "Не задано"; } else { echo "Договорной"; } -- libgit2 0.21.4