示例#1
0
echo $form->field($model, 'tees_id')->widget(DepDrop::classname(), ['options' => ['id' => 'tees-id'], 'pluginOptions' => ['depends' => ['course-id'], 'placeholder' => 'Select...', 'url' => Url::to(['/golfer/practice/tees'])]]);
?>
	
    <?php 
echo $form->field($model, 'start_time')->widget(DateTimePicker::classname(), ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'todayHighlight' => true]]);
?>

	<?php 
echo $form->field($model, 'start_hole')->dropDownList(array(1 => '1', 10 => '10'));
?>

	<?php 
echo $form->field($model, 'holes')->dropDownList(array(18 => '18', 9 => '9'));
?>

    <?php 
echo $form->field($model, 'status')->dropDownList(Practice::getLocalizedConstants('STATUS_'));
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('igolf', 'Add') : Yii::t('igolf', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
示例#2
0
<?php

use kartik\detail\DetailView;
use yii\helpers\ArrayHelper;
use common\models\Course;
use common\models\Practice;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model app\models\Practice */
?>
<div class="practice-view">
	
    <?php 
echo DetailView::widget(['model' => $model, 'panel' => ['heading' => '<h3>' . $this->title . '</h3>'], 'labelColOptions' => ['style' => 'width: 30%'], 'attributes' => [['attribute' => 'course_id', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'options' => ['id' => 'course-id'], 'items' => ArrayHelper::map(Course::find()->asArray()->all(), 'id', 'name'), 'value' => $model->course ? $model->course->name : ''], ['attribute' => 'tees_id', 'type' => DetailView::INPUT_DEPDROP, 'value' => $model->tees ? $model->tees->name : '', 'widgetOptions' => ['pluginOptions' => ['depends' => ['course-id'], 'placeholder' => 'Select...', 'url' => Url::to(['/golfer/practice/tees'])], 'data' => $model->tees ? [$model->tees_id => $model->tees->name] : []]], ['attribute' => 'start_time', 'format' => 'datetime', 'type' => DetailView::INPUT_DATETIME, 'widgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'todayHighlight' => true]]], ['attribute' => 'start_hole', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => array(1 => '1', 10 => '10')], ['attribute' => 'holes', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => array(18 => '18', 9 => '9')], 'handicap', ['attribute' => 'status', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => Practice::getLocalizedConstants('STATUS_')]]]);
?>

</div>