Exemplo n.º 1
0
 public function addToDatabase($para)
 {
     try {
         if ($this->validateAddNew($para)) {
             BO::autoloadBO("style");
             $styleBO = new StyleBO();
             if (isset($para->name)) {
                 $styleBO->name = $para->name;
             }
             if (isset($para->slug)) {
                 $styleBO->slug = $para->slug;
             }
             if (isset($para->description)) {
                 $styleBO->description = $para->description;
             }
             if (isset($para->parent)) {
                 $styleBO->parent = $para->parent;
             }
             $styleBO->count = 0;
             $styleBO->term_group = 0;
             $this->db->beginTransaction();
             if (parent::addToDatabase($styleBO)) {
                 $this->db->commit();
                 $_SESSION["fb_success"][] = ADD_STYLE_SUCCESS;
                 return TRUE;
             } else {
                 $this->db->rollBack();
                 $_SESSION["fb_error"][] = ADD_STYLE_SUCCESS;
             }
         }
     } catch (Exception $e) {
         $_SESSION["fb_error"][] = ERROR_ADD_NEW_STYLE;
     }
     return FALSE;
 }
Exemplo n.º 2
0
 public function addToDatabase($para)
 {
     try {
         if ($this->validateAddNew($para)) {
             BO::autoloadBO("attraction");
             $attractionBO = new AttractionBO();
             if (isset($para->name)) {
                 $attractionBO->name = $para->name;
             }
             if (isset($para->slug)) {
                 $attractionBO->slug = $para->slug;
             }
             if (isset($para->description)) {
                 $attractionBO->description = $para->description;
             }
             if (isset($para->country) && $para->country != "0") {
                 $attractionBO->country = $para->country;
             }
             if (isset($para->parent) && $para->parent != "0") {
                 $attractionBO->parent = $para->parent;
             }
             if (isset($para->city) && $para->city != "0") {
                 $attractionBO->city = $para->city;
             }
             if (isset($para->destination) && $para->destination != "0") {
                 $attractionBO->destination = $para->destination;
             }
             if (isset($para->post_content_1)) {
                 $attractionBO->post_content_1 = $para->post_content_1;
             }
             if (isset($para->post_content_2)) {
                 $attractionBO->post_content_2 = $para->post_content_2;
             }
             if (isset($para->current_rating)) {
                 $attractionBO->current_rating = $para->current_rating;
             }
             if (isset($para->vote_times)) {
                 $attractionBO->vote_times = $para->vote_times;
             }
             if (isset($para->tag_list)) {
                 $attractionBO->tag_list = $para->tag_list;
             }
             if (isset($para->tag_array)) {
                 $attractionBO->tag_array = $para->tag_array;
             }
             if (isset($para->images)) {
                 $attractionBO->images = $para->images;
             }
             $attractionBO->count = 0;
             $attractionBO->term_group = 0;
             $this->db->beginTransaction();
             $attractionBO->term_taxonomy_id = parent::addToDatabase($attractionBO);
             if ($attractionBO->term_taxonomy_id != NULL) {
                 if (isset($attractionBO->post_content_1) || isset($attractionBO->post_content_2)) {
                     $this->addContent($attractionBO);
                 }
                 $this->db->commit();
                 $attractionBOAdded = parent::get($attractionBO->term_taxonomy_id);
                 if (isset($attractionBO->country) && $attractionBO->country != "") {
                     $this->addMetaInfoToDatabase($attractionBOAdded->term_id, "country", $attractionBO->country);
                 }
                 if (isset($attractionBO->city) && $attractionBO->city != "") {
                     $this->addMetaInfoToDatabase($attractionBOAdded->term_id, "city", $attractionBO->city);
                 }
                 if (isset($attractionBO->destination) && $attractionBO->destination != "") {
                     $this->addMetaInfoToDatabase($attractionBOAdded->term_id, "destination", $attractionBO->destination);
                 }
                 if (isset($attractionBO->current_rating) && $attractionBO->current_rating != "") {
                     $this->addMetaInfoToDatabase($attractionBOAdded->term_id, "current_rating", $attractionBO->current_rating);
                 }
                 if (isset($attractionBO->vote_times) && $attractionBO->vote_times != "") {
                     $this->addMetaInfoToDatabase($attractionBOAdded->term_id, "vote_times", $attractionBO->vote_times);
                 }
                 $_SESSION["fb_success"][] = ADD_ATTRACTION_SUCCESS;
                 return TRUE;
             } else {
                 $this->db->rollBack();
                 $_SESSION["fb_error"][] = ADD_ATTRACTION_SUCCESS;
             }
         }
     } catch (Exception $e) {
         $_SESSION["fb_error"][] = ERROR_ADD_NEW_ATTRACTION;
     }
     return FALSE;
 }
Exemplo n.º 3
0
 public function addToDatabase($para)
 {
     try {
         if ($this->validateAddNew($para)) {
             BO::autoloadBO("country");
             $countryBO = new CountryBO();
             if (isset($para->name)) {
                 $countryBO->name = $para->name;
             }
             if (isset($para->slug)) {
                 $countryBO->slug = $para->slug;
             }
             if (isset($para->description)) {
                 $countryBO->description = $para->description;
             }
             if (isset($para->parent)) {
                 $countryBO->parent = $para->parent;
             }
             if (isset($para->overview)) {
                 $countryBO->overview = $para->overview;
             }
             if (isset($para->history)) {
                 $countryBO->history = $para->history;
             }
             if (isset($para->weather)) {
                 $countryBO->weather = $para->weather;
             }
             if (isset($para->passport_visa)) {
                 $countryBO->passport_visa = $para->passport_visa;
             }
             if (isset($para->currency)) {
                 $countryBO->currency = $para->currency;
             }
             if (isset($para->phone_internet_service)) {
                 $countryBO->phone_internet_service = $para->phone_internet_service;
             }
             if (isset($para->transportation)) {
                 $countryBO->transportation = $para->transportation;
             }
             if (isset($para->food_drink)) {
                 $countryBO->food_drink = $para->food_drink;
             }
             if (isset($para->public_holiday)) {
                 $countryBO->public_holiday = $para->public_holiday;
             }
             if (isset($para->predeparture_check_list)) {
                 $countryBO->predeparture_check_list = $para->predeparture_check_list;
             }
             if (isset($para->tag_list)) {
                 $countryBO->tag_list = $para->tag_list;
             }
             if (isset($para->tag_array)) {
                 $countryBO->tag_array = $para->tag_array;
             }
             if (isset($para->image_weathers)) {
                 $countryBO->image_weathers = $para->image_weathers;
             }
             $countryBO->count = 0;
             $countryBO->term_group = 0;
             $this->db->beginTransaction();
             $countryBO->term_taxonomy_id = parent::addToDatabase($countryBO);
             if ($countryBO->term_taxonomy_id != NULL) {
                 if (isset($countryBO->overview) || isset($countryBO->history) || isset($countryBO->weather) || isset($countryBO->passport_visa) || isset($countryBO->currency) || isset($countryBO->phone_internet_service) || isset($countryBO->transportation) || isset($countryBO->food_drink) || isset($countryBO->public_holiday) || isset($countryBO->predeparture_check_list)) {
                     $this->addContent($countryBO);
                 }
                 $this->db->commit();
                 $_SESSION["fb_success"][] = ADD_COUNTRY_SUCCESS;
                 return TRUE;
             } else {
                 $this->db->rollBack();
                 $_SESSION["fb_error"][] = ADD_COUNTRY_SUCCESS;
             }
         }
     } catch (Exception $e) {
         $_SESSION["fb_error"][] = ERROR_ADD_NEW_COUNTRY;
     }
     return FALSE;
 }