Ejemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('seasons')->delete();
     Season::create(['country' => 'England', 'league' => 'Barclays Premier League', 'year' => 2014, 'number_of_teams' => 20, 'number_of_teams_to_cl' => 4, 'number_of_teams_to_el' => 2, 'number_of_teams_to_ld' => 3]);
     Season::create(['country' => 'Germany', 'league' => 'Bundesliga', 'year' => 2015, 'number_of_teams' => 18, 'number_of_teams_to_cl' => 3, 'number_of_teams_to_el' => 3, 'number_of_teams_to_ld' => 3]);
     Season::create(['country' => 'Russia', 'league' => 'Premier League', 'year' => 2015, 'number_of_teams' => 16, 'number_of_teams_to_cl' => 1, 'number_of_teams_to_el' => 3, 'number_of_teams_to_ld' => 2]);
 }
Ejemplo n.º 2
0
 public function actionIndex()
 {
     $season = Season::findBySql('SELECT * FROM season WHERE invisible = 0 AND (unit1 != "" OR unit2 != "" OR unit3 != "" OR unit4 != "")')->all();
     $news = News::find()->where(['type' => '1'])->orderBy('id DESC')->one();
     $event = News::find()->where(['type' => '2'])->orderBy('id DESC')->one();
     $msgs = Chatmain::find()->orderBy('id DESC')->limit(50)->all();
     return $this->render('index', ['season' => $season, 'news' => $news, 'event' => $event, 'msgs' => $msgs]);
 }
Ejemplo n.º 3
0
, cell);
                    }
                })
            }
            <?php 
        }
        ?>
        }
        <?php 
    }
    ?>


        <?php 
    // проверка на тип сетки // Г Р У П П А
    if (Season::nets()[$season['net_type']]['type'] == 2) {
        ?>

        // ---------- функция для изменения ячеек ЮНИТЫ----------------------
        function update_cell_u<?php 
        echo $season['id'];
        ?>
(cell){
            <?php 
        if ($season['admin_id'] == Yii::$app->user->id) {
            ?>
            var msgOld = $('#<?php 
            echo $season['id'];
            ?>
'+cell).text();
            var msg = prompt('Имя участника (не более 12 символов) изменить на...', msgOld);
Ejemplo n.º 4
0
    ?>
                        <tr>
                            <td><?php 
    echo $one->id;
    ?>
</td>
                            <td><?php 
    echo T::name($one->t_id, 1);
    ?>
</td>
                            <td><?php 
    echo HTML::encode($one->name);
    ?>
</td>
                            <td><?php 
    echo Season::nets(1, $one->net_type);
    ?>
</td>
                            <td><?php 
    echo User::name($one->admin_id);
    ?>
</td>
                            <td><?php 
    echo date('d.m.y в H:i', $one->time_update);
    ?>
</td>
                        </tr>
                    <?php 
}
?>
                </table>
Ejemplo n.º 5
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param int $id
  *
  * @return mixed
  */
 public function edit($id)
 {
     $division = Division::findOrFail($id);
     $seasons = Season::all();
     return view('admin.data-management.divisions.edit', compact('division', 'seasons'));
 }
Ejemplo n.º 6
0
        echo $one->id;
        ?>
">
                    <td><a href="<?php 
        echo \Yii::$app->urlManager->createUrl(['t/season', 'id' => $one['id']]);
        ?>
"><strong><?php 
        echo HTML::encode($one->name);
        ?>
</strong></a></td>
                    <td><?php 
        echo date('d.m.Y', $one->time);
        ?>
</td>
                    <td><?php 
        echo Season::nets()[$one->net_type]['name'];
        ?>
</td>
                    <td><button onclick="delete_season('<?php 
        echo $one->name;
        ?>
', <?php 
        echo $one->id;
        ?>
)">удалить</button></td>
                </tr>
                <?php 
    }
    ?>
            </table>
            <?php 
Ejemplo n.º 7
0
    <h4 style="text-align: center">Турнирные сетки типа "Круговые"</h4>
    <table class="table table-striped .table-bordered table-responsive">
        <thead>
        <tr>
            <th>Название</th>
            <th>Описание</th>
            <th>Тип</th>
            <th>Кол-во участников</th>
            <th></th>
            <th>Кол-во игр на одного участника</th>
            <th>Пример</th>
        </tr>
        </thead>
        <tbody>
        <?php 
foreach (Season::nets() as $one) {
    if ($one['type'] == 3) {
        ?>
                <tr>
                    <td><?php 
        echo $one['name'];
        ?>
</td>
                    <td><?php 
        echo $one['opisanie'];
        ?>
</td>
                    <td><?php 
        if ($one['type'] == 1) {
            echo 'Дерево';
        }
Ejemplo n.º 8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSeason()
 {
     return $this->hasOne(Season::className(), ['id' => 'season_id']);
 }
Ejemplo n.º 9
0
 public function actionAjaxupdatecell($id = null)
 {
     //echo $id;
     if ($id != null) {
         $season = Season::findOne($id);
         if ($season != null) {
             $t = T::findOne($season->t_id);
             if ($t != null and $t->admin_id == Yii::$app->user->id) {
                 if (isset($_GET['cell']) and isset($_GET['msg'])) {
                     $cell = $_GET['cell'];
                     $msg = $_GET['msg'];
                     $season[$cell] = $msg;
                     $season['time_update'] = time();
                     if ($season->update()) {
                         echo HTML::encode($msg);
                     } else {
                         echo 'Ошибка! Не сохранилось...';
                     }
                 } else {
                     echo 'Ошибка! Не пришли жанные ячейки и записи...' . $_GET['cell'] . ' ' . $_GET['msg'];
                 }
             } else {
                 echo 'Ошибка! Вы не админ...';
             }
         } else {
             echo 'Ошибка! Сезон не найден...';
         }
     } else {
         echo 'Ошибка! Не пришел id...';
     }
 }
Ejemplo n.º 10
0
 /**
  * Remove season.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($season_id)
 {
     Season::destroy($season_id);
     Team::where('season_id', $season_id)->delete();
     Fixture::where('season_id', $season_id)->delete();
     LeagueTable::where('season_id', $season_id)->delete();
     return response()->json(['success' => true]);
 }
Ejemplo n.º 11
0
 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  *
  * @return mixed
  */
 public function destroy($id)
 {
     $canBeDeleted = empty(Season::find($id)->divisions->toArray());
     if ($canBeDeleted) {
         Season::destroy($id);
         \Flash::success('Season deleted!');
     } else {
         \Flash::error('Cannot delete because they are existing divisions in this season.');
     }
     return redirect('admin/data-management/seasons');
 }
Ejemplo n.º 12
0
$form = ActiveForm::begin();
?>

        <p>
            <?php 
echo $form->field($season, 'name')->textInput(['size' => '10', 'maxlength' => '10', 'placeholder' => 'Season 1'])->label('Название турнирной сетки / сезона <span class="desc_field" >(максимально 10 символов. Пример: "Сезон 2", "Этап четвертый")</span>');
?>
        </p>
        <p>
            <?php 
echo $form->field($season, 'time_action')->textInput(['size' => '20', 'maxlength' => '20', 'placeholder' => '01.01.16-03.01.16'])->label('Время проведения <span class="desc_field" >(необязательно к заполнению, максимально 20 символов. Пример: "20-24 августа")</span>');
?>
        </p>
        <p>
            <?php 
echo $form->field($season, 'net_type')->dropDownList(Season::nets(2))->label('Вид турнирной сетки <span style="color: red">(Все виды сеток Вы можете посмотреть в таблице ниже)</span>');
?>
        </p>

        <p>
            <a onclick="openOtherParamSeason()" style="cursor: pointer">Другие параметры (развернуть)</a>
        </p>
        <div id="divOtherParamSeason" style="display: none">
            <p>
                <?php 
echo $form->field($season, 'unit_type')->dropDownList(['0' => 'ничего не указывать', '1' => 'игроки', '2' => 'команды']);
?>
            </p>
            <p>
                <?php 
echo $form->field($season, 'score_open')->dropDownList(['0' => 'не показывать', '1' => 'показывать']);