Example #1
0
 /**
  * Дейсвтие-обработчик ПОСТ-запроса на изменения кол-ва комментов ВК
  */
 public function action_change_comments_num()
 {
     if (\Input::method() == 'POST') {
         $id = (int) \Input::post('id');
         $num = (int) \Input::post('num');
         if ($id != 0) {
             $match = \Model_Match::find($id);
             if ($match) {
                 $match->vk_comments_count = $num;
                 $match->save();
                 return \View::forge('empty', array());
             }
         }
     }
 }
Example #2
0
 /**
  * Просмотр календаря матча конкретного сезона
  * 
  * @param int $season_id id сезона
  */
 public function action_view($season_id = NULL)
 {
     is_null($season_id) and \Response::redirect('');
     $matches = \Model_Match::find('all', array('related' => array('team_1', 'team_2', 'season'), 'where' => array(array('season_id', '=', $season_id)), 'order_by' => array('date' => 'ASC')));
     if ($matches) {
         $name = '';
         $res = array();
         foreach ($matches as $item) {
             if ($item->name != $name) {
                 $res[] = array('name' => $item->name, 'matches' => array());
                 $name = $item->name;
             }
             $res[count($res) - 1]['matches'][] = $item;
             if (!isset($season)) {
                 $season = $item->season->value;
             }
         }
         $this->template->page_title = 'Команда :: Календарь матчей :: ' . $season;
         $this->template->content = \View::forge('calendar/view', array('matches' => $res), FALSE);
     } else {
         \Response::redirect('');
     }
 }
Example #3
0
 public function action_delete($id = null)
 {
     is_null($id) and \Response::redirect('matches');
     if ($match = \Model_Match::find($id)) {
         $match->delete();
         \Session::set_flash('success', 'Матч удалён.');
     } else {
         \Session::set_flash('error', 'Could not delete match #' . $id);
     }
     \Response::redirect('admin/competitions/matches');
 }