use yii\helpers\Html; use yii\helpers\Url; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model common\models\Practice */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="practice-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'course_id')->dropDownList(Course::getCourseList(), ['id' => 'course-id']); ?> <?php 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
} array_pop($this->params['breadcrumbs']); $this->params['breadcrumbs'][] = $this->title; $recurrence = $model->recurrence; if ($model->recurrence) { // strips "RRULE:" at begining of string $str = strpos($model->recurrence, 'RRULE:') === 0 ? substr($model->recurrence, 6) : $model->recurrence; $rrule = new Recurr\Rule($str); $textTransformer = new Recurr\Transformer\TextTransformer(); $recurrence = ucfirst($textTransformer->transform($rrule)); } ?> <div class="competition-view"> <?php echo DetailView::widget(['model' => $model, 'panel' => ['heading' => '<h3>' . Yii::t('igolf', $model->competition_type) . ' ' . $model->name . '</h3>'], 'labelColOptions' => ['style' => 'width: 30%'], 'attributes' => ['name', 'description', ['attribute' => 'parent_id', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => $model->getParentCandidates(), 'label' => Yii::t('igolf', 'Parent'), 'value' => $model->parent ? $model->parent->name . Html::a(' <span class="glyphicon glyphicon-share"></span>', ['view', 'id' => $model->parent_id]) : '', 'visible' => $model->competition_type != Competition::TYPE_SEASON, 'format' => 'raw'], ['attribute' => 'course_id', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'label' => Yii::t('igolf', 'Course'), 'items' => Course::getCourseList(true), 'value' => $model->course ? $model->course->getFullName() . Html::a(' <span class="glyphicon glyphicon-share"></span>', ['course/view', 'id' => $model->course_id]) : '', 'format' => 'raw'], ['attribute' => 'holes', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => array(18 => '18', 9 => '9')], ['attribute' => 'rule_id', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(['' => ''] + Rule::find()->where(['competition_type' => $model->competition_type])->asArray()->all(), 'id', 'name'), 'value' => $model->rule->name . Html::a(' <span class="glyphicon glyphicon-share"></span>', ['rule/view', 'id' => $model->rule_id]), 'format' => 'raw'], ['attribute' => 'final_rule_id', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(['' => ''] + Rule::find()->where(['competition_type' => $model->competition_type])->asArray()->all(), 'id', 'name'), 'value' => $model->final_rule_id ? $model->finalRule->name . Html::a(' <span class="glyphicon glyphicon-share"></span>', ['rule/view', 'id' => $model->final_rule_id]) : '', 'format' => 'raw'], ['attribute' => 'start_date', 'format' => 'datetime', 'type' => DetailView::INPUT_DATETIME, 'widgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'todayHighlight' => true]], 'value' => $model->registration_begin ? new DateTime($model->start_date) : ''], ['attribute' => 'recurrence', 'format' => 'raw', 'type' => DetailView::INPUT_TEXT, 'value' => $recurrence], ['attribute' => 'registration_begin', 'format' => 'datetime', 'type' => DetailView::INPUT_DATETIME, 'widgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'todayHighlight' => true]], 'value' => $model->registration_begin ? new DateTime($model->registration_begin) : ''], ['attribute' => 'registration_end', 'format' => 'datetime', 'type' => DetailView::INPUT_DATETIME, 'widgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'todayHighlight' => true]], 'value' => $model->registration_end ? new DateTime($model->registration_end) : ''], 'handicap_min', 'handicap_max', 'age_min', 'age_max', ['attribute' => 'gender', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => ['' => ''] + Competition::getLocalizedConstants('GENDER_')], 'max_players', ['attribute' => 'registration_special', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => ['' => ''] + Competition::getLocalizedConstants('SPECIAL_')], 'registration_time', 'flight_size', 'flight_time', ['attribute' => 'status', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => Competition::getLocalizedConstants('STATUS_')]]]); ?> <?php if (in_array($model->competition_type, [Competition::TYPE_SEASON, Competition::TYPE_TOURNAMENT])) { switch ($model->competition_type) { case Competition::TYPE_SEASON: $searchModel = new TournamentSearch(); $dataProvider = $searchModel->search(['TournamentSearch' => ['parent_id' => $model->id]]); $type = Competition::TYPE_TOURNAMENT; break; case Competition::TYPE_TOURNAMENT: $searchModel = new MatchSearch(); $dataProvider = $searchModel->search(['MatchSearch' => ['parent_id' => $model->id]]); $type = Competition::TYPE_MATCH; break;
?> <?php echo $form->field($model, 'gender')->radioList($model::getLocalizedConstants('GENDER_'), ['inline' => true]); ?> <?php echo $form->field($model, 'registration_special')->dropDownList(['' => ''] + $model::getLocalizedConstants('SPECIAL_')); ?> <?php if ($model->competition_type == $model::TYPE_MATCH) { ?> <?php echo $form->field($model, 'course_id')->dropDownList(Course::getCourseList(true)); ?> <?php echo $form->field($model, 'holes')->dropDownList(array(18 => '18', 9 => '9')); ?> <div class='row'> <div class='col-lg-4'> <?php echo $form->field($model, 'start_date')->widget(DateTimePicker::classname(), ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'todayHighlight' => true]])->label(Yii::t('igolf', 'Start Date & Time')); ?> </div> <div class='col-lg-8'> <?php