echo Html::a('Neuer Benutzertext', ['user-text/create/' . $type], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'ut_id', ['attribute' => 'p_id', 'filterType' => GridView::FILTER_SELECT2, 'filter' => InputHelper::getDropdownOptions('app\\models\\Group', 'p_id', 'bezeichnung', true, true), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'value' => function ($model, $key, $index, $widget) { if (!$model->p_id) { return 'Alle'; } $group = \app\models\Group::findOne($model->p_id); return $group ? $group->bezeichnung : $model->p_id; }, 'filterInputOptions' => ['placeholder' => 'Bitte wählen Sie'], 'format' => 'raw'], ['attribute' => 'b_id', 'filterType' => GridView::FILTER_SELECT2, 'filter' => InputHelper::getDropdownOptions('app\\models\\Bank', 'b_id', 'bezeichnung', true, true), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'value' => function ($model, $key, $index, $widget) { if (!$model->b_id) { return 'Alle'; } $group = \app\models\Bank::findOne($model->b_id); return $group ? $group->bezeichnung : $model->b_id; }, 'filterInputOptions' => ['placeholder' => 'Bitte wählen Sie'], 'format' => 'raw'], ['attribute' => 'l_id', 'filterType' => GridView::FILTER_SELECT2, 'filter' => InputHelper::getDropdownOptions('app\\models\\Language', 'l_id', 'name', true, true, true), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'value' => function ($model, $key, $index, $widget) { if (!$model->b_id) { return 'Default'; } $group = \app\models\Language::findOne($model->l_id); return $group ? $group->name : $model->l_id; }, 'filterInputOptions' => ['placeholder' => 'Bitte wählen Sie'], 'format' => 'raw'], ['attribute' => 't_id', 'value' => function ($model, $key, $index, $widget) { $group = \app\models\Text::findOne($model->t_id); return $group ? $group->name : $model->t_id; }, 'format' => 'raw'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']]]); ?> </div>
use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; /* @var $this yii\web\View */ $this->title = 'Victor 2016'; $webRoot = Yii::$app->getUrlManager()->getBaseUrl(); ?> <link href="<?php echo $webRoot; ?> /css/styles/<?php echo $style; ?> /style.css" rel="stylesheet"> <?php if (!empty($warning)) { ?> <div class="alert alert-warning"> <?php echo nl2br($warning); ?> </div> <?php } ?> <div class="content"> <?php echo \app\models\Text::findOne($text->t_id)->text; ?> </div>
/** * Finds the Text model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Text the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Text::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }