コード例 #1
0
ファイル: _form.php プロジェクト: kleitz/golfleague
?>

    <?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 
echo $form->field($model, 'handicap')->widget(SwitchInput::className(), ['pluginOptions' => ['onText' => Yii::t('igolf', '   Use Handicap    '), 'offText' => Yii::t('igolf', 'Do Not Use Handicap')]]);
?>
			
    <?php 
echo $form->field($model, 'team')->dropDownList(Rule::getTeamList())->hint(Yii::t('igolf', 'Camp size'));
?>

    <?php 
echo $form->field($model, 'classname')->dropDownList(Rule::getList())->hint(Yii::t('igolf', 'Rule to apply'));
?>

	<?php 
コード例 #2
0
ファイル: view.php プロジェクト: kleitz/golfleague
<?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>
コード例 #3
0
ファイル: Rule.php プロジェクト: kleitz/golfleague
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['source_direction'], 'in', 'range' => array_keys(Scorecard::getConstants('DIRECTION_'))], [['source_type', 'destination_type'], 'in', 'range' => array_keys(Scorecard::getConstants('SCORE_'))], [['status'], 'in', 'range' => array_keys(self::getConstants('STATUS_'))]]);
 }