open.php
87 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments |
| 4 | * @subpackage core |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | $vik = VAPApplication::getInstance(); |
| 15 | |
| 16 | $id = isset($displayData['id']) ? $displayData['id'] : ''; |
| 17 | $required = isset($displayData['required']) ? $displayData['required'] : false; |
| 18 | $label = isset($displayData['label']) ? $displayData['label'] : ''; |
| 19 | $desc = isset($displayData['description']) ? $displayData['description'] : ''; |
| 20 | |
| 21 | // extract type from custom field parameters and use it as class suffix for individual styling |
| 22 | $type = $displayData['field']['type']; |
| 23 | |
| 24 | if ($type == 'checkbox' && $displayData['field']['poplink']) |
| 25 | { |
| 26 | // use terms-of-service identifier |
| 27 | $type = 'tos'; |
| 28 | } |
| 29 | |
| 30 | ?> |
| 31 | |
| 32 | <div class="cf-control<?php echo $type ? ' ' . $type : ''; ?>"> |
| 33 | |
| 34 | <div class="cf-label"> |
| 35 | |
| 36 | <!-- START WRAPPER --> |
| 37 | |
| 38 | <?php |
| 39 | if ($type == 'tos') |
| 40 | { |
| 41 | JHtml::fetch('vaphtml.assets.fancybox'); |
| 42 | |
| 43 | // in case of a checkbox with popup URL, use a link instead of a label to |
| 44 | // allow the customers to see the contents inside an iframe modal |
| 45 | $url = JRoute::rewrite($displayData['field']['poplink']); |
| 46 | ?><a href="javascript:void(0)" onclick="vapOpenPopup('<?php echo $this->escape($url); ?>');" id="<?php echo $id; ?>-label"><?php |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | // use a label for any other fields |
| 51 | ?><label for="<?php echo $id; ?>" id="<?php echo $id; ?>-label"><?php |
| 52 | } |
| 53 | ?> |
| 54 | |
| 55 | <!-- LABEL CONTENT --> |
| 56 | |
| 57 | <?php |
| 58 | // display required symbol before the label (skip if TOS field) |
| 59 | if ($required && $label && $type != 'tos'): ?> |
| 60 | <span class="vaprequired"><sup>*</sup></span> |
| 61 | <?php endif; ?> |
| 62 | |
| 63 | <span><?php echo $label; ?></span> |
| 64 | |
| 65 | <?php if ($desc): ?> |
| 66 | <i class="fas fa-question-circle hasTooltip" title="<?php echo $this->escape($desc); ?>"></i> |
| 67 | <?php endif; ?> |
| 68 | |
| 69 | <?php |
| 70 | // display required symbol after the label (only if TOS field) |
| 71 | if ($required && $label && $type == 'tos'): ?> |
| 72 | <span class="vaprequired">*</span> |
| 73 | <?php endif; ?> |
| 74 | |
| 75 | <!-- END WRAPPER --> |
| 76 | |
| 77 | <?php |
| 78 | if ($type == 'tos'): ?> |
| 79 | </a> |
| 80 | <?php else: ?> |
| 81 | </label> |
| 82 | <?php endif; ?> |
| 83 | |
| 84 | </div> |
| 85 | |
| 86 | <div class="cf-value"> |
| 87 |