| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikBooking |
| 4 |
* @subpackage com_vikbooking |
| 5 |
* @author Alessio Gaggii - e4j - Extensionsforjoomla.com |
| 6 |
* @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved. |
| 7 |
* @license GNU General Public License version 2 or later; see LICENSE |
| 8 |
* @link https://vikwp.com |
| 9 |
*/ |
| 10 |
|
| 11 |
defined('ABSPATH') or die('No script kiddies please!'); |
| 12 |
|
| 13 |
jimport('joomla.application.component.view'); |
| 14 |
|
| 15 |
class VikbookingViewRevstay extends JViewVikBooking |
| 16 |
{ |
| 17 |
function display($tpl = null) |
| 18 |
{ |
| 19 |
$dbo = JFactory::getDbo(); |
| 20 |
$mainframe = JFactory::getApplication(); |
| 21 |
$vbo_tn = VikBooking::getTranslator(); |
| 22 |
|
| 23 |
// data validation |
| 24 |
$sid = VikRequest::getString('sid', '', 'request'); |
| 25 |
$ts = VikRequest::getString('ts', '', 'request'); |
| 26 |
if (empty($sid) || empty($ts)) { |
| 27 |
showSelectVb(JText::translate('VBINSUFDATA')); |
| 28 |
return; |
| 29 |
} |
| 30 |
|
| 31 |
// find booking details |
| 32 |
$q = "SELECT `o`.* FROM `#__vikbooking_orders` AS `o` WHERE (`o`.`sid`=" . $dbo->quote($sid) . " OR `o`.`idorderota`=" . $dbo->quote($sid) . ") AND `o`.`ts`=" . $dbo->quote($ts) . " AND `o`.`status`='confirmed';"; |
| 33 |
$dbo->setQuery($q); |
| 34 |
$dbo->execute(); |
| 35 |
if (!$dbo->getNumRows()) { |
| 36 |
showSelectVb(JText::translate('VBORDERNOTFOUND')); |
| 37 |
return; |
| 38 |
} |
| 39 |
$order = $dbo->loadAssoc(); |
| 40 |
|
| 41 |
// make sure a review can be left for this booking |
| 42 |
if (!VikBooking::canBookingBeReviewed($order)) { |
| 43 |
throw new Exception('Cannot leave a review at this time', 403); |
| 44 |
} |
| 45 |
|
| 46 |
// get customer information |
| 47 |
$customer = VikBooking::getCPinIstance()->getCustomerFromBooking($order['id']); |
| 48 |
|
| 49 |
// review services |
| 50 |
$grev_services = VikBooking::guestReviewsServices(); |
| 51 |
$vbo_tn->translateContents($grev_services, '#__vikbooking_greview_service'); |
| 52 |
|
| 53 |
$this->order = $order; |
| 54 |
$this->customer = $customer; |
| 55 |
$this->grev_services = $grev_services; |
| 56 |
$this->vbo_tn = $vbo_tn; |
| 57 |
|
| 58 |
parent::display($tpl); |
| 59 |
} |
| 60 |
} |
| 61 |
|