Пример #1
0
 public function index()
 {
     if (in_array(Auth::getCapability(), array(CAPABILITY_ADMINISTRATOR))) {
         Model::autoloadModel('city');
         $model = new CityModel($this->db);
         $this->para = new stdClass();
         if (isset($_POST['type'])) {
             $this->para->type = $_POST['type'];
         }
         if (isset($_POST['orderby'])) {
             $this->para->orderby = $_POST['orderby'];
         }
         if (isset($_POST['order'])) {
             $this->para->order = $_POST['order'];
         }
         if (isset($_POST['page'])) {
             $this->para->page = $_POST['page'];
         }
         if (isset($_POST['s'])) {
             $this->para->s = $_POST['s'];
         }
         if (isset($_POST['paged'])) {
             $this->para->paged = $_POST['paged'];
         }
         if (isset($_POST['cities'])) {
             $this->para->cities = $_POST['cities'];
         }
         if (isset($_POST['action'])) {
             $this->para->action = $_POST['action'];
         }
         if (isset($_POST['action2'])) {
             $this->para->action2 = $_POST['action2'];
         }
         if (isset($_POST['description_show'])) {
             $this->para->description_show = $_POST['description_show'];
         }
         if (isset($_POST['slug_show'])) {
             $this->para->slug_show = $_POST['slug_show'];
         }
         if (isset($_POST['tours_show'])) {
             $this->para->tours_show = $_POST['tours_show'];
         }
         if (isset($_POST['cities_per_page'])) {
             $this->para->cities_per_page = $_POST['cities_per_page'];
         }
         if (isset($_POST['current_rating'])) {
             $this->para->current_rating = $_POST['current_rating'];
         }
         if (isset($_POST['vote_times'])) {
             $this->para->vote_times = $_POST['vote_times'];
         }
         if (isset($_POST['adv_setting'])) {
             $this->para->adv_setting = $_POST['adv_setting'];
         }
         if (isset($this->para->adv_setting) && $this->para->adv_setting == "adv_setting") {
             $model->changeAdvSetting($this->para);
         }
         if (isset($this->para->type) && in_array($this->para->type, array("action", "action2")) && isset($this->para->cities)) {
             $model->executeAction($this->para);
         }
         $model->search($this->view, $this->para);
         if (count((array) $this->para) > 0) {
             $this->view->ajax = TRUE;
             $this->view->renderAdmin(RENDER_VIEW_CITY_INDEX, TRUE);
         } else {
             $this->view->renderAdmin(RENDER_VIEW_CITY_INDEX);
         }
     } else {
         $this->login();
     }
 }