PluginProbe
WP Directory Kit / 1.5.6
WP Directory Kit v1.5.6
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
wpdirectorykit / application / views / wdk_location / location_edit.php

location_edit.php in WP Directory Kit 1.5.6, at application/views/wdk_location/location_edit.php

255 lines 12.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The template for Edit Location.
5 *
6 * This is the template that form edit
7 *
8 */
9
10 if (! defined('ABSPATH')) {
11 exit; // Exit if accessed directly.
12 }
13 ?>
14 <!-- This file should primarily consist of HTML with a little bit of PHP. -->
15
16 <div class="wrap wdk-wrap">
17 <h1 class="wp-heading-inline"><?php echo __('Location Management', 'wpdirectorykit'); ?></h1>
18 <br />
19 <div class="wdk-body">
20 <div class="postbox" style="display: block;">
21 <div class="postbox-header">
22 <h3><?php echo __('Add/Edit Location', 'wpdirectorykit'); ?></h3>
23
24 <?php if (function_exists('run_wdk_svg_map') && wmvc_show_data('idlocation', $db_data, false)): ?>
25 <a href="<?php echo esc_url(admin_url('admin.php?page=wdk_location&function=import_from_svg&id=' . wmvc_show_data('idlocation', $db_data, false))); ?>" class="wdk-mr-5 button button-secondary alignright">
26 <span class="dashicons dashicons-admin-page" ></span><?php echo esc_html__('Import sublocations from SVG Map', 'wpdirectorykit'); ?>
27 </a>
28 <?php endif; ?>
29 </div>
30 <div class="inside">
31
32 <form method="post" class="form_listing_ai" action="<?php echo esc_url(wmvc_current_edit_url()); ?>" novalidate="novalidate">
33 <?php wp_nonce_field('wdk-location-edit_' . wmvc_show_data('idlocation', $db_data, 0), '_wpnonce'); ?>
34 <?php
35 $form->messages('class="alert alert-danger"', __('Successfully saved', 'wpdirectorykit'));
36 ?>
37
38 <table class="form-table" role="presentation">
39 <tbody>
40 <tr>
41 <th scope="row"><label for="parent_id"><?php echo __('Parent', 'wpdirectorykit'); ?></label></th>
42 <td>
43 <?php
44 echo wmvc_select_option('parent_id', $parents, wmvc_show_data('parent_id', $db_data, ''), NULL, __('Root', 'wpdirectorykit'), '0');
45 ?>
46
47 </td>
48 </tr>
49 <tr>
50 <th scope="row"><label for="location_title"><?php echo __('Title', 'wpdirectorykit'); ?></label></th>
51 <td><input name="location_title" type="text" id="location_title" value="<?php echo esc_attr(wmvc_show_data('location_title', $db_data, '')); ?>" class="regular-text"></td>
52 </tr>
53 <tr>
54 <th scope="row">
55 <label for="titles_for_search"><?php echo __('Alternative titles for search', 'wpdirectorykit'); ?></label>
56 </th>
57 <td>
58 <input name="titles_for_search" type="text" id="titles_for_search"
59 value="<?php echo esc_attr(wmvc_show_data('titles_for_search', $db_data, '')); ?>"
60 class="regular-text">
61 <p class="description" id="order_index-description">
62 <?php echo __('This can be used for search in different languages, please enter titles like: "Croatia,Hrvatska" so supporting multiple titles', 'wpdirectorykit'); ?>
63 </p>
64 </td>
65 </tr>
66 <tr>
67 <th scope="row"><label for="order_index"><?php echo __('Order Index', 'wpdirectorykit'); ?></label></th>
68 <td>
69 <input name="order_index" type="text" id="order_index" value="<?php echo esc_attr(wmvc_show_data('order_index', $db_data, '')); ?>" class="regular-text">
70 <p class="description" id="order_index-description"><?php echo __('Index for sorting/ordering, you can leave it empty and will be auto added to end of parent list', 'wpdirectorykit'); ?></p>
71 </td>
72 </tr>
73 <?php if (function_exists('run_wdk_svg_map')): ?>
74 <tr>
75 <th scope="row"><label for="related_svg_map"><?php echo __('Related SVG Map', 'wpdirectorykit'); ?></label></th>
76 <td>
77 <?php
78 echo wmvc_select_option('related_svg_map', $maps_list, wmvc_show_data('related_svg_map', $db_data, ''), "id='related_svg_map'", __('Not Selected', 'wpdirectorykit'), '0');
79 ?>
80 </td>
81 </tr>
82 <tr>
83 <th scope="row"><label for="related_svg_map_location"><?php echo __('Related SVG Map Location', 'wpdirectorykit'); ?></label></th>
84 <td>
85 <?php
86 echo wmvc_select_option('related_svg_map_location', $map_related_locations, wmvc_show_data('related_svg_map_location', $db_data, ''), "id='related_svg_map_location'", __('Not Selected', 'wpdirectorykit'), '0');
87 ?>
88 </td>
89 </tr>
90 <?php endif; ?>
91 <tr>
92 <th scope="row"><label for="icon_id"><?php echo __('Icon', 'wpdirectorykit'); ?></label></th>
93 <td>
94 <?php
95 echo wmvc_upload_media('icon_id', wmvc_show_data('icon_id', $db_data, ''));
96 ?>
97 <p class="description" id="icon_id-description"><?php echo __('Icon used for marker/pin on map or special places on website', 'wpdirectorykit'); ?></p>
98 </td>
99 </tr>
100 <tr>
101 <th scope="row"><label for="image_id"><?php echo __('Image', 'wpdirectorykit'); ?></label></th>
102 <td>
103 <?php
104 echo wmvc_upload_media('image_id', wmvc_show_data('image_id', $db_data, ''));
105 ?>
106 <p class="description" id="image_id-description"><?php echo __('Image used for widgets or elements where categories are visible', 'wpdirectorykit'); ?></p>
107 </td>
108 </tr>
109 </tbody>
110 </table>
111 <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php echo esc_html__('Save Changes', 'wpdirectorykit'); ?>">
112 </form>
113 </div>
114 </div>
115 <div class="postbox postbox-map" style="<?php if (wmvc_show_data('related_svg_map', $db_data, '')): ?>display: block;<?php else: ?>display: none;<?php endif; ?>">
116 <div class="postbox-header">
117 <h3><?php echo __('Map', 'wpdirectorykit'); ?></h3>
118 </div>
119 <div class="inside">
120 <div class="wdk-row">
121 <div class="wdk-col-auto col-list">
122 <div class="map-list">
123 </div>
124 </div>
125 <div class="wdk-col-auto col-map">
126 <div class="wdk-svg-map-box">
127 <div class="wdk_svg_map" data-map="<?php echo wmvc_show_data('related_svg_map', $db_data, ''); ?>"></div>
128 </div>
129 </div>
130 </div>
131 </div>
132 </div>
133 <div class="alert alert-info" role="alert"><?php echo sprintf(__('%1$s How to add new country in locations? %2$s', 'wpdirectorykit'), '<a href="//wpdirectorykit.com/documentation/#add-new-country" target="_blank">', '</a>'); ?></div>
134 </div>
135 </div>
136
137
138 <?php if(function_exists('run_wdk_svg_map')):?>
139 <script>
140 var jqxhr = null;
141 jQuery(document).ready(function($) {
142 $('#related_svg_map').on('input', function(e) {
143 e.preventDefault();
144 e.stopPropagation();
145 var self = $(this);
146
147 jQuery('#related_svg_map_location').closest('tr').find('label').addClass('wdk_btn_load_indicator out');
148
149 var ajax_param = {
150 "action": 'wdk_svg_map_public_action',
151 "page": 'wdk_svg_map_frontendajax',
152 "function": 'get_map_data',
153 };
154 ajax_param['related_svg_map'] = $(this).val();
155
156 // Assign handlers immediately after making the request,
157 // and remember the jqxhr object for this request
158 if (jqxhr != null)
159 jqxhr.abort();
160
161 jqxhr = $.post("<?php echo admin_url('admin-ajax.php'); ?>", ajax_param,
162 function(data) {
163 var select_list = '<option value=""> <?php echo esc_js('Not Selected', 'wpdirectorykit'); ?> </option>';
164 jQuery.each(data.output.locations, function(i, v) {
165 select_list += '<option value="' + i + '"> ' + v + ' </option>';
166 });
167
168 jQuery('#related_svg_map_location').html(select_list);
169
170 }).always(function(data) {
171 jQuery('#related_svg_map_location').closest('tr').find('label').removeClass('wdk_btn_load_indicator out');
172 });
173 return false;
174 })
175 })
176 </script>
177
178
179 <?php
180 wp_enqueue_style('wdk-svg-map');
181 wp_enqueue_style('wdk-geo-map-lib', WDK_SVG_MAP_URL . 'public/css/wdk-geo-map-lib.css', array(), 1.0, 'all');
182 wp_enqueue_script('wdk-geo-map-lib', WDK_SVG_MAP_URL . 'public/js/wdk-geo-map-lib.js', array('jquery'), 1.0, false);
183 wp_enqueue_style('dashicons');
184
185 $params = array(
186 'ajax_url' => admin_url('admin-ajax.php')
187 );
188 wp_localize_script('wdk-geo-map-lib', 'wdk_geo_map_script_parameters', $params);
189
190 ?>
191
192 <script>
193 jQuery(document).ready(function($) {
194 var that = $('.postbox.postbox-map .inside');
195 var geomap = that.find('.wdk_svg_map').WdkSvgMap('set_config', {
196 'base_path': '<?php echo esc_js(WDK_SVG_MAP_PACS_URL); ?>',
197 'color_hover': '#2271b1',
198 'color_active': '#2271b1',
199 'color_border_hover': '#2271b1',
200 'color_border_active': '#2271b1',
201 });
202
203 /* events */
204 geomap.on('map_generated.WdkSvgMap', function(event) {
205 var map_back = that.find('.map-back');
206 if (event.tree_maps.length) {
207 var names = '';
208 for (let el of event.tree_maps) {
209 if (names != '')
210 names += ' - ';
211 names += el.location_name;
212 }
213 map_back.find('.name').html(names);
214
215 map_back.show().off().on('click', function(e) {
216 e.preventDefault();
217 geomap.WdkSvgMap('set_pre_map');
218 });
219 } else {
220 map_back.hide();
221 }
222
223 var html = "";
224 if (event.locations_list) {
225 html += "<ul>"
226 jQuery.each(event.locations_list, function(index, value) {
227 html += "<li>" + value + "</li>"
228 })
229 html += "</ul>"
230 }
231
232 jQuery('.map-list').html(html);
233
234 });
235
236 geomap.WdkSvgMap('generate_map', that.find('.wdk_svg_map').attr('data-map'));
237
238 $('#related_svg_map').on('input', function(e) {
239 e.preventDefault();
240
241 if ($(this).val() != '' && $(this).val() != 0) {
242 jQuery('.postbox.postbox-map').show();
243 } else {
244 jQuery('.postbox.postbox-map').hide();
245 }
246
247 geomap.WdkSvgMap('generate_map', $(this).val());
248 });
249
250 });
251 </script>
252
253 <?php endif;?>
254
255 <?php $this->view('general/footer', $data); ?>