fix project

This commit is contained in:
Kavalar 2018-11-23 16:14:28 +03:00
parent 25e922cd37
commit 553e3b885e
2 changed files with 34 additions and 28 deletions

View File

@ -58,14 +58,18 @@ class ProjectController extends Controller
public function actionView($id) public function actionView($id)
{ {
$model = $this->findModel($id); $model = $this->findModel($id);
$hh = Hh::findOne($model->hh_id);
$jobsProvider = null;
if($model->hh_id){
$hh = Hh::findOne($model->hh_id);
$jobsProvider = new ActiveDataProvider([ $jobsProvider = new ActiveDataProvider([
'query' => HhJob::find()->where(['employer_id' => $hh->hh_id]), 'query' => HhJob::find()->where(['employer_id' => $hh->hh_id]),
'pagination' => [ 'pagination' => [
'pageSize' => 200, 'pageSize' => 200,
], ],
]); ]);
}
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([
'query' => FieldsValue::find()->where(['project_id' => $id])->orderBy('order'), 'query' => FieldsValue::find()->where(['project_id' => $id])->orderBy('order'),

View File

@ -43,7 +43,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $modelFildValue, 'dataProvider' => $modelFildValue,
'layout'=>"{items}", 'layout' => "{items}",
'columns' => [ 'columns' => [
'field.name:text:Поле', 'field.name:text:Поле',
'value', 'value',
@ -54,21 +54,21 @@ $this->params['breadcrumbs'][] = $this->title;
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $modelUser, 'dataProvider' => $modelUser,
'layout'=>"{items}", 'layout' => "{items}",
'columns' => [ 'columns' => [
'card.fio:text:ФИО', 'card.fio:text:ФИО',
[ [
'class' => 'yii\grid\ActionColumn', 'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}', 'template' => '{view} {update}',
'buttons' => [ 'buttons' => [
'update' => function ($url,$model) { 'update' => function ($url, $model) {
return Html::a( return Html::a(
'<span class="glyphicon glyphicon-pencil"></span>', '<span class="glyphicon glyphicon-pencil"></span>',
['/card/user-card/update', 'id' => $model->id], ['/card/user-card/update', 'id' => $model->id],
['target' => '_blank'] ['target' => '_blank']
); );
}, },
'view' => function ($url,$model) { 'view' => function ($url, $model) {
return Html::a( return Html::a(
'<span class="glyphicon glyphicon-eye-open"></span>', '<span class="glyphicon glyphicon-eye-open"></span>',
['/card/user-card/view', 'id' => $model->id], ['/card/user-card/view', 'id' => $model->id],
@ -81,6 +81,7 @@ $this->params['breadcrumbs'][] = $this->title;
], ],
]); ?> ]); ?>
<?php if ($jobsProvider): ?>
<h2>Вакансии hh.ru</h2> <h2>Вакансии hh.ru</h2>
<?= GridView::widget([ <?= GridView::widget([
'dataProvider' => $jobsProvider, 'dataProvider' => $jobsProvider,
@ -101,4 +102,5 @@ $this->params['breadcrumbs'][] = $this->title;
], ],
], ],
]); ?> ]); ?>
<?php endif; ?>
</div> </div>