PluginProbe
WP Directory Kit / 1.4.8
WP Directory Kit v1.4.8
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
← All changes | application/controllers/Wdk.php +43 -7 1.2.31.4.8 View file →
@@ -51,8 +51,21 @@
51 51 foreach($dbusers as $dbuser) {
52 52 $this->data['users'][wmvc_show_data('ID', $dbuser)] = '#'.wmvc_show_data('ID', $dbuser).', '.wmvc_show_data('display_name', $dbuser);
53 53 }
54 54
55 + $this->data['fields_list'] = $this->field_m->get();
56 +
57 + $fields_data = $this->field_m->get();
58 + $this->data['fields_list'] = array();
59 +
60 + foreach($fields_data as $field)
61 + {
62 + if(wmvc_show_data('field_type', $field) == 'SECTION') {
63 + } else {
64 + $this->data['fields_list']['field_'.wmvc_show_data('idfield', $field)] = '#'.wmvc_show_data('idfield', $field).' '.wmvc_show_data('field_label', $field).'['.wmvc_show_data('field_type', $field).']';
65 + }
66 + }
67 +
55 68 $controller = 'listing';
56 69 $columns = array('ID', 'location_id', 'category_id', 'post_title', 'post_date', 'search', 'order_by', 'address','user_id_editor', 'is_featured','is_activated','is_approved');
57 70 $external_columns = array('location_id', 'category_id', 'post_title', 'user_id_editor',);
58 71
@@ -65,8 +78,10 @@
65 78 'post_date ASC' => __('Post Date', 'wpdirectorykit').' ASC',
66 79 'post_date DESC' => __('Post Date', 'wpdirectorykit').' DESC',
67 80 'date_modified ASC' => __('Last Modified Date', 'wpdirectorykit').' ASC',
68 81 'date_modified DESC' => __('Last Modified Date', 'wpdirectorykit').' DESC',
82 + $this->listing_m->_table_name.'.rank ASC, ID ASC' => __('Rank', 'wpdirectorykit').' ASC',
83 + $this->listing_m->_table_name.'.rank DESC, ID DESC' => __('Rank', 'wpdirectorykit').' DESC',
69 84 );
70 85
71 86 $rules = array(
72 87 array(
@@ -105,10 +120,28 @@
105 120 'rules' => ''
106 121 ),
107 122 );
108 123
124 + $custom_parameters = array();
125 + foreach ($this->input->get() as $key => $value) {
126 + if(stripos($key, 'c_field_') !== FALSE && stripos($key, '_field',8) !== FALSE) {
127 + $field_id = substr($key, 8, (stripos($key, '_',8) - 8) );
128 + if(!empty($_GET['c_field_'.$field_id.'_field'])
129 + && !empty($_GET['c_field_'.$field_id.'_like'])
130 + && !empty($_GET['c_field_'.$field_id.'_value'])) {
131 + switch ($_GET['c_field_'.$field_id.'_like']) {
132 + case '>': $custom_parameters[sanitize_key($_GET['c_field_'.$field_id.'_field']).'_min'] = sanitize_text_field($_GET['c_field_'.$field_id.'_value']);
133 + break;
134 + case '<': $custom_parameters[sanitize_key($_GET['c_field_'.$field_id.'_field']).'_max'] = sanitize_text_field($_GET['c_field_'.$field_id.'_value']);
135 + break;
136 + case '==': $custom_parameters[sanitize_key($_GET['c_field_'.$field_id.'_field'])] = sanitize_text_field($_GET['c_field_'.$field_id.'_value']);
137 + break;
138 + }
139 + }
140 + }
141 + };
142 +
109 143 $this->data['db_data'] = $this->listing_m->prepare_data($this->input->get(), $rules);
110 -
111 144 /* [/Search Form] */
112 145
113 146 $where = array();
114 147 if(isset($_GET['inactive']) && $_GET['inactive'] == 'on') {
@@ -114,9 +147,9 @@
114 147 if(isset($_GET['inactive']) && $_GET['inactive'] == 'on') {
115 148 $where['(is_activated IS NULL OR is_approved IS NULL)'] = NULL;
116 149 }
117 150
118 - wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns);
151 + wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters);
119 152 $total_items = $this->listing_m->total($where);
120 153
121 154 $current_page = 1;
122 155
@@ -133,9 +166,9 @@
133 166
134 167 if(function_exists('wmvc_wp_paginate'))
135 168 $this->data['pagination_output'] = wmvc_wp_paginate($total_items, $per_page);
136 169
137 - wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns);
170 + wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters);
138 171 $this->data['listings'] = $this->listing_m->get_pagination($per_page, $offset, $where);
139 172
140 173 // Load view
141 174 $this->load->view('wdk/index', $this->data);
@@ -152,8 +185,10 @@
152 185 check_admin_referer( 'wdk-listing-delete_'.$post_id, '_wpnonce' );
153 186
154 187 $this->listing_m->delete($post_id);
155 188
189 + do_action('wpdirectorykit/listing/removed');
190 +
156 191 wp_redirect(admin_url("admin.php?page=wdk&paged=$paged"));
157 192 }
158 193
159 194 public function bulk_delete($posts_selected)
@@ -167,8 +202,9 @@
167 202 {
168 203 $this->listing_m->delete($post_id);
169 204 }
170 205
206 + do_action('wpdirectorykit/listing/bulk_removed');
171 207 wp_redirect(admin_url("admin.php?page=wdk"));
172 208 }
173 209
174 210 public function bulk_deactivate($posts_selected)
@@ -181,9 +217,9 @@
181 217 {
182 218 if($this->listing_m->check_deletable($post_id))
183 219 $this->listing_m->insert(array('is_activated'=>NULL), $post_id);
184 220 }
185 -
221 + do_action('wpdirectorykit/listing/updated');
186 222 wp_redirect(admin_url("admin.php?page=wdk"));
187 223 }
188 224
189 225 public function bulk_activate($posts_selected)
@@ -196,9 +232,9 @@
196 232 {
197 233 if($this->listing_m->check_deletable($post_id))
198 234 $this->listing_m->insert(array('is_activated'=>1), $post_id);
199 235 }
200 -
236 + do_action('wpdirectorykit/listing/updated');
201 237 wp_redirect(admin_url("admin.php?page=wdk"));
202 238 }
203 239 public function bulk_deapprove($posts_selected)
204 240 {
@@ -211,9 +247,9 @@
211 247 {
212 248 if($this->listing_m->check_deletable($post_id))
213 249 $this->listing_m->insert(array('is_approved'=>NULL), $post_id);
214 250 }
215 -
251 + do_action('wpdirectorykit/listing/updated');
216 252 wp_redirect(admin_url("admin.php?page=wdk"));
217 253 }
218 254
219 255 public function bulk_approve($posts_selected)
@@ -226,8 +262,8 @@
226 262 {
227 263 if($this->listing_m->check_deletable($post_id))
228 264 $this->listing_m->insert(array('is_approved'=>1), $post_id);
229 265 }
230 -
266 + do_action('wpdirectorykit/listing/updated');
231 267 wp_redirect(admin_url("admin.php?page=wdk"));
232 268 }
233 269 }