PluginProbe
Yatra – Travel Booking & Tour Operator Software / trunk
Yatra – Travel Booking & Tour Operator Software vtrunk
3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 2.0.10 All 83 releases
yatra / templates / pdf / consent.php

consent.php in Yatra – Travel Booking & Tour Operator Software trunk, at templates/pdf/consent.php

241 lines 7.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Template: Signed Consent PDF
4 *
5 * Variables available:
6 * @var string $site_name
7 * @var object $consent
8 * @var string $form_name
9 * @var array $form_data
10 * @var string $signed_at
11 * @var string $ip_address
12 * @var string $user_agent
13 * @var string|null $signature_data
14 * @var string|null $initials_data
15 */
16
17 $safe = static function (?string $value): string {
18 return esc_html($value ?? '');
19 };
20
21 $formatDate = static function (?string $date): string {
22 if (!$date) {
23 return '';
24 }
25 return esc_html(date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($date)));
26 };
27 ?>
28 <!DOCTYPE html>
29 <html lang="en">
30 <head>
31 <meta charset="UTF-8">
32 <title><?php echo $safe($form_name); ?> - <?php echo $safe($site_name); ?></title>
33 <style>
34 @page {
35 margin: 22mm 13mm;
36 }
37 body {
38 font-family: 'Noto Sans Devanagari', 'Noto Sans Arabic', 'Noto Sans CJK', 'DejaVu Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
39 font-size: 11.5px;
40 color: #111827;
41 line-height: 1.32;
42 margin: 0;
43 padding: 0;
44 background: #ffffff;
45 }
46 .wrapper {
47 padding: 14px 12px;
48 page-break-after: avoid;
49 }
50 .header {
51 margin-bottom: 18px;
52 border-bottom: 1px solid #d1d5db;
53 padding-bottom: 10px;
54 page-break-after: avoid;
55 }
56 .header h1 {
57 margin: 0;
58 font-size: 17px;
59 }
60 .meta {
61 width: 100%;
62 border-collapse: collapse;
63 margin-bottom: 10px;
64 }
65 .meta td {
66 padding: 5px 0;
67 vertical-align: top;
68 }
69 .section-title {
70 font-size: 12px;
71 font-weight: 700;
72 margin-top: 16px;
73 margin-bottom: 5px;
74 page-break-after: avoid;
75 }
76 .responses {
77 width: 100%;
78 border-collapse: collapse;
79 page-break-inside: auto;
80 font-size: 10.5px;
81 }
82 .responses th,
83 .responses td {
84 padding: 5px;
85 border: 1px solid #e5e7eb;
86 text-align: left;
87 }
88 .responses th {
89 background: #f3f4f6;
90 font-weight: 700;
91 }
92 .responses tr {
93 page-break-inside: avoid;
94 }
95 .signature-box {
96 border: 1px dashed #9ca3af;
97 padding: 10px;
98 height: 80px;
99 display: flex;
100 align-items: center;
101 justify-content: center;
102 margin-top: 10px;
103 background: #f9fafb;
104 page-break-inside: avoid;
105 box-sizing: border-box;
106 }
107 .signature-row {
108 width: 100%;
109 border-collapse: collapse;
110 margin-top: 10px;
111 page-break-inside: avoid;
112 }
113 .signature-row td {
114 vertical-align: top;
115 padding: 0;
116 }
117 .signature-row td:first-child {
118 width: 48%;
119 padding-right: 2%;
120 }
121 .signature-row td:last-child {
122 width: 48%;
123 padding-left: 2%;
124 }
125 .signature-label {
126 font-size: 11px;
127 font-weight: 700;
128 margin-bottom: 5px;
129 color: #374151;
130 }
131 .muted {
132 color: #6b7280;
133 font-size: 11px;
134 }
135 .section {
136 page-break-inside: avoid;
137 }
138 .footer-note {
139 page-break-inside: avoid;
140 text-align: center;
141 margin-top: 20px;
142 font-size: 10px;
143 color: #6b7280;
144 }
145 </style>
146 </head>
147 <body>
148 <div class="wrapper">
149 <div class="header">
150 <h1><?php echo $safe($form_name); ?></h1>
151 <p class="muted"><?php echo $safe($site_name); ?></p>
152 </div>
153
154 <table class="meta">
155 <tr>
156 <td><strong><?php esc_html_e('Signer Name', 'yatra'); ?>:</strong></td>
157 <td><?php echo $safe($consent->signer_name ?? ''); ?></td>
158 </tr>
159 <tr>
160 <td><strong><?php esc_html_e('Email', 'yatra'); ?>:</strong></td>
161 <td><?php echo $safe($consent->signer_email ?? ''); ?></td>
162 </tr>
163 <tr>
164 <td><strong><?php esc_html_e('Signed At', 'yatra'); ?>:</strong></td>
165 <td><?php echo $formatDate($signed_at); ?></td>
166 </tr>
167 <tr>
168 <td><strong><?php esc_html_e('IP Address', 'yatra'); ?>:</strong></td>
169 <td><?php echo $safe($ip_address); ?></td>
170 </tr>
171 <tr>
172 <td><strong><?php esc_html_e('User Agent', 'yatra'); ?>:</strong></td>
173 <td><?php echo $safe($user_agent); ?></td>
174 </tr>
175 </table>
176
177 <div class="section-title"><?php esc_html_e('Form Responses', 'yatra'); ?></div>
178 <?php if (!empty($form_data)): ?>
179 <table class="responses">
180 <thead>
181 <tr>
182 <th><?php esc_html_e('Field', 'yatra'); ?></th>
183 <th><?php esc_html_e('Response', 'yatra'); ?></th>
184 </tr>
185 </thead>
186 <tbody>
187 <?php foreach ($form_data as $field => $value): ?>
188 <tr>
189 <td><?php echo $safe(is_string($field) ? $field : (string) $field); ?></td>
190 <td>
191 <?php
192 if (is_bool($value)) {
193 echo $value ? esc_html__('Yes', 'yatra') : esc_html__('No', 'yatra');
194 } elseif (is_array($value)) {
195 echo $safe(implode(', ', array_map('strval', $value)));
196 } else {
197 echo $safe((string) $value);
198 }
199 ?>
200 </td>
201 </tr>
202 <?php endforeach; ?>
203 </tbody>
204 </table>
205 <?php else: ?>
206 <p class="muted"><?php esc_html_e('No responses recorded for this consent form.', 'yatra'); ?></p>
207 <?php endif; ?>
208
209 <div class="section-title"><?php esc_html_e('Signature & Initials', 'yatra'); ?></div>
210 <table class="signature-row">
211 <tr>
212 <td>
213 <div class="signature-label"><?php esc_html_e('Signature', 'yatra'); ?></div>
214 <div class="signature-box">
215 <?php if (!empty($signature_data)): ?>
216 <img src="<?php echo esc_attr($signature_data); ?>" alt="<?php esc_attr_e('Signature', 'yatra'); ?>" style="max-height: 80px;">
217 <?php else: ?>
218 <span class="muted"><?php esc_html_e('No signature captured.', 'yatra'); ?></span>
219 <?php endif; ?>
220 </div>
221 </td>
222 <td>
223 <div class="signature-label"><?php esc_html_e('Initials', 'yatra'); ?></div>
224 <div class="signature-box">
225 <?php if (!empty($initials_data)): ?>
226 <img src="<?php echo esc_attr($initials_data); ?>" alt="<?php esc_attr_e('Initials', 'yatra'); ?>" style="max-height: 50px;">
227 <?php else: ?>
228 <span class="muted"><?php esc_html_e('No initials captured.', 'yatra'); ?></span>
229 <?php endif; ?>
230 </div>
231 </td>
232 </tr>
233 </table>
234
235 <p class="footer-note">
236 <?php esc_html_e('This document is generated electronically and is valid without a handwritten signature.', 'yatra'); ?>
237 </p>
238 </div>
239 </body>
240 </html>
241