PluginProbe
WP Directory Kit / 1.2.7
WP Directory Kit v1.2.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 1.4.0 1.4.1 All 35 releases
wpdirectorykit / application / views / wdk_fields / index.php

index.php in WP Directory Kit 1.2.7, at application/views/wdk_fields/index.php

178 lines 10.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The template for Directory Fields Management.
4 *
5 * This is the template that table, search layout
6 *
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
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 __('Directory Fields Management','wpdirectorykit'); ?> <a href="<?php echo get_admin_url() . "admin.php?page=wdk_fields&function=field_edit"; ?>" class="button button-primary" id="add_field_button"><?php echo __('Add Field','wpdirectorykit'); ?></a></h1>
18 <br /><br />
19 <div class="wdk-body ">
20 <div class="row fields_list">
21 <?php if(count($fields) == 0): ?>
22 <?php if(!function_exists('eli_installer') || !function_exists('run_elementinvader') || !is_plugin_active('elementor/elementor.php')):?>
23 <?php
24 $tgma_link = '';
25 if(file_exists(get_template_directory().'/includes/tgm_pa/class-tgm-plugin-activation.php') || file_exists(get_template_directory().'/tgm_pa/class-tgm-plugin-activation.php')) {
26 $tgma_link = get_admin_url() . "themes.php?page=tgmpa-install-plugins";
27 } else {
28 $tgma_link = get_admin_url() . "plugins.php?page=tgmpa-install-plugins";
29 }
30 ?>
31
32 <div class="notice notice-error">
33 <p>
34 <?php echo __('First please install / activate required plugins, then you can import demo data','wpdirectorykit'); ?>
35 <a href="<?php echo esc_url($tgma_link); ?>" class="button button-primary">
36 <?php echo __('Begin to install / activate','wpdirectorykit'); ?>
37 </a>
38 </p>
39 </div>
40 <?php else:?>
41 <?php
42 if(file_exists(WPDIRECTORYKIT_PATH.'demo-data/'))
43 {
44 $files = array();
45 $dir = WPDIRECTORYKIT_PATH.'demo-data/';
46 if (is_dir($dir)) {
47 if ($dh = opendir($dir)) {
48 while (($file = readdir($dh)) !== false) {
49 if($file == 'locations.xml') continue;
50 if(strpos($file, '.xml') !== false && strpos($file, '~') === false)
51 $multipurpose_values[$file] = ucfirst(str_replace(array('_', '-', '.xml'), ' ', $file));
52 }
53 closedir($dh);
54 }
55 }
56 }
57 ksort($multipurpose_values);
58
59
60 if(has_filter('wdk/settings/import/multipurpose_values'))
61 $multipurpose_values = apply_filters('wdk/settings/import/multipurpose_values', $multipurpose_values);
62 ?>
63 <div class="notice notice-success">
64 <p>
65 <?php echo __('You don\'t have any fields, import demo data for','wpdirectorykit'); ?>
66 <select name="multipurpose" class="field_purpose align-top text-capitalize">
67 <?php foreach ($multipurpose_values as $purpose_key => $purpose) :?>
68 <?php
69 $selected = '';
70 if($purpose_key=='real-estate.xml')
71 $selected = "selected ='selected'";
72 ?>
73 <option value="<?php echo esc_attr($purpose_key);?>" <?php echo esc_html($selected);?>><?php echo esc_html(ucwords($purpose));?></option>
74 <?php endforeach;?>
75 </select>
76 <a href="<?php echo get_admin_url() . "admin.php?page=wdk_settings&function=run&multipurpose=real-estate.xml&redirect_url=admin.php?page=wdk_fields&_wpnonce=".wp_create_nonce( 'wdk-import-data-run'); ?>" class="button button-primary event-ajax-indicator" id="import_demo_field_button">
77 <?php echo __('Click here to import now','wpdirectorykit'); ?>
78 </a>
79 <span class="wdk-ajax-indicator wdk-infinity-load color-primary dashicons dashicons-update-alt hidden" style="margin-top: 6px;margin-left: 4px;"></span>
80 </p>
81 </div>
82 <?php endif; ?>
83 <?php endif; ?>
84 <?php
85 if (isset($_GET['message'])) {
86 echo '<p class="alert alert-success">' .str_replace("+", ' ', wp_kses_post(urldecode($_GET['message']))) . '</p><br/>';
87 }
88 ?>
89
90 <div id="wdk-sortable-fields" class="meta-box-sortables ui-sortable wdk-row">
91 <?php foreach($fields as $field): ?>
92 <div id="fid_<?php echo esc_attr($field->idfield); ?>" class=" wdk_field wdk-col-md-<?php echo esc_attr($field->columns_number); ?> <?php echo esc_attr($field->field_type); ?>" rel="<?php echo esc_attr($field->idfield); ?>">
93 <div class="postbox-header postbox ">
94 <h3 class="hndle ui-sortable-handle"> <a href="<?php echo get_admin_url() . "admin.php?page=wdk_fields&function=field_edit&id=".esc_attr($field->idfield); ?>">#<?php echo esc_html($field->idfield); ?> <?php echo esc_html($field->field_label); ?> <?php echo !empty(wmvc_show_data('is_required', $field, ''))?'*':''; ?> [<?php echo esc_html($field->field_type); ?>]</a>
95 <a class="question_sure pull_right" href="<?php echo get_admin_url() . "admin.php?page=wdk_fields&function=delete&id=".esc_attr($field->idfield); ?>&_wpnonce=<?php echo wp_create_nonce( 'wdk-fields-delete_'.esc_attr($field->idfield));?>" title="<?php echo esc_attr__('Remove','wpdirectorykit');?>"><span class="dashicons dashicons-no"></span></a>
96 <a class="pull_right" href="<?php echo get_admin_url() . "admin.php?page=wdk_fields&function=field_edit&id=".esc_attr($field->idfield); ?>" title="<?php echo esc_attr__('Edit','wpdirectorykit');?>"><span class="dashicons dashicons-edit"></span></a>
97 </h3>
98 <?php if(false): ?>
99 <div class="handle-actions hide-if-no-js">
100 <button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="postimagediv-handle-order-higher-description">
101 <span class="screen-reader-text">Move up</span>
102 <span class="order-higher-indicator" aria-hidden="true"></span>
103 </button>
104 <span class="hidden" id="postimagediv-handle-order-higher-description">Move Featured image box up</span>
105 <button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="postimagediv-handle-order-lower-description">
106 <span class="screen-reader-text">Move down</span><span class="order-lower-indicator" aria-hidden="true"></span>
107 </button>
108 <span class="hidden" id="postimagediv-handle-order-lower-description">Move Featured image box down</span>
109 <button type="button" class="handlediv" aria-expanded="true"><span class="screen-reader-text">Toggle panel: Featured image</span>
110 <span class="toggle-indicator" aria-hidden="true"></span>
111 </button>
112 </div>
113 <?php endif; ?>
114 </div>
115 <?php if(false): ?>
116 <div class="inside">
117 <p class="hide-if-no-js"></p>
118 </div>
119 <?php endif; ?>
120 </div>
121 <?php endforeach; ?>
122 </div>
123
124 <div class="alert alert-info" style="margin-bottom:20px" role="alert"><?php echo sprintf(__('%1$s This fields and section can be restructured, replaced/moved with drag & drop, resized etc. How to add new fields?%2$s', 'wpdirectorykit'),'<a href="//wpdirectorykit.com/documentation/#!/custom_fields" target="_blank">','</a>'); ?></div>
125 <iframe width="560" height="315" src="//www.youtube.com/embed/cewZBOGzbPg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
126 </div>
127 </div>
128 </div>
129
130 <?php
131
132 wp_enqueue_script( 'jquery-ui-core', false, array('jquery') );
133 wp_enqueue_script( 'jquery-ui-sortable', false, array('jquery') );
134
135 ?>
136
137
138 <script>
139 // Generate table
140 jQuery(document).ready(function($) {
141
142 $('.field_purpose').on('change', function(){
143 $('#import_demo_field_button').attr('href', '<?php echo get_admin_url() . "admin.php?page=wdk_settings&function=run&redirect_url=admin.php?page=wdk_fields&_wpnonce=".wp_create_nonce( 'wdk-import-data-run'); ?>&multipurpose='+$(this).find(":selected").attr('value'))
144 });
145
146 $( "#wdk-sortable-fields" ).sortable({
147 update: function(event, ui) {
148
149 var data_fields_list = '';
150
151 $('#wdk-sortable-fields .wdk_field').each(function( index ) {
152 data_fields_list+=$( this ).attr('rel')+';';
153 });
154
155 //console.log(data_fields_list);
156
157 var data = {
158 'page': 'wdk_fields',
159 'function': 'ajax_save_order',
160 'action': 'wdk_admin_action',
161 'data_fields_list' : data_fields_list
162 };
163
164 $.post( "<?php echo esc_url(admin_url( 'admin-ajax.php' )); ?>", data)
165 .done(function( data ) {
166 //alert( "Data Loaded: " + data );
167 });
168 }
169 });
170
171 $('.question_sure').on('click', function(){
172 return confirm("<?php echo esc_js(__('Are you sure? Selected item will be completely removed!','wpdirectorykit')); ?>");
173 });
174 });
175
176 </script>
177
178 <?php $this->view('general/footer', $data); ?>