Esempio 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;
 }
Esempio n. 2
0
 function __construct($file_name_thumb, $file_path)
 {
     parent::__construct();
     $this->file = $file_name_thumb;
     $this->url = $file_path;
     $this->mine_type = Utils::_mime_content_type($file_name_thumb);
     $imageThumbSizes = getimagesize($file_name_thumb);
     $this->width = $imageThumbSizes[0];
     $this->height = $imageThumbSizes[1];
 }
Esempio n. 3
0
 /**
  * addToDatabase
  *
  * Add new internalflight
  *
  * @param stdClass $para para for add new internalflight
  */
 public function addToDatabase($para)
 {
     try {
         if ($this->validateAddNew($para)) {
             BO::autoloadBO("internalflight");
             $internalflightBO = new InternalflightBO();
             if (isset($para->post_title)) {
                 $internalflightBO->post_title = $para->post_title;
             }
             if (isset($para->current_rating)) {
                 $internalflightBO->current_rating = $para->current_rating;
             }
             if (isset($para->vote_times)) {
                 $internalflightBO->vote_times = $para->vote_times;
             }
             if (isset($para->tag_list)) {
                 $internalflightBO->tag_list = $para->tag_list;
             }
             if (isset($para->post_content)) {
                 $internalflightBO->post_content = $para->post_content;
             }
             if (isset($para->post_name)) {
                 $internalflightBO->post_name = $para->post_name;
             }
             if (isset($para->city_id)) {
                 $internalflightBO->city_id = $para->city_id;
             }
             if (isset($para->country_id)) {
                 $internalflightBO->country_id = $para->country_id;
             }
             $internalflightBO->post_author = Session::get("user_id");
             $internalflightBO->post_date = date("Y-m-d H:i:s");
             $internalflightBO->post_date_gmt = gmdate("Y-m-d H:i:s");
             $internalflightBO->post_modified = $internalflightBO->post_date;
             $internalflightBO->post_modified_gmt = $internalflightBO->post_date_gmt;
             $internalflightBO->post_parent = 0;
             $internalflightBO->post_status = "publish";
             $internalflightBO->comment_status = "closed";
             $internalflightBO->ping_status = "open";
             $internalflightBO->guid = "";
             $this->db->beginTransaction();
             if (isset($para->image)) {
                 Model::autoloadModel("image");
                 $imageModel = new ImageModel($this->db);
                 $imageModel->is_create_thumb = true;
                 $imageModel->is_medium = true;
                 $image_array_id = $imageModel->uploadImages("image");
                 if (!is_null($image_array_id) && is_array($image_array_id) && sizeof($image_array_id) != 0) {
                     $image_id = $image_array_id[0];
                     $internalflightBO->image_id = $image_id;
                 } else {
                     $_SESSION["fb_error"][] = ERROR_UPLOAD_IMAGE_FAILED;
                     $this->db->rollBack();
                     return FALSE;
                 }
             }
             $post_id = parent::addToDatabase($internalflightBO);
             if ($post_id != NULL) {
                 $guid = CONTEXT_PATH_INTERNALFLIGHT_VIEW . $post_id . "/" . $internalflightBO->post_name . "/";
                 if (!$this->updateGuid($post_id, $guid)) {
                     if (isset($imageModel) && isset($image_id)) {
                         $imageModel->delete($image_id);
                     }
                     $this->db->rollBack();
                     $_SESSION["fb_error"][] = ERROR_ADD_NEW_INTERNALFLIGHT;
                     return FALSE;
                 }
                 if (isset($internalflightBO->image_id) && $internalflightBO->image_id != "") {
                     if ($this->addMetaInfoToDatabase($post_id, "image_id", $internalflightBO->image_id) == NULL) {
                         if (isset($imageModel) && isset($image_id)) {
                             $imageModel->delete($image_id);
                         }
                         $this->db->rollBack();
                         $_SESSION["fb_error"][] = ERROR_ADD_NEW_INTERNALFLIGHT;
                         return FALSE;
                     }
                 }
                 if (isset($internalflightBO->current_rating) && $internalflightBO->current_rating != "") {
                     if ($this->addMetaInfoToDatabase($post_id, "current_rating", $internalflightBO->current_rating) == NULL) {
                         if (isset($imageModel) && isset($image_id)) {
                             $imageModel->delete($image_id);
                         }
                         $this->db->rollBack();
                         $_SESSION["fb_error"][] = ERROR_ADD_NEW_INTERNALFLIGHT;
                         return FALSE;
                     }
                 }
                 if (isset($internalflightBO->vote_times) && $internalflightBO->vote_times != "") {
                     if ($this->addMetaInfoToDatabase($post_id, "vote_times", $internalflightBO->vote_times) == NULL) {
                         if (isset($imageModel) && isset($image_id)) {
                             $imageModel->delete($image_id);
                         }
                         $this->db->rollBack();
                         $_SESSION["fb_error"][] = ERROR_ADD_NEW_INTERNALFLIGHT;
                         return FALSE;
                     }
                 }
                 Model::autoloadModel('taxonomy');
                 $taxonomyModel = new TaxonomyModel($this->db);
                 if ($taxonomyModel->addRelationshipToDatabase($post_id, $internalflightBO->city_id, 0) == NULL) {
                     if (isset($imageModel) && isset($image_id)) {
                         $imageModel->delete($image_id);
                     }
                     $this->db->rollBack();
                     $_SESSION["fb_error"][] = ERROR_ADD_NEW_INTERNALFLIGHT;
                     return FALSE;
                 }
                 if ($taxonomyModel->addRelationshipToDatabase($post_id, $internalflightBO->country_id, 0) == NULL) {
                     if (isset($imageModel) && isset($image_id)) {
                         $imageModel->delete($image_id);
                     }
                     $this->db->rollBack();
                     $_SESSION["fb_error"][] = ERROR_ADD_NEW_INTERNALFLIGHT;
                     return FALSE;
                 }
                 if (isset($para->tag_array) && count($para->tag_array) > 0) {
                     Model::autoloadModel('tag');
                     $tagModel = new TagModel($this->db);
                     $tag_id_array = $tagModel->addTagArray($para->tag_array);
                     for ($i = 0; $i < count($tag_id_array); $i++) {
                         $taxonomyModel->addRelationshipToDatabase($post_id, $tag_id_array[$i]);
                     }
                 }
                 $this->db->commit();
                 $_SESSION["fb_success"][] = ADD_INTERNALFLIGHT_SUCCESS;
                 return TRUE;
             } else {
                 $this->db->rollBack();
                 $_SESSION["fb_error"][] = ERROR_ADD_NEW_INTERNALFLIGHT;
                 if (isset($imageModel) && isset($image_id)) {
                     $imageModel->delete($image_id);
                 }
             }
         }
     } catch (Exception $e) {
         $_SESSION["fb_error"][] = ERROR_ADD_NEW_INTERNALFLIGHT;
     }
     return FALSE;
 }
Esempio n. 4
0
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
BO::autoloadBO("taxonomy");
class TagBO extends TaxonomyBO
{
    public $taxonomy = "tag";
}
Esempio n. 5
0
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
BO::autoloadBO('post');
class HotelBO extends PostBO
{
    public $post_type = "hotel";
    public $address;
    public $number_of_rooms;
    public $star;
    public $image_id;
    public $image_url;
    public $city_id;
    public $city_name;
    public $country_id;
    public $country_name;
    public $current_rating;
    public $vote_times;
    public $tag_list;
    function __construct()
    {
        parent::__construct();
    }
    public function setHotelInfo($hotelInfo)
    {
        if (!is_null($hotelInfo)) {
            if (isset($hotelInfo->address)) {
Esempio n. 6
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
BO::autoloadBO('image_meta');
BO::autoloadBO('image_sizes');
class Image_MetadataBO extends BO
{
    public $width;
    public $height;
    public $file;
    /** @var Image_SizesBO */
    public $sizes;
    /** @var Image_MetaBO */
    public $image_meta;
    function __construct()
    {
    }
}
Esempio n. 7
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;
 }
Esempio n. 8
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;
 }
Esempio n. 9
0
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
BO::autoloadBO('attachment');
BO::autoloadBO('image_metadata');
class ImageBO extends AttachmentBO
{
    /** @var Image_MetadataBO */
    public $attachment_metadata;
    function __construct()
    {
    }
    function decode_attachment_metadata()
    {
        if (!is_object($this->attachment_metadata)) {
            $this->attachment_metadata = json_decode($this->attachment_metadata);
        }
    }
}
Esempio n. 10
0
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
BO::autoloadBO("taxonomy");
BO::autoloadBO("post");
class EatBO extends TaxonomyBO
{
    public $taxonomy = "eat";
    public $postBO;
    public $post_content_1 = "";
    public $post_content_2 = "";
    public $images;
    public $image_ids;
    public $current_rating;
    public $vote_times;
    public $tag_list;
    public $country;
    public $city;
    public $destination;
}
Esempio n. 11
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
BO::autoloadBO('thumbnail');
class Image_SizesBO extends BO
{
    /** @var ThumbnailBO */
    public $slider_thumb;
    /** @var ThumbnailBO */
    public $thumbnail;
    /** @var ThumbnailBO */
    public $post_thumbnail;
    /** @var ThumbnailBO */
    public $medium;
    /** @var ThumbnailBO */
    public $medium_large;
    /** @var ThumbnailBO */
    public $large;
    function __construct()
    {
    }
}
Esempio n. 12
0
 public function addNew($para)
 {
     try {
         if ($this->validateAddNew($para)) {
             BO::autoloadBO("user");
             $userBO = new UserBO();
             if (isset($para->user_login)) {
                 $userBO->user_login = $para->user_login;
             }
             if (isset($para->role)) {
                 $userBO->wp_capabilities = $para->role;
             }
             if (isset($para->first_name)) {
                 $userBO->first_name = $para->first_name;
             }
             if (isset($para->last_name)) {
                 $userBO->last_name = $para->last_name;
             }
             if (isset($para->nickname)) {
                 $userBO->nickname = $para->nickname;
             }
             if (isset($para->display_name)) {
                 $userBO->display_name = $para->display_name;
             }
             if (isset($para->email)) {
                 $userBO->user_email = $para->email;
             }
             if (isset($para->url)) {
                 $userBO->user_url = $para->url;
             }
             if (isset($para->description)) {
                 $userBO->description = $para->description;
             }
             if (isset($para->pass1_text)) {
                 $userBO->user_pass = $para->pass1_text;
             }
             $this->db->beginTransaction();
             if (isset($para->avatar)) {
                 Model::autoloadModel("image");
                 $imageModel = new ImageModel($this->db);
                 $imageModel->is_create_thumb = true;
                 $imageModel->is_slider_thumb = true;
                 $avatar_array_id = $imageModel->uploadImages("avatar");
                 if (!is_null($avatar_array_id) && is_array($avatar_array_id) && sizeof($avatar_array_id) != 0) {
                     $avatar_id = $avatar_array_id[0];
                     $userBO->avatar = $avatar_id;
                 } else {
                     $_SESSION["fb_error"][] = ERROR_UPLOAD_AVATAR_FAILED;
                 }
             }
             if ($this->addToDatabase($userBO)) {
                 $this->db->commit();
                 $_SESSION["fb_success"][] = ADD_USER_SUCCESS;
                 return TRUE;
             } else {
                 $this->db->rollBack();
                 $_SESSION["fb_error"][] = ADD_USER_SUCCESS;
                 if (isset($is_change_avatar) && $is_change_avatar && isset($imageModel) && isset($avatar_id)) {
                     $imageModel->delete($avatar_id);
                 }
             }
         }
     } catch (Exception $e) {
         $_SESSION["fb_error"][] = ERROR_ADD_NEW_USER;
     }
     return FALSE;
 }
Esempio n. 13
0
<?php

BO::autoloadBO("term");
class TaxonomyBO extends TermBO
{
    public $term_taxonomy_id = null;
    public $taxonomy = null;
    public $description = "";
    public $parent = 0;
    public $count = 0;
    public function setTaxonomyInfo($termInfo)
    {
        if (!is_null($termInfo)) {
            if (isset($termInfo->term_taxonomy_id)) {
                $this->term_taxonomy_id = $termInfo->term_taxonomy_id;
            }
            if (isset($termInfo->taxonomy)) {
                $this->taxonomy = $termInfo->taxonomy;
            }
            if (isset($termInfo->description)) {
                $this->description = $termInfo->description;
            }
            if (isset($termInfo->parent)) {
                $this->parent = $termInfo->parent;
            }
            if (isset($termInfo->count)) {
                $this->count = $termInfo->count;
            }
        }
    }
}