PluginProbe
Property Hive / 2.3.1
Property Hive v2.3.1
2.4.0 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 All 262 releases
propertyhive / includes / admin / views / html-property-sales-meta-box.php

html-property-sales-meta-box.php in Property Hive 2.3.1, at includes/admin/views/html-property-sales-meta-box.php

160 lines 10.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 exit;
4 }
5
6 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
7 $meta_query = array(
8 array(
9 'key' => '_property_id',
10 'value' => $post_id,
11 ),
12 );
13
14 if ( isset($selected_status) && !empty($selected_status) )
15 {
16 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
17 $meta_query[] = array(
18 'key' => '_status',
19 'value' => $selected_status,
20 );
21 }
22
23 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
24 $args = array(
25 'post_type' => 'sale',
26 'nopaging' => true,
27 'orderby' => 'meta_value',
28 'order' => 'DESC',
29 // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- The CRM grid orders all linked records by their stored event date; keep metadata ordering for existing display and export parity.
30 'meta_key' => '_sale_date_time',
31 'post_status' => 'publish',
32 // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Required relationship/status metadata restricts this grid to the selected property; retain existing result and status-filter semantics.
33 'meta_query' => $meta_query,
34 );
35 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
36 $sales_query = new WP_Query( $args );
37 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
38 $sales_count = $sales_query->found_posts;
39
40 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
41 $columns = array(
42 'date' => __( 'Sale Date', 'propertyhive' ),
43 'applicant' => __( 'Applicant(s)', 'propertyhive' ),
44 'amount' => __( 'Sale Amount', 'propertyhive' ),
45 'status' => __( 'Status', 'propertyhive' ),
46 );
47
48 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
49 $columns = apply_filters( 'propertyhive_property_sales_columns', $columns );
50 ?>
51
52 <div class="tablenav top">
53 <div class="alignleft actions">
54 <select name="_status" id="_sale_status_filter">
55 <option value=""><?php echo esc_html(__( 'All Statuses', 'propertyhive' )); ?></option>
56 <?php
57 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
58 $sale_statuses = ph_get_sale_statuses();
59
60 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
61 foreach ( $sale_statuses as $status => $display_status )
62 {
63 ?>
64 <option value="<?php echo esc_attr($status); ?>" <?php selected( $status, $selected_status ); ?>><?php echo esc_html($display_status); ?></option>
65 <?php
66 }
67 ?>
68 </select>
69 <input type="button" name="filter_action" id="filter-property-sales-grid" class="button" value="Filter">
70 <a href="" name="export_action" id="export-property-sales-grid" class="button">Export</a>
71 </div>
72 <div class='tablenav-pages one-page'>
73 <span class="displaying-num"><?php echo esc_attr($sales_count); ?> item<?php echo $sales_count != 1 ? 's' : ''; ?></span>
74 </div>
75 <br class="clear" />
76 </div>
77 <table class="wp-list-table widefat fixed striped posts">
78 <thead>
79 <tr>
80 <?php
81 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
82 $column_i = 0;
83 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
84 foreach ( $columns as $column_key => $column )
85 {
86 ?>
87 <th scope="col" id='<?php echo esc_attr($column_key); ?>' class='manage-column column-<?php echo esc_attr($column_key); echo ($column_i == 0 ? ' column-primary' : ''); ?>'><?php echo esc_html($column); ?></th>
88 <?php
89 ++$column_i;
90 }
91 ?>
92 </tr>
93 </thead>
94 <tbody id="the-list">
95 <?php
96 if ( $sales_query->have_posts() )
97 {
98 while ( $sales_query->have_posts() )
99 {
100 $sales_query->the_post();
101 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
102 $the_sale = new PH_Sale( get_the_ID() );
103
104 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
105 $edit_link = get_edit_post_link( get_the_ID() );
106
107 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
108 $column_data = array(
109 'date' => '<a href="' . esc_url($edit_link) . '" target="' . esc_attr(apply_filters('propertyhive_subgrid_link_target', '')) . '" data-sale-id="' . esc_attr(get_the_ID()) . '">' . esc_html(gmdate("jS F Y", strtotime($the_sale->_sale_date_time))) . '</a>',
110 'applicant' => $the_sale->get_applicants( true, true ),
111 'amount' => esc_html($the_sale->get_formatted_amount()),
112 'status' => esc_html(propertyhive_get_status_label( $the_sale->_status )),
113 );
114
115 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
116 $row_classes = array( 'status-' . $the_sale->_status );
117 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
118 $row_classes = apply_filters( 'propertyhive_property_sales_row_classes', $row_classes, get_the_ID(), $the_sale );
119 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
120 $row_classes = is_array($row_classes) ? array_map( 'sanitize_html_class', array_map( 'strtolower', $row_classes ) ) : array();
121 ?>
122 <tr class="<?php echo esc_attr(implode(" ", $row_classes)); ?>" >
123 <?php
124 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
125 $column_i = 0;
126 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope.
127 foreach ( $columns as $column_key => $column )
128 {
129 echo '<td class="' . esc_attr($column_key) . ' column-' . esc_attr($column_key) . ($column_i == 0 ? ' column-primary' : '') . '" data-colname="' . esc_attr($column) . '">';
130
131 if ( isset( $column_data[$column_key] ) )
132 {
133 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Core cells are escaped HTML assembled above or by the reviewed PH model formatters; preserve trusted PHP contact-detail filter markup and links.
134 echo $column_data[$column_key];
135 }
136
137 do_action( 'propertyhive_property_sales_custom_column', $column_key );
138
139 if ( $column_i == 0 ) { echo '<button type="button" class="toggle-row"><span class="screen-reader-text">' . esc_html(__('Show more details', 'propertyhive' )) . '</span></button>'; }
140
141 echo '</td>';
142 ++$column_i;
143 }
144 ?>
145 </tr>
146 <?php
147 }
148 }
149 else
150 {
151 ?>
152 <tr class="no-items">
153 <td class="colspanchange" colspan="<?php echo esc_attr(count($columns)); ?>"><?php echo esc_html(__( 'No sales found', 'propertyhive' )); ?></td>
154 </tr>
155 <?php
156 }
157 wp_reset_postdata();
158 ?>
159 </tbody>
160 </table>