From 553e3b885e403923ca32b7ff79f88a9a2decf1e0 Mon Sep 17 00:00:00 2001 From: Kavalar Date: Fri, 23 Nov 2018 16:14:28 +0300 Subject: [PATCH] fix project --- .../project/controllers/ProjectController.php | 18 +++++--- .../modules/project/views/project/view.php | 44 ++++++++++--------- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/backend/modules/project/controllers/ProjectController.php b/backend/modules/project/controllers/ProjectController.php index 6d0f26d..ca147bb 100644 --- a/backend/modules/project/controllers/ProjectController.php +++ b/backend/modules/project/controllers/ProjectController.php @@ -58,14 +58,18 @@ class ProjectController extends Controller public function actionView($id) { $model = $this->findModel($id); - $hh = Hh::findOne($model->hh_id); - $jobsProvider = new ActiveDataProvider([ - 'query' => HhJob::find()->where(['employer_id' => $hh->hh_id]), - 'pagination' => [ - 'pageSize' => 200, - ], - ]); + $jobsProvider = null; + if($model->hh_id){ + $hh = Hh::findOne($model->hh_id); + $jobsProvider = new ActiveDataProvider([ + 'query' => HhJob::find()->where(['employer_id' => $hh->hh_id]), + 'pagination' => [ + 'pageSize' => 200, + ], + ]); + } + $dataProvider = new ActiveDataProvider([ 'query' => FieldsValue::find()->where(['project_id' => $id])->orderBy('order'), diff --git a/backend/modules/project/views/project/view.php b/backend/modules/project/views/project/view.php index 82607df..64e6ba8 100644 --- a/backend/modules/project/views/project/view.php +++ b/backend/modules/project/views/project/view.php @@ -43,7 +43,7 @@ $this->params['breadcrumbs'][] = $this->title; $modelFildValue, - 'layout'=>"{items}", + 'layout' => "{items}", 'columns' => [ 'field.name:text:Поле', 'value', @@ -54,21 +54,21 @@ $this->params['breadcrumbs'][] = $this->title; $modelUser, - 'layout'=>"{items}", + 'layout' => "{items}", 'columns' => [ 'card.fio:text:ФИО', [ 'class' => 'yii\grid\ActionColumn', 'template' => '{view} {update}', 'buttons' => [ - 'update' => function ($url,$model) { + 'update' => function ($url, $model) { return Html::a( '', ['/card/user-card/update', 'id' => $model->id], ['target' => '_blank'] ); }, - 'view' => function ($url,$model) { + 'view' => function ($url, $model) { return Html::a( '', ['/card/user-card/view', 'id' => $model->id], @@ -81,24 +81,26 @@ $this->params['breadcrumbs'][] = $this->title; ], ]); ?> -

Вакансии hh.ru

- $jobsProvider, - 'columns' => [ - ['class' => 'yii\grid\SerialColumn'], + +

Вакансии hh.ru

+ $jobsProvider, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], - 'title', - 'url:url', - 'salary_from', - 'salary_to', - 'salary_currency', - 'address', - 'dt_add:date', + 'title', + 'url:url', + 'salary_from', + 'salary_to', + 'salary_currency', + 'address', + 'dt_add:date', - [ - 'class' => 'yii\grid\ActionColumn', - 'template' => '{view} {delete}' + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{view} {delete}' + ], ], - ], - ]); ?> + ]); ?> +