PluginProbe
Property Hive / 2.4.0
Property Hive v2.4.0
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-enquiries-meta-box.php

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

163 lines 10.5 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 'relation' => 'OR',
10 array(
11 'key' => 'property_id',
12 'value' => $post_id,
13 ),
14 array(
15 'key' => '_property_id',
16 'value' => $post_id,
17 ),
18 ),
19 );
20
21 if ( isset($selected_status) && !empty($selected_status) )
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 $meta_query[] = array(
25 'key' => '_status',
26 'value' => $selected_status,
27 );
28 }
29
30 // 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.
31 $args = array(
32 'post_type' => 'enquiry',
33 'nopaging' => true,
34 // 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.
35 'meta_query' => $meta_query,
36 );
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 $enquiries_query = new WP_Query( $args );
39 // 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.
40 $enquiries_count = $enquiries_query->found_posts;
41
42 // 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.
43 $columns = array(
44 'date_time' => __( 'Date', 'propertyhive' ) . ' / ' . __( 'Time', 'propertyhive' ),
45 'subject' => __( 'Subject', 'propertyhive' ),
46 'status' => __( 'Status', 'propertyhive' ),
47 'negotiator' => __( 'Negotiator', 'propertyhive' ),
48 'office' => __( 'Office', 'propertyhive' ),
49 );
50
51 // 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.
52 $columns = apply_filters( 'propertyhive_property_enquiries_columns', $columns );
53 ?>
54
55 <div class="tablenav top">
56 <div class="alignleft actions">
57 <select name="_status" id="_enquiry_status_filter">
58 <option value=""><?php echo esc_html(__( 'All Statuses', 'propertyhive' )); ?></option>
59 <?php
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 $enquiry_statuses = ph_get_enquiry_statuses();
62
63 // 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.
64 foreach ( $enquiry_statuses as $status => $display_status )
65 {
66 ?>
67 <option value="<?php echo esc_attr($status); ?>" <?php selected( $status, $selected_status ); ?>><?php echo esc_html($display_status); ?></option>
68 <?php
69 }
70 ?>
71 </select>
72 <input type="button" name="filter_action" id="filter-property-enquiries-grid" class="button" value="Filter">
73 </div>
74 <div class='tablenav-pages one-page'>
75 <span class="displaying-num"><?php echo esc_html($enquiries_count); ?> item<?php echo $enquiries_count != 1 ? 's' : ''; ?></span>
76 </div>
77 <br class="clear" />
78 </div>
79 <table class="wp-list-table widefat fixed striped posts">
80 <thead>
81 <tr>
82 <?php
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 $column_i = 0;
85 // 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.
86 foreach ( $columns as $column_key => $column )
87 {
88 ?>
89 <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>
90 <?php
91 ++$column_i;
92 }
93 ?>
94 </tr>
95 </thead>
96 <tbody id="the-list">
97 <?php
98 if ( $enquiries_query->have_posts() )
99 {
100 while ( $enquiries_query->have_posts() )
101 {
102 $enquiries_query->the_post();
103 // 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.
104 $the_enquiry = new PH_Enquiry( get_the_ID() );
105
106 // 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.
107 $edit_link = get_edit_post_link( get_the_ID() );
108
109 // 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.
110 $column_data = array(
111 'date_time' => '<a href="' . esc_url($edit_link) . '" target="' . esc_attr(apply_filters('propertyhive_subgrid_link_target', '')) . '">' . esc_html(get_the_time( 'jS M Y H:i' )) . '</a>',
112 'subject' => esc_html(get_the_title()),
113 'status' => esc_html(ucfirst( $the_enquiry->status )),
114 'negotiator' => wp_kses($the_enquiry->get_negotiator(), array( 'em' => array() )),
115 'office' => esc_html($the_enquiry->get_office()),
116 );
117
118 // 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.
119 $row_classes = array( 'status-' . $the_enquiry->_status );
120 // 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.
121 $row_classes = apply_filters( 'propertyhive_property_enquiries_row_classes', $row_classes, get_the_ID(), $the_enquiry );
122 // 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.
123 $row_classes = is_array($row_classes) ? array_map( 'sanitize_html_class', array_map( 'strtolower', $row_classes ) ) : array();
124 ?>
125 <tr class="<?php echo esc_attr(implode(" ", $row_classes)); ?>" >
126 <?php
127 // 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.
128 $column_i = 0;
129 // 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.
130 foreach ( $columns as $column_key => $column )
131 {
132 echo '<td class="' . esc_attr($column_key) . ' column-' . esc_attr($column_key) . ($column_i == 0 ? ' column-primary' : '') . '" data-colname="' . esc_attr($column) . '">';
133
134 if ( isset( $column_data[$column_key] ) )
135 {
136 // 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.
137 echo $column_data[$column_key];
138 }
139
140 do_action( 'propertyhive_property_enquiries_custom_column', $column_key );
141
142 if ( $column_i == 0 ) { echo '<button type="button" class="toggle-row"><span class="screen-reader-text">' . esc_html(__('Show more details', 'propertyhive' )) . '</span></button>'; }
143
144 echo '</td>';
145 ++$column_i;
146 }
147 ?>
148 </tr>
149 <?php
150 }
151 }
152 else
153 {
154 ?>
155 <tr class="no-items">
156 <td class="colspanchange" colspan="<?php echo count($columns); ?>"><?php echo esc_html(__( 'No enquiries found', 'propertyhive' )); ?></td>
157 </tr>
158 <?php
159 }
160 wp_reset_postdata();
161 ?>
162 </tbody>
163 </table>