コード例 #1
0
 public function edit()
 {
     $this->template->content = new View('teams/edit');
     $this->template->title = 'Редактирование конады';
     $this->selected_page = PAGE_TEAMS;
     $this->selected_subpage = null;
     if (!$this->haveAccess()) {
         return;
     }
     $this->template->content->champ = $this->db->select('*')->from('cups_store')->where('1=1 AND back_up_id is null AND moder_rating > 0')->orderby('cp_name', 'asc')->get();
     $this->getFootballerInfo();
     if ($_POST) {
         $data['tm_name'] = trim($_POST['footballer']['name']);
         $data['tm_photo'] = trim($_POST['footballer']['photo']);
         $data['cp_id'] = intval(@$_POST['footballer']['champ']);
         $data['moder_id'] = $this->moderId;
         $data['tm_status'] = ITEM_STATUS_NEW;
         if (empty($data['tm_name'])) {
             $this->error .= 'Укажите название команды' . $this->NL();
         }
         if (empty($data['cp_id'])) {
             $this->error .= 'Укажите чемпионат' . $this->NL();
         }
         if (empty($data['tm_photo'])) {
             $this->error .= 'Укажите адрес фотографии игрока для анкеты' . $this->NL();
         } elseif (!valid::URL($data['tm_photo'])) {
             $this->error .= 'Укажите правильный адрес фотографии для анкеты' . $this->NL();
         }
         if (is_null($this->error)) {
             if (!$this->haveAccessByStatus($this->template->content->item->tm_status)) {
                 $this->error .= 'Запрещённая операция' . $this->NL();
             } else {
                 $id = intval($this->uri->segment('id'));
                 $this->makeCopy('teams_store', 'tm_id', $id, 'tm_status');
                 $status = $this->db->update('teams_store', $data, array('tm_id' => $id));
                 if (count($status)) {
                     $this->info = 'Команда отредактирована.';
                     url::redirect(url::site() . "teams/info/id/" . intval($this->uri->segment('id')) . '/updated/yes');
                     exit;
                 }
             }
         }
     }
 }
コード例 #2
0
 public function edit()
 {
     $this->template->content = new View('coaches/edit');
     $this->template->title = 'Редактирование тренера';
     $this->selected_page = PAGE_COACHES;
     $this->selected_subpage = null;
     if (!$this->haveAccess()) {
         return;
     }
     $this->getFootballerInfo();
     $this->template->content->teams = $this->db->select('*')->from('teams_store')->join('cups_store', 'cups_store.cp_id', 'teams_store.cp_id', ' AND cups_store.back_up_id is null AND cups_store.moder_rating > 0')->where('1=1 and teams_store.back_up_id IS NULL')->orderby('tm_id', 'desc')->get();
     if ($_POST) {
         $data['ch_name'] = trim($_POST['footballer']['name']);
         $data['tm_id'] = intval(@$_POST['footballer']['team']);
         $data['ch_photo'] = trim($_POST['footballer']['photo']);
         $data['moder_id'] = $this->moderId;
         $data['ch_status'] = ITEM_STATUS_NEW;
         if (empty($data['ch_name'])) {
             $this->error .= 'Укажите имя тренера' . $this->NL();
         }
         if (!$data['tm_id']) {
             $this->error .= 'Укажите команду' . $this->NL();
         }
         if (empty($data['ch_photo'])) {
             $this->error .= 'Укажите адрес фотографии тренера для анкеты' . $this->NL();
         } elseif (!valid::URL($data['ch_photo'])) {
             $this->error .= 'Укажите правильный адрес фотографии для анкеты' . $this->NL();
         }
         if (is_null($this->error)) {
             if (!$this->haveAccessByStatus($this->template->content->item->ch_status)) {
                 $this->error .= 'Запрещённая операция' . $this->NL();
             } else {
                 $id = intval($this->uri->segment('id'));
                 $this->makeCopy('coaches_store', 'ch_id', $id, 'ch_status');
                 $status = $this->db->update('coaches_store', $data, array('ch_id' => $id));
                 if (count($status)) {
                     $this->info = 'Тренер отредактирован.';
                     url::redirect(url::site() . "coaches/info/id/" . intval($this->uri->segment('id')) . '/updated/yes');
                     exit;
                 }
             }
         }
     }
 }
コード例 #3
0
 public function add()
 {
     $this->template->content = new View('sponsors/add');
     $this->template->title = 'Добавление спонсора';
     $this->selected_page = PAGE_SPONSORS;
     $this->selected_subpage = Sponsors_Controller::SUBPAGE_ADD;
     if (!$this->haveAccess()) {
         return;
     }
     if ($_POST) {
         $data['sp_name'] = trim($_POST['footballer']['name']);
         $data['sp_level'] = trim(@$_POST['footballer']['level']);
         $data['sp_rating'] = trim(@$_POST['footballer']['rating']);
         $data['sp_photo'] = trim($_POST['footballer']['photo']);
         $data['moder_id'] = $this->moderId;
         $data['sp_status'] = ITEM_STATUS_NEW;
         if (empty($data['sp_name'])) {
             $this->error .= 'Укажите название спонсора' . $this->NL();
         }
         if (!$data['sp_level']) {
             $this->error .= 'Укажите уровень' . $this->NL();
         }
         if (!$data['sp_rating']) {
             $this->error .= 'Укажите рейтинг' . $this->NL();
         }
         if (empty($data['sp_photo'])) {
             $this->error .= 'Укажите адрес фотографии спонсора для анкеты' . $this->NL();
         } elseif (!valid::URL($data['sp_photo'])) {
             $this->error .= 'Укажите правильный адрес фотографии' . $this->NL();
         }
         if (is_null($this->error)) {
             $status = $this->db->insert('sponsors_store', $data);
             if (count($status)) {
                 $this->info = 'Спонсор добавлен.';
                 url::redirect(url::site() . "sponsors/info/id/" . $status->insert_id());
                 exit;
             }
         }
     }
 }
コード例 #4
0
 public function edit()
 {
     $this->template->content = new View('stadiums/edit');
     $this->template->title = 'Редактирование стадиона';
     $this->selected_page = PAGE_STADIUMS;
     $this->selected_subpage = null;
     if (!$this->haveAccess()) {
         return;
     }
     $this->getFootballerInfo();
     if ($_POST) {
         $data['st_name'] = trim($_POST['footballer']['name']);
         $data['st_city'] = trim($_POST['footballer']['city']);
         $data['st_country_code'] = intval($_POST['footballer']['country']);
         $data['st_level'] = trim(@$_POST['footballer']['level']);
         $data['st_photo'] = trim($_POST['footballer']['photo']);
         $data['moder_id'] = $this->moderId;
         $data['st_status'] = ITEM_STATUS_NEW;
         if (empty($data['st_name'])) {
             $this->error .= 'Укажите название стадиона' . $this->NL();
         }
         if (empty($data['st_city'])) {
             $this->error .= 'Укажите город стадиона' . $this->NL();
         }
         if (!$data['st_country_code']) {
             $this->error .= 'Выбирете принадлежность к стране' . $this->NL();
         }
         if (!$data['st_level']) {
             $this->error .= 'Укажите с которого доступен стадион' . $this->NL();
         }
         if (empty($data['st_photo'])) {
             $this->error .= 'Укажите адрес фотографии стадиона' . $this->NL();
         } elseif (!valid::URL($data['st_photo'])) {
             $this->error .= 'Укажите правильный адрес фотографии стадиона' . $this->NL();
         }
         if (is_null($this->error)) {
             if (!$this->haveAccessByStatus($this->template->content->item->st_status)) {
                 $this->error .= 'Запрещённая операция' . $this->NL();
             } else {
                 $id = intval($this->uri->segment('id'));
                 $this->makeCopy('stadiums_store', 'st_id', $id, 'st_status');
                 $status = $this->db->update('stadiums_store', $data, array('st_id' => $id));
                 if (count($status)) {
                     $this->info = 'Стадион отредактирован.';
                     url::redirect(url::site() . "stadiums/info/id/" . intval($this->uri->segment('id')) . '/updated/yes');
                     exit;
                 }
             }
         }
     }
 }
コード例 #5
0
 public function edit()
 {
     $this->template->content = new View('footballers/edit');
     $this->template->title = 'Редактирование футболиста';
     $this->selected_page = PAGE_FOOTBALLERS;
     $this->selected_subpage = null;
     if (!$this->haveAccess()) {
         return;
     }
     $this->template->content->teams = $this->db->select('*')->from('teams_store')->join('cups_store', 'cups_store.cp_id', 'teams_store.cp_id', ' AND cups_store.back_up_id is null AND cups_store.moder_rating > 0')->where('1=1 and teams_store.back_up_id IS NULL')->orderby('tm_id', 'desc')->get();
     $this->getFootballerInfo();
     if ($_POST) {
         $data['ft_name'] = trim($_POST['footballer']['name']);
         //  $data['ft_desc'] = trim($_POST['footballer']['desc']);
         $data['tm_id'] = intval(@$_POST['footballer']['team']);
         $data['ft_line'] = intval(@$_POST['footballer']['line']);
         //   $data['ft_level'] = trim(@$_POST['footballer']['level']);
         //  $data['ft_rating'] = trim(@$_POST['footballer']['rating']);
         $data['ft_photo'] = trim($_POST['footballer']['photo']);
         $data['ft_photo_best'] = trim($_POST['footballer']['photo_best']);
         $data['ft_year'] = intval($_POST['footballer']['year']);
         $data['moder_id'] = $this->moderId;
         $data['ft_status'] = ITEM_STATUS_NEW;
         if (empty($data['ft_name'])) {
             $this->error .= 'Укажите имя игрока' . $this->NL();
         }
         /*
                     if(empty($data['ft_desc'])){
                         $this->error .= 'Укажите описание' . $this->NL();
                     }*/
         if (!$data['ft_line']) {
             $this->error .= 'Укажите амплуа' . $this->NL();
         }
         if ($data['ft_year'] > 2000 || $data['ft_year'] < 1940) {
             $this->error .= 'Укажите год рождения, с коректным годом (четырёх значное число)' . $this->NL();
         }
         /*
                     if(!$data['ft_level']){
                         $this->error .= 'Укажите уровень' . $this->NL();
                     }
         
                     if(!$data['ft_rating']){
                         $this->error .= 'Укажите рейтинг' . $this->NL();
                     }*/
         if (!$data['tm_id']) {
             $this->error .= 'Укажите команду' . $this->NL();
         }
         if (empty($data['ft_photo'])) {
             $this->error .= 'Укажите адрес фотографии игрока для анкеты' . $this->NL();
         } elseif (!valid::URL($data['ft_photo'])) {
             $this->error .= 'Укажите правильный адрес фотографии для анкеты' . $this->NL();
         }
         if (empty($data['ft_photo_best'])) {
             $this->error .= 'Укажите адрес лучшей фотографии игрока' . $this->NL();
         } elseif (!valid::URL($data['ft_photo_best'])) {
             $this->error .= 'Укажите правильный адрес лучшей фотографии' . $this->NL();
         }
         if (is_null($this->error)) {
             if (!$this->haveAccessByStatus($this->template->content->item->ft_status)) {
                 $this->error .= 'Запрещённая операция' . $this->NL();
             } else {
                 $id = intval($this->uri->segment('id'));
                 $this->makeCopy('footballers_store', 'ft_id', $id, 'ft_status');
                 $status = $this->db->update('footballers_store', $data, array('ft_id' => $id));
                 if (count($status)) {
                     $this->info = 'Футболист отредактирован.';
                     url::redirect(url::site() . "footballers/info/id/" . intval($this->uri->segment('id')) . '/updated/yes');
                     exit;
                 }
             }
         }
     }
 }