Example #1
0
 public function edit($id = null)
 {
     $this->load->model('VisitorModel');
     $this->load->model('AddressModel');
     $this->load->model('DistrictModel');
     $this->load->model('CityModel');
     $this->load->model('StateModel');
     $address = new AddressModel();
     $district = new DistrictModel();
     $city = new CityModel();
     $state = new StateModel();
     $visitor = new VisitorModel();
     $objvisitor = $visitor->search($id);
     $objaddress = $address->search($objvisitor['address']);
     $objdistrict = $district->search($objaddress['district']);
     $objcity = $city->search($objdistrict['city']);
     $objstate = $state->search($objcity['state']);
     $data['visitor'] = $objvisitor;
     $data['currentaddress'] = $objaddress;
     $data['currentdistrict'] = $objdistrict;
     $data['currentcity'] = $objcity;
     $data['currentstate'] = $objstate;
     $data['states'] = $state->listing();
     if ($this->isLogged()) {
         $page = $this->getPage();
         switch ($this->session->userdata('role')) {
             case '1':
                 $this->load->view('public/norole');
                 break;
             case '2':
                 $this->load->view('template/user/header', $page);
                 $this->load->view('user/editvisitor', $data);
                 break;
         }
         $this->load->view('template/public/footer');
     }
 }
Example #2
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();
     }
 }