コード例 #1
0
$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>
コード例 #2
0
/* @var $model app\models\Nurseshift */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="nurseshift-form">

    <?php 
$form = ActiveForm::begin();
?>

    <!--<?php 
echo $form->field($model, 'ns_nurseID')->textInput();
?>
-->
    <?php 
echo $form->field($model, 'ns_nurseID')->dropDownList(Nurse::dropdown());
?>

    <?php 
echo $form->field($model, 'ns_shiftID')->textInput();
?>

    <?php 
echo $form->field($model, 'ns_type')->dropDownList(Types::dropdown());
?>

    <?php 
echo $form->field($model, 'ns_hours')->textInput();
?>

    <div class="form-group">