示例#1
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>
示例#2
0
?>

    <?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 
echo $form->field($model, 'parameters')->textInput(['maxlength' => 255]);
?>

    <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>