PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / trunk
VikAppointments Services Booking Calendar vtrunk
trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / export / tmpl / default_params.php
vikappointments / admin / views / export / tmpl Last commit date
default.php 3 years ago default_params.php 4 years ago index.html 6 years ago
default_params.php
189 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('formbehavior.chosen');
15 JHtml::fetch('bootstrap.popover');
16
17 $vik = VAPApplication::getInstance();
18
19 ?>
20
21 <style>
22 .export-params {
23 display: none;
24 }
25 .export-params label {
26 font-weight: bold;
27 }
28
29 </style>
30
31 <div style="padding:10px">
32
33 <div class="row-fluid">
34
35 <div class="span12">
36 <?php echo $vik->openEmptyFieldset(); ?>
37
38 <!-- NAME - Text -->
39
40 <?php echo $vik->openControl(JText::translate('VAPEXPORTRES1') . '*'); ?>
41 <input type="text" name="filename" value="<?php echo $this->type; ?>" class="required" size="32" />
42 <?php echo $vik->closeControl(); ?>
43
44 <!-- EXPORT CLASS - Select -->
45
46 <?php
47 $elements = array();
48 $elements[] = JHtml::fetch('select.option', '', '--');
49
50 foreach ($this->exportList as $key => $exportable)
51 {
52 $elements[] = JHtml::fetch('select.option', $key, $exportable->getName());
53 }
54
55 echo $vik->openControl(JText::translate('VAPEXPORTRES2') . '*'); ?>
56 <select name="export_class" class="required" id="export-class">
57 <?php echo JHtml::fetch('select.options', $elements); ?>
58 </select>
59 <?php echo $vik->closeControl(); ?>
60
61 <!-- RAW - Checkbox -->
62
63 <?php
64 $yes = $vik->initRadioElement('', '', false);
65 $no = $vik->initRadioElement('', '', true);
66
67 $help = $vik->createPopover(array(
68 'title' => JText::translate('VAP_EXPORT_RAW'),
69 'content' => JText::translate('VAP_EXPORT_RAW_DESC'),
70 ));
71
72 echo $vik->openControl(JText::translate('VAP_EXPORT_RAW') . $help);
73 echo $vik->radioYesNo('raw', $yes, $no, false);
74 echo $vik->closeControl();
75 ?>
76
77 <?php echo $vik->closeEmptyFieldset(); ?>
78 </div>
79
80 <!-- export params -->
81
82 <?php
83 // Display different types of fieldset depending on the current platform.
84 // Since Joomla doesn't return the fields in a fieldset, we should wrap
85 // them by using our application methods. Wordpress instead returns a
86 // full HTML including the fieldset opening and closure.
87 if (VersionListener::isJoomla())
88 {
89 ?>
90 <div class="span12">
91 <?php
92 echo $vik->openEmptyFieldset('form-horizontal export-params');
93 echo $vik->closeEmptyFieldset();
94 ?>
95 </div>
96 <?php
97 }
98 else
99 {
100 ?><div class="export-params"></div><?php
101 }
102 ?>
103
104 </div>
105
106 </div>
107
108 <?php
109 JText::script('VAPCONNECTIONLOSTERROR');
110 ?>
111
112 <script>
113
114 jQuery(function($) {
115
116 VikRenderer.chosen('#adminForm');
117
118 $('#export-class').on('change', function() {
119
120 var type = $(this).val();
121
122 validator.unregisterFields('.export-params .required');
123
124 $('.export-params').html('');
125
126 if (!type.length) {
127 return;
128 }
129
130 // disable export btn
131 $('#export-btn').prop('disabled', true);
132
133 UIAjax.do(
134 '<?php echo $vik->ajaxUrl('index.php?option=com_vikappointments&task=export.params'); ?>',
135 {
136 import_type: '<?php echo $this->type; ?>',
137 export_class: type,
138 },
139 (html) => {
140 $('.export-params').html(html);
141
142 if (html) {
143 $('.export-params').show();
144 } else {
145 $('.export-params').hide();
146 }
147
148 // register new required fields
149 validator.registerFields('.export-params .required');
150
151 // render new select
152 VikRenderer.chosen('.export-params');
153
154 // render popover
155 $('.export-params .hasPopover').popover({trigger: 'hover', sanitize: false, trigger: 'hover', html: true});
156
157 // enable export btn again
158 $('#export-btn').prop('disabled', false);
159 },
160 (err) => {
161 alert(Joomla.JText._('VAPCONNECTIONLOSTERROR'));
162
163 // enable export btn again
164 $('#export-btn').prop('disabled', false);
165
166 $('.export-params').hide();
167 }
168 );
169
170 });
171
172 $('#export-btn').on('click', () => {
173 if (!validator.validate()) {
174 return false;
175 }
176
177 jQuery('#jmodal-download').modal('hide');
178
179 Joomla.submitform('export.download', document.adminForm);
180 });
181
182 });
183
184 // validate
185
186 var validator = new VikFormValidator('#adminForm');
187
188 </script>
189