PluginProbe
Property Hive / 1.4.47
Property Hive v1.4.47
2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 All 261 releases
propertyhive / includes / admin / reports / class-ph-report-incomplete-properties.php

class-ph-report-incomplete-properties.php in Property Hive 1.4.47, at includes/admin/reports/class-ph-report-incomplete-properties.php

332 lines 9.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 /**
8 * PH_Report_Incomplete_Properties
9 *
10 * @author PropertyHive
11 * @category Admin
12 * @package PropertyHive/Admin/Reports
13 * @version 1.0.0
14 */
15 class PH_Report_Incomplete_Properties extends PH_Admin_Report {
16
17 /**
18 * Output the report.
19 */
20 public function output_report() {
21 ?>
22
23 <style type="text/css">
24
25 .chart-with-sidebar { padding:12px 12px 12px 249px; background:#FFF; border:1px solid #DDD; min-height:300px; }
26 .chart-sidebar { width:225px; margin-left:-237px; float:left; }
27 .chart-main { }
28
29 </style>
30
31 <br>
32
33 <div class="chart-with-sidebar">
34
35 <div class="chart-sidebar">
36
37 <form method="post" action="">
38
39 <label for="missing">Show Properties Missing:</label>
40 <select name="missing" id="missing" style="width:100%;">
41 <option value="">One or more items</option>
42 <option value="_photos"<?php if ( isset($_POST['missing']) && $_POST['missing'] == '_photos' ) { echo ' selected'; } ?>>Photos</option>
43 <option value="_floorplans"<?php if ( isset($_POST['missing']) && $_POST['missing'] == '_floorplans' ) { echo ' selected'; } ?>>Floorplans</option>
44 <option value="_epcs"<?php if ( isset($_POST['missing']) && $_POST['missing'] == '_epcs' ) { echo ' selected'; } ?>>EPCS</option>
45 <option value="_brochures"<?php if ( isset($_POST['missing']) && $_POST['missing'] == '_brochures' ) { echo ' selected'; } ?>>Brochures</option>
46 <option value="_virtual_tours"<?php if ( isset($_POST['missing']) && $_POST['missing'] == '_virtual_tours' ) { echo ' selected'; } ?>>Virtual Tours</option>
47 <option value="summary"<?php if ( isset($_POST['missing']) && $_POST['missing'] == 'summary' ) { echo ' selected'; } ?>>Summary Description</option>
48 <option value="_latitude"<?php if ( isset($_POST['missing']) && $_POST['missing'] == '_latitude' ) { echo ' selected'; } ?>>Map Co-ordinates</option>
49 </select>
50
51 <br><br>
52
53 <label for="department">Department:</label>
54 <select name="department" id="department" style="width:100%;">
55 <option value="">All</option>
56
57 <?php
58 $departments = ph_get_departments();
59
60 foreach ( $departments as $key => $value )
61 {
62 if ( get_option( 'propertyhive_active_departments_' . str_replace("residential-", "", $key) ) == 'yes' )
63 {
64 echo '<option value="' . $key . '"';
65 if ( isset($_POST['department']) && $_POST['department'] == $key ) { echo ' selected'; }
66 echo '>' . $value . '</option>';
67 }
68 }
69 ?>
70 </select>
71
72 <br><br>
73
74 <label for="on_market">Market Status:</label>
75 <select name="on_market" id="on_market" style="width:100%;">
76 <option value=""<?php if ( isset($_POST['on_market']) && $_POST['on_market'] == '' ) { echo ' selected'; } ?>>On Market Properties Only</option>
77 <option value="all"<?php if ( isset($_POST['on_market']) && $_POST['on_market'] == 'all' ) { echo ' selected'; } ?>>All Properties</option>
78 </select>
79
80 <br><br>
81
82 <label for="metric_two">Office:</label>
83 <select name="office_id" id="office_id" style="width:100%;">
84 <option value="">All Offices</option>
85 <?php
86 $args = array(
87 'post_type' => 'office',
88 'nopaging' => true,
89 );
90
91 $office_query = new WP_Query( $args );
92
93 if ( $office_query->have_posts() )
94 {
95 while ( $office_query->have_posts() )
96 {
97 $office_query->the_post();
98 ?>
99 <option value="<?php echo get_the_ID(); ?>"<?php if ( isset($_POST['office_id']) && ($_POST['office_id'] == get_the_ID()) ) { echo ' selected'; } ?>><?php echo get_the_title(get_the_ID()); ?></option>
100 <?php
101 }
102 }
103
104 wp_reset_postdata();
105 ?>
106 </select>
107
108 <br><br>
109 <input type="submit" value="Update" class="button button-primary">
110
111 </form>
112
113 </div>
114
115 <div class="chart-main">
116
117 <?php
118 $args = array(
119 'post_type' => 'property',
120 'nopaging' => true,
121 'fields' => 'ids',
122 );
123
124 $meta_query = array('relation' => 'AND');
125
126 if ( isset($_POST['on_market']) && $_POST['on_market'] == 'all' )
127 {
128
129 }
130 else
131 {
132 $meta_query[] = array(
133 'key' => '_on_market',
134 'value' => 'yes',
135 );
136 }
137
138 if ( isset($_POST['department']) && $_POST['department'] != '' )
139 {
140 $meta_query[] = array(
141 'key' => '_department',
142 'value' => ph_clean($_POST['department']),
143 );
144 }
145
146 if ( isset($_POST['office_id']) && $_POST['office_id'] != '' )
147 {
148 $meta_query[] = array(
149 'key' => '_office_id',
150 'value' => (int)$_POST['office_id']
151 );
152 }
153
154 $args['meta_query'] = $meta_query;
155
156 $property_query = new WP_Query( $args );
157
158 if ( $property_query->have_posts() )
159 {
160 echo '<table>
161 <tr>
162 <th style="text-align:left;">Property Address</th>
163 <th style="text-align:left;">Missing</th>
164 </tr>';
165 while ( $property_query->have_posts() )
166 {
167 $property_query->the_post();
168
169 $property = new PH_Property( get_the_ID() );
170
171 $missing = array();
172
173 if (
174 (isset($_POST['missing']) && $_POST['missing'] == '_photos') ||
175 (isset($_POST['missing']) && $_POST['missing'] == '') ||
176 !isset($_POST['missing'])
177 )
178 {
179 $photo = $property->get_main_photo_src();
180 if ( $photo === false )
181 {
182 $missing[] = 'Photos';
183 }
184 }
185
186 if (
187 (isset($_POST['missing']) && $_POST['missing'] == '_floorplans') ||
188 (isset($_POST['missing']) && $_POST['missing'] == '') ||
189 !isset($_POST['missing'])
190 )
191 {
192 if ( get_option('propertyhive_brochures_stored_as', '') == 'urls' )
193 {
194 $floorplans = $property->_floorplan_urls;
195 if (isset($floorplans) && is_array($floorplans) && !empty($floorplans) && isset($floorplans[0]) && isset($floorplans[0]['url']))
196 {
197
198 }
199 else
200 {
201 $missing[] = 'Floorplans';
202 }
203 }
204 else
205 {
206 $floorplans = $property->get_floorplan_attachment_ids();
207 if ( $floorplans === false || ( is_array($floorplans) && empty($floorplans) ) )
208 {
209 $missing[] = 'Floorplans';
210 }
211 }
212 }
213
214 if (
215 (isset($_POST['missing']) && $_POST['missing'] == '_epcs') ||
216 (isset($_POST['missing']) && $_POST['missing'] == '') ||
217 !isset($_POST['missing'])
218 )
219 {
220 if ( get_option('propertyhive_epcs_stored_as', '') == 'urls' )
221 {
222 $epcs = $property->_epc_urls;
223 if (isset($epcs) && is_array($epcs) && !empty($epcs) && isset($epcs[0]) && isset($epcs[0]['url']))
224 {
225
226 }
227 else
228 {
229 $missing[] = 'EPCs';
230 }
231 }
232 else
233 {
234 $epcs = $property->get_epc_attachment_ids();
235 if ( $epcs === false || ( is_array($epcs) && empty($epcs) ) )
236 {
237 $missing[] = 'EPCs';
238 }
239 }
240 }
241
242 if (
243 (isset($_POST['missing']) && $_POST['missing'] == '_brochures') ||
244 (isset($_POST['missing']) && $_POST['missing'] == '') ||
245 !isset($_POST['missing'])
246 )
247 {
248 if ( get_option('propertyhive_brochures_stored_as', '') == 'urls' )
249 {
250 $brochures = $property->_brochure_urls;
251 if (isset($brochures) && is_array($brochures) && !empty($brochures) && isset($brochures[0]) && isset($brochures[0]['url']))
252 {
253
254 }
255 else
256 {
257 $missing[] = 'Brochures';
258 }
259 }
260 else
261 {
262 $brochures = $property->get_epc_attachment_ids();
263 if ( $brochures === false || ( is_array($brochures) && empty($brochures) ) )
264 {
265 $missing[] = 'Brochures';
266 }
267 }
268 }
269
270 if (
271 (isset($_POST['missing']) && $_POST['missing'] == '_virtual_tours') ||
272 (isset($_POST['missing']) && $_POST['missing'] == '') ||
273 !isset($_POST['missing'])
274 )
275 {
276 $virtual_tours = $property->get_virtual_tour_urls();
277 if ( $virtual_tours === false || ( is_array($virtual_tours) && empty($virtual_tours) ) )
278 {
279 $missing[] = 'Virtual Tours';
280 }
281 }
282
283 if (
284 (isset($_POST['missing']) && $_POST['missing'] == 'summary') ||
285 (isset($_POST['missing']) && $_POST['missing'] == '') ||
286 !isset($_POST['missing'])
287 )
288 {
289 $summary = $property->post_excerpt;
290 if ( $summary === false || $summary == '' )
291 {
292 $missing[] = 'Summary';
293 }
294 }
295
296 if (
297 (isset($_POST['missing']) && $_POST['missing'] == '_latitude') ||
298 (isset($_POST['missing']) && $_POST['missing'] == '') ||
299 !isset($_POST['missing'])
300 )
301 {
302 $latitude = $property->latitude;
303 if ( $latitude === false || $latitude == '' )
304 {
305 $missing[] = 'Map Co-ordinates';
306 }
307 }
308
309 if ( !empty($missing) )
310 {
311 echo '<tr>';
312
313 echo '<td><a href="' . get_edit_post_link( get_the_ID() ) . '">' . $property->get_formatted_full_address() . '</a></td>';
314
315 echo '<td>' . implode(", ", $missing) . '</td>';
316
317 echo '</tr>';
318 }
319 }
320 echo '</table>';
321 }
322 wp_reset_postdata();
323 ?>
324
325 </div>
326
327 </div>
328
329 <?php
330 }
331
332 }