PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.6.8
VikBooking Hotel Booking Engine & PMS v1.6.8
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 / helpers / checkins / checkin_tmpl.php

checkin_tmpl.php in VikBooking Hotel Booking Engine & PMS 1.6.8, at site/helpers/checkins/checkin_tmpl.php

303 lines 12.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('_JEXEC') or defined('ABSPATH') or die('No script kiddies please!');
12
13 defined('_VIKBOOKINGEXEC') OR die('Restricted Area');
14
15 /**
16 * This is the Template used for generating the Customer Check-in Document
17 * List of available special-tags that can be used in this template:
18 *
19 * {company_name}
20 * {company_logo}
21 * {company_info}
22 * {checkin_date}
23 * {checkout_date}
24 * {num_nights}
25 * {tot_guests}
26 * {tot_adults}
27 * {tot_children}
28 * {checkin_comments}
29 * {terms_and_conditions}
30 *
31 * The record of the booking can be accessed from the following global array in case you need any extra special tag or to perform queries for a deeper customization level:
32 * $booking_info (booking array)
33 * $booking_rooms (booked rooms array)
34 * Example: the ID of the booking is contained in $booking_info['id'] - you can display that value within PHP tags with "echo $booking_info['id']" - or see the whole array content with the code "print_r($booking_info)"
35 *
36 * It is also possible to access the customer information array by using the variable $customer.
37 * Debug the content of the array with the code "print_r($customer)" by placing it on any part of the PDF content below.
38 */
39
40 //Custom Check-in Document PDF Template Parameters - Start
41 define('VBO_CHECKIN_PDF_PAGE_ORIENTATION', 'P'); //define a constant - P=portrait, L=landscape (P by default or if not specified)
42 define('VBO_CHECKIN_PDF_UNIT', 'mm'); //define a constant - [pt=point, mm=millimeter, cm=centimeter, in=inch] (mm by default or if not specified)
43 define('VBO_CHECKIN_PDF_PAGE_FORMAT', 'A4'); //define a constant - A4 by default or if not specified. Could be also a custom array of width and height but constants arrays are only supported in PHP7
44 define('VBO_CHECKIN_PDF_MARGIN_LEFT', 10); //define a constant - 15 by default or if not specified
45 define('VBO_CHECKIN_PDF_MARGIN_TOP', 10); //define a constant - 27 by default or if not specified
46 define('VBO_CHECKIN_PDF_MARGIN_RIGHT', 10); //define a constant - 15 by default or if not specified
47 define('VBO_CHECKIN_PDF_MARGIN_HEADER', 1); //define a constant - 5 by default or if not specified
48 define('VBO_CHECKIN_PDF_MARGIN_FOOTER', 5); //define a constant - 10 by default or if not specified
49 define('VBO_CHECKIN_PDF_MARGIN_BOTTOM', 5); //define a constant - 25 by default or if not specified
50 define('VBO_CHECKIN_PDF_IMAGE_SCALE_RATIO', 1.25); //define a constant - ratio used to adjust the conversion of pixels to user units (1.25 by default or if not specified)
51 $checkin_params = array(
52 'show_header' => 0, //0 = false (do not show the header) - 1 = true (show the header)
53 'header_data' => array(), //if empty array, no header will be displayed. The array structure is: array(logo_in_tcpdf_folder, logo_width_mm, title, text, rgb-text_color, rgb-line_color). Example: array('logo.png', 30, 'Hotel xy', 'Versilia Coast, xyz street', array(0,0,0), array(0,0,0))
54 'show_footer' => 0, //0 = false (do not show the footer) - 1 = true (show the footer)
55 'pdf_page_orientation' => 'VBO_CHECKIN_PDF_PAGE_ORIENTATION', //must be a constant - P=portrait, L=landscape (P by default)
56 'pdf_unit' => 'VBO_CHECKIN_PDF_UNIT', //must be a constant - [pt=point, mm=millimeter, cm=centimeter, in=inch] (mm by default)
57 'pdf_page_format' => 'VBO_CHECKIN_PDF_PAGE_FORMAT', //must be a constant defined above or an array of custom values like: 'pdf_page_format' => array(400, 300)
58 'pdf_margin_left' => 'VBO_CHECKIN_PDF_MARGIN_LEFT', //must be a constant - 15 by default
59 'pdf_margin_top' => 'VBO_CHECKIN_PDF_MARGIN_TOP', //must be a constant - 27 by default
60 'pdf_margin_right' => 'VBO_CHECKIN_PDF_MARGIN_RIGHT', //must be a constant - 15 by default
61 'pdf_margin_header' => 'VBO_CHECKIN_PDF_MARGIN_HEADER', //must be a constant - 5 by default
62 'pdf_margin_footer' => 'VBO_CHECKIN_PDF_MARGIN_FOOTER', //must be a constant - 10 by default
63 'pdf_margin_bottom' => 'VBO_CHECKIN_PDF_MARGIN_BOTTOM', //must be a constant - 25 by default
64 'pdf_image_scale_ratio' => 'VBO_CHECKIN_PDF_IMAGE_SCALE_RATIO', //must be a constant - ratio used to adjust the conversion of pixels to user units (1.25 by default)
65 'header_font_size' => '8', //must be a number
66 'body_font_size' => '8', //must be a number
67 'footer_font_size' => '6' //must be a number
68 );
69 $nowdf = VikBooking::getDateFormat();
70 if ($nowdf == "%d/%m/%Y") {
71 $df = 'd/m/Y';
72 } elseif ($nowdf == "%m/%d/%Y") {
73 $df = 'm/d/Y';
74 } else {
75 $df = 'Y/m/d';
76 }
77 $datesep = VikBooking::getDateSeparator();
78 $all_countries = VikBooking::getCountriesArray();
79 defined('_VIKBOOKING_CHECKIN_PARAMS') OR define('_VIKBOOKING_CHECKIN_PARAMS', '1');
80 //Custom Check-in Document PDF Template Parameters - End
81 ?>
82
83 <div style="display: inline-block; width: 100%;">
84
85 <?php
86 //Company Name, Logo and Details + Document Title - Start
87 ?>
88 <h3 style="text-align: center; color: #444;">{company_name}</h3>
89 <table width="100%" border="0" cellspacing="0" cellpadding="0">
90 <tr>
91 <td width="50%" align="left" valign="top">{company_info}</td>
92 <td width="50%" align="right" valign="top">{company_logo}</td>
93 </tr>
94 </table>
95 <br/>
96 <h4 style="text-align: center;"><?php echo JText::translate('VBOCHECKINDOCTITLE'); ?></h4>
97 <p> </p>
98 <?php
99 //Company Name, Logo and Details + Document Title - End
100
101 //Customer Name + Check-in/Check-out Dates - Start
102 ?>
103 <table width="100%" align="center" border="0" cellspacing="1" cellpadding="2" border="1" style="border: 1px solid #363636;">
104 <tr>
105 <td align="center" valign="top"><strong><?php echo JText::translate('VBCUSTOMERFIRSTNAME'); ?></strong></td>
106 <td align="center" valign="top"><strong><?php echo JText::translate('VBCUSTOMERLASTNAME'); ?></strong></td>
107 <td align="center" valign="top"><strong><?php echo JText::translate('VBOCHECKINDOCARRVDT'); ?></strong></td>
108 <td align="center" valign="top"><strong><?php echo JText::translate('VBOCHECKINDOCDEPADT'); ?></strong></td>
109 </tr>
110 <tr>
111 <td align="center"><?php echo count($customer) ? $customer['first_name'] : ''; ?></td>
112 <td align="center"><?php echo count($customer) ? $customer['last_name'] : ''; ?></td>
113 <td align="center">{checkin_date}</td>
114 <td align="center">{checkout_date}</td>
115 </tr>
116 </table>
117 <p> </p>
118 <?php
119 //Customer Name + Check-in/Check-out Dates - End
120
121 //Rooms information and Guests Details - Start
122 foreach ($booking_rooms as $k => $room) {
123 //Room Specific Unit
124 $spec_unit = '';
125 if (!empty($room['params'])) {
126 $room_params = json_decode($room['params'], true);
127 $arr_features = array();
128 if (is_array($room_params) && array_key_exists('features', $room_params) && @count($room_params['features']) > 0) {
129 foreach ($room_params['features'] as $rind => $rfeatures) {
130 foreach ($rfeatures as $fname => $fval) {
131 if (strlen($fval)) {
132 $arr_features[$rind] = '#'.$rind.' - '.JText::translate($fname).': '.$fval;
133 break;
134 }
135 }
136 }
137 }
138 if (isset($arr_features[$room['roomindex']])) {
139 $spec_unit = $arr_features[$room['roomindex']];
140 }
141 }
142 //
143 ?>
144 <table width="100%" border="0" cellspacing="1" cellpadding="2" style="border: 1px solid #000000;">
145 <tr>
146 <td align="left" valign="top" style="border-right: 1px solid #000000;"><strong><?php echo $room['room_name']; ?></strong></td>
147 <td align="center" valign="top" style="border-right: 1px solid #000000;"><strong><?php echo JText::translate('VBEDITORDERADULTS'); ?></strong></td>
148 <td align="center" valign="top"><strong><?php echo JText::translate('VBEDITORDERCHILDREN'); ?></strong></td>
149 </tr>
150 <tr>
151 <td align="left" style="border-bottom: 1px solid #000000; border-right: 1px solid #000000;"><?php echo $spec_unit; ?></td>
152 <td align="center" style="border-bottom: 1px solid #000000; border-right: 1px solid #000000;"><?php echo $room['adults']; ?></td>
153 <td align="center" style="border-bottom: 1px solid #000000;"><?php echo $room['children']; ?></td>
154 </tr>
155 <?php
156 if (count($customer) && isset($customer['pax_data'][$k]) && count($customer['pax_data'][$k]) > 0) {
157 ?>
158 <tr>
159 <td align="left" valign="top" style="border-right: 1px solid #000000;"><strong><?php echo JText::translate('VBOGUESTSDETAILS'); ?></strong></td>
160 <td align="center" valign="top" style="border-right: 1px solid #000000;"><strong><?php echo JText::translate('VBCUSTOMERFIRSTNAME'); ?></strong></td>
161 <td align="center" valign="top"><strong><?php echo JText::translate('VBCUSTOMERLASTNAME'); ?></strong></td>
162 </tr>
163 <tr>
164 <td style="border-right: 1px solid #000000;"> </td>
165 <td align="center" valign="top" style="border-right: 1px solid #000000;">
166 <?php
167 foreach ($customer['pax_data'][$k] as $guest_num => $guest) {
168 //by default we display the first and last name of each guest (other fields available are: 'country', 'docnum', 'extranotes')
169 //in this cell we display the first name of each guest, one per line
170 ?>
171 <span><?php echo $guest['first_name']; ?></span>
172 <?php
173 if ($guest_num < $room['adults']) {
174 echo '<br/>';
175 }
176 }
177 ?>
178 </td>
179 <td align="center" valign="top">
180 <?php
181 foreach ($customer['pax_data'][$k] as $guest_num => $guest) {
182 //by default we display the first and last name of each guest (other fields available are: 'country', 'docnum', 'extranotes')
183 //in this cell we display the last name of each guest, one per line
184 ?>
185 <span><?php echo $guest['last_name']; ?></span>
186 <?php
187 if ($guest_num < $room['adults']) {
188 echo '<br/>';
189 }
190 }
191 ?>
192 </td>
193 </tr>
194 <?php
195 }
196 ?>
197 </table>
198 <?php
199 }
200 //Rooms information and Guests Details - End
201
202 //Customer Billing Information - Start
203 $customer_details = array(
204 'company' => JText::translate('VBCUSTOMERCOMPANY'),
205 'vat' => JText::translate('VBCUSTOMERCOMPANYVAT'),
206 'email' => JText::translate('VBCUSTOMEREMAIL'),
207 'phone' => JText::translate('VBCUSTOMERPHONE'),
208 'address' => JText::translate('VBCUSTOMERADDRESS'),
209 'city' => JText::translate('VBCUSTOMERCITY'),
210 'zip' => JText::translate('VBCUSTOMERZIP'),
211 'country' => JText::translate('VBCUSTOMERCOUNTRY'),
212 'doctype' => JText::translate('VBCUSTOMERDOCTYPE'),
213 'docnum' => JText::translate('VBCUSTOMERDOCNUM')
214 );
215 //display 3 details per row
216 $details_per_row = 3;
217 $details_counter = 0;
218 $rows_written = 0;
219 ?>
220
221 <p> </p>
222
223 <?php
224 if (count($customer)) {
225 ?>
226 <table width="100%" align="center" border="0" cellspacing="1" cellpadding="3" border="1" rules="rows">
227 <tr>
228 <?php
229 foreach ($customer_details as $key => $field) {
230 if (!isset($customer[$key]) || empty($customer[$key])) {
231 continue;
232 }
233 $details_counter++;
234 $current_value = $customer[$key];
235 if ($key == 'country') {
236 //display the full country name, rather than the 3-chars-code version of the country
237 $current_value = isset($all_countries[$customer[$key]]) ? $all_countries[$customer[$key]]['country_name'] : $current_value;
238 }
239 ?>
240 <td align="center" valign="top">
241 <strong><?php echo $field; ?></strong>
242 <br/>
243 <span><?php echo $current_value; ?></span>
244 </td>
245 <?php
246 if ((($rows_written * $details_per_row) + $details_counter) < count($customer_details) && $details_counter >= $details_per_row) {
247 $details_counter = 0;
248 $rows_written++;
249 echo '</tr><tr>';
250 }
251 }
252 // this syntax with the comparison operators is compatible with DOMDocument
253 if (!($details_counter > $details_per_row)) {
254 for ($i = $details_per_row; $i > $details_per_row; $i--) {
255 echo '<td align="center" valign="top"> </td>';
256 }
257 }
258 ?>
259 </tr>
260 </table>
261 <?php
262 }
263 ?>
264
265 <p> </p>
266
267 <?php
268 //Customer Billing Information - End
269
270 //Terms and Conditions Text - Start
271 ?>
272 <p>{terms_and_conditions}</p>
273 <?php
274 //Terms and Conditions Text - End
275
276 //Customer Signature + Date - Start
277 ?>
278 <div style="display: inline-block; width: 100%;">
279 <table width="100%" border="0" cellspacing="1" cellpadding="1">
280 <tr>
281 <td align="left" valign="top"><strong><?php echo JText::translate('VBOCHECKINDOCTODAYDT'); ?></strong></td>
282 <td align="center" valign="top"><strong><?php echo JText::translate('VBOCHECKINDOCGUESTSIGN'); ?></strong></td>
283 </tr>
284 <tr>
285 <td align="left" valign="top"><?php echo date(str_replace("/", $datesep, $df)); ?></td>
286 <td align="center" style="border-bottom: 1px solid #363636;">
287 <?php
288 // this syntax is compatible with DOMDocument
289 if (!empty($customer['signature']) && is_file(VBO_ADMIN_PATH.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'idscans'.DIRECTORY_SEPARATOR.$customer['signature'])) {
290 $sign_source = VBO_ADMIN_URI . 'resources/idscans/' . $customer['signature'] . '?' . time();
291 echo '<img src="' . $sign_source . '" />';
292 }
293 ?>
294 </td>
295 </tr>
296 </table>
297 </div>
298 <?php
299 //Customer Signature + Date - End
300 ?>
301 <p><br/></p>
302 </div>
303