예제 #1
0
파일: tees.php 프로젝트: kleitz/golfleague
$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']);
$buttons .= ' ' . $statuses;
echo $buttons;
?>

</div>
<script type="text/javascript">
예제 #2
0
}, '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;
}], ['label' => Yii::t('igolf', 'Created At'), 'attribute' => 'created_at', 'format' => 'datetime', 'value' => function ($model, $key, $index, $widget) {
    return new DateTime($model->created_at);
}], ['label' => Yii::t('igolf', 'Last Update'), 'attribute' => 'updated_at', 'format' => 'datetime', 'value' => function ($model, $key, $index, $widget) {
    return new DateTime($model->updated_at);
}], ['attribute' => 'status', 'value' => function ($model, $key, $index, $widget) {
    return Yii::t('igolf', $model->status);
}, 'filter' => Registration::getLocalizedPreCompetitionStatuses()], ['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', 'Change Status of Selected Registrations to ') . ' <span class="caret"></span></button><ul class="dropdown-menu" role="menu">';
foreach (Registration::getLocalizedConstants('STATUS_') as $key => $value) {
    $statuses .= '<li>' . Html::a(Yii::t('igolf', 'Change to {0}', $value), null, ['class' => 'igolf-bulk-action', 'data-status' => $key]) . '</li>';
}
$statuses .= '</ul></div>';
$buttons = '';
if ($competition) {
    $buttons = Html::a(Yii::t('igolf', 'New Registration'), ['create', 'id' => $competition->id], ['class' => 'btn btn-success']);
    $buttons .= ' ' . Html::a(Yii::t('igolf', 'Bulk Registrations'), ['bulk', 'id' => $competition->id], ['class' => 'btn btn-success']);
}
$buttons .= ' ' . Html::a(Yii::t('igolf', 'Delete Selected Registrations'), null, ['class' => 'btn btn-danger igolf-bulk-action', 'data' => ['status' => Registration::ACTION_DELETE, 'confirm-local' => Yii::t('igolf', 'Are you sure you want to delete selected registration(s)?')]]);
$buttons .= ' ' . $statuses;
if ($competition) {
    if (in_array($competition->competition_type, [Competition::TYPE_SEASON, Competition::TYPE_TOURNAMENT])) {
        if ($competition->getCompetitions()->exists()) {
            $children = '<div class="btn-group"><button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">' . Yii::t('igolf', 'Register Selected to ') . ' <span class="caret"></span></button><ul class="dropdown-menu" role="menu">';
            foreach ($competition->getCompetitions()->each() as $child) {