/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Competition::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['eventsSetName'] = ['asc' => ['{{%events_set}}.name' => SORT_ASC], 'desc' => ['{{%events_set}}.name' => SORT_DESC]];
     $dataProvider->sort->attributes['sportName'] = ['asc' => ['{{%sport}}.name' => SORT_ASC], 'desc' => ['{{%sport}}.name' => SORT_DESC]];
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         $query->joinWith('{{@eventsSet}}');
         $query->joinWith('{{@sport}}');
         return $dataProvider;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'sport_id' => $this->sport_id, 'events_set_id' => $this->events_set_id, 'date_start' => $this->date_start, 'date_finish' => $this->date_finish, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'location', $this->location]);
     $query->joinWith(['eventsSet' => function ($q) {
         $q->where('{{%events_set}}.name LIKE "%' . $this->eventsSetName . '%"');
     }]);
     $query->joinWith(['sport' => function ($q) {
         $q->where('{{%sport}}.name LIKE "%' . $this->sportName . '%"');
     }]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * Finds the Competition model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Competition the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Competition::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Competition::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'parent_id' => $this->parent_id, 'start_date' => $this->start_date, 'course_id' => $this->course_id, 'holes' => $this->holes, 'rule_id' => $this->rule_id, 'registration_begin' => $this->registration_begin, 'registration_end' => $this->registration_end, 'handicap_min' => $this->handicap_min, 'handicap_max' => $this->handicap_max, 'age_min' => $this->age_min, 'age_max' => $this->age_max, 'recurrence_id' => $this->recurrence_id, 'max_players' => $this->max_players, 'cba' => $this->cba, 'tour' => $this->tour, 'flight_size' => $this->flight_size, 'flight_time' => $this->flight_time, 'flight_window' => $this->flight_window, 'registration_time' => $this->registration_time, 'final_rule_id' => $this->final_rule_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'competition_type', $this->competition_type])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'gender', $this->gender])->andFilterWhere(['like', 'player_type', $this->player_type])->andFilterWhere(['like', 'registration_special', $this->registration_special]);
     return $dataProvider;
 }
Exemplo n.º 4
0
}
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;
Exemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCompetitions()
 {
     return $this->hasMany(Competition::className(), ['events_set_id' => 'id'])->inverseOf('eventsSet');
 }
Exemplo n.º 6
0
 /**
  * find a document instance and returns it property typed.
  *
  * @return app\models\{Document,Bid,Order,Bill} the document
  */
 public static function findCompetition($id)
 {
     $model = Competition::findOne($id);
     if ($model) {
         switch ($model->competition_type) {
             case self::TYPE_MATCH:
                 return Match::findOne($id);
                 break;
             case self::TYPE_TOURNAMENT:
                 return Tournament::findOne($id);
                 break;
             case self::TYPE_SEASON:
                 return Season::findOne($id);
                 break;
         }
     }
     return null;
 }
Exemplo n.º 7
0
 /**
  * Deregister currently logged user from competition
  * @param  [type] $competition_type Season, Tournament, or Match.
  * @param  [type] $competition_id   Identifier of competition
  * @return [type]                   Action to do after. Set flash on success/error.
  */
 public function actionDeregister($id)
 {
     if (!($me = Golfer::me())) {
         Yii::$app->session->setFlash('error', 'You need to be a registered golfer of this site to register to matches.');
     } else {
         $model = Competition::findOne($id);
         if ($model->deregister($me)) {
             Yii::$app->session->setFlash('success', Yii::t('igolf', 'You deregistered from competition "{0}".', $model->name));
         } else {
             Yii::$app->session->setFlash('error', Yii::t('igolf', 'You cannot deregister from competition "{0}".', $model->name));
         }
     }
     return $this->redirect(Yii::$app->request->getReferrer());
 }
Exemplo n.º 8
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['course_id', 'holes', 'rule_id', 'start_date'], 'required']]);
 }
Exemplo n.º 9
0
<?php

use yii\helpers\Html;
use kartik\grid\GridView;
use common\models\Competition;
/* @var $this yii\web\View */
/* @var $searchModel app\models\RuleSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('igolf', 'Competition Rules');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="rule-index">

    <h1><?php 
echo Html::encode($this->title);
?>
 <?php 
echo Html::a(Yii::t('igolf', 'Create Rule'), ['create'], ['class' => 'btn btn-success']);
?>
</h1>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'name', 'description', ['attribute' => 'competition_type', 'filter' => Competition::getLocalizedConstants('TYPE_'), 'value' => function ($model, $key, $index, $widget) {
    return Yii::t('igolf', $model->competition_type);
}], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{view} {delete}']]]);
?>

</div>
Exemplo n.º 10
0
$starts = [];
foreach ($competition->getStarts()->each() as $start) {
    $starts[$start->tees_id] = $start->tees->name;
}
$this->title = $competition->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('igolf', 'Competitions'), 'url' => ['competition/index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="registration-index">

     <?php 
echo GridView::widget(['options' => ['id' => 'registration'], 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'panel' => ['heading' => '<h4>' . $this->title . '</h4>', 'footer' => false], 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true], 'export' => false, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'competition_name', 'label' => Yii::t('igolf', 'Competition'), 'value' => function ($model, $key, $index, $widget) {
    return $model->competition->name;
}, 'visible' => $competition === null], ['attribute' => 'competition_type', 'label' => Yii::t('igolf', 'Competition Type'), 'value' => function ($model, $key, $index, $widget) {
    return Yii::t('igolf', $model->competition->competition_type);
}, 'filter' => Competition::getLocalizedConstants('TYPE_'), 'visible' => $competition === null], ['attribute' => 'golfer_name', 'label' => Yii::t('igolf', 'Golfer'), 'value' => function ($model, $key, $index, $widget) {
    return $model->golfer->name;
}], ['attribute' => 'tees_id', 'filter' => $starts, 'format' => 'raw', 'value' => function ($model, $key, $index, $widget) {
    return $model->tees ? $model->tees->getLabel() : '';
}], ['attribute' => 'status', 'value' => function ($model, $key, $index, $widget) {
    return Yii::t('igolf', $model->status);
}, 'filter' => Registration::getLocalizedConstants('STATUS_')], ['class' => 'kartik\\grid\\CheckboxColumn']]]);
?>

<?php 
$statuses = '<div class="btn-group"><button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">' . Yii::t('igolf', 'Set Tees of Selected Golfer to ') . ' <span class="caret"></span></button><ul class="dropdown-menu" role="menu">';
foreach ($starts as $key => $value) {
    $statuses .= '<li>' . Html::a(Yii::t('igolf', $value), null, ['class' => 'igolf-bulk-action', 'data-tees_id' => $key]) . '</li>';
}
$statuses .= '</ul></div>';
$buttons = Html::a(Yii::t('igolf', 'Assign Tees'), ['assign-tees', 'id' => $competition->id], ['class' => 'btn btn-success']);
Exemplo n.º 11
0
use yii\widgets\ActiveForm;
use common\models\Competition;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model common\models\Start */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="start-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'gender')->radioList(Competition::getLocalizedConstants('GENDER_'));
?>

    <?php 
echo $form->field($model, 'age_min')->textInput();
?>

    <?php 
echo $form->field($model, 'age_max')->textInput();
?>

    <?php 
echo $form->field($model, 'handicap_min')->textInput(['maxlength' => 10]);
?>

    <?php 
Exemplo n.º 12
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCompetition()
 {
     return $this->hasOne(Competition::className(), ['id' => 'competition_id']);
 }
Exemplo n.º 13
0
?>
 <span class="caret"></span></button>
			<ul class="dropdown-menu" role="menu">
				<?php 
foreach (Competition::getConstants('TYPE_') as $competition) {
    ?>
				<li><?php 
    echo Html::a(Yii::t('igolf', $competition), ['create', 'type' => $competition]);
    ?>
</li>
				<?php 
}
?>
			</ul>
		</div>
	</h1>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'name', ['attribute' => 'competition_type', 'hAlign' => GridView::ALIGN_CENTER, 'noWrap' => true, 'visible' => !isset($type), 'filter' => Competition::getLocalizedConstants('TYPE_')], 'description', ['attribute' => 'parent_id', 'label' => Yii::t('igolf', 'Part Of'), 'hAlign' => GridView::ALIGN_CENTER, 'value' => function ($model, $key, $index, $widget) {
    return $model->parent ? $model->parent->name : '';
}, 'noWrap' => true], ['attribute' => 'registration_begin', 'format' => 'datetime', 'hAlign' => GridView::ALIGN_CENTER, 'value' => function ($model, $key, $index, $widget) {
    return new DateTime($model->registration_begin);
}, 'noWrap' => true], ['attribute' => 'registration_end', 'format' => 'datetime', 'hAlign' => GridView::ALIGN_CENTER, 'value' => function ($model, $key, $index, $widget) {
    return new DateTime($model->registration_end);
}, 'noWrap' => true], ['label' => Yii::t('igolf', 'Status'), 'value' => function ($model, $key, $index, $widget) {
    return Yii::t('igolf', $model->status);
}], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{view} {delete}', 'noWrap' => true]]]);
?>

</div>
Exemplo n.º 14
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCompetitions()
 {
     return $this->hasMany(Competition::className(), ['course_id' => 'id']);
 }
Exemplo n.º 15
0
<?php

use common\models\Competition;
use yii\helpers\Html;
use kartik\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\models\TournamentSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('igolf', $parent->childType());
?>
<div class="tournament-index">

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'panel' => ['heading' => '<h4>' . $this->title . '</h4>'], 'export' => false, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'name', 'description', 'registration_begin', 'registration_end', ['attribute' => 'status', 'label' => Yii::t('igolf', 'Status'), 'filter' => Competition::getLocalizedConstants('STATUS_'), 'value' => function ($model, $key, $index, $widget) {
    return Yii::t('igolf', $model->status);
}], ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{view}', 'noWrap' => true]]]);
?>

</div>
Exemplo n.º 16
0
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 80]);
?>

    <?php 
echo $form->field($model, 'description')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'note')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'competition_type')->dropDownList(Competition::getLocalizedConstants('TYPE_'))->hint(Yii::t('igolf', 'Rule applies to this type of competition'));
?>

    <?php 
echo $form->field($model, 'source_type')->dropDownList(Scorecard::getConstants('SCORE_'))->hint(Yii::t('igolf', 'Source column for score'));
?>

    <?php 
echo $form->field($model, 'source_direction')->dropDownList(Scorecard::getConstants('DIRECTION_'))->hint(Yii::t('igolf', 'Source column for score ordering. ASC is smallest wins to largest looses. DESC is opposite.'));
?>

    <?php 
echo $form->field($model, 'destination_type')->dropDownList(Scorecard::getConstants('SCORE_'))->hint(Yii::t('igolf', 'Destination column for result.'));
?>

	<?php 
Exemplo n.º 17
0
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 20]);
?>

    <?php 
echo $form->field($model, 'par')->textInput(['maxlength' => 20]);
?>

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

	<?php 
echo $form->field($model, 'gender')->dropDownList(['' => ''] + Competition::getLocalizedConstants('GENDER_'));
?>

	<?php 
echo $form->field($model, 'category')->dropDownList(['' => ''] + Tees::getLocalizedConstants('CATEGORY_'));
?>

	<?php 
echo $form->field($model, 'front_back')->dropDownList(['' => ''] + Tees::getLocalizedConstants('TEE_'));
?>

    <?php 
echo $form->field($model, 'course_rating')->textInput(['maxlength' => 20]);
?>

    <?php 
Exemplo n.º 18
0
<?php

use common\models\Competition;
use common\models\Scorecard;
use common\models\Rule;
use kartik\detail\DetailView;
use yii\helpers\Html;
use yii\data\ActiveDataProvider;
/* @var $this yii\web\View */
/* @var $model app\models\Rule */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('igolf', 'Competition Rules'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="rule-view">

    <?php 
echo DetailView::widget(['model' => $model, 'panel' => ['heading' => '<h3>' . $model->name . '</h3>'], 'labelColOptions' => ['style' => 'width: 30%'], 'attributes' => ['name', 'description', 'note', ['attribute' => 'competition_type', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => Competition::getConstants('TYPE_')], ['attribute' => 'source_type', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => Scorecard::getConstants('SCORE_')], ['attribute' => 'source_direction', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => Scorecard::getConstants('DIRECTION_')], ['attribute' => 'destination_type', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => ['' => ''] + Scorecard::getConstants('SCORE_')], ['attribute' => 'handicap', 'type' => DetailView::INPUT_SWITCH, 'widgetOptions' => ['pluginOptions' => ['onText' => Yii::t('igolf', '   Use Handicap    '), 'offText' => Yii::t('igolf', 'Do Not Use Handicap')]]], ['attribute' => 'team', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => Rule::getTeamList()], ['attribute' => 'classname', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => Rule::getList()], 'parameters']]);
?>



<?php 
$dataProvider = new ActiveDataProvider(['query' => $model->getPoints()]);
echo $this->render('../point/_updates', ['dataProvider' => $dataProvider, 'rule' => $model]);
?>

</div>
Exemplo n.º 19
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCompetitions()
 {
     return $this->hasMany(Competition::className(), ['sport_id' => 'id'])->inverseOf('sport');
 }
Exemplo n.º 20
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCompetitions0()
 {
     return $this->hasMany(Competition::className(), ['final_rule_id' => 'id']);
 }
Exemplo n.º 21
0
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\Registration */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="registration-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'competition_id')->dropDownList(ArrayHelper::map(Competition::find()->where(['status' => Competition::STATUS_OPEN])->asArray()->all(), 'id', 'name'));
?>

    <?php 
echo $form->field($model, 'golfer_id')->dropDownList(ArrayHelper::map(Golfer::find()->asArray()->all(), 'id', 'name'));
?>

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

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('igolf', 'Create') : Yii::t('igolf', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
Exemplo n.º 22
0
/* @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;