/**
  * Lists all MatchEvent models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new MatchEventSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $matchEventTable = $searchModel::tableName();
     $matchEventTypeTable = MatchEventType::tableName();
     $matchEvents = MatchEventType::find()->innerJoin($matchEventTable, "{$matchEventTable}.match_event_type_id = {$matchEventTypeTable}.id")->all();
     $eventFilter = ArrayHelper::map($matchEvents, 'id', 'name');
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'eventFilter' => $eventFilter]);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MatchEventType::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
예제 #3
0
use common\models\Composition;
/* @var $this yii\web\View */
/* @var $model common\models\MatchEvent */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="match-event-form">

    <?php 
$form = ActiveForm::begin();
?>

    <div class="row">
        <div class="col-sm-6">
            <?php 
echo $form->field($model, 'match_event_type_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(MatchEventType::find()->all(), 'id', 'name'), 'language' => 'ru', 'options' => ['placeholder' => 'Выберите тип события...'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
        <div class="col-sm-3">
            <?php 
echo $form->field($model, 'minute')->textInput();
?>
        </div>
        <div class="col-sm-3">
            <?php 
echo $form->field($model, 'additional_minute')->textInput();
?>
        </div>
    </div>

    <div class="row">
 /**
  * Finds the MatchEventType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return MatchEventType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = MatchEventType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #5
0
 /**
  * Updates statistics of an existing Match model.
  * @param integer $id
  * @return mixed
  */
 public function actionEvents($id)
 {
     $model = $this->findModel($id);
     $matchEventModel = new MatchEvent();
     $matchEventModel->match_id = $model->id;
     $matchEventModelSearch = new MatchEventSearch();
     $params = ['MatchEventSearch' => ['match_id' => $model->id]];
     $matchEventDataProvider = $matchEventModelSearch->search($params);
     //        $totalCount = $matchEventDataProvider->getTotalCount();
     //        $matchEventDataProvider->pagination = ['defaultPageSize' => 60];
     $matchEventDataProvider->setSort(['defaultOrder' => ['minute' => SORT_DESC, 'additional_minute' => SORT_DESC]]);
     $matchEvents = MatchEventType::find()->all();
     $eventFilter = ArrayHelper::map($matchEvents, 'id', 'name');
     $searchModel = new CompositionSearch();
     // homeCompositionDataProvider
     $params = ['CompositionSearch' => ['match_id' => $model->id, 'command_id' => $model->command_home_id]];
     $homeCompositionDataProvider = $searchModel->search($params);
     $homeCompositionDataProvider->setSort(['defaultOrder' => ['is_basis' => SORT_DESC, 'number' => SORT_ASC]]);
     // guestCompositionDataProvider
     $params = ['CompositionSearch' => ['match_id' => $model->id, 'command_id' => $model->command_guest_id]];
     $guestCompositionDataProvider = $searchModel->search($params);
     $guestCompositionDataProvider->setSort(['defaultOrder' => ['is_basis' => SORT_DESC, 'number' => SORT_ASC]]);
     if ($matchEventModel->load(Yii::$app->request->post()) && $matchEventModel->validate()) {
         $matchEventModel->save(false);
         $this->redirect(['match/events', 'id' => $model->id]);
     }
     return $this->render('match_events', compact('model', 'matchEventModel', 'matchEventModelSearch', 'matchEventDataProvider', 'eventFilter', 'homeCompositionDataProvider', 'guestCompositionDataProvider'));
 }
예제 #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMatchEventType()
 {
     return $this->hasOne(MatchEventType::className(), ['id' => 'match_event_type_id']);
 }
예제 #7
0
                        <div class="info">
                            <div class="minute"><?php 
            echo $event->getTime();
            ?>
</div>
                        </div>
                        <div class="text">
                            <?php 
            echo $event->notes;
            ?>
                        </div>
                        <div class="clearfix"></div>
                    </div>
            <?php 
        } else {
            $eventValue = MatchEventType::find()->where(['id' => $event->match_event_type_id])->all();
            $eventIcon = $eventValue[0]->getAsset();
            $eventIconUrl = $eventIcon->getFileUrl();
            ?>
                    <div class="message message-with-icon">
                        <div class="info">
                            <?php 
            if ($eventIconUrl) {
                ?>
                                <img src="<?php 
                echo $eventIconUrl;
                ?>
" class="icon">
                            <?php 
            }
            ?>