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 = new ActiveDataProvider([ $jobsProvider = null;
'query' => HhJob::find()->where(['employer_id' => $hh->hh_id]), if($model->hh_id){
'pagination' => [ $hh = Hh::findOne($model->hh_id);
'pageSize' => 200, $jobsProvider = new ActiveDataProvider([
], 'query' => HhJob::find()->where(['employer_id' => $hh->hh_id]),
]); 'pagination' => [
'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,24 +81,26 @@ $this->params['breadcrumbs'][] = $this->title;
], ],
]); ?> ]); ?>
<h2>Вакансии hh.ru</h2> <?php if ($jobsProvider): ?>
<?= GridView::widget([ <h2>Вакансии hh.ru</h2>
'dataProvider' => $jobsProvider, <?= GridView::widget([
'columns' => [ 'dataProvider' => $jobsProvider,
['class' => 'yii\grid\SerialColumn'], 'columns' => [
['class' => 'yii\grid\SerialColumn'],
'title', 'title',
'url:url', 'url:url',
'salary_from', 'salary_from',
'salary_to', 'salary_to',
'salary_currency', 'salary_currency',
'address', 'address',
'dt_add:date', 'dt_add:date',
[ [
'class' => 'yii\grid\ActionColumn', 'class' => 'yii\grid\ActionColumn',
'template' => '{view} {delete}' 'template' => '{view} {delete}'
],
], ],
], ]); ?>
]); ?> <?php endif; ?>
</div> </div>