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-contact-offers-meta-box.php

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

162 lines 10.8 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' => '_applicant_contact_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' => 'offer',
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' => '_offer_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 contact; 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 $offers_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 $offers_count = $offers_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' => __( 'Offer Date', 'propertyhive' ),
43 'property' => __( 'Property', 'propertyhive' ),
44 'property_owner' => __( 'Property Owner', 'propertyhive' ),
45 'amount' => __( 'Offer Amount', 'propertyhive' ),
46 'status' => __( 'Status', 'propertyhive' ),
47 );
48
49 // 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.
50 $columns = apply_filters( 'propertyhive_contact_offers_columns', $columns );
51 ?>
52
53 <div class="tablenav top">
54 <div class="alignleft actions">
55 <select name="_status" id="_offer_status_filter">
56 <option value=""><?php echo esc_html(__( 'All Statuses', 'propertyhive' )); ?></option>
57 <?php
58 // 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.
59 $offer_statuses = ph_get_offer_statuses();
60
61 // 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.
62 foreach ( $offer_statuses as $status => $display_status )
63 {
64 ?>
65 <option value="<?php echo esc_attr($status); ?>" <?php selected( $status, $selected_status ); ?>><?php echo esc_html($display_status); ?></option>
66 <?php
67 }
68 ?>
69 </select>
70 <input type="button" name="filter_action" id="filter-contact-offers-grid" class="button" value="Filter">
71 <a href="" name="export_action" id="export-contact-offers-grid" class="button">Export</a>
72 </div>
73 <div class='tablenav-pages one-page'>
74 <span class="displaying-num"><?php echo esc_html($offers_count); ?> item<?php echo $offers_count != 1 ? 's' : ''; ?></span>
75 </div>
76 <br class="clear" />
77 </div>
78 <table class="wp-list-table widefat fixed striped posts">
79 <thead>
80 <tr>
81 <?php
82 // 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.
83 $column_i = 0;
84 // 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.
85 foreach ( $columns as $column_key => $column )
86 {
87 ?>
88 <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>
89 <?php
90 ++$column_i;
91 }
92 ?>
93 </tr>
94 </thead>
95 <tbody id="the-list">
96 <?php
97 if ( $offers_query->have_posts() )
98 {
99 while ( $offers_query->have_posts() )
100 {
101 $offers_query->the_post();
102 // 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.
103 $the_offer = new PH_Offer( get_the_ID() );
104
105 // 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.
106 $edit_link = get_edit_post_link( get_the_ID() );
107
108 // 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.
109 $column_data = array(
110 'date' => '<a href="' . esc_url($edit_link) . '" target="' . esc_attr(apply_filters('propertyhive_subgrid_link_target', '')) . '" data-offer-id="' . esc_attr(get_the_ID()) . '">' . esc_html(gmdate("jS F Y", strtotime($the_offer->_offer_date_time))) . '</a>',
111 'property' => $the_offer->get_property_address(),
112 'property_owner' => $the_offer->get_property_owners(),
113 'amount' => esc_html($the_offer->get_formatted_amount()),
114 'status' => esc_html(propertyhive_get_status_label( $the_offer->_status )),
115 );
116
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 = array( 'status-' . $the_offer->_status );
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 = apply_filters( 'propertyhive_contact_offers_row_classes', $row_classes, get_the_ID(), $the_offer );
121 // 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.
122 $row_classes = is_array($row_classes) ? array_map( 'sanitize_html_class', array_map( 'strtolower', $row_classes ) ) : array();
123 ?>
124 <tr class="<?php echo esc_attr(implode(" ", $row_classes)); ?>" >
125 <?php
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 $column_i = 0;
128 // 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.
129 foreach ( $columns as $column_key => $column )
130 {
131 echo '<td class="' . esc_attr($column_key) . ' column-' . esc_attr($column_key) . ($column_i == 0 ? ' column-primary' : '') . '" data-colname="' . esc_attr($column) . '">';
132
133 if ( isset( $column_data[$column_key] ) )
134 {
135 // 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.
136 echo $column_data[$column_key];
137 }
138
139 do_action( 'propertyhive_contact_offers_custom_column', $column_key );
140
141 if ( $column_i == 0 ) { echo '<button type="button" class="toggle-row"><span class="screen-reader-text">' . esc_html(__('Show more details', 'propertyhive' )) . '</span></button>'; }
142
143 echo '</td>';
144 ++$column_i;
145 }
146 ?>
147 </tr>
148 <?php
149 }
150 }
151 else
152 {
153 ?>
154 <tr class="no-items">
155 <td class="colspanchange" colspan="<?php echo count($columns); ?>"><?php echo esc_html(__( 'No offers found', 'propertyhive' )); ?></td>
156 </tr>
157 <?php
158 }
159 wp_reset_postdata();
160 ?>
161 </tbody>
162 </table>