Version Description
- Bug - Updated $form_data['date_created'], $form_data['date_created_usa'], $form_data['misc']['date_time'], $form_data['misc']['time_24hr'] and $form_data['misc']['time_12hr'] to factor in the website's timezone settings.
Download this release
Release Info
Developer | Blue Liquid Designs |
Plugin | Gravity PDF |
Version | 3.7.2 |
Comparing to | |
See all releases |
Code changes from version 3.7.1 to 3.7.2
- README.txt +4 -1
- helper/pdf-entry-detail.php +2037 -2045
- pdf.php +2 -2
- view/templates/settings/changelog.php +6 -0
README.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://gravitypdf.com
|
|
4 |
Tags: gravity, forms, pdf, automation, attachment
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 3.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl.txt
|
10 |
|
@@ -88,6 +88,9 @@ All FAQs can be [viewed on the Gravity PDF website](https://gravitypdf.com/#faqs
|
|
88 |
|
89 |
== Changelog ==
|
90 |
|
|
|
|
|
|
|
91 |
= 3.7.1 =
|
92 |
* Housekeeping - Allow control over signature width in default template using the 'gfpdfe_signature_width' filter
|
93 |
* Housekeeping - Add better error checking when migrating PDF template folder
|
4 |
Tags: gravity, forms, pdf, automation, attachment
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 3.7.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl.txt
|
10 |
|
88 |
|
89 |
== Changelog ==
|
90 |
|
91 |
+
= 3.7.2 =
|
92 |
+
* Bug - Updated $form_data['date_created'], $form_data['date_created_usa'], $form_data['misc']['date_time'], $form_data['misc']['time_24hr'] and $form_data['misc']['time_12hr'] to factor in the website's timezone settings.
|
93 |
+
|
94 |
= 3.7.1 =
|
95 |
* Housekeeping - Allow control over signature width in default template using the 'gfpdfe_signature_width' filter
|
96 |
* Housekeeping - Add better error checking when migrating PDF template folder
|
helper/pdf-entry-detail.php
CHANGED
@@ -1,2046 +1,2038 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
This file is part of Gravity PDF.
|
5 |
-
|
6 |
-
Gravity PDF Copyright (C) 2015 Blue Liquid Designs
|
7 |
-
|
8 |
-
This program is free software; you can redistribute it and/or modify
|
9 |
-
it under the terms of the GNU General Public License as published by
|
10 |
-
the Free Software Foundation; either version 2 of the License, or
|
11 |
-
(at your option) any later version.
|
12 |
-
|
13 |
-
This program is distributed in the hope that it will be useful,
|
14 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
-
GNU General Public License for more details.
|
17 |
-
|
18 |
-
You should have received a copy of the GNU General Public License
|
19 |
-
along with this program; if not, write to the Free Software
|
20 |
-
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
21 |
-
*/
|
22 |
-
|
23 |
-
if(!class_exists('GFPDFEntryDetail'))
|
24 |
-
{
|
25 |
-
|
26 |
-
/*
|
27 |
-
* Include Gravity Forms Currency class (it not already included)
|
28 |
-
*/
|
29 |
-
if ( false === class_exists( 'RGCurrency' ) && class_exists('GFCommon') ) {
|
30 |
-
require_once( GFCommon::get_base_path() . '/currency.php' );
|
31 |
-
}
|
32 |
-
|
33 |
-
add_filter('gfpdf_field_content', array('GFPDFEntryDetail', 'encode_tags'), 10, 2); /* encode shortcodes in user's response so they aren't converted later by do_shortcode */
|
34 |
-
class GFPDFEntryDetail {
|
35 |
-
|
36 |
-
/* holds the form fields, stored by field ID */
|
37 |
-
static $fields;
|
38 |
-
|
39 |
-
/* depreciated function which we will replace with a better config passing method */
|
40 |
-
public static function lead_detail_grid($form, $lead, $allow_display_empty_fields=false, $show_html=false, $show_page_name=false, $return=false) {
|
41 |
-
|
42 |
-
$config = array(
|
43 |
-
'empty_field' => $allow_display_empty_fields,
|
44 |
-
'html_field' => $show_html,
|
45 |
-
'page_names' => $show_page_name,
|
46 |
-
'return' => $return,
|
47 |
-
);
|
48 |
-
|
49 |
-
return self::do_lead_detail_grid($form, $lead, $config);
|
50 |
-
}
|
51 |
-
|
52 |
-
|
53 |
-
public static function do_lead_detail_grid($form, $lead, $config) {
|
54 |
-
$form_id = $form['id'];
|
55 |
-
$results = array();
|
56 |
-
|
57 |
-
/*
|
58 |
-
* Set up our defaults and merge down the user config
|
59 |
-
*/
|
60 |
-
$defaults = array(
|
61 |
-
'empty_field' => false,
|
62 |
-
'html_field' => false,
|
63 |
-
'page_names' => false,
|
64 |
-
'return' => false,
|
65 |
-
'section_content' => false,
|
66 |
-
);
|
67 |
-
|
68 |
-
$config = array_merge($defaults, $config);
|
69 |
-
|
70 |
-
if($config['return'] === true)
|
71 |
-
{
|
72 |
-
$results['title'] = '<h2 id="details" class="default">'. $form['title'] .'</h2>';
|
73 |
-
}
|
74 |
-
else
|
75 |
-
{
|
76 |
-
?>
|
77 |
-
<div id='container'>
|
78 |
-
<h2 id='details' class='default'><?php echo $form['title']?></h2>
|
79 |
-
<?php
|
80 |
-
}
|
81 |
-
|
82 |
-
|
83 |
-
$count = 0;
|
84 |
-
$field_count = sizeof($form['fields']);
|
85 |
-
|
86 |
-
$has_product_fields = false;
|
87 |
-
|
88 |
-
$page_number = 0;
|
89 |
-
foreach($form['fields'] as $field) {
|
90 |
-
|
91 |
-
|
92 |
-
/*
|
93 |
-
* Check if this field has been excluded from the list
|
94 |
-
*/
|
95 |
-
if(isset($field['cssClass']) && strpos($field['cssClass'], 'exclude') !== false)
|
96 |
-
{
|
97 |
-
/* skip this field */
|
98 |
-
continue;
|
99 |
-
}
|
100 |
-
|
101 |
-
/*
|
102 |
-
* Skip over hidden fields
|
103 |
-
*/
|
104 |
-
if(GFFormsModel::is_field_hidden( $form, $field, array(), $lead ))
|
105 |
-
{
|
106 |
-
continue;
|
107 |
-
}
|
108 |
-
|
109 |
-
/*
|
110 |
-
* Check if we are to show the page names
|
111 |
-
*/
|
112 |
-
if($config['page_names'] === true)
|
113 |
-
{
|
114 |
-
if((int) $field['pageNumber'] !== $page_number && isset($form['pagination']['pages'][$page_number]))
|
115 |
-
{
|
116 |
-
/*
|
117 |
-
* Display the page number
|
118 |
-
*/
|
119 |
-
if($config['return'] === true)
|
120 |
-
{
|
121 |
-
$results['field'][] = '<h2 id="field-'. $field['id'].'" class="default entry-view-page-break">'. $form['pagination']['pages'][$page_number] .'</h2>';
|
122 |
-
}
|
123 |
-
else
|
124 |
-
{
|
125 |
-
?>
|
126 |
-
<h2 id='field-<?php echo $field['id']; ?>' class='default entry-view-page-break'><?php echo $form['pagination']['pages'][$page_number]; ?></h2>
|
127 |
-
<?php
|
128 |
-
}
|
129 |
-
/*
|
130 |
-
* Increment the page number
|
131 |
-
*/
|
132 |
-
$page_number++;
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
$even = $odd = '';
|
137 |
-
|
138 |
-
switch(RGFormsModel::get_input_type($field)){
|
139 |
-
case 'section' :
|
140 |
-
|
141 |
-
if(!GFCommon::is_section_empty($field, $form, $lead) || $config['empty_field'] || $config['section_content']){
|
142 |
-
$count++;
|
143 |
-
|
144 |
-
if($config['return'] === true)
|
145 |
-
{
|
146 |
-
$results['field'][] = '<h2 id="field-'.$field['id'].'" class="default entry-view-section-break">'. esc_html(GFCommon::get_label($field)) .'</h2>';
|
147 |
-
|
148 |
-
if($config['section_content'])
|
149 |
-
{
|
150 |
-
$results['field'][] = '<div class="default entry-view-section-break entry-view-section-break-content">' . $field['description'] . '</div>';
|
151 |
-
}
|
152 |
-
|
153 |
-
}
|
154 |
-
else
|
155 |
-
{
|
156 |
-
?>
|
157 |
-
<h2 id="field-<?php echo $field['id']; ?>" class="default entry-view-section-break"><?php echo esc_html(GFCommon::get_label($field))?></h2>
|
158 |
-
|
159 |
-
<?php if($config['section_content']): ?>
|
160 |
-
<div class="default entry-view-section-break entry-view-section-break-content"><?php echo $field['description']; ?></div>
|
161 |
-
<?php endif; ?>
|
162 |
-
<?php
|
163 |
-
}
|
164 |
-
}
|
165 |
-
break;
|
166 |
-
|
167 |
-
case 'captcha':
|
168 |
-
case 'password':
|
169 |
-
case 'page':
|
170 |
-
//ignore captcha, html, password, page field
|
171 |
-
break;
|
172 |
-
case 'html':
|
173 |
-
if($config['html_field'] == true)
|
174 |
-
{
|
175 |
-
|
176 |
-
$count++;
|
177 |
-
$is_last = $count >= $field_count && !$has_product_fields ? true : false;
|
178 |
-
$last_row = $is_last ? ' lastrow' : '';
|
179 |
-
$even = ($count%2) ? ' odd' : ' even';
|
180 |
-
|
181 |
-
$display_value = $field['content'];
|
182 |
-
$value = '';
|
183 |
-
|
184 |
-
$content = '<div id="field-'. $field['id'] .'" class="entry-view-html-value' . $last_row . $even . '"><div class="value">' . $display_value . '</div></div>';
|
185 |
-
$content = apply_filters('gfpdf_field_content', $content, $field, $value, $lead['id'], $form['id']);
|
186 |
-
|
187 |
-
if($config['return'] === true)
|
188 |
-
{
|
189 |
-
$results['field'][] = $content;
|
190 |
-
}
|
191 |
-
else
|
192 |
-
{
|
193 |
-
echo $content;
|
194 |
-
}
|
195 |
-
}
|
196 |
-
break;
|
197 |
-
case 'signature':
|
198 |
-
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
199 |
-
$public_folder = RGFormsModel::get_upload_url_root() . 'signatures/';
|
200 |
-
$server_folder = RGFormsModel::get_upload_root() . 'signatures/';
|
201 |
-
$file = $server_folder.$value;
|
202 |
-
$display_value = false;
|
203 |
-
|
204 |
-
$is_last = $count >= $field_count ? true : false;
|
205 |
-
$last_row = $is_last ? ' lastrow' : '';
|
206 |
-
|
207 |
-
if(file_exists($file) && !is_dir($file))
|
208 |
-
{
|
209 |
-
$image_size = getimagesize($file);
|
210 |
-
$width = apply_filters('gfpdfe_signature_width', $image_size[0] / 4, $image_size[0]);
|
211 |
-
|
212 |
-
$display_value = '<img src="'. $file .'" alt="Signature" width=" '. $width .'" />';
|
213 |
-
}
|
214 |
-
|
215 |
-
if($display_value)
|
216 |
-
{
|
217 |
-
$content = '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div> <div class="value">' . $display_value . '</div></div> ';
|
218 |
-
|
219 |
-
if($config['return'] === true)
|
220 |
-
{
|
221 |
-
$results['field'][] = $content;
|
222 |
-
}
|
223 |
-
else
|
224 |
-
{
|
225 |
-
echo $content;
|
226 |
-
}
|
227 |
-
}
|
228 |
-
elseif($config['empty_field'])
|
229 |
-
{
|
230 |
-
if($config['return'] === true)
|
231 |
-
{
|
232 |
-
$results['field'][] = '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div> <div class="value"> </div></div>';
|
233 |
-
}
|
234 |
-
else
|
235 |
-
{
|
236 |
-
print '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div><div class="value"> </div></div>';
|
237 |
-
}
|
238 |
-
|
239 |
-
}
|
240 |
-
break;
|
241 |
-
|
242 |
-
default:
|
243 |
-
|
244 |
-
//ignore product fields as they will be grouped together at the end of the grid
|
245 |
-
if(GFCommon::is_product_field($field['type'])){
|
246 |
-
$has_product_fields = true;
|
247 |
-
continue;
|
248 |
-
}
|
249 |
-
|
250 |
-
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
251 |
-
$display_value = self::pdf_get_lead_field_display($field, $value, $lead['currency']);
|
252 |
-
|
253 |
-
|
254 |
-
$display_value = apply_filters('gform_entry_field_value', $display_value, $field, $lead, $form);
|
255 |
-
|
256 |
-
if( !empty($display_value) || $display_value === '0' || $config['empty_field']){
|
257 |
-
$count++;
|
258 |
-
$is_last = $count >= $field_count && !$has_product_fields ? true : false;
|
259 |
-
$last_row = $is_last ? ' lastrow' : '';
|
260 |
-
$even = ($count%2) ? ' odd' : ' even';
|
261 |
-
|
262 |
-
$display_value = empty($display_value) && $display_value !== '0' ? ' ' : $display_value;
|
263 |
-
|
264 |
-
$content = '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div> <div class="value">' . $display_value . '</div></div>';
|
265 |
-
|
266 |
-
$content = apply_filters('gfpdf_field_content', $content, $field, $value, $lead['id'], $form['id']);
|
267 |
-
|
268 |
-
if($config['return'] === true)
|
269 |
-
{
|
270 |
-
$results['field'][] = $content;
|
271 |
-
}
|
272 |
-
else
|
273 |
-
{
|
274 |
-
echo $content;
|
275 |
-
}
|
276 |
-
|
277 |
-
}
|
278 |
-
break;
|
279 |
-
}
|
280 |
-
|
281 |
-
}
|
282 |
-
$products = array();
|
283 |
-
if($has_product_fields){
|
284 |
-
if($config['return'] === true)
|
285 |
-
{
|
286 |
-
ob_start();
|
287 |
-
self::product_table($form, $lead);
|
288 |
-
$results['field'][] = ob_get_contents();
|
289 |
-
ob_end_clean();
|
290 |
-
}
|
291 |
-
else
|
292 |
-
{
|
293 |
-
self::product_table($form, $lead);
|
294 |
-
}
|
295 |
-
|
296 |
-
}
|
297 |
-
|
298 |
-
if($config['return'] === true)
|
299 |
-
{
|
300 |
-
return $results;
|
301 |
-
}
|
302 |
-
?>
|
303 |
-
</div>
|
304 |
-
<?php
|
305 |
-
}
|
306 |
-
|
307 |
-
public static function product_table($form, $lead)
|
308 |
-
{
|
309 |
-
$products = GFCommon::get_product_fields($form, $lead, true);
|
310 |
-
|
311 |
-
$form_id = $form['id'];
|
312 |
-
if(!empty($products['products'])){
|
313 |
-
?>
|
314 |
-
|
315 |
-
<h2 class='default entry-view-field-name'><?php echo apply_filters("gform_order_label_{$form['id']}", apply_filters('gform_order_label', __('Order', 'gravityforms'), $form['id']), $form['id']) ?></h2>
|
316 |
-
|
317 |
-
<table class='entry-products' autosize='1' cellspacing='0' width='97%'>
|
318 |
-
<colgroup>
|
319 |
-
<col class='entry-products-col1' />
|
320 |
-
<col class='entry-products-col2' />
|
321 |
-
<col class='entry-products-col3' />
|
322 |
-
<col class='entry-products-col4' />
|
323 |
-
</colgroup>
|
324 |
-
<thead>
|
325 |
-
<tr>
|
326 |
-
<th scope='col'><?php echo apply_filters('gform_product_{$form_id}', apply_filters('gform_product', __('Product', 'gravityforms'), $form_id), $form_id) ?></th>
|
327 |
-
<th scope='col' class='textcenter'><?php echo apply_filters('gform_product_qty_{$form_id}', apply_filters('gform_product_qty', __('Qty', 'gravityforms'), $form_id), $form_id) ?></th>
|
328 |
-
<th scope='col'><?php echo apply_filters('gform_product_unitprice_{$form_id}', apply_filters('gform_product_unitprice', __('Unit Price', 'gravityforms'), $form_id), $form_id) ?></th>
|
329 |
-
<th scope='col'><?php echo apply_filters('gform_product_price_{$form_id}', apply_filters('gform_product_price', __('Price', 'gravityforms'), $form_id), $form_id) ?></th>
|
330 |
-
</tr>
|
331 |
-
</thead>
|
332 |
-
<tbody>
|
333 |
-
<?php
|
334 |
-
|
335 |
-
$total = 0;
|
336 |
-
foreach($products['products'] as $product){
|
337 |
-
?>
|
338 |
-
<tr>
|
339 |
-
<td>
|
340 |
-
<div class='product_name'><?php echo esc_html($product['name'])?></div>
|
341 |
-
|
342 |
-
<?php
|
343 |
-
$price = GFCommon::to_number($product['price']);
|
344 |
-
if(is_array(rgar($product,'options'))){
|
345 |
-
echo '<ul class="product_options">';
|
346 |
-
$count = sizeof($product['options']);
|
347 |
-
$index = 1;
|
348 |
-
foreach($product['options'] as $option){
|
349 |
-
$price += GFCommon::to_number($option['price']);
|
350 |
-
$class = $index == $count ? ' class="lastitem"' : '';
|
351 |
-
$index++;
|
352 |
-
?>
|
353 |
-
<li<?php echo $class?>><?php echo $option['option_label']?></li>
|
354 |
-
<?php
|
355 |
-
}
|
356 |
-
echo '</ul>';
|
357 |
-
}
|
358 |
-
$subtotal = floatval($product['quantity']) * $price;
|
359 |
-
$total += $subtotal;
|
360 |
-
?>
|
361 |
-
|
362 |
-
</td>
|
363 |
-
<td class='textcenter'><?php echo $product['quantity'] ?></td>
|
364 |
-
<td><?php echo GFCommon::to_money($price, $lead['currency']) ?></td>
|
365 |
-
<td><?php echo GFCommon::to_money($subtotal, $lead['currency']) ?></td>
|
366 |
-
</tr>
|
367 |
-
<?php
|
368 |
-
}
|
369 |
-
$total += floatval($products['shipping']['price']);
|
370 |
-
?>
|
371 |
-
|
372 |
-
|
373 |
-
<?php
|
374 |
-
if(!empty($products['shipping']['name'])){
|
375 |
-
?>
|
376 |
-
<tr>
|
377 |
-
<td colspan='2' rowspan='2' class='emptycell'> </td>
|
378 |
-
<td class='textright shipping'><?php echo $products['shipping']['name'] ?></td>
|
379 |
-
<td class='shipping_amount'><?php echo GFCommon::to_money($products['shipping']['price'], $lead['currency'])?> </td>
|
380 |
-
</tr>
|
381 |
-
<?php
|
382 |
-
}
|
383 |
-
?>
|
384 |
-
<tr>
|
385 |
-
<?php
|
386 |
-
if(empty($products['shipping']['name'])){
|
387 |
-
?>
|
388 |
-
<td colspan='2' class='emptycell'> </td>
|
389 |
-
<?php
|
390 |
-
}
|
391 |
-
?>
|
392 |
-
<td class='textright grandtotal'><?php _e('Total', 'gravityforms') ?></td>
|
393 |
-
<td class='grandtotal_amount'><?php echo GFCommon::to_money($total, $lead['currency'])?></td>
|
394 |
-
</tr>
|
395 |
-
</tbody>
|
396 |
-
|
397 |
-
</table>
|
398 |
-
|
399 |
-
<?php
|
400 |
-
}
|
401 |
-
}
|
402 |
-
|
403 |
-
/*
|
404 |
-
* Public method for outputting likert (survey addon field)
|
405 |
-
*/
|
406 |
-
public static function get_likert($form, $lead, $field_id)
|
407 |
-
{
|
408 |
-
$fields = self::$fields;
|
409 |
-
$field = $fields[$field_id];
|
410 |
-
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
411 |
-
|
412 |
-
$display_value = apply_filters('gform_entry_field_value', self::pdf_get_lead_field_display($field, $value, ''), $field, $lead, $form);
|
413 |
-
$content = $display_value;
|
414 |
-
|
415 |
-
$results = apply_filters('gfpdf_field_content', $content, $field, $value, $lead['id'], $form['id']);
|
416 |
-
|
417 |
-
return $results;
|
418 |
-
}
|
419 |
-
|
420 |
-
|
421 |
-
{
|
422 |
-
|
423 |
-
$
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
case '
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
case '
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
{
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
break;
|
490 |
-
|
491 |
-
case '
|
492 |
-
$form_array['survey']['
|
493 |
-
break;
|
494 |
-
|
495 |
-
case '
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
$
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
$
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
$
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
{
|
628 |
-
$
|
629 |
-
}
|
630 |
-
|
631 |
-
$
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
self
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
$form_array['
|
717 |
-
$form_array['
|
718 |
-
|
719 |
-
/*
|
720 |
-
*
|
721 |
-
*/
|
722 |
-
$form_array['
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
$form_array['
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
$form_array['misc']['
|
736 |
-
$form_array['misc']['
|
737 |
-
$form_array['misc']['
|
738 |
-
$form_array['misc']['
|
739 |
-
$form_array['misc']['
|
740 |
-
$form_array['misc']['
|
741 |
-
$form_array['misc']['
|
742 |
-
$form_array['misc']['
|
743 |
-
$form_array['misc']['
|
744 |
-
$form_array['misc']['
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
$poll_results
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
$
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
}
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
$
|
932 |
-
|
933 |
-
$
|
934 |
-
|
935 |
-
|
936 |
-
*
|
937 |
-
*/
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
/*
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
|
1004 |
-
|
1005 |
-
|
1006 |
-
|
1007 |
-
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
-
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
1045 |
-
|
1046 |
-
|
1047 |
-
|
1048 |
-
|
1049 |
-
|
1050 |
-
|
1051 |
-
|
1052 |
-
|
1053 |
-
|
1054 |
-
|
1055 |
-
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
$
|
1077 |
-
$
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
$form_array['
|
1105 |
-
'img' => $sig_html,
|
1106 |
-
'path' => $file,
|
1107 |
-
'url' => $http_folder.$value,
|
1108 |
-
'width' => $width,
|
1109 |
-
'height' => $height,
|
1110 |
-
);
|
1111 |
-
|
1112 |
-
|
1113 |
-
|
1114 |
-
|
1115 |
-
|
1116 |
-
|
1117 |
-
|
1118 |
-
);
|
1119 |
-
|
1120 |
-
|
1121 |
-
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
}
|
1140 |
-
|
1141 |
-
private static function
|
1142 |
-
{
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
-
|
1147 |
-
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
-
/*
|
1152 |
-
* Check if
|
1153 |
-
*/
|
1154 |
-
if(!is_array($list)
|
1155 |
-
{
|
1156 |
-
|
1157 |
-
}
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
-
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
$
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
|
1208 |
-
|
1209 |
-
|
1210 |
-
$
|
1211 |
-
|
1212 |
-
$form_array
|
1213 |
-
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
$
|
1219 |
-
|
1220 |
-
return $form_array;
|
1221 |
-
}
|
1222 |
-
|
1223 |
-
private static function
|
1224 |
-
{
|
1225 |
-
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
$form_array
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
/*
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
-
|
1283 |
-
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
return $
|
1344 |
-
}
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
|
1350 |
-
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
$
|
1362 |
-
|
1363 |
-
$
|
1364 |
-
$
|
1365 |
-
$
|
1366 |
-
|
1367 |
-
$
|
1368 |
-
|
1369 |
-
|
1370 |
-
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
-
break;
|
1384 |
-
|
1385 |
-
case '
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
{
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
|
1476 |
-
|
1477 |
-
|
1478 |
-
|
1479 |
-
|
1480 |
-
|
1481 |
-
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
1503 |
-
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
|
1515 |
-
|
1516 |
-
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
break;
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
}
|
1554 |
-
|
1555 |
-
|
1556 |
-
return
|
1557 |
-
}
|
1558 |
-
else if($
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
-
|
1575 |
-
|
1576 |
-
|
1577 |
-
|
1578 |
-
|
1579 |
-
|
1580 |
-
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
$list .= implode('
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
break;
|
1596 |
-
|
1597 |
-
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
|
1608 |
-
$list
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
$list
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
|
1653 |
-
|
1654 |
-
return $
|
1655 |
-
}
|
1656 |
-
|
1657 |
-
|
1658 |
-
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
-
|
1666 |
-
|
1667 |
-
|
1668 |
-
|
1669 |
-
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
$
|
1677 |
-
$
|
1678 |
-
$
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
|
1686 |
-
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
1708 |
-
|
1709 |
-
|
1710 |
-
$
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
$
|
1729 |
-
$
|
1730 |
-
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
1735 |
-
$
|
1736 |
-
|
1737 |
-
|
1738 |
-
|
1739 |
-
|
1740 |
-
|
1741 |
-
|
1742 |
-
|
1743 |
-
$address
|
1744 |
-
|
1745 |
-
}
|
1746 |
-
|
1747 |
-
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
break;
|
1761 |
-
|
1762 |
-
case '
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
|
1786 |
-
|
1787 |
-
|
1788 |
-
|
1789 |
-
|
1790 |
-
|
1791 |
-
|
1792 |
-
|
1793 |
-
|
1794 |
-
|
1795 |
-
|
1796 |
-
|
1797 |
-
|
1798 |
-
|
1799 |
-
|
1800 |
-
|
1801 |
-
|
1802 |
-
|
1803 |
-
|
1804 |
-
|
1805 |
-
|
1806 |
-
|
1807 |
-
|
1808 |
-
|
1809 |
-
|
1810 |
-
|
1811 |
-
|
1812 |
-
|
1813 |
-
|
1814 |
-
$value = $url;
|
1815 |
-
$value .= !empty($title) ?
|
1816 |
-
$value .= !empty($caption) ?
|
1817 |
-
$value .= !empty($description) ?
|
1818 |
-
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
1824 |
-
|
1825 |
-
|
1826 |
-
|
1827 |
-
|
1828 |
-
|
1829 |
-
|
1830 |
-
|
1831 |
-
|
1832 |
-
|
1833 |
-
|
1834 |
-
|
1835 |
-
|
1836 |
-
$output .= '
|
1837 |
-
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
1848 |
-
|
1849 |
-
|
1850 |
-
|
1851 |
-
|
1852 |
-
|
1853 |
-
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
|
1858 |
-
|
1859 |
-
|
1860 |
-
|
1861 |
-
|
1862 |
-
|
1863 |
-
|
1864 |
-
|
1865 |
-
|
1866 |
-
|
1867 |
-
|
1868 |
-
|
1869 |
-
|
1870 |
-
|
1871 |
-
|
1872 |
-
|
1873 |
-
|
1874 |
-
|
1875 |
-
|
1876 |
-
|
1877 |
-
|
1878 |
-
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
|
1889 |
-
|
1890 |
-
|
1891 |
-
|
1892 |
-
|
1893 |
-
|
1894 |
-
|
1895 |
-
|
1896 |
-
|
1897 |
-
|
1898 |
-
|
1899 |
-
|
1900 |
-
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
|
1908 |
-
|
1909 |
-
|
1910 |
-
|
1911 |
-
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
|
1917 |
-
|
1918 |
-
|
1919 |
-
break;
|
1920 |
-
|
1921 |
-
|
1922 |
-
|
1923 |
-
|
1924 |
-
|
1925 |
-
|
1926 |
-
|
1927 |
-
|
1928 |
-
|
1929 |
-
|
1930 |
-
|
1931 |
-
|
1932 |
-
|
1933 |
-
|
1934 |
-
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
-
|
1953 |
-
|
1954 |
-
|
1955 |
-
|
1956 |
-
$list .= implode('
|
1957 |
-
|
1958 |
-
|
1959 |
-
|
1960 |
-
break;
|
1961 |
-
|
1962 |
-
|
1963 |
-
|
1964 |
-
$list
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
-
|
1970 |
-
|
1971 |
-
|
1972 |
-
$list
|
1973 |
-
|
1974 |
-
|
1975 |
-
|
1976 |
-
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
-
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
$list
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
return $
|
2019 |
-
}
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
$content = str_replace(']', ']', $content);
|
2039 |
-
$content = str_replace('{', '{', $content);
|
2040 |
-
$content = str_replace('}', '}', $content);
|
2041 |
-
}
|
2042 |
-
|
2043 |
-
return $content;
|
2044 |
-
}
|
2045 |
-
}
|
2046 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
This file is part of Gravity PDF.
|
5 |
+
|
6 |
+
Gravity PDF Copyright (C) 2015 Blue Liquid Designs
|
7 |
+
|
8 |
+
This program is free software; you can redistribute it and/or modify
|
9 |
+
it under the terms of the GNU General Public License as published by
|
10 |
+
the Free Software Foundation; either version 2 of the License, or
|
11 |
+
(at your option) any later version.
|
12 |
+
|
13 |
+
This program is distributed in the hope that it will be useful,
|
14 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
+
GNU General Public License for more details.
|
17 |
+
|
18 |
+
You should have received a copy of the GNU General Public License
|
19 |
+
along with this program; if not, write to the Free Software
|
20 |
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
21 |
+
*/
|
22 |
+
|
23 |
+
if(!class_exists('GFPDFEntryDetail'))
|
24 |
+
{
|
25 |
+
|
26 |
+
/*
|
27 |
+
* Include Gravity Forms Currency class (it not already included)
|
28 |
+
*/
|
29 |
+
if ( false === class_exists( 'RGCurrency' ) && class_exists('GFCommon') ) {
|
30 |
+
require_once( GFCommon::get_base_path() . '/currency.php' );
|
31 |
+
}
|
32 |
+
|
33 |
+
add_filter('gfpdf_field_content', array('GFPDFEntryDetail', 'encode_tags'), 10, 2); /* encode shortcodes in user's response so they aren't converted later by do_shortcode */
|
34 |
+
class GFPDFEntryDetail {
|
35 |
+
|
36 |
+
/* holds the form fields, stored by field ID */
|
37 |
+
static $fields;
|
38 |
+
|
39 |
+
/* depreciated function which we will replace with a better config passing method */
|
40 |
+
public static function lead_detail_grid($form, $lead, $allow_display_empty_fields=false, $show_html=false, $show_page_name=false, $return=false) {
|
41 |
+
|
42 |
+
$config = array(
|
43 |
+
'empty_field' => $allow_display_empty_fields,
|
44 |
+
'html_field' => $show_html,
|
45 |
+
'page_names' => $show_page_name,
|
46 |
+
'return' => $return,
|
47 |
+
);
|
48 |
+
|
49 |
+
return self::do_lead_detail_grid($form, $lead, $config);
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
public static function do_lead_detail_grid($form, $lead, $config) {
|
54 |
+
$form_id = $form['id'];
|
55 |
+
$results = array();
|
56 |
+
|
57 |
+
/*
|
58 |
+
* Set up our defaults and merge down the user config
|
59 |
+
*/
|
60 |
+
$defaults = array(
|
61 |
+
'empty_field' => false,
|
62 |
+
'html_field' => false,
|
63 |
+
'page_names' => false,
|
64 |
+
'return' => false,
|
65 |
+
'section_content' => false,
|
66 |
+
);
|
67 |
+
|
68 |
+
$config = array_merge($defaults, $config);
|
69 |
+
|
70 |
+
if($config['return'] === true)
|
71 |
+
{
|
72 |
+
$results['title'] = '<h2 id="details" class="default">'. $form['title'] .'</h2>';
|
73 |
+
}
|
74 |
+
else
|
75 |
+
{
|
76 |
+
?>
|
77 |
+
<div id='container'>
|
78 |
+
<h2 id='details' class='default'><?php echo $form['title']?></h2>
|
79 |
+
<?php
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
$count = 0;
|
84 |
+
$field_count = sizeof($form['fields']);
|
85 |
+
|
86 |
+
$has_product_fields = false;
|
87 |
+
|
88 |
+
$page_number = 0;
|
89 |
+
foreach($form['fields'] as $field) {
|
90 |
+
|
91 |
+
|
92 |
+
/*
|
93 |
+
* Check if this field has been excluded from the list
|
94 |
+
*/
|
95 |
+
if(isset($field['cssClass']) && strpos($field['cssClass'], 'exclude') !== false)
|
96 |
+
{
|
97 |
+
/* skip this field */
|
98 |
+
continue;
|
99 |
+
}
|
100 |
+
|
101 |
+
/*
|
102 |
+
* Skip over hidden fields
|
103 |
+
*/
|
104 |
+
if(GFFormsModel::is_field_hidden( $form, $field, array(), $lead ))
|
105 |
+
{
|
106 |
+
continue;
|
107 |
+
}
|
108 |
+
|
109 |
+
/*
|
110 |
+
* Check if we are to show the page names
|
111 |
+
*/
|
112 |
+
if($config['page_names'] === true)
|
113 |
+
{
|
114 |
+
if((int) $field['pageNumber'] !== $page_number && isset($form['pagination']['pages'][$page_number]))
|
115 |
+
{
|
116 |
+
/*
|
117 |
+
* Display the page number
|
118 |
+
*/
|
119 |
+
if($config['return'] === true)
|
120 |
+
{
|
121 |
+
$results['field'][] = '<h2 id="field-'. $field['id'].'" class="default entry-view-page-break">'. $form['pagination']['pages'][$page_number] .'</h2>';
|
122 |
+
}
|
123 |
+
else
|
124 |
+
{
|
125 |
+
?>
|
126 |
+
<h2 id='field-<?php echo $field['id']; ?>' class='default entry-view-page-break'><?php echo $form['pagination']['pages'][$page_number]; ?></h2>
|
127 |
+
<?php
|
128 |
+
}
|
129 |
+
/*
|
130 |
+
* Increment the page number
|
131 |
+
*/
|
132 |
+
$page_number++;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
|
136 |
+
$even = $odd = '';
|
137 |
+
|
138 |
+
switch(RGFormsModel::get_input_type($field)){
|
139 |
+
case 'section' :
|
140 |
+
|
141 |
+
if(!GFCommon::is_section_empty($field, $form, $lead) || $config['empty_field'] || $config['section_content']){
|
142 |
+
$count++;
|
143 |
+
|
144 |
+
if($config['return'] === true)
|
145 |
+
{
|
146 |
+
$results['field'][] = '<h2 id="field-'.$field['id'].'" class="default entry-view-section-break">'. esc_html(GFCommon::get_label($field)) .'</h2>';
|
147 |
+
|
148 |
+
if($config['section_content'])
|
149 |
+
{
|
150 |
+
$results['field'][] = '<div class="default entry-view-section-break entry-view-section-break-content">' . $field['description'] . '</div>';
|
151 |
+
}
|
152 |
+
|
153 |
+
}
|
154 |
+
else
|
155 |
+
{
|
156 |
+
?>
|
157 |
+
<h2 id="field-<?php echo $field['id']; ?>" class="default entry-view-section-break"><?php echo esc_html(GFCommon::get_label($field))?></h2>
|
158 |
+
|
159 |
+
<?php if($config['section_content']): ?>
|
160 |
+
<div class="default entry-view-section-break entry-view-section-break-content"><?php echo $field['description']; ?></div>
|
161 |
+
<?php endif; ?>
|
162 |
+
<?php
|
163 |
+
}
|
164 |
+
}
|
165 |
+
break;
|
166 |
+
|
167 |
+
case 'captcha':
|
168 |
+
case 'password':
|
169 |
+
case 'page':
|
170 |
+
//ignore captcha, html, password, page field
|
171 |
+
break;
|
172 |
+
case 'html':
|
173 |
+
if($config['html_field'] == true)
|
174 |
+
{
|
175 |
+
|
176 |
+
$count++;
|
177 |
+
$is_last = $count >= $field_count && !$has_product_fields ? true : false;
|
178 |
+
$last_row = $is_last ? ' lastrow' : '';
|
179 |
+
$even = ($count%2) ? ' odd' : ' even';
|
180 |
+
|
181 |
+
$display_value = $field['content'];
|
182 |
+
$value = '';
|
183 |
+
|
184 |
+
$content = '<div id="field-'. $field['id'] .'" class="entry-view-html-value' . $last_row . $even . '"><div class="value">' . $display_value . '</div></div>';
|
185 |
+
$content = apply_filters('gfpdf_field_content', $content, $field, $value, $lead['id'], $form['id']);
|
186 |
+
|
187 |
+
if($config['return'] === true)
|
188 |
+
{
|
189 |
+
$results['field'][] = $content;
|
190 |
+
}
|
191 |
+
else
|
192 |
+
{
|
193 |
+
echo $content;
|
194 |
+
}
|
195 |
+
}
|
196 |
+
break;
|
197 |
+
case 'signature':
|
198 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
199 |
+
$public_folder = RGFormsModel::get_upload_url_root() . 'signatures/';
|
200 |
+
$server_folder = RGFormsModel::get_upload_root() . 'signatures/';
|
201 |
+
$file = $server_folder.$value;
|
202 |
+
$display_value = false;
|
203 |
+
|
204 |
+
$is_last = $count >= $field_count ? true : false;
|
205 |
+
$last_row = $is_last ? ' lastrow' : '';
|
206 |
+
|
207 |
+
if(file_exists($file) && !is_dir($file))
|
208 |
+
{
|
209 |
+
$image_size = getimagesize($file);
|
210 |
+
$width = apply_filters('gfpdfe_signature_width', $image_size[0] / 4, $image_size[0]);
|
211 |
+
|
212 |
+
$display_value = '<img src="'. $file .'" alt="Signature" width=" '. $width .'" />';
|
213 |
+
}
|
214 |
+
|
215 |
+
if($display_value)
|
216 |
+
{
|
217 |
+
$content = '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div> <div class="value">' . $display_value . '</div></div> ';
|
218 |
+
|
219 |
+
if($config['return'] === true)
|
220 |
+
{
|
221 |
+
$results['field'][] = $content;
|
222 |
+
}
|
223 |
+
else
|
224 |
+
{
|
225 |
+
echo $content;
|
226 |
+
}
|
227 |
+
}
|
228 |
+
elseif($config['empty_field'])
|
229 |
+
{
|
230 |
+
if($config['return'] === true)
|
231 |
+
{
|
232 |
+
$results['field'][] = '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div> <div class="value"> </div></div>';
|
233 |
+
}
|
234 |
+
else
|
235 |
+
{
|
236 |
+
print '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div><div class="value"> </div></div>';
|
237 |
+
}
|
238 |
+
|
239 |
+
}
|
240 |
+
break;
|
241 |
+
|
242 |
+
default:
|
243 |
+
|
244 |
+
//ignore product fields as they will be grouped together at the end of the grid
|
245 |
+
if(GFCommon::is_product_field($field['type'])){
|
246 |
+
$has_product_fields = true;
|
247 |
+
continue;
|
248 |
+
}
|
249 |
+
|
250 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
251 |
+
$display_value = self::pdf_get_lead_field_display($field, $value, $lead['currency']);
|
252 |
+
|
253 |
+
|
254 |
+
$display_value = apply_filters('gform_entry_field_value', $display_value, $field, $lead, $form);
|
255 |
+
|
256 |
+
if( !empty($display_value) || $display_value === '0' || $config['empty_field']){
|
257 |
+
$count++;
|
258 |
+
$is_last = $count >= $field_count && !$has_product_fields ? true : false;
|
259 |
+
$last_row = $is_last ? ' lastrow' : '';
|
260 |
+
$even = ($count%2) ? ' odd' : ' even';
|
261 |
+
|
262 |
+
$display_value = empty($display_value) && $display_value !== '0' ? ' ' : $display_value;
|
263 |
+
|
264 |
+
$content = '<div id="field-'. $field['id'] .'" class="entry-view-field-value' . $last_row . $even . '"><div class="strong">' . esc_html(GFCommon::get_label($field)) . '</div> <div class="value">' . $display_value . '</div></div>';
|
265 |
+
|
266 |
+
$content = apply_filters('gfpdf_field_content', $content, $field, $value, $lead['id'], $form['id']);
|
267 |
+
|
268 |
+
if($config['return'] === true)
|
269 |
+
{
|
270 |
+
$results['field'][] = $content;
|
271 |
+
}
|
272 |
+
else
|
273 |
+
{
|
274 |
+
echo $content;
|
275 |
+
}
|
276 |
+
|
277 |
+
}
|
278 |
+
break;
|
279 |
+
}
|
280 |
+
|
281 |
+
}
|
282 |
+
$products = array();
|
283 |
+
if($has_product_fields){
|
284 |
+
if($config['return'] === true)
|
285 |
+
{
|
286 |
+
ob_start();
|
287 |
+
self::product_table($form, $lead);
|
288 |
+
$results['field'][] = ob_get_contents();
|
289 |
+
ob_end_clean();
|
290 |
+
}
|
291 |
+
else
|
292 |
+
{
|
293 |
+
self::product_table($form, $lead);
|
294 |
+
}
|
295 |
+
|
296 |
+
}
|
297 |
+
|
298 |
+
if($config['return'] === true)
|
299 |
+
{
|
300 |
+
return $results;
|
301 |
+
}
|
302 |
+
?>
|
303 |
+
</div>
|
304 |
+
<?php
|
305 |
+
}
|
306 |
+
|
307 |
+
public static function product_table($form, $lead)
|
308 |
+
{
|
309 |
+
$products = GFCommon::get_product_fields($form, $lead, true);
|
310 |
+
|
311 |
+
$form_id = $form['id'];
|
312 |
+
if(!empty($products['products'])){
|
313 |
+
?>
|
314 |
+
|
315 |
+
<h2 class='default entry-view-field-name'><?php echo apply_filters("gform_order_label_{$form['id']}", apply_filters('gform_order_label', __('Order', 'gravityforms'), $form['id']), $form['id']) ?></h2>
|
316 |
+
|
317 |
+
<table class='entry-products' autosize='1' cellspacing='0' width='97%'>
|
318 |
+
<colgroup>
|
319 |
+
<col class='entry-products-col1' />
|
320 |
+
<col class='entry-products-col2' />
|
321 |
+
<col class='entry-products-col3' />
|
322 |
+
<col class='entry-products-col4' />
|
323 |
+
</colgroup>
|
324 |
+
<thead>
|
325 |
+
<tr>
|
326 |
+
<th scope='col'><?php echo apply_filters('gform_product_{$form_id}', apply_filters('gform_product', __('Product', 'gravityforms'), $form_id), $form_id) ?></th>
|
327 |
+
<th scope='col' class='textcenter'><?php echo apply_filters('gform_product_qty_{$form_id}', apply_filters('gform_product_qty', __('Qty', 'gravityforms'), $form_id), $form_id) ?></th>
|
328 |
+
<th scope='col'><?php echo apply_filters('gform_product_unitprice_{$form_id}', apply_filters('gform_product_unitprice', __('Unit Price', 'gravityforms'), $form_id), $form_id) ?></th>
|
329 |
+
<th scope='col'><?php echo apply_filters('gform_product_price_{$form_id}', apply_filters('gform_product_price', __('Price', 'gravityforms'), $form_id), $form_id) ?></th>
|
330 |
+
</tr>
|
331 |
+
</thead>
|
332 |
+
<tbody>
|
333 |
+
<?php
|
334 |
+
|
335 |
+
$total = 0;
|
336 |
+
foreach($products['products'] as $product){
|
337 |
+
?>
|
338 |
+
<tr>
|
339 |
+
<td>
|
340 |
+
<div class='product_name'><?php echo esc_html($product['name'])?></div>
|
341 |
+
|
342 |
+
<?php
|
343 |
+
$price = GFCommon::to_number($product['price']);
|
344 |
+
if(is_array(rgar($product,'options'))){
|
345 |
+
echo '<ul class="product_options">';
|
346 |
+
$count = sizeof($product['options']);
|
347 |
+
$index = 1;
|
348 |
+
foreach($product['options'] as $option){
|
349 |
+
$price += GFCommon::to_number($option['price']);
|
350 |
+
$class = $index == $count ? ' class="lastitem"' : '';
|
351 |
+
$index++;
|
352 |
+
?>
|
353 |
+
<li<?php echo $class?>><?php echo $option['option_label']?></li>
|
354 |
+
<?php
|
355 |
+
}
|
356 |
+
echo '</ul>';
|
357 |
+
}
|
358 |
+
$subtotal = floatval($product['quantity']) * $price;
|
359 |
+
$total += $subtotal;
|
360 |
+
?>
|
361 |
+
|
362 |
+
</td>
|
363 |
+
<td class='textcenter'><?php echo $product['quantity'] ?></td>
|
364 |
+
<td><?php echo GFCommon::to_money($price, $lead['currency']) ?></td>
|
365 |
+
<td><?php echo GFCommon::to_money($subtotal, $lead['currency']) ?></td>
|
366 |
+
</tr>
|
367 |
+
<?php
|
368 |
+
}
|
369 |
+
$total += floatval($products['shipping']['price']);
|
370 |
+
?>
|
371 |
+
|
372 |
+
|
373 |
+
<?php
|
374 |
+
if(!empty($products['shipping']['name'])){
|
375 |
+
?>
|
376 |
+
<tr>
|
377 |
+
<td colspan='2' rowspan='2' class='emptycell'> </td>
|
378 |
+
<td class='textright shipping'><?php echo $products['shipping']['name'] ?></td>
|
379 |
+
<td class='shipping_amount'><?php echo GFCommon::to_money($products['shipping']['price'], $lead['currency'])?> </td>
|
380 |
+
</tr>
|
381 |
+
<?php
|
382 |
+
}
|
383 |
+
?>
|
384 |
+
<tr>
|
385 |
+
<?php
|
386 |
+
if(empty($products['shipping']['name'])){
|
387 |
+
?>
|
388 |
+
<td colspan='2' class='emptycell'> </td>
|
389 |
+
<?php
|
390 |
+
}
|
391 |
+
?>
|
392 |
+
<td class='textright grandtotal'><?php _e('Total', 'gravityforms') ?></td>
|
393 |
+
<td class='grandtotal_amount'><?php echo GFCommon::to_money($total, $lead['currency'])?></td>
|
394 |
+
</tr>
|
395 |
+
</tbody>
|
396 |
+
|
397 |
+
</table>
|
398 |
+
|
399 |
+
<?php
|
400 |
+
}
|
401 |
+
}
|
402 |
+
|
403 |
+
/*
|
404 |
+
* Public method for outputting likert (survey addon field)
|
405 |
+
*/
|
406 |
+
public static function get_likert($form, $lead, $field_id)
|
407 |
+
{
|
408 |
+
$fields = self::$fields;
|
409 |
+
$field = $fields[$field_id];
|
410 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
411 |
+
|
412 |
+
$display_value = apply_filters('gform_entry_field_value', self::pdf_get_lead_field_display($field, $value, ''), $field, $lead, $form);
|
413 |
+
$content = $display_value;
|
414 |
+
|
415 |
+
$results = apply_filters('gfpdf_field_content', $content, $field, $value, $lead['id'], $form['id']);
|
416 |
+
|
417 |
+
return $results;
|
418 |
+
}
|
419 |
+
|
420 |
+
/* returns the form values as an array instead of pre-formated html */
|
421 |
+
public static function lead_detail_grid_array($form, $lead){
|
422 |
+
|
423 |
+
$form_id = $form['id'];
|
424 |
+
$form_array = self::set_form_array_common($form, $lead, $form_id);
|
425 |
+
|
426 |
+
$has_product_fields = false;
|
427 |
+
|
428 |
+
foreach($form['fields'] as $field) {
|
429 |
+
|
430 |
+
|
431 |
+
/*
|
432 |
+
* Add field descriptions to the $form_data array
|
433 |
+
*/
|
434 |
+
if(isset($field['description']))
|
435 |
+
{
|
436 |
+
$form_array['field_descriptions'][$field['id']] = $field['description'];
|
437 |
+
}
|
438 |
+
|
439 |
+
switch(RGFormsModel::get_input_type($field)) {
|
440 |
+
case 'section' :
|
441 |
+
case 'html':
|
442 |
+
$form_array = self::get_html($field, $form_array);
|
443 |
+
break;
|
444 |
+
|
445 |
+
case 'captcha':
|
446 |
+
case 'password':
|
447 |
+
case 'page':
|
448 |
+
//ignore captcha, password and page
|
449 |
+
break;
|
450 |
+
case 'signature':
|
451 |
+
$form_array = self::get_signature($form, $lead, $field, $form_array);
|
452 |
+
|
453 |
+
break;
|
454 |
+
case 'fileupload':
|
455 |
+
$form_array = self::get_fileupload($form, $lead, $field, $form_array);
|
456 |
+
break;
|
457 |
+
case 'list':
|
458 |
+
/*
|
459 |
+
* We want list to run both this and the deafult so don't call break.
|
460 |
+
* Get the list array and store it outside of [field] in a new key called ['list']
|
461 |
+
*/
|
462 |
+
$form_array = self::get_default_list($lead, $field, $form_array);
|
463 |
+
|
464 |
+
case 'select':
|
465 |
+
case 'multiselect':
|
466 |
+
case 'radio':
|
467 |
+
|
468 |
+
if($field['type'] == 'quiz')
|
469 |
+
{
|
470 |
+
$form_array = self::get_quiz_radios($form, $lead, $field, $form_array);
|
471 |
+
}
|
472 |
+
elseif($field['type'] == 'poll' || $field['type'] == 'survey')
|
473 |
+
{
|
474 |
+
$form_array = self::get_poll_radios($form, $lead, $field, $form_array);
|
475 |
+
}
|
476 |
+
else
|
477 |
+
{
|
478 |
+
/* store values in regular [field] array */
|
479 |
+
$form_array = self::get_the_list($lead, $field, $form_array);
|
480 |
+
}
|
481 |
+
break;
|
482 |
+
|
483 |
+
case 'likert':
|
484 |
+
$form_array['survey']['likert'][$field['id']] = self::get_the_likert($form, $lead, $field, $form_array);
|
485 |
+
break;
|
486 |
+
|
487 |
+
case 'rank':
|
488 |
+
$form_array['survey']['rank'][$field['id']] = self::get_the_rank($form, $lead, $field, $form_array);
|
489 |
+
break;
|
490 |
+
|
491 |
+
case 'rating':
|
492 |
+
$form_array['survey']['rating'][$field['id']] = self::get_the_rank($form, $lead, $field, $form_array);
|
493 |
+
break;
|
494 |
+
|
495 |
+
case 'checkbox':
|
496 |
+
/* Only process non-survey checkbox fields */
|
497 |
+
if($field['type'] == 'checkbox') {
|
498 |
+
$form_array = self::get_the_list($lead, $field, $form_array);
|
499 |
+
break;
|
500 |
+
}
|
501 |
+
|
502 |
+
default:
|
503 |
+
|
504 |
+
|
505 |
+
//ignore product fields as they will be grouped together at the end of the grid
|
506 |
+
if(GFCommon::is_product_field($field['type'])){
|
507 |
+
$has_product_fields = true;
|
508 |
+
continue;
|
509 |
+
}
|
510 |
+
|
511 |
+
$form_array = self::get_defaults($lead, $field, $form_array);
|
512 |
+
|
513 |
+
break;
|
514 |
+
}
|
515 |
+
|
516 |
+
}
|
517 |
+
|
518 |
+
$form_array = self::get_product_array($form, $lead, $has_product_fields, $form_array);
|
519 |
+
|
520 |
+
return $form_array;
|
521 |
+
}
|
522 |
+
|
523 |
+
private static function get_quiz_radios($form, $lead, $field, $form_array)
|
524 |
+
{
|
525 |
+
$id = $field['id'];
|
526 |
+
$results = $lead[$id];
|
527 |
+
$return = array();
|
528 |
+
|
529 |
+
foreach($field['choices'] as $choice)
|
530 |
+
{
|
531 |
+
if(trim($choice['value']) == trim($results))
|
532 |
+
{
|
533 |
+
$return = array('text' => $choice['text'], 'isCorrect' => $choice['gquizIsCorrect']);
|
534 |
+
break;
|
535 |
+
}
|
536 |
+
}
|
537 |
+
|
538 |
+
/* add data to field tag correctly */
|
539 |
+
$form_array['field'][$field['id'].'.'.$field['label'].'_name'] = $return;
|
540 |
+
|
541 |
+
/* add ID incase want to use template on multiple duplicate forms with different field names */
|
542 |
+
$form_array['field'][$field['id']] = $return;
|
543 |
+
|
544 |
+
return $form_array;
|
545 |
+
|
546 |
+
}
|
547 |
+
|
548 |
+
private static function get_poll_radios($form, $lead, $field, $form_array)
|
549 |
+
{
|
550 |
+
|
551 |
+
$id = $field['id'];
|
552 |
+
$results = $lead[$id];
|
553 |
+
$return = array();
|
554 |
+
|
555 |
+
$return = self::get_poll_data($results, $field['choices']);
|
556 |
+
|
557 |
+
/* add data to field tag correctly */
|
558 |
+
$form_array['field'][$field['id'].'.'.$field['label'].'_name'] = $return;
|
559 |
+
|
560 |
+
/* add ID incase want to use template on multiple duplicate forms with different field names */
|
561 |
+
$form_array['field'][$field['id']] = $return;
|
562 |
+
|
563 |
+
return $form_array;
|
564 |
+
|
565 |
+
}
|
566 |
+
|
567 |
+
private static function get_poll_checkbox($field, $values)
|
568 |
+
{
|
569 |
+
foreach($values as $id => $item)
|
570 |
+
{
|
571 |
+
$values[$id] = self::get_poll_data($item, $field['choices']);
|
572 |
+
}
|
573 |
+
return $values;
|
574 |
+
}
|
575 |
+
|
576 |
+
private static function get_poll_data($lookup, $options)
|
577 |
+
{
|
578 |
+
$return = '';
|
579 |
+
|
580 |
+
foreach($options as $choice)
|
581 |
+
{
|
582 |
+
if(trim($choice['value']) == trim($lookup))
|
583 |
+
{
|
584 |
+
$return = $choice['text'];
|
585 |
+
break;
|
586 |
+
}
|
587 |
+
}
|
588 |
+
|
589 |
+
return $return;
|
590 |
+
}
|
591 |
+
|
592 |
+
private static function get_the_rank($form, $lead, $field, $form_array)
|
593 |
+
{
|
594 |
+
$id = $field['id'];
|
595 |
+
$results = explode(',', $lead[$id]);
|
596 |
+
$return = array();
|
597 |
+
|
598 |
+
foreach($results as $rank)
|
599 |
+
{
|
600 |
+
foreach($field['choices'] as $choice)
|
601 |
+
{
|
602 |
+
if(trim($choice['value']) == trim($rank))
|
603 |
+
{
|
604 |
+
$return[] = $choice['text'];
|
605 |
+
break;
|
606 |
+
}
|
607 |
+
}
|
608 |
+
}
|
609 |
+
|
610 |
+
return $return;
|
611 |
+
}
|
612 |
+
|
613 |
+
private static function get_the_likert($form, $lead, $field, $form_array)
|
614 |
+
{
|
615 |
+
$id = $field['id'];
|
616 |
+
$multiple_rows = rgar($field, "gsurveyLikertEnableMultipleRows");
|
617 |
+
|
618 |
+
if(!$multiple_rows)
|
619 |
+
{
|
620 |
+
$results = $lead[$id];
|
621 |
+
}
|
622 |
+
|
623 |
+
$likert = array();
|
624 |
+
|
625 |
+
/* store the column names */
|
626 |
+
foreach($field['choices'] as $col)
|
627 |
+
{
|
628 |
+
$likert['col'][$col['value']] = $col['text'];
|
629 |
+
}
|
630 |
+
|
631 |
+
if(is_array($field['inputs']) && sizeof($field['inputs']) > 0)
|
632 |
+
{
|
633 |
+
/* do our multi-row likert */
|
634 |
+
foreach($field['inputs'] as $row)
|
635 |
+
{
|
636 |
+
/* pad the array with the number of columns */
|
637 |
+
|
638 |
+
foreach($likert['col'] as $col_id => $text)
|
639 |
+
{
|
640 |
+
/*
|
641 |
+
* Results for multi row is stored with ID.ROW# (eg $lead['1.2'])
|
642 |
+
* The number is stored in $row['id']
|
643 |
+
*/
|
644 |
+
$results = $lead[$row['id']];
|
645 |
+
|
646 |
+
/* user data in the $lead comes in as ROW ID:COL ID */
|
647 |
+
$comparison = $row['name'] . ':' . $col_id;
|
648 |
+
|
649 |
+
/* do our comparison and update the output */
|
650 |
+
$output = ($comparison == $results) ? 'selected' : '';
|
651 |
+
|
652 |
+
/* assign our results to the array */
|
653 |
+
$likert['rows'][$row['label']][$text] = $output;
|
654 |
+
|
655 |
+
}
|
656 |
+
}
|
657 |
+
}
|
658 |
+
else
|
659 |
+
{
|
660 |
+
/* do our single row likert */
|
661 |
+
foreach($likert['col'] as $col_id => $text)
|
662 |
+
{
|
663 |
+
/* single row data comes in with col value */
|
664 |
+
/* do our comparison and update the output */
|
665 |
+
$output = ($col_id == $results) ? 'selected' : '';
|
666 |
+
|
667 |
+
$likert['row'][$text] = $output;
|
668 |
+
|
669 |
+
}
|
670 |
+
}
|
671 |
+
|
672 |
+
/*
|
673 |
+
* Check if scoring is enabled and calculate
|
674 |
+
*/
|
675 |
+
if($field['gsurveyLikertEnableScoring'] && class_exists('GFSurvey'))
|
676 |
+
{
|
677 |
+
$survey = GFSurvey::get_instance();
|
678 |
+
$likert['score'] = $survey->get_field_score($field, $lead);
|
679 |
+
}
|
680 |
+
|
681 |
+
return $likert;
|
682 |
+
|
683 |
+
}
|
684 |
+
|
685 |
+
private static function get_form_fields($form)
|
686 |
+
{
|
687 |
+
$fields = array();
|
688 |
+
foreach($form['fields'] as $field)
|
689 |
+
{
|
690 |
+
$fields[$field['id']] = $field;
|
691 |
+
}
|
692 |
+
|
693 |
+
self::$fields = $fields;
|
694 |
+
}
|
695 |
+
|
696 |
+
private static function set_form_array_common($form, $lead, $form_id)
|
697 |
+
{
|
698 |
+
/*
|
699 |
+
* Reorder the $form array as we can access the info by Field ID
|
700 |
+
*/
|
701 |
+
self::get_form_fields($form);
|
702 |
+
|
703 |
+
$form_array = array();
|
704 |
+
|
705 |
+
/*
|
706 |
+
* Add form_id and lead_id
|
707 |
+
*/
|
708 |
+
$form_array['form_id'] = $form_id;
|
709 |
+
$form_array['entry_id'] = $lead['id'];
|
710 |
+
|
711 |
+
/*
|
712 |
+
* Set title and dates (both US and international)
|
713 |
+
*/
|
714 |
+
$form_array['form_title'] = $form['title'];
|
715 |
+
$form_array['form_description'] = (isset($form['description'])) ? $form['description'] : '';
|
716 |
+
$form_array['date_created'] = GFCommon::format_date( $lead['date_created'], false, 'j/n/Y', false);
|
717 |
+
$form_array['date_created_usa'] = GFCommon::format_date( $lead['date_created'], false, 'n/j/Y', false);
|
718 |
+
|
719 |
+
/*
|
720 |
+
* Include page names
|
721 |
+
*/
|
722 |
+
$form_array['pages'] = $form['pagination']['pages'];
|
723 |
+
|
724 |
+
/*
|
725 |
+
* Add misc fields
|
726 |
+
*/
|
727 |
+
$form_array['misc']['date_time'] = GFCommon::format_date( $lead['date_created'], false, 'Y-m-d H:i:s', false);
|
728 |
+
$form_array['misc']['time_24hr'] = GFCommon::format_date( $lead['date_created'], false, 'H:i', false);
|
729 |
+
$form_array['misc']['time_12hr'] = GFCommon::format_date( $lead['date_created'], false, 'g:ia', false);
|
730 |
+
$form_array['misc']['is_starred'] = $lead['is_starred'];
|
731 |
+
$form_array['misc']['is_read'] = $lead['is_read'];
|
732 |
+
$form_array['misc']['ip'] = $lead['ip'];
|
733 |
+
$form_array['misc']['source_url'] = $lead['source_url'];
|
734 |
+
$form_array['misc']['post_id'] = $lead['post_id'];
|
735 |
+
$form_array['misc']['currency'] = $lead['currency'];
|
736 |
+
$form_array['misc']['payment_status'] = $lead['payment_status'];
|
737 |
+
$form_array['misc']['payment_date'] = $lead['payment_date'];
|
738 |
+
$form_array['misc']['transaction_id'] = $lead['transaction_id'];
|
739 |
+
$form_array['misc']['payment_amount'] = $lead['payment_amount'];
|
740 |
+
$form_array['misc']['is_fulfilled'] = $lead['is_fulfilled'];
|
741 |
+
$form_array['misc']['created_by'] = $lead['created_by'];
|
742 |
+
$form_array['misc']['transaction_type'] = $lead['transaction_type'];
|
743 |
+
$form_array['misc']['user_agent'] = $lead['user_agent'];
|
744 |
+
$form_array['misc']['status'] = $lead['status'];
|
745 |
+
|
746 |
+
|
747 |
+
|
748 |
+
/*
|
749 |
+
* Add quiz/survey/poll results
|
750 |
+
*/
|
751 |
+
|
752 |
+
if(class_exists('GFQuiz'))
|
753 |
+
{
|
754 |
+
$form_array = self::get_quiz_results($form_array, $form, $lead);
|
755 |
+
}
|
756 |
+
|
757 |
+
if(class_exists('GFSurvey'))
|
758 |
+
{
|
759 |
+
$form_array = self::get_survey_results($form_array, $form, $lead);
|
760 |
+
}
|
761 |
+
|
762 |
+
if(class_exists('GFPolls'))
|
763 |
+
{
|
764 |
+
$form_array = self::get_poll_results($form_array, $form, $lead);
|
765 |
+
}
|
766 |
+
|
767 |
+
return $form_array;
|
768 |
+
}
|
769 |
+
|
770 |
+
/**
|
771 |
+
* Sniff the form fields and determine if there are any of the $type avaluable
|
772 |
+
* @param string $type the field type we are looking for
|
773 |
+
* @param array $form the form array
|
774 |
+
* @return boolean Whether there is a match or not
|
775 |
+
*/
|
776 |
+
private static function check_for_fields($type, $form)
|
777 |
+
{
|
778 |
+
foreach($form['fields'] as $field)
|
779 |
+
{
|
780 |
+
if($field['type'] == $type)
|
781 |
+
{
|
782 |
+
return true;
|
783 |
+
}
|
784 |
+
}
|
785 |
+
return false;
|
786 |
+
}
|
787 |
+
|
788 |
+
private static function get_poll_results($form_array, $form, $lead)
|
789 |
+
{
|
790 |
+
if(self::check_for_fields('poll', $form) === false)
|
791 |
+
{
|
792 |
+
return $form_array;
|
793 |
+
}
|
794 |
+
|
795 |
+
$fields = self::get_related_fields($form["fields"], 'poll');
|
796 |
+
$poll_results = self::get_addon_global_data($form, array(), $fields);
|
797 |
+
|
798 |
+
$form_fields = self::$fields;
|
799 |
+
|
800 |
+
/*
|
801 |
+
* Convert the array keys into their text counterparts
|
802 |
+
* Loop through the global poll data
|
803 |
+
*/
|
804 |
+
foreach($poll_results['field_data'] as $id => &$choices)
|
805 |
+
{
|
806 |
+
/* get the $field */
|
807 |
+
$field = $form_fields[$id];
|
808 |
+
|
809 |
+
/* add the field name to the ['misc'] key */
|
810 |
+
$choices['misc']['label'] = $field['label'];
|
811 |
+
|
812 |
+
/* loop through the field choices */
|
813 |
+
foreach($field['choices'] as $choice)
|
814 |
+
{
|
815 |
+
$choices = self::replace_key($choices, $choice['value'], $choice['text']);
|
816 |
+
}
|
817 |
+
}
|
818 |
+
|
819 |
+
$form_array['poll']['global'] = $poll_results;
|
820 |
+
|
821 |
+
return $form_array;
|
822 |
+
}
|
823 |
+
|
824 |
+
private static function get_survey_results($form_array, $form, $lead)
|
825 |
+
{
|
826 |
+
if(self::check_for_fields('survey', $form) === false)
|
827 |
+
{
|
828 |
+
return $form_array;
|
829 |
+
}
|
830 |
+
|
831 |
+
/*
|
832 |
+
* If there are any survey results
|
833 |
+
* add them to the 'survey' key
|
834 |
+
*/
|
835 |
+
$fields = GFCommon::get_fields_by_type($form, array('survey'));
|
836 |
+
$count_survey_fields = count($fields);
|
837 |
+
|
838 |
+
if ($count_survey_fields > 0 && isset($lead['gsurvey_score']))
|
839 |
+
{
|
840 |
+
$form_array['survey']['score'] = $lead['gsurvey_score'];
|
841 |
+
}
|
842 |
+
|
843 |
+
$fields = self::get_related_fields($form["fields"], 'survey');
|
844 |
+
$form_array['survey']['global'] = self::get_addon_global_data($form, array(), $fields);
|
845 |
+
$form_fields = self::$fields;
|
846 |
+
|
847 |
+
/*
|
848 |
+
* Convert the array keys into their text counterparts
|
849 |
+
* Loop through the global survey data
|
850 |
+
*/
|
851 |
+
foreach($form_array['survey']['global']['field_data'] as $id => &$choices)
|
852 |
+
{
|
853 |
+
/* get the $field */
|
854 |
+
$field = $form_fields[$id];
|
855 |
+
|
856 |
+
/*
|
857 |
+
* Check if we have a multifield likert and replace the row key
|
858 |
+
*/
|
859 |
+
if(isset($field['gsurveyLikertEnableMultipleRows']) && $field['gsurveyLikertEnableMultipleRows'] == 1)
|
860 |
+
{
|
861 |
+
foreach($field['gsurveyLikertRows'] as $row)
|
862 |
+
{
|
863 |
+
$choices = self::replace_key($choices, $row['value'], $row['text']);
|
864 |
+
}
|
865 |
+
|
866 |
+
foreach($choices as $multi_id => &$multi_choices)
|
867 |
+
{
|
868 |
+
foreach($field['choices'] as $choice)
|
869 |
+
{
|
870 |
+
$multi_choices = self::replace_key($multi_choices, $choice['value'], $choice['text']);
|
871 |
+
}
|
872 |
+
}
|
873 |
+
}
|
874 |
+
|
875 |
+
|
876 |
+
/* replace the standard row data */
|
877 |
+
if(isset($field['choices']) && is_array($field['choices']))
|
878 |
+
{
|
879 |
+
foreach($field['choices'] as $choice)
|
880 |
+
{
|
881 |
+
$choices = self::replace_key($choices, $choice['value'], $choice['text']);
|
882 |
+
}
|
883 |
+
}
|
884 |
+
}
|
885 |
+
|
886 |
+
return $form_array;
|
887 |
+
|
888 |
+
}
|
889 |
+
|
890 |
+
private static function replace_key($array, $key, $text)
|
891 |
+
{
|
892 |
+
if($key != $text && isset($array[$key]))
|
893 |
+
{
|
894 |
+
/* replace the array key with the actual field name */
|
895 |
+
$array[$text] = $array[$key];
|
896 |
+
unset($array[$key]);
|
897 |
+
}
|
898 |
+
return $array;
|
899 |
+
}
|
900 |
+
|
901 |
+
private static function get_quiz_results($form_array, $form, $lead)
|
902 |
+
{
|
903 |
+
|
904 |
+
if(self::check_for_fields('quiz', $form) === false)
|
905 |
+
{
|
906 |
+
return $form_array;
|
907 |
+
}
|
908 |
+
|
909 |
+
/*
|
910 |
+
* If there are any quiz results
|
911 |
+
* add them to the 'quiz' key
|
912 |
+
*/
|
913 |
+
$fields = GFCommon::get_fields_by_type($form, array('quiz'));
|
914 |
+
$count_quiz_fields = count($fields);
|
915 |
+
|
916 |
+
if ($count_quiz_fields > 0)
|
917 |
+
{
|
918 |
+
$form_array['quiz']['config']['grading'] = (isset($form['gravityformsquiz']['grading'])) ? $form['gravityformsquiz']['grading'] : '';
|
919 |
+
$form_array['quiz']['config']['passPercent'] = (isset($form['gravityformsquiz']['passPercent'])) ? $form['gravityformsquiz']['passPercent'] : '';
|
920 |
+
$form_array['quiz']['config']['grades'] = (isset($form['gravityformsquiz']['grades'])) ? $form['gravityformsquiz']['grades'] : '';
|
921 |
+
|
922 |
+
$form_array['quiz']['results']['score'] = rgar($lead, 'gquiz_score');
|
923 |
+
$form_array['quiz']['results']['percent'] = rgar($lead, 'gquiz_percent');
|
924 |
+
$form_array['quiz']['results']['is_pass'] = rgar($lead, 'gquiz_is_pass');
|
925 |
+
$form_array['quiz']['results']['grade'] = rgar($lead, 'gquiz_grade');
|
926 |
+
|
927 |
+
/*
|
928 |
+
* Get the overall results
|
929 |
+
*/
|
930 |
+
|
931 |
+
$quiz_global = self::get_quiz_overalls($form);
|
932 |
+
|
933 |
+
$form_fields = self::$fields;
|
934 |
+
/*
|
935 |
+
* Convert the array keys into their text counterparts
|
936 |
+
* Loop through the global quiz data
|
937 |
+
*/
|
938 |
+
if(empty($quiz_global['field_data']))
|
939 |
+
{
|
940 |
+
$quiz_global['field_data'] = array();
|
941 |
+
}
|
942 |
+
|
943 |
+
foreach($quiz_global['field_data'] as $id => &$choices)
|
944 |
+
{
|
945 |
+
/* get the $field */
|
946 |
+
$field = $form_fields[$id];
|
947 |
+
|
948 |
+
/* replace ['totals'] key with ['misc'] key */
|
949 |
+
$choices = self::replace_key($choices, 'totals', 'misc');
|
950 |
+
|
951 |
+
/* add the field name to the ['misc'] key */
|
952 |
+
$choices['misc']['label'] = $field['label'];
|
953 |
+
|
954 |
+
/* loop through the field choices */
|
955 |
+
foreach($field['choices'] as $choice)
|
956 |
+
{
|
957 |
+
$choices = self::replace_key($choices, $choice['value'], $choice['text']);
|
958 |
+
|
959 |
+
/* check if this is the correct field */
|
960 |
+
if(isset($choice['gquizIsCorrect']) && $choice['gquizIsCorrect'] == 1)
|
961 |
+
{
|
962 |
+
$choices['misc']['correct_option_name'][] = $choice['text'];
|
963 |
+
}
|
964 |
+
|
965 |
+
}
|
966 |
+
}
|
967 |
+
|
968 |
+
$form_array['quiz']['global'] = $quiz_global;
|
969 |
+
//$form_array['quiz']['global'] = self::get_quiz_overalls($form);
|
970 |
+
|
971 |
+
}
|
972 |
+
|
973 |
+
return $form_array;
|
974 |
+
}
|
975 |
+
|
976 |
+
private static function get_addon_global_data($form, $options, $fields)
|
977 |
+
{
|
978 |
+
/* if the results class isn't loaded, load it */
|
979 |
+
if (!class_exists("GFResults"))
|
980 |
+
{
|
981 |
+
require_once(GFCommon::get_base_path() . "/includes/addon/class-gf-results.php");
|
982 |
+
}
|
983 |
+
|
984 |
+
$form_id = $form['id'];
|
985 |
+
|
986 |
+
/* add form filter to keep in line with GF standard */
|
987 |
+
$form = apply_filters( "gform_form_pre_results_$form_id", apply_filters( 'gform_form_pre_results', $form ) );
|
988 |
+
|
989 |
+
/* initiat the results class */
|
990 |
+
$gf_results = new GFResults('', $options);
|
991 |
+
|
992 |
+
/* ensure that only active leads are queried */
|
993 |
+
$search = array(
|
994 |
+
'field_filters' => array('mode' => ''),
|
995 |
+
'status' => 'active'
|
996 |
+
);
|
997 |
+
|
998 |
+
/* get the results */
|
999 |
+
$data = $gf_results->get_results_data($form, $fields, $search);
|
1000 |
+
|
1001 |
+
/* unset some array keys we don't need */
|
1002 |
+
unset($data['status']);
|
1003 |
+
unset($data['timestamp']);
|
1004 |
+
|
1005 |
+
return $data;
|
1006 |
+
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
/**
|
1010 |
+
* Gravity Forms is throwing notices when accessing get_results_data()
|
1011 |
+
* due to poor validation. To fix this we'll unset the 'choices' array key
|
1012 |
+
* if it is not an array (the expected input for this function)
|
1013 |
+
* @param Array $fields The fields array
|
1014 |
+
* @return Array The processed fields array
|
1015 |
+
*/
|
1016 |
+
private static function get_related_fields($fields, $type)
|
1017 |
+
{
|
1018 |
+
foreach($fields as $id => $field)
|
1019 |
+
{
|
1020 |
+
if($field['type'] !== $type)
|
1021 |
+
{
|
1022 |
+
unset($fields[$id]);
|
1023 |
+
continue;
|
1024 |
+
}
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
return $fields;
|
1028 |
+
}
|
1029 |
+
|
1030 |
+
private static function get_quiz_overalls($form)
|
1031 |
+
{
|
1032 |
+
/* we need to tap into functions GF Quiz has so only run if it is active */
|
1033 |
+
if(class_exists('GFQuiz'))
|
1034 |
+
{
|
1035 |
+
/* GFQuiz is a singleton. Get the instance */
|
1036 |
+
$quiz = GFQuiz::get_instance();
|
1037 |
+
|
1038 |
+
/* create our callback to add additional data to the array specific to the quiz plugin */
|
1039 |
+
$options['callbacks']['calculation'] = array(
|
1040 |
+
$quiz,
|
1041 |
+
'results_calculation'
|
1042 |
+
);
|
1043 |
+
|
1044 |
+
$fields = self::get_related_fields($form["fields"], 'quiz');
|
1045 |
+
|
1046 |
+
$quiz_results = self::get_addon_global_data($form, $options, $fields);
|
1047 |
+
|
1048 |
+
return $quiz_results;
|
1049 |
+
}
|
1050 |
+
|
1051 |
+
return array(__('Activate Gravity Forms Quiz Add On to see global quiz statistics for this form', 'pdfextended'));
|
1052 |
+
}
|
1053 |
+
|
1054 |
+
private static function get_html($field, $form_array)
|
1055 |
+
{
|
1056 |
+
if(isset($field['content']))
|
1057 |
+
{
|
1058 |
+
$form_array['html'][] = wpautop($field['content']);
|
1059 |
+
$form_array['html_id'][$field['id']] = wpautop($field['content']);
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
return $form_array;
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
private static function get_signature($form, $lead, $field, $form_array)
|
1066 |
+
{
|
1067 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
1068 |
+
$http_folder = RGFormsModel::get_upload_url_root(). 'signatures/';
|
1069 |
+
$server_folder = RGFormsModel::get_upload_root() . 'signatures/';
|
1070 |
+
$file = $server_folder.$value;
|
1071 |
+
$sig_html = '';
|
1072 |
+
|
1073 |
+
/*
|
1074 |
+
* Set defaults is we cannot find the images
|
1075 |
+
*/
|
1076 |
+
$width = 75;
|
1077 |
+
$height = 45;
|
1078 |
+
|
1079 |
+
/*
|
1080 |
+
* Only get sane defaults specific to the image if we can find it.
|
1081 |
+
*/
|
1082 |
+
if(file_exists($file) !== false && is_dir($file) !== true)
|
1083 |
+
{
|
1084 |
+
$image_size = getimagesize($file);
|
1085 |
+
$width = $image_size[0] / 4;
|
1086 |
+
$height = $image_size[1] / 4;
|
1087 |
+
$sig_html = '<img src="'. $server_folder.$value .'" alt="Signature" width="'. $width .'" height="'. $height .'" />';
|
1088 |
+
}
|
1089 |
+
|
1090 |
+
/*
|
1091 |
+
* Include the image details
|
1092 |
+
*/
|
1093 |
+
|
1094 |
+
|
1095 |
+
$form_array['signature'][] = $sig_html;
|
1096 |
+
$form_array['signature_details'][] = array(
|
1097 |
+
'img' => $sig_html,
|
1098 |
+
'path' => $file,
|
1099 |
+
'url' => $http_folder.$value,
|
1100 |
+
'width' => $width,
|
1101 |
+
'height' => $height,
|
1102 |
+
);
|
1103 |
+
|
1104 |
+
$form_array['signature_details_id'][$field['id']] = array(
|
1105 |
+
'img' => $sig_html,
|
1106 |
+
'path' => $file,
|
1107 |
+
'url' => $http_folder.$value,
|
1108 |
+
'width' => $width,
|
1109 |
+
'height' => $height,
|
1110 |
+
);
|
1111 |
+
|
1112 |
+
|
1113 |
+
return $form_array;
|
1114 |
+
}
|
1115 |
+
|
1116 |
+
private static function get_fileupload($form, $lead, $field, $form_array)
|
1117 |
+
{
|
1118 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
1119 |
+
$display = self::get_lead_field_display($field, $value, $lead['currency']);
|
1120 |
+
|
1121 |
+
/*
|
1122 |
+
* Get the absolute path to the upload
|
1123 |
+
*/
|
1124 |
+
$path = str_replace(home_url().'/', ABSPATH, $display);
|
1125 |
+
|
1126 |
+
/* add path */
|
1127 |
+
$form_array['field'][$field['id'].'_path'] = $path;
|
1128 |
+
$form_array['field'][$field['id'].'.'.$field['label'].'_path'] = $path;
|
1129 |
+
|
1130 |
+
return self::assign_form($field, $display, $form_array);
|
1131 |
+
}
|
1132 |
+
|
1133 |
+
private static function get_default_list($lead, $field, $form_array)
|
1134 |
+
{
|
1135 |
+
$value = self::remove_empty_list_rows(unserialize(RGFormsModel::get_lead_field_value($lead, $field)));
|
1136 |
+
$form_array['list'][$field['id']] = $value;
|
1137 |
+
|
1138 |
+
return $form_array;
|
1139 |
+
}
|
1140 |
+
|
1141 |
+
private static function remove_empty_list_rows($list)
|
1142 |
+
{
|
1143 |
+
/*
|
1144 |
+
* Check if there are any values in the list
|
1145 |
+
*/
|
1146 |
+
if(!is_array($list) || sizeof($list) == 0)
|
1147 |
+
{
|
1148 |
+
return $list;
|
1149 |
+
}
|
1150 |
+
|
1151 |
+
/*
|
1152 |
+
* Check if it's a multi column list
|
1153 |
+
*/
|
1154 |
+
if(!is_array($list[0]))
|
1155 |
+
{
|
1156 |
+
$list = array_filter($list);
|
1157 |
+
}
|
1158 |
+
else
|
1159 |
+
{
|
1160 |
+
$list = self::remove_empty_multi_col_list($list);
|
1161 |
+
}
|
1162 |
+
|
1163 |
+
return $list;
|
1164 |
+
}
|
1165 |
+
|
1166 |
+
private static function remove_empty_multi_col_list($list)
|
1167 |
+
{
|
1168 |
+
foreach($list as $id => $row)
|
1169 |
+
{
|
1170 |
+
|
1171 |
+
$empty = true;
|
1172 |
+
foreach($row as &$col)
|
1173 |
+
{
|
1174 |
+
/* check if there is data and if so break the loop */
|
1175 |
+
if(trim(strlen($col) > 0))
|
1176 |
+
{
|
1177 |
+
$empty = false;
|
1178 |
+
break;
|
1179 |
+
}
|
1180 |
+
}
|
1181 |
+
|
1182 |
+
/* remove row from list */
|
1183 |
+
if($empty)
|
1184 |
+
{
|
1185 |
+
unset($list[$id]);
|
1186 |
+
}
|
1187 |
+
}
|
1188 |
+
|
1189 |
+
return $list;
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
private static function get_the_list($lead, $field, $form_array)
|
1193 |
+
{
|
1194 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
1195 |
+
$display = self::get_lead_field_display($field, $value, $lead['currency']);
|
1196 |
+
|
1197 |
+
$form_array = self::assign_form($field, $display, $form_array);
|
1198 |
+
|
1199 |
+
/*
|
1200 |
+
* Include these items correct names
|
1201 |
+
*/
|
1202 |
+
$display = self::get_lead_field_display($field, $value, $lead['currency'], true);
|
1203 |
+
/* add data to field tag correctly */
|
1204 |
+
$form_array['field'][$field['id'].'.'.$field['label'].'_name'] = $display;
|
1205 |
+
|
1206 |
+
/* add ID incase want to use template on multiple duplicate forms with different field names */
|
1207 |
+
$form_array['field'][$field['id'].'_name'] = $display;
|
1208 |
+
|
1209 |
+
/* keep backwards compatibility */
|
1210 |
+
$form_array['field'][$field['label'].'_name'] = $display;
|
1211 |
+
|
1212 |
+
return $form_array;
|
1213 |
+
}
|
1214 |
+
|
1215 |
+
private static function get_defaults($lead, $field, $form_array)
|
1216 |
+
{
|
1217 |
+
$value = RGFormsModel::get_lead_field_value($lead, $field);
|
1218 |
+
$display = self::get_lead_field_display($field, $value, $lead['currency']);
|
1219 |
+
|
1220 |
+
return self::assign_form($field, $display, $form_array);
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
private static function assign_form($field, $display, $form_array)
|
1224 |
+
{
|
1225 |
+
/* add data to field tag correctly */
|
1226 |
+
$form_array['field'][$field['id'].'.'.$field['label']] = $display;
|
1227 |
+
|
1228 |
+
/* add ID incase want to use template on multiple duplicate forms with different field names */
|
1229 |
+
$form_array['field'][$field['id']] = $display;
|
1230 |
+
|
1231 |
+
/* keep backwards compatibility */
|
1232 |
+
$form_array['field'][$field['label']] = $display;
|
1233 |
+
|
1234 |
+
return $form_array;
|
1235 |
+
}
|
1236 |
+
|
1237 |
+
private static function get_product_array($form, $lead, $has_product_fields, $form_array)
|
1238 |
+
{
|
1239 |
+
$currency_type = (method_exists('GFCommon', 'is_currency_decimal_dot')) ? GFCommon::is_currency_decimal_dot() : PDF_Common::is_currency_decimal_dot();
|
1240 |
+
$currency_format = $currency_type ? 'decimal_dot' : 'decimal_comma';
|
1241 |
+
|
1242 |
+
if($has_product_fields) {
|
1243 |
+
$products = GFCommon::get_product_fields($form, $lead, true);
|
1244 |
+
|
1245 |
+
/* check that there are actual product fields */
|
1246 |
+
if(sizeof($products['products']) > 0 )
|
1247 |
+
{
|
1248 |
+
|
1249 |
+
/*
|
1250 |
+
* Set up our variables
|
1251 |
+
*/
|
1252 |
+
$total = 0;
|
1253 |
+
$subtotal = 0;
|
1254 |
+
|
1255 |
+
foreach($products['products'] as $id => $product) {
|
1256 |
+
$price = GFCommon::to_number($product['price']);
|
1257 |
+
|
1258 |
+
/* add all options to total price */
|
1259 |
+
if(is_array(rgar($product,'options')))
|
1260 |
+
{
|
1261 |
+
foreach($product['options'] as $option){
|
1262 |
+
$price += GFCommon::to_number($option['price']);
|
1263 |
+
}
|
1264 |
+
}
|
1265 |
+
|
1266 |
+
/* calculate subtotal */
|
1267 |
+
$subtotal = floatval($product['quantity']) * $price;
|
1268 |
+
$total += $subtotal;
|
1269 |
+
|
1270 |
+
/*
|
1271 |
+
* Check if we should include options
|
1272 |
+
*/
|
1273 |
+
$options = isset($product['options']) ? $product['options'] : array();
|
1274 |
+
|
1275 |
+
/*
|
1276 |
+
* Add formated price for each product option
|
1277 |
+
*/
|
1278 |
+
foreach($options as &$o)
|
1279 |
+
{
|
1280 |
+
if(is_numeric($o['price']))
|
1281 |
+
{
|
1282 |
+
$o['price_formatted'] = GFCommon::format_number($o['price'], 'currency');
|
1283 |
+
}
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
/*
|
1287 |
+
* Store product in $form_array array
|
1288 |
+
*/
|
1289 |
+
$form_array['products'][$id] = array(
|
1290 |
+
'name' => esc_html($product['name']),
|
1291 |
+
'price' => esc_html($product['price']),
|
1292 |
+
'price_unformatted' => GFCommon::clean_number($product['price'], $currency_format),
|
1293 |
+
'options' => $options,
|
1294 |
+
'quantity' => $product['quantity'],
|
1295 |
+
'subtotal' => $subtotal,
|
1296 |
+
'subtotal_formatted' => GFCommon::format_number($subtotal, 'currency'));
|
1297 |
+
}
|
1298 |
+
|
1299 |
+
/* Increment total */
|
1300 |
+
$total += floatval($products['shipping']['price']);
|
1301 |
+
$subtotal = $total - floatval($products['shipping']['price']);
|
1302 |
+
|
1303 |
+
/* add totals to form data */
|
1304 |
+
$form_array['products_totals'] = array(
|
1305 |
+
'subtotal' => $subtotal,
|
1306 |
+
'shipping' => $products['shipping']['price'],
|
1307 |
+
'total' => $total,
|
1308 |
+
'shipping_formatted' => GFCommon::format_number($products['shipping']['price'], 'currency'),
|
1309 |
+
'subtotal_formatted' => GFCommon::format_number($subtotal, 'currency'),
|
1310 |
+
'total_formatted' => GFCommon::format_number($total, 'currency'),
|
1311 |
+
);
|
1312 |
+
}
|
1313 |
+
}
|
1314 |
+
|
1315 |
+
return $form_array;
|
1316 |
+
}
|
1317 |
+
|
1318 |
+
public static function get_lead_field_display($field, $value, $currency='', $use_text=false, $format='html', $media='screen'){
|
1319 |
+
|
1320 |
+
if($field['type'] == 'post_category')
|
1321 |
+
$value = GFCommon::prepare_post_category_value($value, $field);
|
1322 |
+
|
1323 |
+
switch(RGFormsModel::get_input_type($field)){
|
1324 |
+
case 'name' :
|
1325 |
+
if(is_array($value)){
|
1326 |
+
$prefix = trim(rgget($field['id'] . '.2', $value));
|
1327 |
+
$first = trim(rgget($field['id'] . '.3', $value));
|
1328 |
+
$middle = trim(rgget($field['id'] . '.4', $value));
|
1329 |
+
$last = trim(rgget($field['id'] . '.6', $value));
|
1330 |
+
$suffix = trim(rgget($field['id'] . '.8', $value));
|
1331 |
+
|
1332 |
+
return array('prefix' => $prefix, 'first' => $first, 'middle' => $middle, 'last' => $last, 'suffix' => $suffix);
|
1333 |
+
}
|
1334 |
+
else{
|
1335 |
+
return $value;
|
1336 |
+
}
|
1337 |
+
|
1338 |
+
break;
|
1339 |
+
case 'creditcard' :
|
1340 |
+
if(is_array($value)){
|
1341 |
+
$card_number = trim(rgget($field['id'] . '.1', $value));
|
1342 |
+
$card_type = trim(rgget($field['id'] . '.4', $value));
|
1343 |
+
return array('card_number' => $card_number, 'card_type' => $card_type);
|
1344 |
+
}
|
1345 |
+
else{
|
1346 |
+
return '';
|
1347 |
+
}
|
1348 |
+
break;
|
1349 |
+
|
1350 |
+
case 'address' :
|
1351 |
+
if(is_array($value)){
|
1352 |
+
$street_value = trim(rgget($field['id'] . '.1', $value));
|
1353 |
+
$street2_value = trim(rgget($field['id'] . '.2', $value));
|
1354 |
+
$city_value = trim(rgget($field['id'] . '.3', $value));
|
1355 |
+
$state_value = trim(rgget($field['id'] . '.4', $value));
|
1356 |
+
$zip_value = trim(rgget($field['id'] . '.5', $value));
|
1357 |
+
$country_value = trim(rgget($field['id'] . '.6', $value));
|
1358 |
+
|
1359 |
+
$line_break = $format == 'html' ? '<br />' : '\n';
|
1360 |
+
|
1361 |
+
$address_display_format = apply_filters('gform_address_display_format', 'default');
|
1362 |
+
|
1363 |
+
$address['street'] = $street_value;
|
1364 |
+
$address['street2'] = $street2_value;
|
1365 |
+
$address['city'] = $city_value;
|
1366 |
+
$address['state'] = $state_value;
|
1367 |
+
$address['zip'] = $zip_value;
|
1368 |
+
$address['country'] = $country_value;
|
1369 |
+
|
1370 |
+
return $address;
|
1371 |
+
}
|
1372 |
+
else{
|
1373 |
+
return '';
|
1374 |
+
}
|
1375 |
+
break;
|
1376 |
+
|
1377 |
+
case 'email' :
|
1378 |
+
return GFCommon::is_valid_email($value) && $format == 'html' ? $value : $value;
|
1379 |
+
break;
|
1380 |
+
|
1381 |
+
case 'website' :
|
1382 |
+
return GFCommon::is_valid_url($value) && $format == 'html' ? $value : $value;
|
1383 |
+
break;
|
1384 |
+
|
1385 |
+
case 'checkbox' :
|
1386 |
+
if(is_array($value)){
|
1387 |
+
|
1388 |
+
$items = array();
|
1389 |
+
|
1390 |
+
foreach($value as $key => $item){
|
1391 |
+
if(!empty($item)) {
|
1392 |
+
if($field['type'] == 'poll' || $field['type'] == 'survey')
|
1393 |
+
{
|
1394 |
+
/*
|
1395 |
+
* Convert our poll type
|
1396 |
+
*/
|
1397 |
+
$items[] = self::get_poll_checkbox($field, $value);
|
1398 |
+
return $items;
|
1399 |
+
}
|
1400 |
+
|
1401 |
+
switch($format){
|
1402 |
+
case 'text' :
|
1403 |
+
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
1404 |
+
break;
|
1405 |
+
|
1406 |
+
default:
|
1407 |
+
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
1408 |
+
break;
|
1409 |
+
}
|
1410 |
+
}
|
1411 |
+
}
|
1412 |
+
if(empty($items)){
|
1413 |
+
return '';
|
1414 |
+
}
|
1415 |
+
else if($format == 'text'){
|
1416 |
+
/*return substr($items, 0, strlen($items)-2); //removing last comma*/
|
1417 |
+
}
|
1418 |
+
else{
|
1419 |
+
return $items;
|
1420 |
+
}
|
1421 |
+
}
|
1422 |
+
else{
|
1423 |
+
return $value;
|
1424 |
+
}
|
1425 |
+
break;
|
1426 |
+
|
1427 |
+
case 'post_image' :
|
1428 |
+
$ary = explode('|:|', $value);
|
1429 |
+
$url = count($ary) > 0 ? $ary[0] : '';
|
1430 |
+
$title = count($ary) > 1 ? $ary[1] : '';
|
1431 |
+
$caption = count($ary) > 2 ? $ary[2] : '';
|
1432 |
+
$description = count($ary) > 3 ? $ary[3] : '';
|
1433 |
+
|
1434 |
+
if(!empty($url)){
|
1435 |
+
$url = str_replace(' ', '%20', $url);
|
1436 |
+
|
1437 |
+
$value = array('url' => $url,
|
1438 |
+
'path' => str_replace(site_url().'/', ABSPATH, $url),
|
1439 |
+
'title' => $title,
|
1440 |
+
'caption' => $caption,
|
1441 |
+
'description' => $description);
|
1442 |
+
}
|
1443 |
+
return $value;
|
1444 |
+
|
1445 |
+
case 'fileupload' :
|
1446 |
+
$output_arr = array();
|
1447 |
+
if(!empty($value)){
|
1448 |
+
$file_paths = rgar($field,'multipleFiles') ? json_decode($value) : array($value);
|
1449 |
+
foreach($file_paths as $file_path){
|
1450 |
+
$info = pathinfo($file_path);
|
1451 |
+
$file_path = esc_attr(str_replace(' ', '%20', $file_path));
|
1452 |
+
$output_arr[] = $file_path;
|
1453 |
+
}
|
1454 |
+
$output = join(PHP_EOL, $output_arr);
|
1455 |
+
}
|
1456 |
+
return $output_arr;
|
1457 |
+
break;
|
1458 |
+
|
1459 |
+
case 'date' :
|
1460 |
+
return GFCommon::date_display($value, rgar($field, 'dateFormat'));
|
1461 |
+
break;
|
1462 |
+
|
1463 |
+
case 'radio' :
|
1464 |
+
case 'select' :
|
1465 |
+
return GFCommon::selection_display($value, $field, $currency, $use_text);
|
1466 |
+
break;
|
1467 |
+
|
1468 |
+
case 'multiselect' :
|
1469 |
+
if(empty($value) || $format == 'text')
|
1470 |
+
return $value;
|
1471 |
+
|
1472 |
+
if(!is_array($value))
|
1473 |
+
{
|
1474 |
+
$value = explode(',', $value);
|
1475 |
+
}
|
1476 |
+
|
1477 |
+
$items = '';
|
1478 |
+
foreach($value as $item){
|
1479 |
+
$items[] = GFCommon::selection_display($item, $field, $currency, $use_text);
|
1480 |
+
}
|
1481 |
+
|
1482 |
+
if(sizeof($items) == 1)
|
1483 |
+
{
|
1484 |
+
return $items[0];
|
1485 |
+
}
|
1486 |
+
return $items;
|
1487 |
+
|
1488 |
+
|
1489 |
+
break;
|
1490 |
+
|
1491 |
+
case 'calculation' :
|
1492 |
+
case 'singleproduct' :
|
1493 |
+
if(is_array($value)){
|
1494 |
+
$product_name = trim($value[$field['id'] . '.1']);
|
1495 |
+
$price = trim($value[$field['id'] . '.2']);
|
1496 |
+
$quantity = trim($value[$field['id'] . '.3']);
|
1497 |
+
|
1498 |
+
$product = $product_name . ', ' . __('Qty: ', 'gravityforms') . $quantity . ', ' . __('Price: ', 'gravityforms') . $price;
|
1499 |
+
|
1500 |
+
return $product;
|
1501 |
+
}
|
1502 |
+
else{
|
1503 |
+
return '';
|
1504 |
+
}
|
1505 |
+
break;
|
1506 |
+
|
1507 |
+
case 'number' :
|
1508 |
+
return GFCommon::format_number($value, rgar($field, 'numberFormat'));
|
1509 |
+
break;
|
1510 |
+
|
1511 |
+
case 'singleshipping' :
|
1512 |
+
case 'donation' :
|
1513 |
+
case 'total' :
|
1514 |
+
case 'price' :
|
1515 |
+
return GFCommon::to_money($value, $currency);
|
1516 |
+
|
1517 |
+
case 'list' :
|
1518 |
+
if(empty($value))
|
1519 |
+
return '';
|
1520 |
+
$value = unserialize($value);
|
1521 |
+
|
1522 |
+
$has_columns = is_array($value[0]);
|
1523 |
+
|
1524 |
+
if(!$has_columns){
|
1525 |
+
$items = array();
|
1526 |
+
foreach($value as $key => $item){
|
1527 |
+
if(!empty($item)){
|
1528 |
+
switch($format){
|
1529 |
+
case 'text' :
|
1530 |
+
$items[] = $item;
|
1531 |
+
break;
|
1532 |
+
case 'url' :
|
1533 |
+
$items[] = $item;
|
1534 |
+
break;
|
1535 |
+
default :
|
1536 |
+
if($media == 'email'){
|
1537 |
+
$items[] = $item;
|
1538 |
+
}
|
1539 |
+
else{
|
1540 |
+
$items[] = $item;
|
1541 |
+
}
|
1542 |
+
break;
|
1543 |
+
}
|
1544 |
+
}
|
1545 |
+
}
|
1546 |
+
|
1547 |
+
if(empty($items)){
|
1548 |
+
return '';
|
1549 |
+
}
|
1550 |
+
else if($format == 'text'){
|
1551 |
+
/* return substr($items, 0, strlen($items)-2); //removing last comma*/
|
1552 |
+
return $items;
|
1553 |
+
}
|
1554 |
+
else if($format == 'url'){
|
1555 |
+
/*return substr($items, 0, strlen($items)-1); //removing last comma*/
|
1556 |
+
return $items;
|
1557 |
+
}
|
1558 |
+
else if($media == 'email'){
|
1559 |
+
return $items;
|
1560 |
+
}
|
1561 |
+
else {
|
1562 |
+
$list = '<table autosize="1" class="gfield_list" style="border-top: 1px solid #DFDFDF; border-left: 1px solid #DFDFDF; border-spacing: 0; padding: 0; margin: 2px 0 6px; width: 100%">';
|
1563 |
+
foreach($items as $i)
|
1564 |
+
{
|
1565 |
+
$list .= '<tr><td>' . $i .'</td></tr>';
|
1566 |
+
}
|
1567 |
+
$list .= '</table>';
|
1568 |
+
|
1569 |
+
return $list;
|
1570 |
+
}
|
1571 |
+
}
|
1572 |
+
else if(is_array($value)){
|
1573 |
+
$columns = array_keys($value[0]);
|
1574 |
+
|
1575 |
+
$list = '';
|
1576 |
+
|
1577 |
+
switch($format){
|
1578 |
+
case 'text' :
|
1579 |
+
$is_first_row = true;
|
1580 |
+
foreach($value as $item){
|
1581 |
+
if(!$is_first_row)
|
1582 |
+
$list .= '\n\n' . $field['label'] . ': ';
|
1583 |
+
$list .= implode(',', array_values($item));
|
1584 |
+
|
1585 |
+
$is_first_row = false;
|
1586 |
+
}
|
1587 |
+
break;
|
1588 |
+
|
1589 |
+
case 'url' :
|
1590 |
+
foreach($value as $item){
|
1591 |
+
$list .= implode('|', array_values($item)) . ',';
|
1592 |
+
}
|
1593 |
+
if(!empty($list))
|
1594 |
+
$list = substr($list, 0, strlen($list)-1);
|
1595 |
+
break;
|
1596 |
+
|
1597 |
+
default :
|
1598 |
+
|
1599 |
+
if($media == 'email'){
|
1600 |
+
$list = '<table autosize="1" class="gfield_list" style="border-top: 1px solid #DFDFDF; border-left: 1px solid #DFDFDF; border-spacing: 0; padding: 0; margin: 2px 0 6px; width: 100%"><thead><tr>';
|
1601 |
+
|
1602 |
+
//reading columns from entry data
|
1603 |
+
foreach($columns as $column){
|
1604 |
+
$list .= '<th style="background-image: none; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; padding: 6px 10px; font-family: sans-serif; font-size: 12px; font-weight: bold; background-color: #F1F1F1; color:#333; text-align:left">" . esc_html($column) . "</th>';
|
1605 |
+
}
|
1606 |
+
$list .= '</tr></thead>';
|
1607 |
+
|
1608 |
+
$list .= '<tbody style="background-color: #F9F9F9">';
|
1609 |
+
foreach($value as $item){
|
1610 |
+
$list .= '<tr>';
|
1611 |
+
foreach($columns as $column){
|
1612 |
+
$val = rgar($item, $column);
|
1613 |
+
$list .= '<td style="padding: 6px 10px; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; border-top: 1px solid #FFF; font-family: sans-serif; font-size:12px;">{$val}</td>';
|
1614 |
+
}
|
1615 |
+
|
1616 |
+
$list .='</tr>';
|
1617 |
+
}
|
1618 |
+
|
1619 |
+
$list .='</tbody></table>';
|
1620 |
+
}
|
1621 |
+
else{
|
1622 |
+
$list = '<table class="gfield_list" autosize="1"><thead><tr>';
|
1623 |
+
|
1624 |
+
//reading columns from entry data
|
1625 |
+
foreach($columns as $column){
|
1626 |
+
$list .= '<th>' . esc_html($column) . '</th>';
|
1627 |
+
}
|
1628 |
+
$list .= '</tr></thead>';
|
1629 |
+
|
1630 |
+
$list .= '<tbody>';
|
1631 |
+
foreach($value as $item){
|
1632 |
+
$list .= '<tr>';
|
1633 |
+
foreach($columns as $column){
|
1634 |
+
$val = rgar($item, $column);
|
1635 |
+
$list .= '<td>'.htmlspecialchars($val).'</td>';
|
1636 |
+
}
|
1637 |
+
|
1638 |
+
$list .='</tr>';
|
1639 |
+
}
|
1640 |
+
|
1641 |
+
$list .='</tbody></table>';
|
1642 |
+
}
|
1643 |
+
break;
|
1644 |
+
}
|
1645 |
+
|
1646 |
+
return $list;
|
1647 |
+
}
|
1648 |
+
return '';
|
1649 |
+
break;
|
1650 |
+
|
1651 |
+
default :
|
1652 |
+
if (!is_array($value))
|
1653 |
+
{
|
1654 |
+
return nl2br($value);
|
1655 |
+
}
|
1656 |
+
break;
|
1657 |
+
}
|
1658 |
+
}
|
1659 |
+
|
1660 |
+
public static function pdf_get_lead_field_display($field, $value, $currency='', $use_text=false, $format='html', $media='screen'){
|
1661 |
+
|
1662 |
+
if($field['type'] == 'post_category')
|
1663 |
+
$value = GFCommon::prepare_post_category_value($value, $field);
|
1664 |
+
|
1665 |
+
switch(RGFormsModel::get_input_type($field)){
|
1666 |
+
case 'name' :
|
1667 |
+
if(is_array($value)){
|
1668 |
+
$prefix = trim(rgget($field['id'] . '.2', $value));
|
1669 |
+
$first = trim(rgget($field['id'] . '.3', $value));
|
1670 |
+
$middle = trim(rgget($field['id'] . '.4', $value));
|
1671 |
+
$last = trim(rgget($field['id'] . '.6', $value));
|
1672 |
+
$suffix = trim(rgget($field['id'] . '.8', $value));
|
1673 |
+
|
1674 |
+
$name = $prefix;
|
1675 |
+
$name .= !empty($name) && !empty($first) ? " $first" : $first;
|
1676 |
+
$name .= !empty($name) && !empty($middle) ? " $middle" : $middle;
|
1677 |
+
$name .= !empty($name) && !empty($last) ? " $last" : $last;
|
1678 |
+
$name .= !empty($name) && !empty($suffix) ? " $suffix" : $suffix;
|
1679 |
+
|
1680 |
+
return $name;
|
1681 |
+
}
|
1682 |
+
else{
|
1683 |
+
return $value;
|
1684 |
+
}
|
1685 |
+
|
1686 |
+
break;
|
1687 |
+
case 'creditcard' :
|
1688 |
+
if(is_array($value)){
|
1689 |
+
$card_number = trim(rgget($field['id'] . '.1', $value));
|
1690 |
+
$card_type = trim(rgget($field['id'] . '.4', $value));
|
1691 |
+
$separator = $format == 'html' ? '<br/>' : '\n';
|
1692 |
+
return empty($card_number) ? '' : $card_type . $separator . $card_number;
|
1693 |
+
}
|
1694 |
+
else{
|
1695 |
+
return '';
|
1696 |
+
}
|
1697 |
+
break;
|
1698 |
+
|
1699 |
+
case 'address' :
|
1700 |
+
if(is_array($value)){
|
1701 |
+
$street_value = trim(rgget($field['id'] . '.1', $value));
|
1702 |
+
$street2_value = trim(rgget($field['id'] . '.2', $value));
|
1703 |
+
$city_value = trim(rgget($field['id'] . '.3', $value));
|
1704 |
+
$state_value = trim(rgget($field['id'] . '.4', $value));
|
1705 |
+
$zip_value = trim(rgget($field['id'] . '.5', $value));
|
1706 |
+
$country_value = trim(rgget($field['id'] . '.6', $value));
|
1707 |
+
|
1708 |
+
$line_break = $format == 'html' ? '<br />' : '\n';
|
1709 |
+
|
1710 |
+
$address_display_format = apply_filters('gform_address_display_format', 'default');
|
1711 |
+
if($address_display_format == 'zip_before_city'){
|
1712 |
+
/*
|
1713 |
+
Sample:
|
1714 |
+
3333 Some Street
|
1715 |
+
suite 16
|
1716 |
+
2344 City, State
|
1717 |
+
Country
|
1718 |
+
*/
|
1719 |
+
|
1720 |
+
$addr_ary = array();
|
1721 |
+
$addr_ary[] = $street_value;
|
1722 |
+
|
1723 |
+
if(!empty($street2_value))
|
1724 |
+
$addr_ary[] = $street2_value;
|
1725 |
+
|
1726 |
+
$zip_line = trim($zip_value . ' ' . $city_value);
|
1727 |
+
$zip_line .= !empty($zip_line) && !empty($state_value) ? ", {$state_value}" : $state_value;
|
1728 |
+
$zip_line = trim($zip_line);
|
1729 |
+
if(!empty($zip_line))
|
1730 |
+
$addr_ary[] = $zip_line;
|
1731 |
+
|
1732 |
+
if(!empty($country_value))
|
1733 |
+
$addr_ary[] = $country_value;
|
1734 |
+
|
1735 |
+
$address = implode('<br />', $addr_ary);
|
1736 |
+
|
1737 |
+
}
|
1738 |
+
else{
|
1739 |
+
$address = $street_value;
|
1740 |
+
$address .= !empty($address) && !empty($street2_value) ? $line_break . $street2_value : $street2_value;
|
1741 |
+
$address .= !empty($address) && (!empty($city_value) || !empty($state_value)) ? $line_break. $city_value : $city_value;
|
1742 |
+
$address .= !empty($address) && !empty($city_value) && !empty($state_value) ? ", $state_value" : $state_value;
|
1743 |
+
$address .= !empty($address) && !empty($zip_value) ? " $zip_value" : $zip_value;
|
1744 |
+
$address .= !empty($address) && !empty($country_value) ? $line_break . $country_value : $country_value;
|
1745 |
+
}
|
1746 |
+
|
1747 |
+
return $address;
|
1748 |
+
}
|
1749 |
+
else{
|
1750 |
+
return '';
|
1751 |
+
}
|
1752 |
+
break;
|
1753 |
+
|
1754 |
+
case 'email' :
|
1755 |
+
return GFCommon::is_valid_email($value) && $format == 'html' ? '<a href="mailto:'. $value .'">'. $value .'</a>' : $value;
|
1756 |
+
break;
|
1757 |
+
|
1758 |
+
case 'website' :
|
1759 |
+
return GFCommon::is_valid_url($value) && $format == 'html' ? '<a href="'. $value .'" target="_blank">'. $value .'</a>' : $value;
|
1760 |
+
break;
|
1761 |
+
|
1762 |
+
case 'checkbox' :
|
1763 |
+
if(is_array($value)){
|
1764 |
+
|
1765 |
+
$items = '';
|
1766 |
+
|
1767 |
+
foreach($value as $key => $item){
|
1768 |
+
if(!empty($item)){
|
1769 |
+
switch($format){
|
1770 |
+
case 'text' :
|
1771 |
+
$items .= GFCommon::selection_display($item, $field, $currency, true) . ', ';
|
1772 |
+
break;
|
1773 |
+
|
1774 |
+
default:
|
1775 |
+
$items .= '<li>' . GFCommon::selection_display($item, $field, $currency, true) . '</li>';
|
1776 |
+
break;
|
1777 |
+
}
|
1778 |
+
}
|
1779 |
+
}
|
1780 |
+
if(empty($items)){
|
1781 |
+
return '';
|
1782 |
+
}
|
1783 |
+
else if($format == 'text'){
|
1784 |
+
return substr($items, 0, strlen($items)-2); //removing last comma
|
1785 |
+
}
|
1786 |
+
else{
|
1787 |
+
return '<ul class="bulleted">' . $items . '</ul>';
|
1788 |
+
}
|
1789 |
+
}
|
1790 |
+
else{
|
1791 |
+
return $value;
|
1792 |
+
}
|
1793 |
+
break;
|
1794 |
+
|
1795 |
+
case 'post_image' :
|
1796 |
+
$ary = explode('|:|', $value);
|
1797 |
+
$url = count($ary) > 0 ? $ary[0] : '';
|
1798 |
+
$title = count($ary) > 1 ? $ary[1] : '';
|
1799 |
+
$caption = count($ary) > 2 ? $ary[2] : '';
|
1800 |
+
$description = count($ary) > 3 ? $ary[3] : '';
|
1801 |
+
|
1802 |
+
if(!empty($url)){
|
1803 |
+
$url = str_replace(' ', '%20', $url);
|
1804 |
+
switch($format){
|
1805 |
+
case 'text' :
|
1806 |
+
$value = $url;
|
1807 |
+
$value .= !empty($title) ? '\n\n' . $field['label'] . ' (' . __('Title', 'gravityforms') . '): ' . $title : '';
|
1808 |
+
$value .= !empty($caption) ? '\n\n' . $field['label'] . ' (' . __('Caption', 'gravityforms') . '): ' . $caption : '';
|
1809 |
+
$value .= !empty($description) ? '\n\n' . $field['label'] . ' (' . __('Description', 'gravityforms') . '): ' . $description : '';
|
1810 |
+
break;
|
1811 |
+
|
1812 |
+
default :
|
1813 |
+
$path = str_replace(site_url().'/', ABSPATH, $url);
|
1814 |
+
$value = "<a href='$url' target='_blank' title='" . __("Click to view", "gravityforms") . "'><img src='$path' width='100' /></a>";
|
1815 |
+
$value .= !empty($title) ? "<div>Title: $title</div>" : "";
|
1816 |
+
$value .= !empty($caption) ? "<div>Caption: $caption</div>" : "";
|
1817 |
+
$value .= !empty($description) ? "<div>Description: $description</div>": "";
|
1818 |
+
|
1819 |
+
break;
|
1820 |
+
}
|
1821 |
+
}
|
1822 |
+
return $value;
|
1823 |
+
|
1824 |
+
case 'fileupload' :
|
1825 |
+
$output = '';
|
1826 |
+
$output_arr = array();
|
1827 |
+
if(!empty($value)){
|
1828 |
+
$output .= '<ul>';
|
1829 |
+
$file_paths = rgar($field,'multipleFiles') ? json_decode($value) : array($value);
|
1830 |
+
foreach($file_paths as $file_path){
|
1831 |
+
$info = pathinfo($file_path);
|
1832 |
+
$file_path = esc_attr(str_replace(' ', '%20', $file_path));
|
1833 |
+
$output_arr[] = '<li><a href="'. $file_path .'" target="_blank" title="' . __('Click to view', 'gravityforms') . '">' . $info['basename'] . '</a></li>';
|
1834 |
+
}
|
1835 |
+
$output .= join(PHP_EOL, $output_arr);
|
1836 |
+
$output .= '</ul>';
|
1837 |
+
}
|
1838 |
+
|
1839 |
+
return $output;
|
1840 |
+
break;
|
1841 |
+
|
1842 |
+
case 'date' :
|
1843 |
+
return GFCommon::date_display($value, rgar($field, 'dateFormat'));
|
1844 |
+
break;
|
1845 |
+
|
1846 |
+
case 'radio' :
|
1847 |
+
case 'select' :
|
1848 |
+
return GFCommon::selection_display($value, $field, $currency, true);
|
1849 |
+
break;
|
1850 |
+
|
1851 |
+
case 'multiselect' :
|
1852 |
+
if(empty($value) || $format == 'text')
|
1853 |
+
return $value;
|
1854 |
+
|
1855 |
+
if(!is_array($value))
|
1856 |
+
{
|
1857 |
+
$value = explode(',', $value);
|
1858 |
+
}
|
1859 |
+
|
1860 |
+
$items = '';
|
1861 |
+
foreach($value as $item){
|
1862 |
+
$items .= '<li>' . GFCommon::selection_display($item, $field, $currency, true) . '</li>';
|
1863 |
+
}
|
1864 |
+
|
1865 |
+
return '<ul class="bulleted">' . $items . '</ul>';
|
1866 |
+
|
1867 |
+
break;
|
1868 |
+
|
1869 |
+
case 'calculation' :
|
1870 |
+
case 'singleproduct' :
|
1871 |
+
if(is_array($value)){
|
1872 |
+
$product_name = trim($value[$field['id'] . '.1']);
|
1873 |
+
$price = trim($value[$field['id'] . '.2']);
|
1874 |
+
$quantity = trim($value[$field['id'] . '.3']);
|
1875 |
+
|
1876 |
+
$product = $product_name . ', ' . __('Qty: ', 'gravityforms') . $quantity . ', ' . __('Price: ', 'gravityforms') . $price;
|
1877 |
+
return $product;
|
1878 |
+
}
|
1879 |
+
else{
|
1880 |
+
return '';
|
1881 |
+
}
|
1882 |
+
break;
|
1883 |
+
|
1884 |
+
case 'number' :
|
1885 |
+
return GFCommon::format_number($value, rgar($field, 'numberFormat'));
|
1886 |
+
break;
|
1887 |
+
|
1888 |
+
case 'singleshipping' :
|
1889 |
+
case 'donation' :
|
1890 |
+
case 'total' :
|
1891 |
+
case 'price' :
|
1892 |
+
return GFCommon::to_money($value, $currency);
|
1893 |
+
|
1894 |
+
case 'list' :
|
1895 |
+
if(empty($value))
|
1896 |
+
return '';
|
1897 |
+
$value = unserialize($value);
|
1898 |
+
|
1899 |
+
$has_columns = is_array($value[0]);
|
1900 |
+
|
1901 |
+
if(!$has_columns){
|
1902 |
+
$items = '';
|
1903 |
+
foreach($value as $key => $item){
|
1904 |
+
if(!empty($item)){
|
1905 |
+
switch($format){
|
1906 |
+
case 'text' :
|
1907 |
+
$items .= $item . ', ';
|
1908 |
+
break;
|
1909 |
+
case 'url' :
|
1910 |
+
$items .= $item . ',';
|
1911 |
+
break;
|
1912 |
+
default :
|
1913 |
+
if($media == 'email'){
|
1914 |
+
$items .= '<li>'.htmlspecialchars($item).'</li>';
|
1915 |
+
}
|
1916 |
+
else{
|
1917 |
+
$items .= '<li>'.htmlspecialchars($item).'</li>';
|
1918 |
+
}
|
1919 |
+
break;
|
1920 |
+
}
|
1921 |
+
}
|
1922 |
+
}
|
1923 |
+
|
1924 |
+
if(empty($items)){
|
1925 |
+
return '';
|
1926 |
+
}
|
1927 |
+
else if($format == 'text'){
|
1928 |
+
return substr($items, 0, strlen($items)-2); //removing last comma
|
1929 |
+
}
|
1930 |
+
else if($format == 'url'){
|
1931 |
+
return substr($items, 0, strlen($items)-1); //removing last comma
|
1932 |
+
}
|
1933 |
+
else{
|
1934 |
+
return '<ul class="bulleted">' . $items . '</ul>';
|
1935 |
+
}
|
1936 |
+
}
|
1937 |
+
else if(is_array($value)){
|
1938 |
+
$columns = array_keys($value[0]);
|
1939 |
+
|
1940 |
+
$list = '';
|
1941 |
+
|
1942 |
+
switch($format){
|
1943 |
+
case 'text' :
|
1944 |
+
$is_first_row = true;
|
1945 |
+
foreach($value as $item){
|
1946 |
+
if(!$is_first_row)
|
1947 |
+
$list .= '\n\n' . $field['label'] . ': ';
|
1948 |
+
$list .= implode(',', array_values($item));
|
1949 |
+
|
1950 |
+
$is_first_row = false;
|
1951 |
+
}
|
1952 |
+
break;
|
1953 |
+
|
1954 |
+
case 'url' :
|
1955 |
+
foreach($value as $item){
|
1956 |
+
$list .= implode('|', array_values($item)) . ',';
|
1957 |
+
}
|
1958 |
+
if(!empty($list))
|
1959 |
+
$list = substr($list, 0, strlen($list)-1);
|
1960 |
+
break;
|
1961 |
+
|
1962 |
+
default :
|
1963 |
+
if($media == 'email'){
|
1964 |
+
$list = '<table autosize="1" class="gfield_list" style="border-top: 1px solid #DFDFDF; border-left: 1px solid #DFDFDF; border-spacing: 0; padding: 0; margin: 2px 0 6px; width: 100%"><thead><tr>';
|
1965 |
+
|
1966 |
+
//reading columns from entry data
|
1967 |
+
foreach($columns as $column){
|
1968 |
+
$list .= '<th style="background-image: none; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; padding: 6px 10px; font-family: sans-serif; font-size: 12px; font-weight: bold; background-color: #F1F1F1; color:#333; text-align:left">' . esc_html($column) . '</th>';
|
1969 |
+
}
|
1970 |
+
$list .= '</tr></thead>';
|
1971 |
+
|
1972 |
+
$list .= '<tbody style="background-color: #F9F9F9">';
|
1973 |
+
foreach($value as $item){
|
1974 |
+
$list .= '<tr>';
|
1975 |
+
foreach($columns as $column){
|
1976 |
+
$val = rgar($item, $column);
|
1977 |
+
$list .= '<td style="padding: 6px 10px; border-right: 1px solid #DFDFDF; border-bottom: 1px solid #DFDFDF; border-top: 1px solid #FFF; font-family: sans-serif; font-size:12px;">{$val}</td>';
|
1978 |
+
}
|
1979 |
+
|
1980 |
+
$list .='</tr>';
|
1981 |
+
}
|
1982 |
+
|
1983 |
+
$list .='</tbody></table>';
|
1984 |
+
}
|
1985 |
+
else{
|
1986 |
+
$list = '<table autosize="1" class="gfield_list"><thead><tr>';
|
1987 |
+
|
1988 |
+
//reading columns from entry data
|
1989 |
+
foreach($columns as $column){
|
1990 |
+
$list .= '<th>' . esc_html($column) . '</th>';
|
1991 |
+
}
|
1992 |
+
$list .= '</tr></thead>';
|
1993 |
+
|
1994 |
+
$list .= '<tbody>';
|
1995 |
+
foreach($value as $item){
|
1996 |
+
$list .= '<tr>';
|
1997 |
+
foreach($columns as $column){
|
1998 |
+
$val = rgar($item, $column);
|
1999 |
+
$list .= '<td>'.htmlspecialchars($val).'</td>';
|
2000 |
+
}
|
2001 |
+
|
2002 |
+
$list .='</tr>';
|
2003 |
+
}
|
2004 |
+
|
2005 |
+
$list .='</tbody></table>';
|
2006 |
+
}
|
2007 |
+
break;
|
2008 |
+
}
|
2009 |
+
|
2010 |
+
return $list;
|
2011 |
+
}
|
2012 |
+
return '';
|
2013 |
+
break;
|
2014 |
+
|
2015 |
+
default :
|
2016 |
+
if (!is_array($value))
|
2017 |
+
{
|
2018 |
+
return nl2br($value);
|
2019 |
+
}
|
2020 |
+
break;
|
2021 |
+
}
|
2022 |
+
}
|
2023 |
+
|
2024 |
+
|
2025 |
+
public static function encode_tags($content, $field)
|
2026 |
+
{
|
2027 |
+
if(RGFormsModel::get_input_type($field) != 'html' || RGFormsModel::get_input_type($field) != 'signature')
|
2028 |
+
{
|
2029 |
+
$content = str_replace('[', '[', $content);
|
2030 |
+
$content = str_replace(']', ']', $content);
|
2031 |
+
$content = str_replace('{', '{', $content);
|
2032 |
+
$content = str_replace('}', '}', $content);
|
2033 |
+
}
|
2034 |
+
|
2035 |
+
return $content;
|
2036 |
+
}
|
2037 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2038 |
}
|
pdf.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Gravity PDF
|
5 |
* Plugin URI: https://gravitypdf.com
|
6 |
* Description: Gravity PDF allows you to save/view/download a PDF from the front- and back-end, and automate PDF creation on form submission. Our Business Plus package also allows you to overlay field onto an existing PDF.
|
7 |
-
* Version: 3.7.
|
8 |
* Author: Blue Liquid Designs
|
9 |
* Author URI: http://www.blueliquiddesigns.com.au
|
10 |
*/
|
@@ -41,7 +41,7 @@
|
|
41 |
/*
|
42 |
* Define our constants
|
43 |
*/
|
44 |
-
define('PDF_EXTENDED_VERSION', '3.7.
|
45 |
define('GF_PDF_EXTENDED_SUPPORTED_VERSION', '1.8');
|
46 |
define('GF_PDF_EXTENDED_WP_SUPPORTED_VERSION', '3.9');
|
47 |
define('GF_PDF_EXTENDED_PHP_SUPPORTED_VERSION', '5');
|
4 |
* Plugin Name: Gravity PDF
|
5 |
* Plugin URI: https://gravitypdf.com
|
6 |
* Description: Gravity PDF allows you to save/view/download a PDF from the front- and back-end, and automate PDF creation on form submission. Our Business Plus package also allows you to overlay field onto an existing PDF.
|
7 |
+
* Version: 3.7.2
|
8 |
* Author: Blue Liquid Designs
|
9 |
* Author URI: http://www.blueliquiddesigns.com.au
|
10 |
*/
|
41 |
/*
|
42 |
* Define our constants
|
43 |
*/
|
44 |
+
define('PDF_EXTENDED_VERSION', '3.7.2');
|
45 |
define('GF_PDF_EXTENDED_SUPPORTED_VERSION', '1.8');
|
46 |
define('GF_PDF_EXTENDED_WP_SUPPORTED_VERSION', '3.9');
|
47 |
define('GF_PDF_EXTENDED_PHP_SUPPORTED_VERSION', '5');
|
view/templates/settings/changelog.php
CHANGED
@@ -40,6 +40,12 @@
|
|
40 |
<p><strong>Current Version: <?php echo PDF_EXTENDED_VERSION; ?></strong></p>
|
41 |
|
42 |
<h3><?php echo PDF_EXTENDED_VERSION; ?></h3>
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
<ul>
|
44 |
<li>Housekeeping - Allow control over signature width in default template using the 'gfpdfe_signature_width' filter</li>
|
45 |
<li>Housekeeping - Add better error checking when migrating PDF template folder</li>
|
40 |
<p><strong>Current Version: <?php echo PDF_EXTENDED_VERSION; ?></strong></p>
|
41 |
|
42 |
<h3><?php echo PDF_EXTENDED_VERSION; ?></h3>
|
43 |
+
<ul>
|
44 |
+
<li>Bug - Updated $form_data['date_created'], $form_data['date_created_usa'], $form_data['misc']['date_time'], $form_data['misc']['time_24hr'] and $form_data['misc']['time_12hr'] to factor in the website's timezone settings. </li>
|
45 |
+
</ul>
|
46 |
+
|
47 |
+
|
48 |
+
<h3>3.7.1</h3>
|
49 |
<ul>
|
50 |
<li>Housekeeping - Allow control over signature width in default template using the 'gfpdfe_signature_width' filter</li>
|
51 |
<li>Housekeeping - Add better error checking when migrating PDF template folder</li>
|