Exemple #1
2
<?php

use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use kartik\detail\DetailView;
use common\models\Facility;
use common\models\Golfer;
use common\models\User;
use yii2mod\selectize\Selectize;
/* @var $this yii\web\View */
/* @var $model common\models\Golfer */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('igolf', 'Golfers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="golfer-view">

    <?php 
echo DetailView::widget(['model' => $model, 'panel' => ['heading' => '<h3>' . $model->name . '</h3>'], 'labelColOptions' => ['style' => 'width: 30%'], 'attributes' => ['name', 'email:email', 'phone', 'handicap', ['attribute' => 'gender', 'type' => DetailView::INPUT_RADIO_LIST, 'items' => ['' => Yii::t('igolf', 'Unspecified')] + Golfer::getLocalizedConstants('GENDER_')], ['attribute' => 'hand', 'type' => DetailView::INPUT_RADIO_LIST, 'items' => ['' => Yii::t('igolf', 'Unspecified')] + Golfer::getLocalizedConstants('HAND_')], 'homecourse', ['attribute' => 'facility_id', 'value' => isset($model->facility) ? $model->facility->name : '', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => ['' => 'Select home course...'] + ArrayHelper::map(Facility::find()->where(['>', 'id', 0])->asArray()->all(), 'id', 'name'), 'widgetOptions' => ['pluginOptions' => ['items' => ArrayHelper::map(Facility::find()->where(['>', 'id', 0])->asArray()->all(), 'id', 'name')]]], ['attribute' => 'user_id', 'label' => 'User', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(['' => ''] + User::find()->orderBy('username')->asArray()->all(), 'id', 'username'), 'value' => isset($model->user) ? $model->user->username : '******']]]);
?>

</div>
 /**
  * Finds the Facility model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Facility the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Facility::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Facility::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'units', $this->units]);
     return $dataProvider;
 }
Exemple #4
0
?>

    <?php 
echo $form->field($model, 'subject')->textInput(['maxlength' => 80]);
?>

    <?php 
echo $form->field($model, 'body')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'message_type')->dropDownList(Message::getLocalizedConstants('TYPE_'));
?>

    <?php 
echo $form->field($model, 'facility_id')->dropDownList(['' => ''] + ArrayHelper::map(Facility::find()->asArray()->all(), 'id', 'name'));
?>

    <?php 
echo $form->field($model, 'message_start')->widget(DateTimePicker::classname(), ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'todayHighlight' => true]]);
?>

    <?php 
echo $form->field($model, 'message_end')->widget(DateTimePicker::classname(), ['pluginOptions' => ['format' => 'yyyy-mm-dd hh:ii:ss', 'todayHighlight' => true]]);
?>

    <?php 
echo $form->field($model, 'status')->dropDownList(Message::getLocalizedConstants('STATUS_'));
?>

    <div class="form-group">
Exemple #5
0
echo $form->field($model, 'name')->textInput(['maxlength' => 80]);
?>

    <?php 
echo $form->field($model, 'phone')->textInput(['maxlength' => 20]);
?>

    <?php 
echo $form->field($model, 'email')->textInput(['maxlength' => 80]);
?>

    <?php 
echo $form->field($model, 'website')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'units')->dropDownList(Facility::getLocalizedConstants('UNITS_'));
?>

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

    <?php 
ActiveForm::end();
?>

</div>
Exemple #6
0
?>

    <?php 
echo $form->field($model, 'email')->textInput(['maxlength' => 40]);
?>

    <?php 
echo $form->field($model, 'phone')->textInput(['maxlength' => 40]);
?>

    <?php 
echo $form->field($model, 'homecourse')->textInput(['maxlength' => 80]);
?>

    <?php 
echo $form->field($model, 'facility_id')->widget(Selectize::className(), ['items' => ['' => 'Select home course...'] + ArrayHelper::map(Facility::find()->where(['>', 'id', 0])->asArray()->all(), 'id', 'name')]);
?>

    <?php 
echo $form->field($model, 'gender')->radioList(Golfer::getLocalizedConstants('GENDER_'));
?>

    <?php 
echo $form->field($model, 'hand')->radioList(Golfer::getLocalizedConstants('HAND_'));
?>

    <?php 
echo $form->field($model, 'handicap')->textInput();
?>

    <div class="form-group">
Exemple #7
0
?>
<div class="golfer-profile-index">

	<div class="row">
		<div class="col-lg-8">
			<?php 
if (!$model) {
    ?>
				<div class="alert alert-info">
					Your are not registered as a golfer.
				</div>
			<?php 
} else {
    ?>
    <?php 
    echo DetailView::widget(['model' => $model, 'panel' => ['heading' => '<h3>' . Html::encode($this->title) . '</h3>'], 'labelColOptions' => ['style' => 'width: 30%'], 'formOptions' => ['action' => Url::to(['view', 'id' => $model->id])], 'attributes' => ['name', 'email:email', 'phone', 'handicap', ['attribute' => 'gender', 'type' => DetailView::INPUT_RADIO_LIST, 'items' => ['' => Yii::t('igolf', 'Unspecified')] + Golfer::getLocalizedConstants('GENDER_')], ['attribute' => 'hand', 'type' => DetailView::INPUT_RADIO_LIST, 'items' => ['' => Yii::t('igolf', 'Unspecified')] + Golfer::getLocalizedConstants('HAND_')], ['label' => Yii::t('igolf', 'Home Course'), 'attribute' => 'facility_id', 'value' => isset($model->facility) ? $model->facility->name : '', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => ['' => 'Select home course...'] + ArrayHelper::map(Facility::find()->where(['>', 'id', 0])->asArray()->all(), 'id', 'name'), 'widgetOptions' => ['pluginOptions' => ['items' => ArrayHelper::map(Facility::find()->where(['>', 'id', 0])->asArray()->all(), 'id', 'name')]]]]]);
    ?>

			<?php 
}
?>
		</div>
		
		<div class="col-lg-4">
		    <h3><?php 
echo Yii::t('goflleague', 'Menu');
?>
</h3>

		    <h3><?php 
echo Yii::t('goflleague', 'Enter score');
Exemple #8
0
<?php

use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use kartik\grid\GridView;
use common\models\Facility;
use common\models\Message;
/* @var $this yii\web\View */
/* @var $searchModel backend\MessageSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('igolf', 'Messages');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="message-index">

    <h1>    <h1><?php 
echo Html::encode($this->title);
?>
 <?php 
echo Html::a(Yii::t('igolf', 'Create {modelClass}', ['modelClass' => 'Message']), ['create'], ['class' => 'btn btn-success']);
?>
</h1>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], 'subject', ['attribute' => 'message_type', 'filter' => Message::getLocalizedConstants('TYPE_')], ['attribute' => 'facility_id', 'filter' => ArrayHelper::map(Facility::find()->asArray()->all(), 'id', 'name'), 'value' => 'facility.name'], ['attribute' => 'status', 'filter' => Message::getLocalizedConstants('STATUS_')], 'updated_at', ['class' => 'kartik\\grid\\ActionColumn', 'template' => '{view} {delete}']]]);
?>

</div>
Exemple #9
0
use yii\helpers\Html;
use yii\data\ActiveDataProvider;
use kartik\detail\DetailView;
use common\models\Facility;
use common\models\search\TeesSearch;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $model app\models\Course */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('igolf', 'Facilities'), 'url' => ['facility/index']];
$this->params['breadcrumbs'][] = ['label' => $model->facility->name, 'url' => ['facility/view', 'id' => $model->facility_id]];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="course-view">

    <?php 
echo DetailView::widget(['model' => $model, 'panel' => ['heading' => '<h3>' . $model->name . '</h3>'], 'labelColOptions' => ['style' => 'width: 30%'], 'attributes' => [['attribute' => 'facility_id', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(Facility::find()->asArray()->all(), 'id', 'name'), 'label' => 'Facility', 'value' => $model->facility->name], 'name', ['attribute' => 'holes', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => array(18 => '18', 9 => '9')]]]);
?>


<?php 
$dataProvider = new ActiveDataProvider(['query' => $model->getTees()]);
echo $this->render('../tees/_list', ['dataProvider' => $dataProvider, 'course' => $model]);
?>

<?php 
echo $this->render('../media/_add', ['model' => $model]);
?>

</div>
Exemple #10
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFacility()
 {
     return $this->hasOne(Facility::className(), ['id' => 'facility_id']);
 }
Exemple #11
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['facility_name'], 'in', 'range' => Facility::find()->select(['name'])->column(), 'message' => 'Facility "{value}" not found.'], [['holes'], 'in', 'range' => ['18', '9']]]);
 }
Exemple #12
0
<?php

use yii\data\ActiveDataProvider;
use kartik\detail\DetailView;
use common\models\Facility;
use common\models\Course;
/* @var $this yii\web\View */
/* @var $model app\models\Facility */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('igolf', 'Facilities'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="facility-view">

    <?php 
echo DetailView::widget(['model' => $model, 'panel' => ['heading' => '<h3>' . $model->name . '</h3>'], 'labelColOptions' => ['style' => 'width: 30%'], 'attributes' => ['name', 'phone', 'email:email', 'website', ['attribute' => 'units', 'type' => DetailView::INPUT_DROPDOWN_LIST, 'items' => Facility::getLocalizedConstants('UNITS_'), 'value' => Yii::t('igolf', $model->units)]]]);
?>

<?php 
$dataProvider = new ActiveDataProvider(['query' => $model->getCourses()]);
echo $this->render('../course/_list', ['dataProvider' => $dataProvider, 'facility' => $model]);
?>

<?php 
echo $this->render('../media/_add', ['model' => $model]);
?>

</div>