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

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

162 lines 11.2 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 = add_viewing_status_meta_query( $meta_query, $selected_status );
18 }
19
20 // 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.
21 $args = array(
22 'post_type' => 'viewing',
23 'nopaging' => true,
24 'orderby' => 'meta_value',
25 'order' => 'DESC',
26 // 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.
27 'meta_key' => '_start_date_time',
28 'post_status' => 'publish',
29 // 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.
30 'meta_query' => $meta_query,
31 );
32 // 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.
33 $viewings_query = new WP_Query( $args );
34 // 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.
35 $viewings_count = $viewings_query->found_posts;
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 $columns = array(
39 'date_time' => __( 'Date', 'propertyhive' ) . ' / ' . __( 'Time', 'propertyhive' ),
40 'property' => __( 'Property', 'propertyhive' ),
41 'negotiators' => __( 'Attending Negotiator(s)', 'propertyhive' ),
42 'status' => __( 'Status', 'propertyhive' ),
43 );
44
45 // 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.
46 $columns = apply_filters( 'propertyhive_contact_viewings_columns', $columns );
47 ?>
48
49 <div class="tablenav top">
50 <div class="alignleft actions">
51 <select name="_status" id="_viewing_status_filter">
52 <option value=""><?php echo esc_html(__( 'All Statuses', 'propertyhive' )); ?></option>
53 <?php
54 // 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.
55 $viewing_statuses = ph_get_viewing_statuses();
56
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 foreach ( $viewing_statuses as $status => $display_status )
59 {
60 ?>
61 <option value="<?php echo esc_attr($status); ?>" <?php selected( $status, $selected_status ); ?>><?php echo esc_html($display_status); ?></option>
62 <?php
63 }
64 ?>
65 </select>
66 <input type="button" name="filter_action" id="filter-contact-viewings-grid" class="button" value="Filter">
67 <a href="" name="export_action" id="export-contact-viewings-grid" class="button">Export</a>
68 </div>
69 <div class='tablenav-pages one-page'>
70 <span class="displaying-num"><?php echo esc_html($viewings_count); ?> item<?php echo $viewings_count != 1 ? 's' : ''; ?></span>
71 </div>
72 <br class="clear" />
73 </div>
74 <table class="wp-list-table widefat fixed striped posts">
75 <thead>
76 <tr>
77 <?php
78 // 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.
79 $column_i = 0;
80 // 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.
81 foreach ( $columns as $column_key => $column )
82 {
83 ?>
84 <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>
85 <?php
86 ++$column_i;
87 }
88 ?>
89 </tr>
90 </thead>
91 <tbody id="the-list">
92 <?php
93 if ( $viewings_query->have_posts() )
94 {
95 while ( $viewings_query->have_posts() )
96 {
97 $viewings_query->the_post();
98 // 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.
99 $the_viewing = new PH_Viewing( get_the_ID() );
100
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 $edit_link = get_edit_post_link( 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 $column_data = array(
106 'date_time' => '<a href="' . esc_url($edit_link) . '" target="' . esc_attr(apply_filters('propertyhive_subgrid_link_target', '')) . '" class="viewing-lightbox" data-viewing-id="' . esc_attr(get_the_ID()) . '">' . esc_html(gmdate("H:i jS F Y", strtotime($the_viewing->_start_date_time))) . '</a>',
107 'property' => $the_viewing->get_property_address(),
108 'negotiators' => esc_html($the_viewing->get_negotiators()),
109 'status' => $the_viewing->get_status(),
110 );
111
112 // 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.
113 $row_classes = array( 'status-' . $the_viewing->_status );
114 if ( $the_viewing->_status == 'carried_out' )
115 {
116 // 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.
117 $row_classes[] = 'applicant-feedback-status-' . $the_viewing->_feedback_status;
118 }
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_viewings_row_classes', $row_classes, get_the_ID(), $the_viewing );
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_viewings_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 viewings found', 'propertyhive' )); ?></td>
156 </tr>
157 <?php
158 }
159 wp_reset_postdata();
160 ?>
161 </tbody>
162 </table>