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 / templates / account / owner-viewings.php

owner-viewings.php in Property Hive 2.4.0, at templates/account/owner-viewings.php

125 lines 8.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Owner viewings page within My Account
4 *
5 * This template can be overridden by copying it to yourtheme/propertyhive/account/owner-viewings.php.
6 *
7 * @author PropertyHive
8 * @package PropertyHive/Templates
9 * @version 1.0.0
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 ?>
17
18 <div class="propertyhive-owner-viewings">
19
20 <h4>Upcoming Viewings</h4>
21
22 <?php
23 if ( !empty($upcoming_viewings) )
24 {
25 echo '
26 <table class="viewings-table upcoming-viewings-table" width="100%">
27 <tr>
28 <th>&nbsp;</th>
29 <th>' . esc_html(__( 'Viewing Date/Time', 'propertyhive' )) . '</th>
30 <th>' . esc_html(__( 'Property', 'propertyhive' )) . '</th>
31 </tr>
32 ';
33 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
34 foreach ($upcoming_viewings as $viewing)
35 {
36 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
37 $property = new PH_Property( (int)$viewing->property_id );
38
39 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
40 $link_prefix = ( ( $property->on_market == 'yes' ) ? '<a href="' . esc_url(get_permalink( $viewing->property_id )) . '">' : '' );
41 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
42 $link_suffix = ( ( $property->on_market == 'yes' ) ? '</a>' : '' );
43
44 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
45 $date_prefix = ( ( $viewing->status == 'cancelled' ) ? '<span style="text-decoration:line-through">' : '' );
46 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
47 $date_suffix = ( ( $viewing->status == 'cancelled' ) ? '</span> (' . esc_html(__( 'Cancelled', 'propertyhive' )) . ')' : '' );
48
49 if ( $viewing->status == 'cancelled' && $viewing->cancelled_reason_public == 'yes' && $viewing->cancelled_reason != '' )
50 {
51 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
52 $date_suffix .= '<br>' . esc_html(__( 'Reason Cancelled', 'propertyhive' )) . ':<br>' . nl2br(esc_html($viewing->cancelled_reason));
53 }
54
55 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
56 $image = $property->get_main_photo_src();
57
58 echo '<tr>
59 <td>' . ( ( $image !== false ) ? wp_kses_post( $link_prefix ) . '<img src="' . esc_url($image) . '" width="75" alt="' . esc_attr(get_the_title( $viewing->property_id )) . '">' : '' ) . wp_kses_post( $link_suffix ) . '</td>
60 <td>' . wp_kses_post( $date_prefix ) . esc_html(gmdate( "H:i jS M Y", strtotime( $viewing->start_date_time ) )) . wp_kses_post( $date_suffix ) . '</td>
61 <td>' . wp_kses_post( $link_prefix ) . esc_html(get_the_title( $viewing->property_id )) . wp_kses_post( $link_suffix ) . '<br>' . wp_kses_post( $property->get_formatted_price() ) . '</td>
62 </tr>';
63 }
64 echo '</table>';
65 }
66 else
67 {
68 echo '<p class="propertyhive-info">' . esc_html(__( 'No upcoming viewings scheduled', 'propertyhive' )) . '</p>';
69 }
70 ?>
71
72 <h4>Past Viewings</h4>
73
74 <?php
75 if ( !empty($past_viewings) )
76 {
77 echo '
78 <table class="viewings-table upcoming-viewings-table" width="100%">
79 <tr>
80 <th>&nbsp;</th>
81 <th>' . esc_html(__( 'Viewing Date/Time', 'propertyhive' )) . '</th>
82 <th>' . esc_html(__( 'Property', 'propertyhive' )) . '</th>
83 </tr>
84 ';
85 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
86 foreach ($past_viewings as $viewing)
87 {
88 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
89 $property = new PH_Property( (int)$viewing->property_id );
90
91 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
92 $link_prefix = ( ( $property->on_market == 'yes' ) ? '<a href="' . esc_url(get_permalink( $viewing->property_id )) . '">' : '' );
93 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
94 $link_suffix = ( ( $property->on_market == 'yes' ) ? '</a>' : '' );
95
96 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
97 $date_prefix = ( ( $viewing->status == 'cancelled' ) ? '<span style="text-decoration:line-through">' : '' );
98 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
99 $date_suffix = ( ( $viewing->status == 'cancelled' ) ? '</span> (' . esc_html(__( 'Cancelled', 'propertyhive' )) . ')' : '' );
100
101 if ( $viewing->status == 'cancelled' && $viewing->cancelled_reason_public == 'yes' && $viewing->cancelled_reason != '' )
102 {
103 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
104 $date_suffix .= '<br>' . esc_html(__( 'Reason Cancelled', 'propertyhive' )) . ':<br>' . nl2br(esc_html($viewing->cancelled_reason));
105 }
106
107 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable; the template is included through a helper/function scope, so PrefixAllGlobals misclassifies the file when checked standalone.
108 $image = $property->get_main_photo_src();
109
110 echo '<tr>
111 <td>' . ( ( $image !== false ) ? wp_kses_post( $link_prefix ) . '<img src="' . esc_url($image) . '" width="75" alt="' . esc_attr(get_the_title( $viewing->property_id )) . '">' : '' ) . wp_kses_post( $link_suffix ) . '</td>
112 <td>' . wp_kses_post( $date_prefix ) . esc_html(gmdate( "H:i jS M Y", strtotime( $viewing->start_date_time ) )) . wp_kses_post( $date_suffix ) . '</td>
113 <td>' . wp_kses_post( $link_prefix ) . esc_html(get_the_title( $viewing->property_id )) . wp_kses_post( $link_suffix ) . '<br>' . wp_kses_post( $property->get_formatted_price() ) . '</td>
114 </tr>';
115 }
116 echo '</table>';
117 }
118 else
119 {
120 echo '<p class="propertyhive-info">' . esc_html(__( 'No past viewings', 'propertyhive' )) . '</p>';
121 }
122 ?>
123
124 </div>
125