Example #1
0
$this->title = Yii::t('app', 'Zadania');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="task-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 Task'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['label' => 'Kategoria', 'value' => function ($model) {
    return Categories::findOne(['id' => $model->category_id])->name;
}], ['label' => 'Użytkownik', 'value' => function ($model) {
    return UserFrontend::findOne(['id' => $model->user_id])->username;
}], 'name', ['label' => 'Zadanie wykonane', 'value' => function ($model) {
    return $model->status == 1 ? 'Tak' : 'Nie';
}], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Example #2
0
use yii\widgets\DetailView;
use app\models\UserFrontend;
use app\models\Categories;
/* @var $this yii\web\View */
/* @var $model app\models\Task */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Tasks'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="task-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', ['label' => 'Kategoria', 'value' => Categories::findOne(['id' => $model->category_id])->name], ['label' => 'Użytkownik', 'value' => UserFrontend::findOne(['id' => $model->user_id])->username], 'name', ['label' => 'Zadanie wykonane', 'value' => $model->status == 1 ? 'Tak' : 'Nie']]]);
?>

</div>