checkbox.php
2 days ago
color.php
2 days ago
date.php
2 days ago
editor.php
2 days ago
file.php
2 days ago
hidden.php
2 days ago
html.php
2 days ago
index.html
2 days ago
number.php
2 days ago
select.php
2 days ago
separator.php
2 days ago
tel.php
2 days ago
text.php
2 days ago
textarea.php
2 days ago
date.php
79 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 | $name = !empty($displayData['name']) ? $displayData['name'] : 'name'; |
| 15 | $id = !empty($displayData['id']) ? $displayData['id'] : $name; |
| 16 | $value = isset($displayData['value']) ? $displayData['value'] : ''; |
| 17 | $class = isset($displayData['class']) ? $displayData['class'] : ''; |
| 18 | $attrs = isset($displayData['attrs']) ? $displayData['attrs'] : array(); |
| 19 | |
| 20 | if ($class) |
| 21 | { |
| 22 | if (!empty($attrs['class'])) |
| 23 | { |
| 24 | $attrs['class'] .= ' ' . $class; |
| 25 | } |
| 26 | else |
| 27 | { |
| 28 | $attrs['class'] = $class; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | // prepare jQuery datepicker options |
| 33 | $options = array( |
| 34 | /** |
| 35 | * Whether the year should be rendered as a dropdown instead of text. |
| 36 | * Use the yearRange option to control which years are made available |
| 37 | * for selection. |
| 38 | * |
| 39 | * Since the calendar field is usually used for Birth dates, the year |
| 40 | * selection will be enabled by default, so that the date can be filled |
| 41 | * without having to manually enter the year through the keyboard. |
| 42 | * |
| 43 | * @var boolean |
| 44 | * |
| 45 | * @link https://api.jqueryui.com/datepicker/#option-changeYear |
| 46 | */ |
| 47 | 'changeYear' => true, |
| 48 | |
| 49 | /** |
| 50 | * The range of years displayed in the year drop-down: either relative |
| 51 | * to today's year ("-nn:+nn"), relative to the currently selected year |
| 52 | * ("c-nn:c+nn"), absolute ("nnnn:nnnn"), or combinations of these formats |
| 53 | * ("nnnn:-nn"). |
| 54 | * |
| 55 | * Since the calendar field is usually used for Birth dates, the year |
| 56 | * selection won't allow future years and will go back up to 100 years. |
| 57 | * |
| 58 | * @var boolean |
| 59 | * |
| 60 | * @link https://api.jqueryui.com/datepicker/#option-yearRange |
| 61 | */ |
| 62 | 'yearRange' => '-100:+0', |
| 63 | ); |
| 64 | |
| 65 | // init datepicker |
| 66 | JHtml::fetch('vaphtml.sitescripts.calendar', '#' . $id . ':input', $options); |
| 67 | |
| 68 | ?> |
| 69 | |
| 70 | <input |
| 71 | type="text" |
| 72 | name="<?php echo $this->escape($name); ?>" |
| 73 | id="<?php echo $this->escape($id); ?>" |
| 74 | value="<?php echo $this->escape($value); ?>" |
| 75 | size="40" |
| 76 | class="<?php echo $this->escape($class); ?>" |
| 77 | aria-labelledby="<?php echo $id; ?>-label" |
| 78 | /> |
| 79 |