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 / site / views / orderslist / view.html.php

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

79 lines 2.9 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 VikbookingViewOrderslist extends JViewVikBooking
16 {
17 public function display($tpl = null)
18 {
19 VikBooking::prepareViewContent();
20
21 $app = JFactory::getApplication();
22 $dbo = JFactory::getDbo();
23
24 $islogged = VikBooking::userIsLogged();
25 $cpin = VikBooking::getCPinInstance();
26
27 $pconfirmnumber = VikRequest::getString('confirmnumber', '', 'request');
28 $pitemid = VikRequest::getInt('Itemid', 0, 'request');
29
30 if (!empty($pconfirmnumber)) {
31 $q = "SELECT `id`,`ts`,`sid`,`idorderota` FROM `#__vikbooking_orders` WHERE `confirmnumber`=" . $dbo->quote($pconfirmnumber) . " OR `idorderota`=" . $dbo->quote($pconfirmnumber) . ";";
32 $dbo->setQuery($q);
33 $odata = $dbo->loadAssocList();
34 if ($odata) {
35 $app->redirect(JRoute::rewrite('index.php?option=com_vikbooking&view=booking&sid='.(!empty($odata[0]['sid']) ? $odata[0]['sid'] : $odata[0]['idorderota']).'&ts='.$odata[0]['ts'].(!empty($pitemid) ? '&Itemid='.$pitemid : ''), false));
36 $app->close();
37 }
38 if ($cpin->pinExists($pconfirmnumber)) {
39 $cpin->setNewPin($pconfirmnumber);
40 } else {
41 VikError::raiseWarning('', JText::translate('VBINVALIDCONFIRMNUMBER'));
42 }
43 }
44
45 $customer_details = $cpin->loadCustomerDetails();
46 $userorders = [];
47 $navig = '';
48 if ($islogged || $customer_details) {
49 $currentUser = JFactory::getUser();
50 $lim = 10;
51 $lim0 = VikRequest::getVar('limitstart', 0, '', 'int');
52 $q = "SELECT SQL_CALC_FOUND_ROWS `o`.*,`co`.`idcustomer` FROM `#__vikbooking_orders` AS `o` LEFT JOIN `#__vikbooking_customers_orders` `co` ON `co`.`idorder`=`o`.`id` WHERE ".($islogged ? "`o`.`ujid`='".$currentUser->id."'".(count($customer_details) > 0 ? " OR " : "") : "").(count($customer_details) > 0 ? "`co`.`idcustomer`=".(int)$customer_details['id'] : "")." ORDER BY `o`.`checkin` DESC";
53 $dbo->setQuery($q, $lim0, $lim);
54 $userorders = $dbo->loadAssocList();
55 if ($userorders) {
56 $dbo->setQuery('SELECT FOUND_ROWS();');
57 jimport('joomla.html.pagination');
58 $pageNav = new JPagination( $dbo->loadResult(), $lim0, $lim );
59 $navig = $pageNav->getPagesLinks();
60 }
61 }
62
63 $this->userorders = $userorders;
64 $this->customer_details = $customer_details;
65 $this->navig = $navig;
66
67 //theme
68 $theme = VikBooking::getTheme();
69 if ($theme != 'default') {
70 $thdir = VBO_SITE_PATH . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'orderslist';
71 if (is_dir($thdir)) {
72 $this->_setPath('template', $thdir . DIRECTORY_SEPARATOR);
73 }
74 }
75 //
76 parent::display($tpl);
77 }
78 }
79