default.php
3 days ago
default_api.php
3 days ago
default_api_basic.php
3 days ago
default_api_users.php
3 days ago
default_backup.php
3 days ago
default_backup_basic.php
3 days ago
default_customizer.php
3 days ago
default_customizer_addcss.php
3 days ago
default_customizer_form.php
3 days ago
default_customizer_preview.php
3 days ago
default_customizer_toolbar.php
3 days ago
default_webhooks.php
3 days ago
default_webhooks_basic.php
3 days ago
index.html
3 days ago
default_api_users.php
165 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 | $config = $this->config; |
| 15 | |
| 16 | $vik = VAPApplication::getInstance(); |
| 17 | |
| 18 | /** |
| 19 | * Trigger event to display custom HTML. |
| 20 | * In case it is needed to include any additional fields, |
| 21 | * it is possible to create a plugin and attach it to an event |
| 22 | * called "onDisplayViewConfigappApiUsers". The event method |
| 23 | * receives the view instance as argument. |
| 24 | * |
| 25 | * @since 1.7 |
| 26 | */ |
| 27 | $forms = $this->onDisplayView('ApiUsers'); |
| 28 | |
| 29 | ?> |
| 30 | |
| 31 | <div class="config-fieldset"> |
| 32 | |
| 33 | <div class="config-fieldset-head"> |
| 34 | <h3><?php echo JText::translate('VAPCONFIGAPPTITLE3'); ?></h3> |
| 35 | </div> |
| 36 | |
| 37 | <div class="config-fieldset-body"> |
| 38 | |
| 39 | <!-- USERS MANAGEMENT - Button --> |
| 40 | |
| 41 | <div class="control-group"> |
| 42 | <a href="index.php?option=com_vikappointments&view=apiusers" class="btn<?php echo $config->getBool('apifw') ? '' : ' disabled'; ?>" id="apiusers-btn"> |
| 43 | <?php echo JText::translate('VAPCONFIGSEEAPIUSERS'); ?> |
| 44 | </a> |
| 45 | </div> |
| 46 | |
| 47 | <!-- Define role to detect the supported hook --> |
| 48 | <!-- {"rule":"customizer","event":"onDisplayViewConfigappApiUsers","key":"basic","type":"field"} --> |
| 49 | |
| 50 | <?php |
| 51 | /** |
| 52 | * Look for any additional fields to be pushed within |
| 53 | * the API > Applications > Users fieldset. |
| 54 | * |
| 55 | * @since 1.7 |
| 56 | */ |
| 57 | if (isset($forms['basic'])) |
| 58 | { |
| 59 | echo $forms['basic']; |
| 60 | |
| 61 | // unset details form to avoid displaying it twice |
| 62 | unset($forms['basic']); |
| 63 | } |
| 64 | ?> |
| 65 | |
| 66 | </div> |
| 67 | |
| 68 | </div> |
| 69 | |
| 70 | <div class="config-fieldset"> |
| 71 | |
| 72 | <div class="config-fieldset-head"> |
| 73 | <h3><?php echo JText::translate('VAPCONFIGAPPTITLE4'); ?></h3> |
| 74 | </div> |
| 75 | |
| 76 | <div class="config-fieldset-body"> |
| 77 | |
| 78 | <!-- PLUGINS MANAGEMENT - Button --> |
| 79 | |
| 80 | <div class="control-group"> |
| 81 | <a href="index.php?option=com_vikappointments&view=apiplugins" class="btn<?php echo $config->getBool('apifw') ? '' : ' disabled'; ?>" id="apiplugins-btn"> |
| 82 | <?php echo JText::translate('VAPCONFIGSEEAPIPLUGINS'); ?> |
| 83 | </a> |
| 84 | </div> |
| 85 | |
| 86 | <!-- Define role to detect the supported hook --> |
| 87 | <!-- {"rule":"customizer","event":"onDisplayViewConfigappApiUsers","key":"plugins","type":"field"} --> |
| 88 | |
| 89 | <?php |
| 90 | /** |
| 91 | * Look for any additional fields to be pushed within |
| 92 | * the API > Applications > Plugins fieldset. |
| 93 | * |
| 94 | * @since 1.7 |
| 95 | */ |
| 96 | if (isset($forms['plugins'])) |
| 97 | { |
| 98 | echo $forms['plugins']; |
| 99 | |
| 100 | // unset details form to avoid displaying it twice |
| 101 | unset($forms['plugins']); |
| 102 | } |
| 103 | ?> |
| 104 | |
| 105 | </div> |
| 106 | |
| 107 | </div> |
| 108 | |
| 109 | |
| 110 | |
| 111 | <!-- Define role to detect the supported hook --> |
| 112 | <!-- {"rule":"customizer","event":"onDisplayViewConfigappApiUsers","type":"fieldset"} --> |
| 113 | |
| 114 | <?php |
| 115 | // iterate remaining forms to be displayed as new fieldsets |
| 116 | // within the API > Applications tab |
| 117 | foreach ($forms as $formTitle => $formHtml) |
| 118 | { |
| 119 | ?> |
| 120 | <div class="config-fieldset"> |
| 121 | |
| 122 | <div class="config-fieldset-head"> |
| 123 | <h3><?php echo JText::translate($formTitle); ?></h3> |
| 124 | </div> |
| 125 | |
| 126 | <div class="config-fieldset-body"> |
| 127 | <?php echo $formHtml; ?> |
| 128 | </div> |
| 129 | |
| 130 | </div> |
| 131 | <?php |
| 132 | } |
| 133 | |
| 134 | JText::script('VAPFORMCHANGEDCONFIRMTEXT'); |
| 135 | ?> |
| 136 | |
| 137 | <script> |
| 138 | |
| 139 | jQuery(function($) { |
| 140 | $('#apiusers-btn, #apiplugins-btn').on('click', function() { |
| 141 | if ($(this).hasClass('disabled')) { |
| 142 | event.preventDefault(); |
| 143 | event.stopPropagation(); |
| 144 | return false; |
| 145 | } |
| 146 | |
| 147 | if (!configObserver.isChanged()) { |
| 148 | // nothing has changed, go ahead |
| 149 | return true; |
| 150 | } |
| 151 | |
| 152 | // ask for a confirmation |
| 153 | let r = confirm(Joomla.JText._('VAPFORMCHANGEDCONFIRMTEXT')); |
| 154 | |
| 155 | if (!r) { |
| 156 | // do not leave the page |
| 157 | event.preventDefault(); |
| 158 | event.stopPropagation(); |
| 159 | return false; |
| 160 | } |
| 161 | }); |
| 162 | }); |
| 163 | |
| 164 | </script> |
| 165 |