PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.6.5
VikBooking Hotel Booking Engine & PMS v1.6.5
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
vikbooking / site / views / signature / view.html.php

view.html.php in VikBooking Hotel Booking Engine & PMS 1.6.5, at site/views/signature/view.html.php

91 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 VikbookingViewSignature extends JViewVikBooking
16 {
17 public function display($tpl = null)
18 {
19 //set noindex instruction for robots
20 $document = JFactory::getDocument();
21 $document->setMetaData('robots', 'noindex,follow');
22
23 $sid = VikRequest::getString('sid', '', 'request');
24 $ts = VikRequest::getString('ts', '', 'request');
25
26 $dbo = JFactory::getDbo();
27 $mainframe = JFactory::getApplication();
28 $vbo_tn = VikBooking::getTranslator();
29
30 $q = "SELECT * FROM `#__vikbooking_orders` WHERE `ts`=" . $dbo->quote($ts) . " AND (`sid`=" . $dbo->quote($sid) . " OR `idorderota`=" . $dbo->quote($sid) . ") AND `status`='confirmed';";
31 $dbo->setQuery($q);
32 $row = $dbo->loadAssoc();
33 if (!$row) {
34 VikError::raiseWarning('', 'Booking not found');
35 $mainframe->redirect('index.php');
36 exit;
37 }
38
39 $tonight = mktime(23, 59, 59, date('n'), date('j'), date('Y'));
40 if ($tonight > $row['checkout']) {
41 VikError::raiseWarning('', 'Check-out date is in the past');
42 $mainframe->redirect('index.php');
43 exit;
44 }
45
46 $q = "SELECT `c`.*,`co`.`idorder`,`co`.`signature`,`co`.`pax_data`,`co`.`comments` FROM `#__vikbooking_customers` AS `c` LEFT JOIN `#__vikbooking_customers_orders` `co` ON `c`.`id`=`co`.`idcustomer` WHERE `co`.`idorder`=".(int)$row['id'].";";
47 $dbo->setQuery($q);
48 $customer = $dbo->loadAssoc();
49 if (!$customer) {
50 VikError::raiseWarning('', 'Customer not found');
51 $mainframe->redirect('index.php');
52 exit;
53 }
54
55 $orderrooms = array();
56 $q = "SELECT `or`.`idroom`,`or`.`adults`,`or`.`children`,`or`.`idtar`,`or`.`optionals`,`or`.`roomindex`,`or`.`pkg_id`,`or`.`pkg_name`,`or`.`cust_cost`,`or`.`cust_idiva`,`or`.`extracosts`,`or`.`room_cost`,`r`.`id` AS `r_reference_id`,`r`.`name`,`r`.`img`,`r`.`idcarat`,`r`.`fromadult`,`r`.`toadult` FROM `#__vikbooking_ordersrooms` AS `or`,`#__vikbooking_rooms` AS `r` WHERE `or`.`idorder`=".(int)$row['id']." AND `or`.`idroom`=`r`.`id` ORDER BY `or`.`id` ASC;";
57 $dbo->setQuery($q);
58 $orderrooms = $dbo->loadAssocList();
59 if (!$orderrooms) {
60 VikError::raiseWarning('', 'No rooms found');
61 $mainframe->redirect('index.php');
62 exit;
63 }
64
65 $vbo_tn->translateContents($orderrooms, '#__vikbooking_rooms', array('id' => 'r_reference_id'));
66
67 // load assets
68 if (VikBooking::loadJquery()) {
69 JHtml::fetch('jquery.framework', true, true);
70 }
71 $document->addScript(VBO_SITE_URI.'resources/signature_pad.js');
72 $document->addStyleSheet(VBO_ADMIN_URI.'resources/fonts/vboicomoon.css');
73
74 $this->ord = $row;
75 $this->orderrooms = $orderrooms;
76 $this->customer = $customer;
77 $this->vbo_tn = $vbo_tn;
78
79 // theme
80 $theme = VikBooking::getTheme();
81 if ($theme != 'default') {
82 $thdir = VBO_SITE_PATH . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'signature';
83 if (is_dir($thdir)) {
84 $this->_setPath('template', $thdir . DIRECTORY_SEPARATOR);
85 }
86 }
87
88 parent::display($tpl);
89 }
90 }
91