示例#1
0
 /**
  * Действие для управления настройками
  */
 public function action_index()
 {
     $settings = \Model_Striker::find('first');
     $seasons = \Model_Season::get_seasons_for_select();
     if (\Input::method() == 'POST') {
         $settings->show = \Input::post('show', 0);
         $settings->season_id = \Input::post('season_id');
         $settings->save();
         \Session::set_flash('success', 'Настройки обновлены.');
         \Response::redirect_back('admin/competitions/strikers');
     }
     \View::set_global('seasons', $seasons);
     \View::set_global('settings', $settings);
     $this->template->content = \View::forge('competitions/strikers/index', array('settings' => $settings));
 }
示例#2
0
 /**
  * Действие для создания матча
  */
 public function action_create()
 {
     if (\Input::method() == 'POST') {
         $val = \Model_Match::validate('create');
         if ($val->run()) {
             $match = \Model_Match::forge(array('team_1_id' => \Input::post('team_1_id'), 'team_2_id' => \Input::post('team_2_id'), 'status_id' => 1, 'season_id' => \Input::post('season_id'), 'date' => \Input::post('date') ? strtotime(\Input::post('date')) : NULL, 'name' => \Input::post('name'), 'vk_comments_count' => 0));
             if ($match and $match->save()) {
                 \Session::set_flash('success', 'Матч создано.');
                 \Response::redirect('admin/competitions/matches/edit/' . $match->id);
             } else {
                 \Session::set_flash('error', 'Could not save match.');
             }
         } else {
             \Session::set_flash('error', $val->error());
         }
     }
     // Сезоны для select
     \View::set_global('seasons', \Model_Season::get_seasons_for_select());
     $this->template->content = \View::forge('competitions/matches/create');
 }