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 / quote / view.html.php

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

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