本文整理汇总了PHP中JHotelUtil::convertToMysqlFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP JHotelUtil::convertToMysqlFormat方法的具体用法?PHP JHotelUtil::convertToMysqlFormat怎么用?PHP JHotelUtil::convertToMysqlFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHotelUtil
的用法示例。
在下文中一共展示了JHotelUtil::convertToMysqlFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
function store($data)
{
// dmp($data);
// exit;
if (!isset($data["has_breakfast"])) {
$data["has_breakfast"] = 0;
}
if (isset($data['start_date'])) {
$data['start_date'] = JHotelUtil::convertToMysqlFormat($data['start_date']);
}
if (isset($data['end_date'])) {
$data['end_date'] = JHotelUtil::convertToMysqlFormat($data['end_date']);
}
try {
//$this->_db->BeginTrans();
$query = "START TRANSACTION;";
$this->_db->setQuery($query);
$this->_db->queryBatch();
$row = $this->getTable();
if (count($data['option_ids']) > 0) {
$data['option_ids'] = implode(',', $data['option_ids']);
} else {
$data['option_ids'] = '';
}
// Bind the form fields to the table
if (!$row->bind($data)) {
$this->setError($this->_db->getErrorMsg());
throw new Exception($this->_db->getErrorMsg());
return false;
}
// Make sure the record is valid
if (!$row->check()) {
$this->setError($this->_db->getErrorMsg());
throw new Exception($this->_db->getErrorMsg());
return false;
}
// Store the web link table to the database
if (!$row->store()) {
$this->setError($this->_db->getErrorMsg());
throw new Exception($this->_db->getErrorMsg());
return false;
}
//prepare photos
$path_old = JHotelUtil::makePathFile(JPATH_COMPONENT . PATH_ROOM_PICTURES . ($data['room_id'] + 0) . "/");
$files = glob($path_old . "*.*");
if ($data['room_id'] == '' || $data['room_id'] == 0 || $data['room_id'] == null) {
$data['room_id'] = $this->_db->insertid();
//update all temporary seasons
$query = " UPDATE #__hotelreservation_rooms_seasons SET room_id = " . $data['room_id'] . " WHERE room_id =0 ";
$this->_db->setQuery($query);
$this->_db->query();
//~update all temporary seasons
}
$this->_room_id = $data['room_id'];
$path_new = JHotelUtil::makePathFile(JPATH_COMPONENT . PATH_ROOM_PICTURES . ($data['room_id'] + 0) . "/");
$picture_ids = array();
foreach ($data['pictures'] as $value) {
$row = $this->getTable('ManageRoomPictures');
// dmp($key);
$pic = new stdClass();
$pic->room_picture_id = 0;
$pic->room_id = $data['room_id'];
$pic->room_picture_info = $value['room_picture_info'];
$pic->room_picture_path = $value['room_picture_path'];
$pic->room_picture_enable = $value['room_picture_enable'];
//dmp($pic);
$file_tmp = JHotelUtil::makePathFile($path_old . basename($pic->room_picture_path));
if (!is_file($file_tmp)) {
continue;
}
if (!is_dir($path_new)) {
if (!@mkdir($path_new)) {
throw new Exception($this->_db->getErrorMsg());
}
}
// dmp(($path_old.basename($pic->room_picture_path).",".$path_new.basename($pic->room_picture_path)));
// exit;
if ($path_old . basename($pic->room_picture_path) != $path_new . basename($pic->room_picture_path)) {
if (@rename($path_old . basename($pic->room_picture_path), $path_new . basename($pic->room_picture_path))) {
$pic->room_picture_path = PATH_ROOM_PICTURES . ($data['room_id'] + 0) . '/' . basename($pic->room_picture_path);
//@unlink($path_old.basename($pic->room_picture_path));
} else {
throw new Exception($this->_db->getErrorMsg());
}
}
if (!$row->bind($pic)) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
// Make sure the record is valid
if (!$row->check()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
// Store the web link table to the database
if (!$row->store()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
$picture_ids[] = $this->_db->insertid();
//.........这里部分代码省略.........
示例2: populateReservationDetails
public function populateReservationDetails($data)
{
$userData = new stdClass();
$userData->confirmation_id = $data["reservationId"];
//dmp($data["roomdetails"]);
$guestInfo = $this->getNumberOfGuests($data["roomdetails"]);
$userData->roomGuests = $guestInfo->adults;
//dmp($userData->roomGuests);
$userData->total_adults = 0;
if (isset($userData->roomGuests) && count($userData->roomGuests) >= 1) {
foreach ($userData->roomGuests as $guestPerRoom) {
$userData->total_adults += $guestPerRoom;
}
}
$userData->adults = $userData->total_adults;
$userData->children = 0;
$userData->first_name = $data["first_name"];
$userData->last_name = $data["last_name"];
$userData->address = $data["address"];
$userData->city = $data["city"];
$userData->state_name = $data["state_name"];
$userData->country = $data["country"];
$userData->postal_code = $data["postal_code"];
$userData->phone = $data["phone"];
$userData->email = $data["email"];
$userData->company_name = $data["company_name"];
$userData->guest_type = isset($data["guest_type"]) ? $data["guest_type"] : 0;
$userData->discount_code = $data["discount_code"];
$userData->reservedItems = $data["reservedItem"];
$userData->hotelId = $data["hotelId"];
$userData->totalPaid = $data["totalPaid"];
/*--------------------------------------------------------------*/
//MICOD
//Aquí anexamos el nuevo campo de edades a la variable $userSata
$edades = array($data["edad-1"], $data["edad-2"], $data["edad-3"], $data["edad-4"], $data["edad-5"], $data["edad-6"]);
//Concatenar todo en un nuevo Array
$string_edades = implode("|", $edades);
//Pegar todo en un nuevo string
$userData->child_age = $string_edades;
//Pasar la variable al userData
$_SESSION["child_age"] = $userData->child_age;
//Pasar la variable a una sesión para cargarlo en el archivo ReservationService.php
/*dmp($_SESSION["child_age"]);
die;*/
/*--------------------------------------------------------------*/
$userData->voucher = $data["voucher"];
$userData->remarks = $data["remarks"];
$userData->remarks_admin = $data["remarks_admin"];
$userData->start_date = JHotelUtil::convertToMysqlFormat($data["start_date"]);
$userData->end_date = JHotelUtil::convertToMysqlFormat($data["end_date"]);
$hotel = HotelService::getHotel($userData->hotelId);
$userData->currency = HotelService::getHotelCurrency($hotel);
$userData->arrival_time = $data["arrival_time"];
$userData->rooms = count($data["roomdetails"]);
if ($data["update_price_type"] == 2 || empty($data["update_price_type"])) {
$userData->roomCustomPrices = $this->prepareCustomPrices($userData->reservedItems, $data["roomdetails"], $userData->start_date);
}
if (!empty($data["extraOptionIds"])) {
$extraOptions = array();
if (isset($data["extraOptionIds"])) {
foreach ($data["extraOptionIds"] as $key => $value) {
$extraOption = explode("|", $value);
if ($extraOption[5] > 0 || $extraOption[6] > 0) {
continue;
}
if (isset($data["extra-option-days-" . $extraOption[3]])) {
$extraOption[6] = $data["extra-option-days-" . $extraOption[3]];
}
if (isset($data["extra-option-persons-" . $extraOption[3]])) {
$extraOption[5] = $data["extra-option-persons-" . $extraOption[3]];
}
$extraOptions[$key] = implode("|", $extraOption);
}
}
$userData->extraOptionIds = $extraOptions;
}
$guestDetails = array();
if (isset($data["guest_first_name"])) {
for ($i = 0; $i < count($data["guest_first_name"]); $i++) {
$guestDetail = new stdClass();
$guestDetail->first_name = $data["guest_first_name"][$i];
$guestDetail->last_name = $data["guest_last_name"][$i];
$guestDetail->identification_number = $data["guest_identification_number"][$i];
$guestDetails[] = $guestDetail;
}
}
$userData->guestDetails = $guestDetails;
return $userData;
}
示例3: save
/**
* save a record (and redirect to main page)
* @return void
*/
function save()
{
$bRet = 0;
$post = JRequest::get('post');
$model = $this->getModel('managereservations');
$tsk = 'edit';
if (isset($post['is_assign_number_rooms']) && $post['is_assign_number_rooms'] == 1) {
$tsk = 'assign_number_rooms';
}
if (isset($post['is_status']) && $post['is_status'] == 1) {
$ret = $this->changeStatus();
return $ret;
} else {
if (isset($post['change_confirmation_payment_status']) && $post['change_confirmation_payment_status'] > 0) {
$ret = $this->changeConfirmationPaymentStatus($post['change_confirmation_payment_status']);
return $ret;
} else {
if ($tsk == 'edit') {
// if( strtotime($post['datas']) < strtotime( date('Y-m-d') ) )
// $bRet = -1;
// if( strtotime($post['datae']) < strtotime($post['datas'] ) )
// $bRet = -2;
// if( count($post['room_ids']) == 0)
// $bRet = -3;
}
if ($bRet == 0) {
$modelVariables = $this->getModel('Variables');
$modelConfirmations = $this->getModel('Confirmations');
//$modelConfirmations = $this->getModel('Confirmations');
if (isset($post['is_assign_number_rooms']) && $post['is_assign_number_rooms'] == 1) {
JRequest::setVar('tip_oper', 5);
$modelVariables->load($post['confirmation_id'], $post['email'], $modelVariables->itemCurrency, array('itemRoomsNumbers' => $post['itemRoomsNumbers']));
$tsk = 'assign_number_rooms';
// dmp($modelVariables->itemRoomsNumbers);
// exit;
foreach ($modelVariables->itemRoomsNumbers as $key => $valueNumber) {
if ($valueNumber == 0) {
JError::raiseWarning(500, JText::_('LNG_PLEASE_SELECT_ROOM_NUMBER', true));
$this->setRedirect('index.php?option=' . getBookingExtName() . '&controller=managereservations&view=managereservations&confirmation_id[]=' . $post['confirmation_id'] . '&task=' . $tsk);
return false;
}
}
//$post['itemRoomsNumbers'] = $str;
} else {
if ($tsk == 'edit') {
$start_date = JHotelUtil::convertToMysqlFormat($post["datas"]);
$end_date = JHotelUtil::convertToMysqlFormat($post["datae"]);
//dmp($start_date);
//dmp($end_date);
//dmp($post);
JRequest::setVar('tip_oper', 5);
$modelVariables = new JHotelReservationModelVariables($post['hotel_id']);
$modelVariables->load($post['confirmation_id'], $post['email'], $modelVariables->itemCurrency, $post);
$modelVariables->store($post);
//dmp($modelVariables);
}
}
//dmp($modelVariables);
//exit;
if ($modelVariables->checkAvalability(true)) {
// $str = $modelVariables->getStringRoomsCapacity( $modelVariables->itemRoomsCapacity );
// $post['itemRoomsCapacity'] = $str;
// $modelVariables->store($post);
$check_totals = true;
if (isset($post['is_assign_number_rooms']) && $post['is_assign_number_rooms'] == 1) {
$check_totals = false;
} else {
$modelVariables->status_reservation_id = RESERVED_ID;
}
//$modelVariables->itemRoomsDiscounts = $modelVariables->getRoomsDiscounts();
/*
//numbers
if( isset( $post['is_assign_number_rooms']) && $post['is_assign_number_rooms'] == 1 )
{
$modelVariables->getRoomsAvailable($modelVariables->room_ids, true );
foreach($modelVariables->itemRoomsNumbers as $key=> $nr )
{
foreach( $modelVariables->itemRoomsAvailable as $k => $v )
{
if($v->room_id == $key )
{
foreach( $modelVariables->itemRoomsAvailable[$k]->daily as $d => $vd )
{
// dmp($modelVariables->itemRoomsNumbers);
$modelVariables->itemRoomsAvailable[$k]->daily['numbers'][] = array(
'data' => $vd['numbers'],
'id' => -1,
'nr' => $nr,
'price' => $vd['price_final'],
'discounts' => $vd[ 'discounts' ]
);
}
}
}
}
echo 3;
//.........这里部分代码省略.........
示例4: createUserData
public static function createUserData($data)
{
$log = Logger::getInstance(JPATH_COMPONENT . "/logs/site-log-" . date("d-m-Y") . '.log', 1);
$log->LogDebug("Archivo \\components\\com_jhotelreservation\\classes\\services\\UserDataService.php");
$log->LogDebug("createUserData");
//MICOD
for ($i = 0; $i < 5; $i++) {
$_SESSION["string_edades_habit_" . $i] = NULL;
}
$_SESSION["array_edades_habit"] = NULL;
$userData = new stdClass();
//var_dump("create user data");
if (isset($data) && count($data) > 0 && isset($data["jhotelreservation_datas"])) {
if (isset($data["keyword"])) {
$userData->keyword = $data["keyword"];
} else {
$userData->keyword = "";
}
$userData->start_date = JHotelUtil::convertToMysqlFormat($data["jhotelreservation_datas"]);
$userData->end_date = JHotelUtil::convertToMysqlFormat($data["jhotelreservation_datae"]);
$userData->rooms = $data["rooms"];
$userData->adults = $data["guest_adult"];
$userData->total_adults = $userData->adults;
$userData->children = $data["guest_child"];
$userData->total_children = $userData->children;
$userData->year_start = $data["year_start"];
$userData->month_start = $data["month_start"];
$userData->day_start = $data["day_start"];
$userData->year_end = $data["year_end"];
$userData->month_end = $data["month_end"];
$userData->day_end = $data["day_end"];
/*--------------------------------------------------------------*/
//MICOD
/*En éste espacio capturo los datos de las edades por habitación y los cargo en una sesión PHP de tipo arreglo.
De aquí saltamos a la línea 419 de éste archivo*/
$rooms = $data["rooms"];
$rooms = $rooms + 1;
if ($data["rooms"] > 1) {
for ($i = 0; $i < $rooms; $i++) {
$edades_habit = array($data["edad-" . $i . "-1"], $data["edad-" . $i . "-2"], $data["edad-" . $i . "-3"], $data["edad-" . $i . "-4"], $data["edad-" . $i . "-5"], $data["edad-" . $i . "-6"]);
$string_edades_habit = implode("|", $edades_habit);
$_SESSION["string_edades_habit_" . $i] = $string_edades_habit;
}
$_SESSION["array_edades_habit"] = array($_SESSION["string_edades_habit_1"], $_SESSION["string_edades_habit_2"], $_SESSION["string_edades_habit_3"], $_SESSION["string_edades_habit_4"]);
} else {
//dmp($_SESSION["string_edades_habit_4"]);
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
//MICOD
//Aquí anexamos el nuevo campo de edades a la variable $userSata
$edades = array($data["edad-1"], $data["edad-2"], $data["edad-3"], $data["edad-4"], $data["edad-5"], $data["edad-6"]);
//Concatenar todo en un nuevo Array
$string_edades = implode("|", $edades);
//Pegar todo en un nuevo string
$userData->child_age = $string_edades;
//Pasar la variable al userData
$_SESSION["child_age"] = $userData->child_age;
//Pasar la variable a una sesión para cargarlo en el archivo ReservationService.php
/*dmp($_SESSION["child_age"]);
die;*/
/*--------------------------------------------------------------*/
}
if (isset($data["user_currency"])) {
$userData->user_currency = $data["user_currency"];
} else {
$userData->user_currency = "";
}
if (isset($data["excursions"])) {
$userData->excursions = $data["excursions"];
} else {
$userData->excursions = array();
}
$userData->voucher = isset($data["voucher"]) ? $data["voucher"] : "";
$log->LogDebug("voucher: " . $userData->voucher);
$userData->filterParams = '';
$userData->searchFilter = array("filterCategories" => array());
if (isset($data["room-guests"]) && count($data["room-guests"]) > 1) {
$userData->roomGuests = $data["room-guests"];
$userData->rooms = count($userData->roomGuests);
$userData->total_adults = 0;
foreach ($userData->roomGuests as $guestPerRoom) {
$userData->total_adults += $guestPerRoom;
}
JRequest::setVar('jhotelreservation_rooms', $userData->rooms);
JRequest::setVar('jhotelreservation_guest_adult', $userData->total_adults);
} else {
$userData->roomGuests = array($data["guest_adult"]);
}
if (isset($data["room-guests-children"]) && count($data["room-guests-children"]) > 1) {
$userData->roomGuestsChildren = $data["room-guests-children"];
$userData->total_children = 0;
foreach ($userData->roomGuestsChildren as $guestPerRoom) {
$userData->total_children += $guestPerRoom;
}
JRequest::setVar('jhotelreservation_guest_child', $userData->total_children);
} else {
$userData->roomGuestsChildren = array($data["guest_child"]);
}
/*--------------------------------------------------------------*/
//MICOD
//.........这里部分代码省略.........
示例5: addHotelRoom
function addHotelRoom()
{
$roomId = JRequest::getInt("roomId");
$current = JRequest::getInt("current");
$hotelId = JRequest::getInt("hotelId");
$discountCode = JRequest::getVar("discountCode");
$startDate = JHotelUtil::convertToMysqlFormat(JRequest::getVar("startDate"));
$endDate = JHotelUtil::convertToMysqlFormat(JRequest::getVar("endDate"));
$adults = JRequest::getInt("adults");
$children = JRequest::getInt("children");
$room = HotelService::getHotelRooms($hotelId, $startDate, $endDate, array($roomId), $adults, $children, $discountCode);
$room = $room[0];
//echo($room);
$room->current = $current;
$model = $this->getModel('reservation');
$buff = $model->getRoomHtmlContent($room, $startDate, $endDate);
//header("Content-type:text/xml");
echo '<?xml version="1.0" encoding="utf-8" ?>';
echo '<room_statement>';
echo '<answer error="0" content_records="' . $buff . '" />';
echo '</room_statement>';
echo '</xml>';
JFactory::getApplication()->close();
}
示例6: createUserData
public static function createUserData($data)
{
//$log = Logger::getInstance(JPATH_COMPONENT."/logs/site-log-".date("d-m-Y").'.log',1);
//$log->LogDebug("createUserData");
$userData = new stdClass();
//var_dump("create user data");
if (isset($data) && count($data) > 0 && isset($data["jhotelreservation_datas"])) {
if (isset($data["keyword"])) {
$userData->keyword = $data["keyword"];
} else {
$userData->keyword = "";
}
$userData->start_date = JHotelUtil::convertToMysqlFormat($data["jhotelreservation_datas"]);
$userData->end_date = JHotelUtil::convertToMysqlFormat($data["jhotelreservation_datae"]);
$userData->rooms = $data["rooms"];
$userData->adults = $data["guest_adult"];
$userData->total_adults = $userData->adults;
$userData->children = $data["guest_child"];
$userData->total_children = $userData->children;
$userData->year_start = $data["year_start"];
$userData->month_start = $data["month_start"];
$userData->day_start = $data["day_start"];
$userData->year_end = $data["year_end"];
$userData->month_end = $data["month_end"];
$userData->day_end = $data["day_end"];
if (isset($data["user_currency"])) {
$userData->user_currency = $data["user_currency"];
} else {
$userData->user_currency = "";
}
if (isset($data["excursions"])) {
$userData->excursions = $data["excursions"];
} else {
$userData->excursions = array();
}
$userData->voucher = isset($data["voucher"]) ? $data["voucher"] : "";
//$log->LogDebug("voucher: ".$userData->voucher);
$userData->filterParams = '';
$userData->searchFilter = array("filterCategories" => array());
if (isset($data["room-guests"]) && count($data["room-guests"]) > 1) {
$userData->roomGuests = $data["room-guests"];
$userData->rooms = count($userData->roomGuests);
$userData->total_adults = 0;
foreach ($userData->roomGuests as $guestPerRoom) {
$userData->total_adults += $guestPerRoom;
}
JRequest::setVar('jhotelreservation_rooms', $userData->rooms);
JRequest::setVar('jhotelreservation_guest_adult', $userData->total_adults);
} else {
$userData->roomGuests = array($data["guest_adult"]);
}
if (isset($data["room-guests-children"]) && count($data["room-guests-children"]) > 1) {
$userData->roomGuestsChildren = $data["room-guests-children"];
$userData->total_children = 0;
foreach ($userData->roomGuestsChildren as $guestPerRoom) {
$userData->total_children += $guestPerRoom;
}
JRequest::setVar('jhotelreservation_guest_child', $userData->total_children);
} else {
$userData->roomGuestsChildren = array($data["guest_child"]);
}
$userData->noDates = JRequest::getVar('no-dates', null);
} else {
$userData->searchType = '';
$userData->keyword = '';
$userData->start_date = date('Y-m-d');
$userData->end_date = date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")));
$userData->rooms = '1';
$userData->roomGuests = array(2);
$userData->roomGuestsChildren = array(0);
$userData->adults = isset($data["guest_adult"]) ? $data["guest_adult"] : '2';
$userData->children = isset($data["guest_children"]) ? $data["guest_children"] : '0';
$userData->total_adults = $userData->adults;
$userData->total_children = $userData->children;
$userData->nights = '1';
$userData->year_start = date('Y');
$userData->month_start = date('m');
$userData->day_start = date('d');
$userData->year_end = date("Y", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")));
$userData->month_end = date("m", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")));
$userData->day_end = date("d", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y")));
$userData->voucher = isset($data["voucher"]) ? $data["voucher"] : "";
$userData->filterParams = '';
$userData->searchFilter = array("filterCategories" => array());
$userData->excursions = array();
if (isset($data["keyword"])) {
$userData->keyword = $data["keyword"];
} else {
$userData->keyword = "";
}
$userData->user_currency = "";
}
$userData->reservedItems = array();
$userData->confirmation_id = 0;
$userData->first_name = '';
$userData->last_name = '';
$userData->address = '';
$userData->city = '';
$userData->state_name = '';
$userData->country = '';
//.........这里部分代码省略.........
示例7: populateReservationDetails
public function populateReservationDetails($data)
{
$userData = new stdClass();
$userData->confirmation_id = $data["reservationId"];
//dmp($data["roomdetails"]);
$guestInfo = $this->getNumberOfGuests($data["roomdetails"]);
$userData->roomGuests = $guestInfo->adults;
//dmp($userData->roomGuests);
$userData->total_adults = 0;
if (isset($userData->roomGuests) && count($userData->roomGuests) >= 1) {
foreach ($userData->roomGuests as $guestPerRoom) {
$userData->total_adults += $guestPerRoom;
}
}
$userData->adults = $userData->total_adults;
$userData->children = 0;
$userData->first_name = $data["first_name"];
$userData->last_name = $data["last_name"];
$userData->address = $data["address"];
$userData->city = $data["city"];
$userData->state_name = $data["state_name"];
$userData->country = $data["country"];
$userData->postal_code = $data["postal_code"];
$userData->phone = $data["phone"];
$userData->email = $data["email"];
$userData->company_name = $data["company_name"];
$userData->guest_type = isset($data["guest_type"]) ? $data["guest_type"] : 0;
$userData->discount_code = $data["discount_code"];
$userData->reservedItems = $data["reservedItem"];
$userData->hotelId = $data["hotelId"];
$userData->totalPaid = $data["totalPaid"];
$userData->voucher = $data["voucher"];
$userData->remarks = $data["remarks"];
$userData->remarks_admin = $data["remarks_admin"];
$userData->start_date = JHotelUtil::convertToMysqlFormat($data["start_date"]);
$userData->end_date = JHotelUtil::convertToMysqlFormat($data["end_date"]);
$hotel = HotelService::getHotel($userData->hotelId);
$userData->currency = HotelService::getHotelCurrency($hotel);
$userData->arrival_time = $data["arrival_time"];
$userData->rooms = count($data["roomdetails"]);
if ($data["update_price_type"] == 2 || empty($data["update_price_type"])) {
$userData->roomCustomPrices = $this->prepareCustomPrices($userData->reservedItems, $data["roomdetails"], $userData->start_date);
}
if (!empty($data["extraOptionIds"])) {
$extraOptions = array();
if (isset($data["extraOptionIds"])) {
foreach ($data["extraOptionIds"] as $key => $value) {
$extraOption = explode("|", $value);
if ($extraOption[5] > 0 || $extraOption[6] > 0) {
continue;
}
if (isset($data["extra-option-days-" . $extraOption[3]])) {
$extraOption[6] = $data["extra-option-days-" . $extraOption[3]];
}
if (isset($data["extra-option-persons-" . $extraOption[3]])) {
$extraOption[5] = $data["extra-option-persons-" . $extraOption[3]];
}
$extraOptions[$key] = implode("|", $extraOption);
}
}
$userData->extraOptionIds = $extraOptions;
}
$guestDetails = array();
if (isset($data["guest_first_name"])) {
for ($i = 0; $i < count($data["guest_first_name"]); $i++) {
$guestDetail = new stdClass();
$guestDetail->first_name = $data["guest_first_name"][$i];
$guestDetail->last_name = $data["guest_last_name"][$i];
$guestDetail->identification_number = $data["guest_identification_number"][$i];
$guestDetails[] = $guestDetail;
}
}
$userData->guestDetails = $guestDetails;
return $userData;
}
示例8: initFilterParams
function initFilterParams()
{
$post = JRequest::get('post');
if (isset($post['filter_datas'])) {
$post['filter_datas'] = JHotelUtil::convertToMysqlFormat($post['filter_datas']);
}
if (isset($post['filter_datae'])) {
$post['filter_datae'] = JHotelUtil::convertToMysqlFormat($post['filter_datae']);
}
if (isset($post['hotel_id'])) {
$this->hotel_id = $post['hotel_id'];
} else {
$this->hotel_id = $post['hotel_id'] = 0;
}
if (isset($post['filter_room_types'])) {
$this->filter_room_types = $post['filter_room_types'];
} else {
$this->filter_room_types = $post['filter_room_types'] = 0;
}
if (isset($post['filter_datas'])) {
$this->filter_datas = $post['filter_datas'];
} else {
$this->filter_datas = $post['filter_datas'] = date('Y-m-01');
}
if (isset($post['filter_datae'])) {
$this->filter_datae = $post['filter_datae'];
} else {
$this->filter_datae = $post['filter_datae'] = date('Y-m-t');
}
if (isset($post['filter_report_type'])) {
$this->filter_report_type = $post['filter_report_type'];
} else {
$this->filter_report_type = "MONTH";
}
$this->filter_datas = JHotelUtil::convertToFormat($this->filter_datas);
$this->filter_datae = JHotelUtil::convertToFormat($this->filter_datae);
$hotels = $this->get('Hotels');
$hotels = checkHotels(JFactory::getUser()->id, $hotels);
$this->hotels = $hotels;
return $post;
}
示例9: getListQuery
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*
* @since 1.6
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
// Select all fields from the table.
$query->select($this->getState('list.select', 'c.confirmation_id,c.hotel_id, c.start_date, c.end_date, c.first_name,c.cancellation_notes ,
c.last_name, c.reservation_status, c.voucher, c.created, c.adults, c.children,c.rooms, c.total'));
$query->from($db->quoteName('#__hotelreservation_confirmations') . ' AS c');
$query->select('h.hotel_name');
$query->join('LEFT', '#__hotelreservation_hotels AS h ON c.hotel_id=h.hotel_id');
$query->select(' sum(cr.adults) as total_adults,sum(cr.adults) as total_children');
$query->join('LEFT', '#__hotelreservation_confirmations_rooms AS cr ON c.confirmation_id=cr.confirmation_id');
$query->select('s.status_reservation_name, s.bkcolor, s.color, s.is_modif');
$query->join('LEFT', '#__hotelreservation_status_reservation AS s ON c.reservation_status=s.status_reservation_id');
$query->select('min(cp.payment_status) as payment_status, (cp.amount) as amount_paid');
$query->join('LEFT', '#__hotelreservation_confirmations_payments as cp on c.confirmation_id= cp.confirmation_id');
//if other than super user restrict hotels
$userId = JFactory::getUser()->id;
if (!(isSuperUser($userId) || isManager($userId))) {
$query->join('INNER', $db->quoteName('#__hotelreservation_user_hotel_mapping') . ' AS hum ON h.hotel_id=hum.hotel_id');
$query->where("hum.user_id = " . $userId);
}
// Filter by search in title.
$search = $this->getState('filter.search');
if (!empty($search)) {
if (is_numeric($search)) {
$query->where("c.confirmation_id={$search}");
} else {
$query->where("(c.first_name LIKE '%{$search}%' or c.last_name LIKE '%{$search}%' or h.hotel_name LIKE '%{$search}%')");
}
}
// Filter by search in title.
$searchVoucher = $this->getState('filter.voucher');
if (!empty($searchVoucher)) {
//dmp($searchVoucher);
$query->where("c.voucher LIKE '%" . $searchVoucher . "%'");
}
$searchStartDate = $this->getState('filter.start_date');
$searchEndDate = $this->getState('filter.end_date');
if (!empty($searchEndDate) && !empty($searchStartDate)) {
$query->where("c.start_date between '" . JHotelUtil::convertToMysqlFormat($searchStartDate) . "' and '" . JHotelUtil::convertToMysqlFormat($searchEndDate) . "'");
} else {
if (!empty($searchStartDate)) {
$query->where("c.start_date >= " . JHotelUtil::convertToMysqlFormat($searchStartDate));
}
}
// Filter the items over the menu id if set.
$hotelId = $this->getState('filter.hotel_id');
if (!empty($hotelId)) {
$query->where('h.hotel_id = ' . $hotelId);
}
// Filter the items over the menu id if set.
$roomId = $this->getState('filter.room_type');
if (!empty($roomId)) {
$query->where('cr.room_id = ' . $roomId);
}
// Filter the items over the menu id if set.
$status = $this->getState('filter.status');
if (!empty($status)) {
$query->where('s.status_reservation_id = ' . $status);
}
// Filter the items over the menu id if set.
$payment_status = $this->getState('filter.payment_status');
if ($payment_status != -1 && $payment_status != "") {
$query->where('cp.payment_status = ' . $db->quote($payment_status));
}
$query->group('c.confirmation_id');
// Add the list ordering clause.
$query->order($db->escape($this->getState('list.ordering', 'c.confirmation_id')) . ' ' . $db->escape($this->getState('list.direction', 'ASC')));
return $query;
}
示例10: save
/**
* Method to save the form data.
*
* @param array The form data.
* @return boolean True on success.
*/
public function save($data)
{
$id = !empty($data['id']) ? $data['id'] : (int) $this->getState('excursion.id');
$isNew = true;
for ($day = 1; $day <= 7; $day++) {
if (!isset($data["excursion_day_{$day}"])) {
$data["excursion_day_{$day}"] = 0;
}
}
// Get a row instance.
$table = $this->getTable();
$data['excursion_order'] = $table->getExcursionOrder();
// Load the row if saving an existing item.
if ($id > 0) {
$table->load($id);
$isNew = false;
}
// Bind the data.
if (!$table->bind($data)) {
$this->setError($table->getError());
return false;
}
$table->name = $data["excursion_name"];
$table->data_start = JHotelUtil::convertToMysqlFormat($data["data_start"]);
$table->data_end = JHotelUtil::convertToMysqlFormat($data["data_end"]);
// Check the data.
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// Store the data.
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
$this->setState('excursion.id', $table->id);
// Clean the cache
$this->cleanCache();
return true;
}
示例11: store
/**
* Method to save the form data.
*
* @param array The form data.
* @return boolean True on success.
*/
function store($data)
{
// dmp($data);
// exit;
$data['offer_datas'] = JHotelUtil::convertToMysqlFormat($data['offer_datas']);
$data['offer_datae'] = JHotelUtil::convertToMysqlFormat($data['offer_datae']);
$data['offer_datasf'] = JHotelUtil::convertToMysqlFormat($data['offer_datasf']);
$data['offer_dataef'] = JHotelUtil::convertToMysqlFormat($data['offer_dataef']);
try {
//$this->_db->BeginTrans();
$query = "START TRANSACTION;";
$this->_db->setQuery($query);
$this->_db->queryBatch();
$row = $this->getTable('ManageOffers', 'Table');
$data['offer_order'] = $row->getOfferOrder();
//dmp($data);
//exit;
// Bind the form fields to the table
if (!$row->bind($data)) {
$this->setError($this->_db->getErrorMsg());
throw new Exception($this->_db->getErrorMsg());
return false;
}
// Make sure the record is valid
if (!$row->check()) {
$this->setError($this->_db->getErrorMsg());
throw new Exception($this->_db->getErrorMsg());
return false;
}
// Store the web link table to the database
if (!$row->store()) {
$this->setError($this->_db->getErrorMsg());
throw new Exception($this->_db->getErrorMsg());
return false;
}
if ($data['offer_id'] == '' || $data['offer_id'] == 0 || $data['offer_id'] == null) {
$data['offer_id'] = $this->_db->insertid();
}
$this->setState('offer.offer_id', $data['offer_id']);
$this->_offer_id = $data['offer_id'];
$this->storeVouchers($data);
$this->storePictures($data);
$this->storeRooms($data);
$this->storeRate($data);
$this->storeThemes($data);
//store extra options
$this->storeExtraOptions($this->_offer_id, $data["extra_options_ids"]);
$this->storeOfferExcursions($this->getState('offer.offer_id'), $data["excursion_ids"]);
$query = "COMMIT";
$this->_db->setQuery($query);
$this->_db->queryBatch();
} catch (Exception $ex) {
dmp($ex);
// exit;
//$this->_db->RollbackTrans();
$query = "ROLLBACK";
$this->_db->setQuery($query);
$this->_db->queryBatch();
return false;
}
return true;
}
示例12: save
/**
* Method to save the form data.
*
* @param array The form data.
* @return boolean True on success.
*/
public function save($data)
{
$id = !empty($data['id']) ? $data['id'] : (int) $this->getState('extraoption.id');
$isNew = true;
$data["start_date"] = JHotelUtil::convertToMysqlFormat($data["start_date"]);
$data["end_date"] = JHotelUtil::convertToMysqlFormat($data["end_date"]);
// Get a row instance.
$table = $this->getTable();
// Load the row if saving an existing item.
if ($id > 0) {
$table->load($id);
$isNew = false;
}
// Bind the data.
if (!$table->bind($data)) {
$this->setError($table->getError());
return false;
}
// Check the data.
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// Store the data.
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
$this->setState('extraoption.id', $table->id);
// Clean the cache
$this->cleanCache();
if ($id == 0) {
$this->storePicture($data["image_path"], $table->id, $id);
}
return true;
}
示例13: getDetailedAvailabilityReport
function getDetailedAvailabilityReport()
{
$report = array();
$startDate = JHotelUtil::convertToMysqlFormat($this->getState('filter.start_date'));
$endDate = JHotelUtil::convertToMysqlFormat($this->getState('filter.end_date'));
$hotelId = $this->getState('filter.hotel_id');
$query = "select *\r\n\t\t\t\t from #__hotelreservation_confirmations hc\r\n\t\t\t\t inner join #__hotelreservation_confirmations_rooms hcr on hcr.confirmation_id \t\t= hc.confirmation_id\r\n\t\t\t\t inner join #__hotelreservation_status_reservation hsr on hsr.status_reservation_id\t= hc.reservation_status\r\n\t\t\t\t where ((hc.start_date >='{$startDate}' and hc.end_date <='{$endDate}') or ('{$startDate}' between hc.start_date and hc.end_date) or ('{$endDate}' between hc.start_date and hc.end_date)) and hc.hotel_id = {$hotelId}\r\n\t\t\t\t order by hc.start_date, hc.end_date\r\n\t\t\t\t\t";
$bookings = $this->_getList($query);
// dmp($query);
// dmp($bookings);
//dmp(count($bookings));
if (count($bookings)) {
foreach ($bookings as $booking) {
if (!isset($report[$booking->room_id])) {
$report[$booking->room_id][] = array($booking);
//dmp("add first id:".$booking->confirmation_id);
} else {
$levels =& $report[$booking->room_id];
$index = 0;
$added = false;
foreach ($levels as $i => &$level) {
$lastBooking = end($level);
if (strtotime($lastBooking->end_date) <= strtotime($booking->start_date)) {
$level[] = $booking;
$added = true;
//dmp($level);
//dmp("Add B". $booking->confirmation_id." L:".$i." C: ".count($level));
break;
}
}
if (!$added) {
//debug_zval_dump($booking);
//dmp("create new level add: ".$booking->confirmation_id);
$report[$booking->room_id][] = array($booking);
}
}
}
}
return $report;
}
示例14: store
function store($data)
{
try {
$this->_db->BeginTrans();
$row = $this->getTable('hotels');
//$data["hotel_description"]= strip_tags($data["hotel_description"]);
$this->checkHotelRestrictions($data['hotel_id']);
$data['start_date'] = JHotelUtil::convertToMysqlFormat($data['start_date']);
$data['end_date'] = JHotelUtil::convertToMysqlFormat($data['end_date']);
//dmp($data);
//exit;
// Bind the form fields to the table
if (!$row->bind($data)) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
// return false;
}
// Make sure the record is valid
if (!$row->check()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
// return false;
}
// Store the web link table to the database
if (!$row->store()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
// return false;
}
if ($data['hotel_id'] == '' || $data['hotel_id'] == 0 || $data['hotel_id'] == null) {
$data['hotel_id'] = $this->_db->insertid();
$this->_hotel_id = $data['hotel_id'];
self::copyEmailContent($this->_hotel_id);
}
//prepare photos
$managePictures = JRequest::getVar("manage_pictures", null);
if (!empty($managePictures)) {
$path_old = JHotelUtil::makePathFile(JPATH_ROOT . DS . PATH_HOTEL_PICTURES . ($data['hotel_id'] + 0) . "/");
$files = glob($path_old . "*.*");
$path_new = JHotelUtil::makePathFile(JPATH_ROOT . DS . PATH_HOTEL_PICTURES . ($data['hotel_id'] + 0) . "/");
//dmp($data);
//dmp($data['pictures']);
//exit;
$picture_ids = array();
foreach ($data['pictures'] as $value) {
$row = $this->getTable('ManageHotelPictures');
//dmp($key);
$pic = new stdClass();
$pic->hotel_picture_id = 0;
$pic->hotel_id = $data['hotel_id'];
$pic->hotel_picture_info = $value['hotel_picture_info'];
$pic->hotel_picture_path = $value['hotel_picture_path'];
$pic->hotel_picture_enable = $value['hotel_picture_enable'];
$file_tmp = JHotelUtil::makePathFile($path_old . basename($pic->hotel_picture_path));
if (!is_file($file_tmp)) {
continue;
}
if (!is_dir($path_new)) {
if (!@mkdir($path_new)) {
throw new Exception($this->_db->getErrorMsg());
}
}
//dmp(($path_old.basename($pic->hotel_picture_path).",".$path_new.basename($pic->hotel_picture_path)));
//exit;
if ($path_old . basename($pic->hotel_picture_path) != $path_new . basename($pic->hotel_picture_path)) {
if (@rename($path_old . basename($pic->hotel_picture_path), $path_new . basename($pic->hotel_picture_path))) {
$pic->hotel_picture_path = PATH_HOTEL_PICTURES . ($data['hotel_id'] + 0) . '/' . basename($pic->hotel_picture_path);
//@unlink($path_old.basename($pic->room_picture_path));
} else {
throw new Exception($this->_db->getErrorMsg());
}
}
if (!$row->bind($pic)) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
// Make sure the record is valid
if (!$row->check()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
// Store the web link table to the database
if (!$row->store()) {
throw new Exception($this->_db->getErrorMsg());
$this->setError($this->_db->getErrorMsg());
}
$picture_ids[] = $this->_db->insertid();
}
//dmp($picture_ids);
$files = glob($path_new . "*.*");
foreach ($files as $pic) {
$is_find = false;
foreach ($data['pictures'] as $value) {
$path = JHotelUtil::makePathFile(JPATH_ROOT . DS . $value['hotel_picture_path']);
if ($pic == JHotelUtil::makePathFile(JPATH_ROOT . DS . $value['hotel_picture_path'])) {
$is_find = true;
break;
}
}
//if( $is_find == false )
//.........这里部分代码省略.........
示例15: store
function store($data)
{
$row = $this->getTable();
$data['discount_datas'] = JHotelUtil::convertToMysqlFormat($data['discount_datas']);
$data['discount_datae'] = JHotelUtil::convertToMysqlFormat($data['discount_datae']);
// Bind the form fields to the table
if (!$row->bind($data)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Make sure the record is valid
if (!$row->check()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Store the web link table to the database
if (!$row->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
return true;
}