/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Shifts::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['ID' => $this->ID, 'sh_date' => $this->sh_date, 'sh_is_argia' => $this->sh_is_argia, 'sh_is_efhmeria' => $this->sh_is_efhmeria, 'sh_is_weekend' => $this->sh_is_weekend, 'sh_elaxisto_prosopiko' => $this->sh_elaxisto_prosopiko]);
     $query->andFilterWhere(['like', 'sh_bardia', $this->sh_bardia]);
     return $dataProvider;
 }
 /**
  * Finds the Shifts model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Shifts the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Shifts::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
$nurseModel = new \app\models\Nurse();
?>
<div class="nurseshift-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Create Nurseshift'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'ns_nurseID', 'label' => 'Όνομα Νοσηλευτή', 'value' => function ($model, $index, $dataColumn) {
    // more optimized than $model->role->name;
    $roleDropdown = \app\models\Nurse::dropdown();
    return $roleDropdown[$model->ns_nurseID];
}, 'filter' => \app\models\Nurse::dropdown()], ['attribute' => 'ns_type', 'label' => 'Τύπος', 'value' => 'nsType.description', 'filter' => \app\models\Types::dropdown()], ['attribute' => 'ns_shiftID', 'label' => 'Ημερομηνία', 'value' => function ($model, $index, $dataColumn) {
    // more optimized than $model->role->name;
    $roleDropdown = \app\models\Shifts::dropdown();
    return $roleDropdown[$model->ns_nurseID];
}, 'filter' => \yii\jui\DatePicker::widget(['language' => 'el', 'dateFormat' => 'dd-MM-yyyy']), 'format' => 'html'], 'ns_hours', ['class' => 'yii\\grid\\ActionColumn']], 'containerOptions' => ['style' => 'overflow: auto'], 'beforeHeader' => [['columns' => [['content' => 'Header Before 1', 'options' => ['colspan' => 3, 'class' => 'text-center warning']], ['content' => 'Header Before 2', 'options' => ['colspan' => 3, 'class' => 'text-center warning']], ['content' => 'Header Before 3', 'options' => ['colspan' => 1, 'class' => 'text-center warning']]], 'options' => ['class' => 'skip-export']]], 'toolbar' => [['content' => Html::button('&lt;i class="glyphicon glyphicon-plus">&lt;/i>', ['type' => 'button', 'title' => Yii::t('kvgrid', 'Add Book'), 'class' => 'btn btn-success', 'onclick' => 'alert("This will launch the book creation form.\\n\\nDisabled for this demo!");']) . ' ' . Html::a('&lt;i class="glyphicon glyphicon-repeat">&lt;/i>', ['grid-demo'], ['data-pjax' => 0, 'class' => 'btn btn-default', 'title' => Yii::t('kvgrid', 'Reset Grid')])], '{export}', '{toggleData}'], 'pjax' => true, 'bordered' => true, 'striped' => false, 'condensed' => false, 'responsive' => true, 'hover' => true, 'floatHeader' => true]);
?>

</div>
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getNsShift()
 {
     return $this->hasOne(Shifts::className(), ['ID' => 'ns_shiftID']);
 }