Example #1
0
?>
<div class="season-index">

    <h1>
		<?php 
echo Html::encode($this->title);
?>
    	
		<div class="btn-group">
			<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown"><?php 
echo Yii::t('igolf', 'New');
?>
 <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 : '';
Example #2
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>