PluginProbe
VikBooking Hotel Booking Engine & PMS / trunk
VikBooking Hotel Booking Engine & PMS vtrunk
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 1.7.3 All 36 releases
vikbooking / admin / views / gencheckindoc / view.html.php

view.html.php in VikBooking Hotel Booking Engine & PMS trunk, at admin/views/gencheckindoc/view.html.php

72 lines 2.7 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 // import Joomla view library
14 jimport('joomla.application.component.view');
15
16 class VikBookingViewGencheckindoc extends JViewVikBooking {
17
18 function display($tpl = null) {
19 // This view is usually called within a modal box, so it does not require the toolbar or page title
20
21 /**
22 * @wponly - if we fall here because of a redirect after the generation of the check-in doc, and we are not doing Ajax,
23 * we need to print a button in the toolbar to go back to the booking details page.
24 */
25 $ptmpl = VikRequest::getString('tmpl', '', 'request');
26 if (empty($ptmpl) && !wp_doing_ajax()) {
27 JToolBarHelper::cancel( 'editorder', JText::translate('VBBACK'));
28 JToolBarHelper::spacer();
29 }
30 //
31
32 $cid = VikRequest::getVar('cid', array(0));
33 $id = $cid[0];
34
35 $dbo = JFactory::getDBO();
36 $mainframe = JFactory::getApplication();
37 $ptmpl = VikRequest::getString('tmpl', '', 'request');
38 $q = "SELECT * FROM `#__vikbooking_orders` WHERE `id`=".(int)$id." AND `status`='confirmed' AND `checked` > 0;";
39 $dbo->setQuery($q);
40 $dbo->execute();
41 if ($dbo->getNumRows() < 1) {
42 $mainframe->redirect('index.php');
43 exit;
44 }
45 $row = $dbo->loadAssoc();
46 $customer = array();
47 $q = "SELECT `c`.*,`co`.`idorder`,`co`.`signature`,`co`.`pax_data`,`co`.`comments`,`co`.`checkindoc` FROM `#__vikbooking_customers` AS `c` LEFT JOIN `#__vikbooking_customers_orders` `co` ON `c`.`id`=`co`.`idcustomer` WHERE `co`.`idorder`=".$row['id'].";";
48 $dbo->setQuery($q);
49 $dbo->execute();
50 if ($dbo->getNumRows() > 0) {
51 $customer = $dbo->loadAssoc();
52 if (!empty($customer['country'])) {
53 if (file_exists(VBO_ADMIN_PATH.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'countries'.DIRECTORY_SEPARATOR.$customer['country'].'.png')) {
54 $customer['country_img'] = '<img src="'.VBO_ADMIN_URI.'resources/countries/'.$customer['country'].'.png'.'" title="'.$customer['country'].'" class="vbo-country-flag vbo-country-flag-left"/>';
55 }
56 }
57 }
58 if (!(count($customer) > 0)) {
59 VikError::raiseWarning('', JText::translate('VBOCHECKINERRNOCUSTOMER'));
60 $mainframe->redirect('index.php?option=com_vikbooking&task=newcustomer&checkin=1&bid='.$row['id'].($ptmpl == 'component' ? '&tmpl=component' : ''));
61 exit;
62 }
63
64 $this->row = $row;
65 $this->customer = $customer;
66
67 // Display the template
68 parent::display($tpl);
69 }
70
71 }
72