/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Rule::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'rule_type', $this->rule_type])->andFilterWhere(['like', 'competition_type', $this->competition_type])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'note', $this->note]); return $dataProvider; }
?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => 80]); ?> <?php echo $form->field($model, 'description')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'rule_id')->dropDownList(['' => ''] + ArrayHelper::map(Rule::find()->where(['competition_type' => $model->competition_type])->asArray()->all(), 'id', 'name')); ?> <?php echo $form->field($model, 'final_rule_id')->dropDownList(['' => ''] + ArrayHelper::map(Rule::find()->where(['competition_type' => $model->competition_type])->asArray()->all(), 'id', 'name')); ?> <?php echo $form->field($model, 'registration_begin')->widget(DateTimePicker::classname(), ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'todayHighlight' => true]]); ?> <?php echo $form->field($model, 'registration_end')->widget(DateTimePicker::classname(), ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'todayHighlight' => true]]); ?> <?php echo $form->field($model, 'handicap_min')->textInput(); ?> <?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;
/* @var $this yii\web\View */ /* @var $model common\models\Season */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => Yii::t('igolf', 'Competitions'), 'url' => ['index']]; if ($bcs = $model->breadcrumbs()) { foreach ($bcs as $bc) { $this->params['breadcrumbs'][] = $bc; } } array_pop($this->params['breadcrumbs']); $this->params['breadcrumbs'][] = $this->title; ?> <div class="season-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(), 'value' => $model->parent ? $model->parent->name : '', 'visible' => $model->competition_type != Competition::TYPE_SEASON], ['attribute' => 'course_id', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'label' => Yii::t('igolf', 'Course'), 'items' => ArrayHelper::map(Course::find()->asArray()->all(), 'id', 'name'), 'value' => $model->course ? $model->course->name : ''], ['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_id ? $model->rule->name : ''], ['attribute' => 'start_date', 'format' => 'date', 'type' => DetailView::INPUT_DATE, 'widgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'todayHighlight' => true]]], ['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_')], ['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;