default.php
4 years ago
default_settings.php
4 years ago
default_settings_basic.php
2 years ago
default_templates.php
4 years ago
default_templates_admin.php
4 years ago
default_templates_customer.php
2 years ago
index.html
7 years ago
default.php
170 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 | JHtml::fetch('bootstrap.tooltip', '.hasTooltip'); |
| 15 | JHtml::fetch('vaphtml.assets.select2'); |
| 16 | JHtml::fetch('vaphtml.assets.toast', 'bottom-right'); |
| 17 | |
| 18 | $vik = VAPApplication::getInstance(); |
| 19 | |
| 20 | /** |
| 21 | * Trigger event to display custom HTML. |
| 22 | * In case it is needed to include any additional fields, |
| 23 | * it is possible to create a plugin and attach it to an event |
| 24 | * called "onDisplayViewConfigsmsapi". The event method receives the |
| 25 | * view instance as argument. |
| 26 | * |
| 27 | * @since 1.6.6 |
| 28 | */ |
| 29 | $forms = $this->onDisplayView(); |
| 30 | |
| 31 | /** |
| 32 | * Recover selected tab from the browser cookie. |
| 33 | * |
| 34 | * @since 1.7 |
| 35 | */ |
| 36 | $this->selectedTab = JFactory::getApplication()->input->cookie->get('vikappointments_configsmsapi_tab', 1, 'uint'); |
| 37 | |
| 38 | $tabs = $custTabs = array(); |
| 39 | |
| 40 | // build default tabs: settings, templates |
| 41 | $tabs[] = JText::translate('VAPCONFIGCRONTITLE1'); |
| 42 | $tabs[] = JText::translate('VAPCONFIGSMSTITLE1'); |
| 43 | |
| 44 | /** |
| 45 | * Iterate all form items to be displayed as custom tabs within the nav bar. |
| 46 | * |
| 47 | * @since 1.6.6 |
| 48 | */ |
| 49 | foreach ($forms as $tabName => $tabForms) |
| 50 | { |
| 51 | // include tab |
| 52 | $custTabs[] = JText::translate($tabName); |
| 53 | } |
| 54 | |
| 55 | // make sure the selected tab is still available |
| 56 | if ($this->selectedTab > count($tabs) + count($custTabs)) |
| 57 | { |
| 58 | // reset to first tab |
| 59 | $this->selectedTab = 1; |
| 60 | } |
| 61 | ?> |
| 62 | |
| 63 | <div class="configuration-panel"> |
| 64 | |
| 65 | <div id="configuration-navbar"> |
| 66 | <ul> |
| 67 | <?php |
| 68 | foreach (array_merge($tabs, $custTabs) as $i => $tab) |
| 69 | { |
| 70 | $key = $i + 1; |
| 71 | ?> |
| 72 | <li id="vaptabli<?php echo $key; ?>" class="vaptabli<?php echo ($this->selectedTab == $key ? ' vapconfigtabactive' : ''); ?>" data-id="<?php echo $key; ?>"> |
| 73 | <a href="javascript: void(0);"><?php echo $tab; ?></a> |
| 74 | </li> |
| 75 | <?php |
| 76 | } |
| 77 | ?> |
| 78 | </ul> |
| 79 | </div> |
| 80 | |
| 81 | <?php |
| 82 | // print config search bar |
| 83 | // VAPLoader::import('libraries.widget.layout'); |
| 84 | // echo UIWidgetLayout::getInstance('searchbar')->display(); |
| 85 | ?> |
| 86 | |
| 87 | <div id="configuration-body"> |
| 88 | |
| 89 | <form name="adminForm" id="adminForm" action="index.php" method="post" enctype="multipart/form-data"> |
| 90 | |
| 91 | <?php |
| 92 | // display default tab panes |
| 93 | echo $this->loadTemplate('settings'); |
| 94 | echo $this->loadTemplate('templates'); |
| 95 | |
| 96 | $i = 0; |
| 97 | |
| 98 | /** |
| 99 | * Iterate all form items to be displayed as new panels of custom tabs. |
| 100 | * |
| 101 | * @since 1.6.6 |
| 102 | */ |
| 103 | foreach ($forms as $formName => $formHtml) |
| 104 | { |
| 105 | // sanitize form name |
| 106 | $key = count($tabs) + (++$i); |
| 107 | |
| 108 | ?> |
| 109 | <div id="vaptabview<?php echo $key; ?>" class="vaptabview" style="<?php echo ($this->selectedTab != $key ? 'display: none;' : ''); ?>"> |
| 110 | <?php echo $formHtml; ?> |
| 111 | </div> |
| 112 | <?php |
| 113 | } |
| 114 | ?> |
| 115 | |
| 116 | <?php echo JHtml::fetch('form.token'); ?> |
| 117 | |
| 118 | <input type="hidden" name="option" value="com_vikappointments" /> |
| 119 | <input type="hidden" name="task" value=""/> |
| 120 | </form> |
| 121 | |
| 122 | </div> |
| 123 | |
| 124 | </div> |
| 125 | |
| 126 | <!-- Define role to detect the supported hook --> |
| 127 | <!-- {"rule":"customizer","event":"onDisplayViewConfigsmsapi","type":"tab"} --> |
| 128 | |
| 129 | <!-- SCRIPT --> |
| 130 | |
| 131 | <?php |
| 132 | echo JLayoutHelper::render('configuration.script', array('suffix' => 'smsapi')); |
| 133 | ?> |
| 134 | |
| 135 | <script> |
| 136 | |
| 137 | jQuery(function($) { |
| 138 | $('select.short').select2({ |
| 139 | minimumResultsForSearch: -1, |
| 140 | allowClear: false, |
| 141 | width: 100, |
| 142 | }); |
| 143 | |
| 144 | $('select.small-medium').select2({ |
| 145 | minimumResultsForSearch: -1, |
| 146 | allowClear: false, |
| 147 | width: 150, |
| 148 | }); |
| 149 | |
| 150 | $('select.medium').select2({ |
| 151 | minimumResultsForSearch: -1, |
| 152 | allowClear: false, |
| 153 | width: 200, |
| 154 | }); |
| 155 | |
| 156 | $('select.medium-large').select2({ |
| 157 | minimumResultsForSearch: -1, |
| 158 | allowClear: false, |
| 159 | width: 250, |
| 160 | }); |
| 161 | |
| 162 | $('select.large').select2({ |
| 163 | minimumResultsForSearch: -1, |
| 164 | allowClear: false, |
| 165 | width: 300, |
| 166 | }); |
| 167 | }); |
| 168 | |
| 169 | </script> |
| 170 |