예제 #1
0
 public function view($post_id = NULL)
 {
     Model::autoloadModel('internalflight');
     $model = new InternalflightModel($this->db);
     $this->para = new stdClass();
     if (isset($_POST['internalflight'])) {
         $this->para->post_id = $_POST['internalflight'];
     } elseif (isset($post_id) && !is_null($post_id)) {
         $this->para->post_id = $post_id;
     }
     if (isset($this->para->post_id)) {
         $this->view->internalflightBO = $model->get($this->para->post_id);
         Model::autoloadModel('taxonomy');
         $taxonomyModel = new TaxonomyModel($this->db);
         $this->view->countryList = new SplDoublyLinkedList();
         $taxonomyModel->getAllSorted($this->view->countryList, $taxonomyModel->buildTree($taxonomyModel->getAll("country")), -1);
         $this->view->cityList = new SplDoublyLinkedList();
         if (isset($this->view->internalflightBO->country_id) && $this->view->internalflightBO->country_id != "0") {
             $taxonomyModel->getAllSorted($this->view->cityList, $taxonomyModel->buildTree($taxonomyModel->getByMetaData("city", "country", $this->view->internalflightBO->country_id)), -1);
         }
         if (isset($post_id) && !is_null($post_id)) {
             $this->view->render(RENDER_VIEW_INTERNALFLIGHT);
         } else {
             $this->view->render(RENDER_VIEW_INTERNALFLIGHT, TRUE);
         }
     } else {
         header('location: ' . URL);
     }
 }