コード例 #1
0
ファイル: index.php プロジェクト: aixiaobenaixiaoben/find

    <div class="table-responsive">
        <?php 
echo GridView::widget(['layout' => '{summary}{pager}{items}{pager}', 'dataProvider' => $dataProvider, 'pager' => ['class' => yii\widgets\LinkPager::className(), 'firstPageLabel' => 'First', 'lastPageLabel' => 'Last'], 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-striped table-bordered table-hover'], 'headerRowOptions' => ['class' => 'x'], 'columns' => [['class' => 'yii\\grid\\ActionColumn', 'urlCreator' => function ($action, $model, $key, $index) {
    // using the column name as key, not mapping to 'id' like the standard generator
    $params = is_array($key) ? $key : [$model->primaryKey()[0] => (string) $key];
    $params[0] = \Yii::$app->controller->id ? \Yii::$app->controller->id . '/' . $action : $action;
    return Url::toRoute($params);
}, 'contentOptions' => ['nowrap' => 'nowrap']], ['class' => yii\grid\DataColumn::className(), 'attribute' => 'event_id', 'value' => function ($model) {
    if ($rel = $model->getEvent()->one()) {
        return Html::a($rel->id, ['event/view', 'id' => $rel->id], ['data-pjax' => 0]);
    } else {
        return '';
    }
}, 'format' => 'raw'], 'name', 'age', 'height', 'dress', ['attribute' => 'gender', 'value' => function ($model) {
    return common\models\profile\Profile::getGenderValueLabel($model->gender);
}], 'appearance', 'created_at']]);
?>
    </div>

</div>


<?php 
\yii\widgets\Pjax::end();
?>



コード例 #2
0
ファイル: _form.php プロジェクト: aixiaobenaixiaoben/find
        <p>
            
			<?php 
echo $form->field($model, 'id')->textInput();
?>
			<?php 
echo $form->field($model, 'event_id')->dropDownList(\yii\helpers\ArrayHelper::map(common\models\event\Event::find()->all(), 'id', 'id'), ['prompt' => 'Select']);
?>
			<?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
			<?php 
echo $form->field($model, 'age')->textInput();
?>
			<?php 
echo $form->field($model, 'gender')->dropDownList(common\models\profile\Profile::optsgender());
?>
			<?php 
echo $form->field($model, 'height')->textInput();
?>
			<?php 
echo $form->field($model, 'dress')->textInput(['maxlength' => true]);
?>
			<?php 
echo $form->field($model, 'appearance')->textInput(['maxlength' => true]);
?>
			<?php 
echo $form->field($model, 'created_at')->textInput();
?>
			<?php 
echo $form->field($model, 'updated_at')->textInput();