PluginProbe
WP Directory Kit / 1.1.0
WP Directory Kit v1.1.0
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.1.0, at application/views/wdk_fields/index.php

175 lines 10.3 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 <div class="notice notice-success">
60 <p>
61 <?php echo __('You don\'t have any fields, import demo data for','wpdirectorykit'); ?>
62 <select name="multipurpose" class="field_purpose align-top text-capitalize">
63 <?php foreach ($multipurpose_values as $purpose_key => $purpose) :?>
64 <?php
65 $selected = '';
66 if($purpose_key=='real-estate.xml')
67 $selected = "selected ='selected'";
68 ?>
69 <option value="<?php echo esc_attr($purpose_key);?>" <?php echo esc_html($selected);?>><?php echo esc_html(ucwords($purpose));?></option>
70 <?php endforeach;?>
71 </select>
72 <a href="<?php echo get_admin_url() . "admin.php?page=wdk_settings&function=run&multipurpose=real-estate.xml&redirect_url=".get_admin_url()."admin.php?page=wdk_fields"; ?>" class="button button-primary event-ajax-indicator" id="import_demo_field_button">
73 <?php echo __('Click here to import now','wpdirectorykit'); ?>
74 </a>
75 <span class="wdk-ajax-indicator wdk-infinity-load color-primary dashicons dashicons-update-alt hidden" style="margin-top: 6px;margin-left: 4px;"></span>
76 </p>
77 </div>
78 <?php endif; ?>
79 <?php endif; ?>
80 <?php
81 if (isset($_GET['message'])) {
82 echo '<p class="alert alert-success">' .str_replace("+", ' ', sanitize_text_field($_GET['message'])) . '</p><br/>';
83 }
84 ?>
85
86 <div id="wdk-sortable-fields" class="meta-box-sortables ui-sortable wdk-row">
87 <?php foreach($fields as $field): ?>
88 <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); ?>">
89 <div class="postbox-header postbox ">
90 <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>
91 <a class="question_sure pull_right" href="<?php echo get_admin_url() . "admin.php?page=wdk_fields&function=delete&&id=".esc_attr($field->idfield); ?>"><span class="dashicons dashicons-no"></span></a>
92 <a class="pull_right" href="<?php echo get_admin_url() . "admin.php?page=wdk_fields&function=field_edit&id=".esc_attr($field->idfield); ?>"><span class="dashicons dashicons-edit"></span></a>
93 </h3>
94 <?php if(false): ?>
95 <div class="handle-actions hide-if-no-js">
96 <button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="postimagediv-handle-order-higher-description">
97 <span class="screen-reader-text">Move up</span>
98 <span class="order-higher-indicator" aria-hidden="true"></span>
99 </button>
100 <span class="hidden" id="postimagediv-handle-order-higher-description">Move Featured image box up</span>
101 <button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="postimagediv-handle-order-lower-description">
102 <span class="screen-reader-text">Move down</span><span class="order-lower-indicator" aria-hidden="true"></span>
103 </button>
104 <span class="hidden" id="postimagediv-handle-order-lower-description">Move Featured image box down</span>
105 <button type="button" class="handlediv" aria-expanded="true"><span class="screen-reader-text">Toggle panel: Featured image</span>
106 <span class="toggle-indicator" aria-hidden="true"></span>
107 </button>
108 </div>
109 <?php endif; ?>
110 </div>
111 <?php if(false): ?>
112 <div class="inside">
113 <p class="hide-if-no-js"></p>
114 </div>
115 <?php endif; ?>
116 </div>
117 <?php endforeach; ?>
118 </div>
119
120 <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 feilds?%2$s', 'wpdirectorykit'),'<a href="//wpdirectorykit.com/documentation/#!/custom_fields" target="_blank">','</a>'); ?></div>
121 <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>
122 </div>
123 </div>
124 </div>
125
126 <?php
127
128 wp_enqueue_script( 'jquery-ui-core', false, array('jquery') );
129 wp_enqueue_script( 'jquery-ui-sortable', false, array('jquery') );
130
131 ?>
132
133
134 <script>
135 // Generate table
136 jQuery(document).ready(function($) {
137
138 $('.field_purpose').on('change', function(){
139 $('#import_demo_field_button').attr('href', '<?php echo get_admin_url() . "admin.php?page=wdk_settings&function=run&redirect_url=".get_admin_url()."admin.php?page=wdk_fields"; ?>&multipurpose='+$(this).find(":selected").attr('value'))
140 });
141
142 $( "#wdk-sortable-fields" ).sortable({
143 update: function(event, ui) {
144 console.log($('#wdk-sortable-fields span.column_name'));
145
146 var data_fields_list = '';
147
148 $('#wdk-sortable-fields .wdk_field').each(function( index ) {
149 data_fields_list+=$( this ).attr('rel')+';';
150 });
151
152 //console.log(data_fields_list);
153
154 var data = {
155 'page': 'wdk_fields',
156 'function': 'ajax_save_order',
157 'action': 'wdk_admin_action',
158 'data_fields_list' : data_fields_list
159 };
160
161 $.post( "<?php echo esc_url(admin_url( 'admin-ajax.php' )); ?>", data)
162 .done(function( data ) {
163 //alert( "Data Loaded: " + data );
164 });
165 }
166 });
167
168 $('.question_sure').on('click', function(){
169 return confirm("<?php echo esc_js(__('Are you sure? Selected item will be completely removed!','wpdirectorykit')); ?>");
170 });
171 });
172
173 </script>
174
175 <?php $this->view('general/footer', $data); ?>