本文整理汇总了PHP中JHotelUtil::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JHotelUtil::getInstance方法的具体用法?PHP JHotelUtil::getInstance怎么用?PHP JHotelUtil::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHotelUtil
的用法示例。
在下文中一共展示了JHotelUtil::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processPayment
function processPayment()
{
$appSettings = JHotelUtil::getInstance()->getApplicationSettings();
$paymentMethod = JRequest::getVar("payment_method");
if (!$appSettings->is_enable_payment) {
$paymentMethod = "cash";
}
$paymentModel = $this->getModel("PaymentOptions");
$reservationDetails = $paymentModel->getReservationDetails();
$reservationDetails->paymentMethod = $paymentMethod;
$confirmationModel = $this->getModel("Confirmation");
$confirmationId = $confirmationModel->saveConfirmation($reservationDetails);
$reservationDetails->confirmation_id = $confirmationId;
if ($confirmationId == -1) {
$this->setMessage(JText::_('LNG_NO_ROOMS_AVAILABLE', true));
$this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&view=paymentoptions', $msg));
return;
}
$processor = PaymentService::createPaymentProcessor($paymentMethod);
$paymentDetails = $processor->processTransaction($reservationDetails);
PaymentService::addPayment($paymentDetails);
if ($paymentDetails->status == PAYMENT_REDIRECT) {
$document = JFactory::getDocument();
$viewType = $document->getType();
$view = $this->getView("paymentoptions", $viewType, '', array('base_path' => $this->basePath, 'layout' => "redirect"));
$view->paymentProcessor = $processor;
$view->display("redirect");
} else {
if ($paymentDetails->status == PAYMENT_IFRAME) {
$document = JFactory::getDocument();
$viewType = $document->getType();
$view = $this->getView("paymentoptions", $viewType, '', array('base_path' => $this->basePath, 'layout' => "iframe"));
$view->paymentProcessor = $processor;
$view->display("iframe");
} else {
if ($paymentDetails->status == PAYMENT_SUCCESS) {
$reservationDetails = $confirmationModel->getReservation($confirmationId);
$confirmationModel->sendConfirmationEmail($reservationDetails);
UserDataService::initializeReservationData();
UserDataService::initializeExcursions();
$this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&task=confirmation.viewConfirmation&reservationId=' . $confirmationId, false));
} else {
if ($paymentDetails->status == PAYMENT_WAITING) {
$reservationDetails = $confirmationModel->getReservation($confirmationId);
$confirmationModel->sendConfirmationEmail($reservationDetails);
UserDataService::initializeReservationData();
UserDataService::initializeExcursions();
$this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&task=confirmation.viewConfirmation&reservationId=' . $confirmationId, false));
} else {
if ($paymentDetails->status == PAYMENT_ERROR) {
$app = JFactory::getApplication();
$app->enqueueMessage($paymentDetails->error_message, 'warning');
JRequest::setVar("view", "paymentoptions");
parent::display();
}
}
}
}
}
}
示例2: display
function display($tpl = null)
{
$this->hotels = $this->get("Hotels");
$this->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
if ($this->appSettings->is_enable_reservation == 0) {
JHotelUtil::getInstance()->showUnavailable();
}
//if a single hotel redirect to hotel description
if (count($this->hotels) == 1 && ENABLE_SINGLE_HOTEL == 1) {
$hotelLink = JHotelUtil::getHotelLink($this->hotels[0]);
$app = JFactory::getApplication();
$app->redirect($hotelLink);
}
JRequest::setVar('showFilter', 1);
$voucher = JRequest::getVar('voucher');
$this->voucher = $voucher;
$pagination = $this->get('Pagination');
$this->pagination = $pagination;
$orderBy = JRequest::getVar('orderBy');
$this->orderBy = $orderBy;
$session = JFactory::getSession();
$this->userData = $_SESSION['userData'];
//dmp($this->userData);
$this->searchFilter = $this->get('SearchFilter');
parent::display($tpl);
}
示例3: getDefaultCurrency
public static function getDefaultCurrency()
{
$instance = JHotelUtil::getInstance();
if (!isset($instance->applicationSettings)) {
$instance->applicationSettings = self::getApplicationSettings();
}
return $instance->applicationSettings;
}
示例4: countriesReport
function countriesReport()
{
$this->setReportsToolbar();
$this->itemsRoomTypes = $this->get('RoomTypes');
$this->initFilterParams();
$this->includeCharts();
$this->appSetings = JHotelUtil::getInstance()->getApplicationSettings();
$tpl = "countries";
return $tpl;
}
示例5: getReservationDetails
function getReservationDetails()
{
$userData = UserDataService::getUserData();
$reservationData = new stdClass();
$reservationData->userData = $userData;
$reservationData->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
$reservationData->hotel = HotelService::getHotel($userData->hotelId);
$reservationService = new ReservationService();
$reservationDetails = $reservationService->generateReservationSummary($reservationData);
UserDataService::setReservationDetails($reservationDetails);
$reservationDetails->reservationData = $reservationData;
return $reservationDetails;
}
示例6: display
/**
* Display the view
*/
public function display($tpl = null)
{
//$this->form = $this->get('Form');
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->rate = $this->get('Rate');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
parent::display($tpl);
$this->addToolbar();
}
示例7: addGuestDetails
function addGuestDetails()
{
$data = JRequest::get("post");
UserDataService::addGuestDetails($data);
$appSettings = JHotelUtil::getInstance()->getApplicationSettings();
if ($appSettings->save_all_guests_data) {
UserDataService::storeGuestDetails($data);
}
$reservedItems = JRequest::getVar("reservedItems");
$hotelId = JRequest::getVar("hotel_id");
if (!empty($reservedItems)) {
UserDataService::updateRooms($hotelId, $reservedItems);
/*echo "<pre>";
var_dump(UserDataService::updateRooms($hotelId, $reservedItems));
echo "</pre>";
die;*/
}
$this->setRedirect(JRoute::_('index.php?option=com_jhotelreservation&task=paymentoptions.showPaymentOptions', false));
}
示例8: getNearByHotels
function getNearByHotels($locationName, $searchParams, $hotels)
{
$location = JHotelUtil::getInstance()->getCoordinates($locationName);
if (empty($location)) {
return null;
}
$excludedIds = array();
foreach ($hotels as $hotel) {
$excludedIds[] = $hotel->hotel_id;
}
$searchParams["nearByHotels"] = 1;
$searchParams["latitude"] = $location["latitude"];
$searchParams["longitude"] = $location["longitude"];
$searchParams["distance"] = 100;
if (!empty($excludedIds)) {
$searchParams["excludedIds"] = implode(",", $excludedIds);
}
$hotelTable = $this->getTable('hotels');
$hotels = $hotelTable->getHotels($searchParams, 0, 5);
return $hotels;
}
示例9: editReservation
function editReservation()
{
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
$this->roomTypes = $this->get('RoomTypesOptions');
$this->guestTypes = JHotelReservationHelper::getGuestTypes();
$hotels = $this->get('Hotels');
$this->hotels = checkHotels(JFactory::getUser()->id, $hotels);
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$doc = JFactory::getDocument();
$doc->addScriptDeclaration('
var baseUrl="' . (JURI::base() . '/administrator/index.php?option=' . getBookingExtName()) . '";
');
$doc->addScript('administrator/components/' . getBookingExtName() . '/assets/js/reservation.js');
$tpl = 'editreservation';
return $tpl;
}
示例10: secretizeCard
function secretizeCard($reservationId)
{
$creditCard = JRequest::getVar("card_number");
if (isset($creditCard)) {
$creditCard = JHotelUtil::getInstance()->secretizeCreditCard($creditCard);
$table = $this->getTable("ConfirmationsPayments");
$table->secretizeCard($reservationId, $creditCard);
}
return true;
}
示例11:
<?php
//error_reporting(E_ALL);
//ini_set('display_errors','On');
$appSettings = JHotelUtil::getInstance()->getApplicationSettings();
?>
<div id="advanced-search" style="display:none">
<span title="Cancel" class="dialogCloseButton" onClick="revertValue();jQuery.unblockUI();">
<span title="Cancel" class="closeText">x</span>
</span>
<div class="mod_hotel_reservation" id="mod_hotel_reservation">
<form action="<?php
echo JRoute::_('index.php?option=com_jhotelreservation');
?>
" method="post" name="userModuleAdvancedForm" id="userModuleAdvancedForm" >
<input id="controller3" type='hidden' name='controller' value='hotels'/>
<input id="task3" type='hidden' name='task' value='searchHotels'/>
<input type="hidden" name="hotel_id" id="hotel_id3" value="" />
<input type='hidden' name='year_start' value=''/>
<input type='hidden' name='month_start' value=''/>
<input type='hidden' name='day_start' value=''/>
<input type='hidden' name='year_end' value=''/>
<input type='hidden' name='month_end' value=''/>
<input type='hidden' name='day_end' value=''/>
<input type='hidden' name='rooms' value='' />
<input type='hidden' name='guest_adult' value=''/>
<input type='hidden' name='guest_child' value=''/>
<input type='hidden' name='filterParams' id="filterParams" value='<?php
示例12: sendReservationFailureEmail
public static function sendReservationFailureEmail($reservation)
{
$appSettings = JHotelUtil::getInstance()->getApplicationSettings();
$mode = 1;
//html
$log = Logger::getInstance();
$log->LogDebug("Reservation failure " . serialize($reservation));
$email = JText::_('LNG_RESERVAION_FAILURE_EMAIL', true);
$email = str_replace("<<reservation_id>>", $reservation->confirmation_id, $email);
$email = str_replace("<<start_date>>", $reservation->start_date, $email);
$email = str_replace("<<end_date>>", $reservation->end_date, $email);
$email = str_replace("<<name>>", $reservation->last_name . ' ' . $reservation->first_name, $email);
$email_subject = JText::_('LNG_RESERVAION_FAILURE_EMAIL_SUBJECT', true);
$email_subject = str_replace("<<reservation_id>>", $reservation->confirmation_id, $email_subject);
return self::sendEmail($appSettings->company_email, $appSettings->company_name, null, $appSettings->company_email, null, null, $email_subject, $email, $mode);
}
示例13: defined
/**
* @copyright Copyright (C) 2008-2009 CMSJunkie. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
JHTML::_('stylesheet', 'modules/mod_jreservationinfo/assets/css/style.css');
require_once JPATH_SITE . '/administrator/components/com_jhotelreservation/helpers/defines.php';
require_once JPATH_SITE . '/administrator/components/com_jhotelreservation/helpers/utils.php';
// Include the syndicate functions only once
require_once dirname(__FILE__) . DS . 'helper.php';
$userData = UserDataService::getUserData();
$hotel = HotelService::getHotel($userData->hotelId);
$reservationData = new stdClass();
$reservationData->userData = $userData;
$reservationData->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
$reservationData->hotel = $hotel;
$reservationService = new ReservationService();
$reservationDetails = $reservationService->generateReservationSummary($reservationData);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
require JModuleHelper::getLayoutPath('mod_jreservationinfo', $params->get('layout', 'default'));
示例14: getPaymentDetails
public function getPaymentDetails($paymentDetails, $amount, $cost)
{
$result = "";
$app = JFactory::getApplication();
$isAdmin = $app->isAdmin();
ob_start();
?>
<br/><br/>
<TABLE>
<TR>
<TD align=left width=40% nowrap>
<b><?php
echo JText::_('LNG_PAYMENT_METHOD', true);
?>
: </b>
</TD>
<TD>
<?php
echo $this->name;
?>
</TD>
</TR>
<TR>
<TD align=left width=40% nowrap>
<b><?php
echo JText::_('LNG_NAME_OF_CARD', true);
?>
: </b>
</TD>
<TD>
<?php
echo $paymentDetails->card_name;
?>
</TD>
</TR>
<TR>
<TD align=left width=40% nowrap>
<b><?php
echo JText::_('LNG_CREDIT_CARD_NUMBER', true);
?>
:</b>
</TD>
<TD>
<input type="hidden" name="card_number" value="<?php
echo $paymentDetails->card_number;
?>
">
<?php
echo $isAdmin ? $paymentDetails->card_number : JHotelUtil::getInstance()->secretizeCreditCard($paymentDetails->card_number);
?>
</TD>
</TR>
<TR>
<TD align=left width=40% nowrap>
<b><?php
echo JText::_('LNG_EXPIRATION_DATE', true);
?>
:</b>
</TD>
<TD>
<?php
echo $paymentDetails->card_expiration_month . " - " . $paymentDetails->card_expiration_year;
?>
</TD>
</TR>
<TR>
<TD align=left width=40% nowrap>
<b><?php
echo JText::_('LNG_SECURITY_CODE', true);
?>
:</b>
</TD>
<TD>
<?php
echo $paymentDetails->card_security_code;
?>
</TD>
</TR>
<?php
if ($isAdmin) {
?>
<TR>
<TD align=left width=40% nowrap>
</TD>
<TD>
<button type="button" onClick="jQuery('#task').val('reservation.secretizeCard');jQuery('#adminForm').submit()">Secretize</button>
</TD>
</TR>
<?php
}
?>
</TABLE>
<br/><br/>
<?php
$result = $result . ob_get_contents();
//.........这里部分代码省略.........
示例15: getReservation
function getReservation($reservationId = null, $hotelId = null, $checkAvailability = true)
{
if (!isset($reservationId)) {
$reservationId = JRequest::getInt("reservationId");
}
$confirmationTable = JTable::getInstance('Confirmations', 'Table', array());
$reservation = $confirmationTable->getReservationData($reservationId);
if (!$reservationId) {
$reservation = UserDataService::createUserData(array());
$reservation->hotelId = $hotelId;
} else {
$reservation->reservedItems = explode(",", $reservation->items_reserved);
$reservation->extraOptionIds = explode(",", $reservation->extraOptionIds);
$reservation->hotelId = $reservation->hotel_id;
$reservation->guestDetails = $this->prepareGuestDetails($reservation->guestDetails);
$reservation->roomGuests = explode(",", $reservation->total_adults);
$reservation->total_adults = 0;
if (isset($reservation->roomGuests) && count($reservation->roomGuests) >= 1) {
foreach ($reservation->roomGuests as $guestPerRoom) {
$values = explode("|", $guestPerRoom);
$reservation->total_adults += $values[0];
}
}
$reservation->roomGuestsChildren = explode(",", $reservation->children);
$reservation->total_children = 0;
if (isset($reservation->roomGuestsChildren) && count($reservation->roomGuestsChildren) >= 1) {
foreach ($reservation->roomGuestsChildren as $guestPerRoom) {
$values = explode("|", $guestPerRoom);
$reservation->total_children += $values[0];
}
}
}
//dmp($reservation->total_adults);
//dmp($reservation->roomGuests);
//dmp($reservation);
if (!isset($reservation->totalPaid)) {
$reservation->totalPaid = 0;
}
$hotel = HotelService::getHotel($reservation->hotelId);
$reservation->currency = HotelService::getHotelCurrency($hotel);
$reservationData = new stdClass();
$reservationData->userData = $reservation;
$reservationData->appSettings = JHotelUtil::getInstance()->getApplicationSettings();
$reservationData->hotel = $hotel;
$extraOptionIds = isset($reservationData->userData->extraOptionIds) ? $reservationData->userData->extraOptionIds : null;
$extraOptions = array();
if (is_array($extraOptionIds) && count($extraOptionIds) > 0) {
foreach ($extraOptionIds as $key => $value) {
if (strlen($value) > 1) {
$extraOption = explode("|", $value);
$extraOptions[$key] = $extraOption;
}
}
}
//dmp($_SESSION["extras"]);
$reservationData->extraOptions = ExtraOptionsService::getHotelExtraOptions($reservationData->userData->hotelId, $reservationData->userData->start_date, $reservationData->userData->end_date, $_SESSION["extras"], 0, 0, false);
$reservationDetails = new stdClass();
if ($reservationId) {
$reservationDetails = $this->generateReservationSummary($reservationData, $checkAvailability);
}
$reservationDetails->reservationData = $reservationData;
$reservationDetails->billingInformation = $this->getBillingInformation($reservationData->userData, $reservationData->appSettings->hide_user_email);
$reservationDetails->confirmation_id = $reservation->confirmation_id;
$paymentDetails = PaymentService::getConfirmationPaymentDetails($reservation->confirmation_id);
if (isset($paymentDetails) && $paymentDetails->confirmation_id != 0) {
$reservationDetails->paymentInformation = $this->getPaymentInformation($paymentDetails, $reservationDetails->total, $reservationDetails->cost);
}
//dmp($reservationDetails);
return $reservationDetails;
}