コード例 #1
0
ファイル: index.php プロジェクト: kleitz/golfleague
?>
 <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>
コード例 #2
0
ファイル: tees.php プロジェクト: kleitz/golfleague
$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']);
コード例 #3
0
ファイル: index.php プロジェクト: kleitz/golfleague
<?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>
コード例 #4
0
ファイル: view.php プロジェクト: kleitz/golfleague
}
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;
コード例 #5
0
ファイル: _list.php プロジェクト: kleitz/golfleague
<?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>
コード例 #6
0
ファイル: _form.php プロジェクト: kleitz/golfleague
?>

    <?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 
コード例 #7
0
ファイル: _form.php プロジェクト: kleitz/golfleague
?>

    <?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 
コード例 #8
0
ファイル: _form.php プロジェクト: kleitz/golfleague
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 
コード例 #9
0
ファイル: view.php プロジェクト: kleitz/golfleague
/* @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;