PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.9
VikBooking Hotel Booking Engine & PMS v1.8.9
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 / quote / view.html.php

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

75 lines 2.0 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 E4J srl
6 * @copyright Copyright (C) 2026 E4J srl. 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 VikbookingViewQuote extends JViewVikBooking
16 {
17 public function display($tpl = null)
18 {
19 $app = JFactory::getApplication();
20
21 // set noindex instruction for robots
22 JFactory::getDocument()->setMetaData('robots', 'noindex, nofollow');
23
24 // get quote reference value
25 $ref = $app->input->getString('ref', '');
26
27 // access quote model
28 $quoteModel = VBOMvcModel::getInstance('quote');
29
30 // load requested quote and related booking solutions
31 $quoteData = null;
32 if ($ref) {
33 // load quote data
34 $quoteData = $quoteModel->loadBookingRecords(0, 0, [
35 'filters' => [
36 'uuid' => $ref,
37 ],
38 ])[0] ?? null;
39 }
40
41 // detect quote "viewed" status
42 if (!empty($quoteData->ip) && $app->input->server->get('REMOTE_ADDR') != $quoteData->ip) {
43 // silently update quote record for internal purposes
44 $quoteModel->save([
45 'id' => $quoteData->id,
46 'viewed' => 1,
47 ]);
48 }
49
50 // load the details for the involved rooms
51 $roomsData = [];
52 if ($quoteData) {
53 // collect a unique list of room IDs involved
54 $involvedRoomIds = [];
55 foreach ($quoteData->solutions as $solution) {
56 $involvedRoomIds = array_merge($involvedRoomIds, array_column($solution->rooms, 'id'));
57 }
58 $involvedRoomIds = array_values(array_unique($involvedRoomIds));
59 // map the information
60 $roomsData = array_map(function($roomId) {
61 return VikBooking::getRoomInfo($roomId, [], true);
62 }, $involvedRoomIds);
63 // turn the list into associative
64 $roomsData = array_combine(array_column($roomsData, 'id'), array_values($roomsData));
65 }
66
67 // set template properties
68 $this->quoteData = $quoteData;
69 $this->roomsData = $roomsData;
70
71 // display template
72 parent::display($tpl);
73 }
74 }
75