| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
?> |
| 6 |
|
| 7 |
<div class="wrap propertyhive"> |
| 8 |
|
| 9 |
<h1>Matching Properties For <?php echo esc_html(get_the_title($contact_id)); ?> (<?php echo count($properties); ?>)</h1> |
| 10 |
|
| 11 |
<form method="post" id="mainform" action="" enctype="multipart/form-data"> |
| 12 |
|
| 13 |
<div id="poststuff"> |
| 14 |
|
| 15 |
<?php |
| 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 |
$percentage_lower = get_option( 'propertyhive_applicant_match_price_range_percentage_lower', '' ); |
| 18 |
// 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. |
| 19 |
$percentage_higher = get_option( 'propertyhive_applicant_match_price_range_percentage_higher', '' ); |
| 20 |
|
| 21 |
// 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. |
| 22 |
$currency = '£'; |
| 23 |
if ( isset($applicant_profile['currency']) && !empty($applicant_profile['currency']) ) |
| 24 |
{ |
| 25 |
// 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. |
| 26 |
$PH_Countries = new PH_Countries(); |
| 27 |
// 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. |
| 28 |
$selected_currency = $PH_Countries->get_currency($applicant_profile['currency']); |
| 29 |
if ( $selected_currency !== false ) |
| 30 |
{ |
| 31 |
// 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. |
| 32 |
$currency = $selected_currency['currency_symbol']; |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
echo '<div style="background:#F3F3F3; border:1px solid #DDD; padding:20px;"> |
| 37 |
|
| 38 |
<h3 style="padding-top:0; margin-top:0;">' . esc_html( __('Applicant Requirements', 'propertyhive') ) . '</h3>'; |
| 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 |
$requirements = array(); |
| 42 |
|
| 43 |
if ( |
| 44 |
isset($applicant_profile['department']) && |
| 45 |
( $applicant_profile['department'] == 'residential-sales' || ph_get_custom_department_based_on($applicant_profile['department']) == 'residential-sales' ) && |
| 46 |
isset($applicant_profile['max_price_actual']) && |
| 47 |
$applicant_profile['max_price_actual'] != '' && |
| 48 |
$applicant_profile['max_price_actual'] != 0 |
| 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 |
$requirements[] = array( |
| 53 |
'label' => __( 'Maximum Price', 'propertyhive' ), |
| 54 |
'value' => $currency . esc_html( ph_display_price_field($applicant_profile['max_price']) ), |
| 55 |
); |
| 56 |
} |
| 57 |
if ( |
| 58 |
isset($applicant_profile['department']) && |
| 59 |
( $applicant_profile['department'] == 'residential-sales' || ph_get_custom_department_based_on($applicant_profile['department']) == 'residential-sales' |
| 60 |
) |
| 61 |
) |
| 62 |
{ |
| 63 |
if ( $percentage_lower != '' && $percentage_higher != '' ) |
| 64 |
{ |
| 65 |
// 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. |
| 66 |
$match_price_range_lower = ''; |
| 67 |
// 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. |
| 68 |
$match_price_range_lower_display = ''; |
| 69 |
if ( |
| 70 |
!isset($applicant_profile['match_price_range_lower_actual']) || |
| 71 |
( isset($applicant_profile['match_price_range_lower_actual']) && $applicant_profile['match_price_range_lower_actual'] == '' ) |
| 72 |
) |
| 73 |
{ |
| 74 |
if ( isset($applicant_profile['max_price']) && $applicant_profile['max_price'] != '' ) |
| 75 |
{ |
| 76 |
// 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. |
| 77 |
$match_price_range_lower = (float) $applicant_profile['max_price'] - ( (float) $applicant_profile['max_price'] * ( (float) $percentage_lower / 100 ) ); |
| 78 |
} |
| 79 |
} |
| 80 |
else |
| 81 |
{ |
| 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 |
$match_price_range_lower = $applicant_profile['match_price_range_lower']; |
| 84 |
} |
| 85 |
|
| 86 |
// 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. |
| 87 |
$match_price_range_higher = ''; |
| 88 |
if ( |
| 89 |
!isset($applicant_profile['match_price_range_higher_actual']) || |
| 90 |
( isset($applicant_profile['match_price_range_higher_actual']) && $applicant_profile['match_price_range_higher_actual'] == '' ) |
| 91 |
) |
| 92 |
{ |
| 93 |
if ( isset($applicant_profile['max_price']) && $applicant_profile['max_price'] != '' ) |
| 94 |
{ |
| 95 |
// 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. |
| 96 |
$match_price_range_higher = (float) $applicant_profile['max_price'] + ( (float) $applicant_profile['max_price'] * ( (float) $percentage_higher / 100 ) ); |
| 97 |
} |
| 98 |
} |
| 99 |
else |
| 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 |
$match_price_range_higher = $applicant_profile['match_price_range_higher']; |
| 103 |
} |
| 104 |
|
| 105 |
if ( |
| 106 |
$match_price_range_lower != '' && $match_price_range_higher != '' |
| 107 |
) |
| 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 |
$requirements[] = array( |
| 111 |
'label' => __( 'Match Price Range', 'propertyhive' ), |
| 112 |
'value' => $currency . esc_html( ph_display_price_field($match_price_range_lower) ) . ' to ' . $currency . esc_html( ph_display_price_field($match_price_range_higher) ), |
| 113 |
); |
| 114 |
} |
| 115 |
} |
| 116 |
} |
| 117 |
if ( |
| 118 |
isset($applicant_profile['department']) && ( $applicant_profile['department'] == 'residential-lettings' || ph_get_custom_department_based_on($applicant_profile['department']) == 'residential-lettings' ) && |
| 119 |
isset($applicant_profile['max_price_actual']) && $applicant_profile['max_price_actual'] != '' && $applicant_profile['max_price_actual'] != 0 |
| 120 |
) |
| 121 |
{ |
| 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 |
$requirements[] = array( |
| 124 |
'label' => __( 'Maximum Rent', 'propertyhive' ), |
| 125 |
'value' => $currency . esc_html( ph_display_price_field($applicant_profile['max_rent']) ) . ' ' . esc_html( $applicant_profile['rent_frequency'] ), |
| 126 |
); |
| 127 |
} |
| 128 |
if ( |
| 129 |
isset($applicant_profile['department']) && |
| 130 |
( |
| 131 |
$applicant_profile['department'] == 'residential-sales' || |
| 132 |
$applicant_profile['department'] == 'residential-lettings' || |
| 133 |
ph_get_custom_department_based_on($applicant_profile['department']) == 'residential-sales' || |
| 134 |
ph_get_custom_department_based_on($applicant_profile['department']) == 'residential-lettings' |
| 135 |
) |
| 136 |
) |
| 137 |
{ |
| 138 |
if ( isset($applicant_profile['min_beds']) && $applicant_profile['min_beds'] != '' && $applicant_profile['min_beds'] != 0 ) |
| 139 |
{ |
| 140 |
// 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. |
| 141 |
$requirements[] = array( |
| 142 |
'label' => __( 'Minimum Beds', 'propertyhive' ), |
| 143 |
'value' => esc_html( $applicant_profile['min_beds'] ), |
| 144 |
); |
| 145 |
} |
| 146 |
if ( isset($applicant_profile['property_types']) && is_array($applicant_profile['property_types']) && !empty($applicant_profile['property_types']) ) |
| 147 |
{ |
| 148 |
// 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. |
| 149 |
$terms = get_terms( array_merge( wp_parse_args( array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['property_types']) ), array( 'taxonomy' => 'property_type' ) ) ); |
| 150 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) |
| 151 |
{ |
| 152 |
// 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. |
| 153 |
$sliced_terms = array_slice( $terms, 0, 2 ); |
| 154 |
|
| 155 |
// 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. |
| 156 |
$requirements[] = array( |
| 157 |
'label' => __( 'Property Types', 'propertyhive' ), |
| 158 |
'value' => esc_html( implode(", ", $sliced_terms) ) . ( (count($terms) > 2) ? '<span title="' . esc_attr( implode(", ", $terms) ) .'"> + ' . (count($terms) - 2) . ' more</span>' : '' ), |
| 159 |
); |
| 160 |
} |
| 161 |
} |
| 162 |
} |
| 163 |
if ( |
| 164 |
isset($applicant_profile['department']) && |
| 165 |
( $applicant_profile['department'] == 'commercial' || ph_get_custom_department_based_on($applicant_profile['department']) == 'commercial' ) |
| 166 |
) |
| 167 |
{ |
| 168 |
if ( isset($applicant_profile['available_as']) && is_array($applicant_profile['available_as']) && !empty($applicant_profile['available_as']) ) |
| 169 |
{ |
| 170 |
// 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. |
| 171 |
$available_as = array(); |
| 172 |
if ( in_array('sale', $applicant_profile['available_as']) ) |
| 173 |
{ |
| 174 |
// 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. |
| 175 |
$available_as[] = 'For Sale'; |
| 176 |
} |
| 177 |
if ( in_array('rent', $applicant_profile['available_as']) ) |
| 178 |
{ |
| 179 |
// 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. |
| 180 |
$available_as[] = 'To Rent'; |
| 181 |
} |
| 182 |
|
| 183 |
// 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. |
| 184 |
$requirements[] = array( |
| 185 |
'label' => __( 'Available As', 'propertyhive' ), |
| 186 |
'value' => implode(", ", $available_as), |
| 187 |
); |
| 188 |
} |
| 189 |
|
| 190 |
if ( |
| 191 |
(isset($applicant_profile['min_floor_area_actual']) && $applicant_profile['min_floor_area_actual'] != '') |
| 192 |
|| |
| 193 |
(isset($applicant_profile['max_floor_area_actual']) && $applicant_profile['max_floor_area_actual'] != '') |
| 194 |
) |
| 195 |
{ |
| 196 |
// 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. |
| 197 |
$sizes = array('min' => '', 'max' => ''); |
| 198 |
// 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. |
| 199 |
$value = ''; |
| 200 |
if ( isset($applicant_profile['min_floor_area_actual']) && $applicant_profile['min_floor_area_actual'] != '' ) |
| 201 |
{ |
| 202 |
// 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. |
| 203 |
$sizes['min'] = $applicant_profile['min_floor_area_actual']; |
| 204 |
} |
| 205 |
if ( isset($applicant_profile['max_floor_area_actual']) && $applicant_profile['max_floor_area_actual'] != '' ) |
| 206 |
{ |
| 207 |
// 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. |
| 208 |
$sizes['max'] = $applicant_profile['max_floor_area_actual']; |
| 209 |
} |
| 210 |
if ( $sizes['min'] != '' && $sizes['max'] != '' ) |
| 211 |
{ |
| 212 |
// 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. |
| 213 |
$value = number_format( (float) $sizes['min'] ) . ' - ' . number_format( (float) $sizes['max'] ) . ' Sq Ft'; |
| 214 |
} |
| 215 |
if ( $sizes['min'] != '' && $sizes['max'] == '' ) |
| 216 |
{ |
| 217 |
// 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. |
| 218 |
$value = 'From ' . number_format( (float) $sizes['min'] ) . ' Sq Ft'; |
| 219 |
} |
| 220 |
if ( $sizes['min'] == '' && $sizes['max'] != '' ) |
| 221 |
{ |
| 222 |
// 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. |
| 223 |
$value = 'Up To ' . number_format( (float) $sizes['max'] ) . ' Sq Ft'; |
| 224 |
} |
| 225 |
|
| 226 |
if ( $value != '' ) |
| 227 |
{ |
| 228 |
// 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. |
| 229 |
$requirements[] = array( |
| 230 |
'label' => __( 'Floor Area', 'propertyhive' ), |
| 231 |
'value' => $value, |
| 232 |
); |
| 233 |
} |
| 234 |
} |
| 235 |
|
| 236 |
if ( isset($applicant_profile['commercial_property_types']) && is_array($applicant_profile['commercial_property_types']) && !empty($applicant_profile['commercial_property_types']) ) |
| 237 |
{ |
| 238 |
// 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. |
| 239 |
$terms = get_terms( array_merge( wp_parse_args( array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['commercial_property_types']) ), array( 'taxonomy' => 'commercial_property_type' ) ) ); |
| 240 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) |
| 241 |
{ |
| 242 |
// 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. |
| 243 |
$sliced_terms = array_slice( $terms, 0, 2 ); |
| 244 |
|
| 245 |
// 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. |
| 246 |
$requirements[] = array( |
| 247 |
'label' => __( 'Property Types', 'propertyhive' ), |
| 248 |
'value' => esc_html( implode(", ", $sliced_terms) ) . ( (count($terms) > 2) ? '<span title="' . esc_attr( implode(", ", $terms) ) .'"> + ' . (count($terms) - 2) . ' more</span>' : '' ), |
| 249 |
); |
| 250 |
} |
| 251 |
} |
| 252 |
} |
| 253 |
if ( get_option('propertyhive_applicant_locations_type') != 'text' ) |
| 254 |
{ |
| 255 |
if ( isset($applicant_profile['locations']) && is_array($applicant_profile['locations']) && !empty($applicant_profile['locations']) ) |
| 256 |
{ |
| 257 |
// 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. |
| 258 |
$terms = get_terms( array_merge( wp_parse_args( array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['locations']) ), array( 'taxonomy' => 'location' ) ) ); |
| 259 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) |
| 260 |
{ |
| 261 |
// 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. |
| 262 |
$sliced_terms = array_slice( $terms, 0, 2 ); |
| 263 |
|
| 264 |
// 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. |
| 265 |
$requirements[] = array( |
| 266 |
'label' => __( 'Locations', 'propertyhive' ), |
| 267 |
'value' => esc_html( implode(", ", $sliced_terms) ) . ( (count($terms) > 2) ? ' <span title="' . esc_attr( implode(", ", $terms) ) .'">+ ' . (count($terms) - 2) . ' more</span>' : '' ), |
| 268 |
); |
| 269 |
} |
| 270 |
} |
| 271 |
} |
| 272 |
else |
| 273 |
{ |
| 274 |
if ( isset($applicant_profile['location_text']) && trim($applicant_profile['location_text']) != '' ) |
| 275 |
{ |
| 276 |
// 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. |
| 277 |
$location_value = trim($applicant_profile['location_text']); |
| 278 |
|
| 279 |
if ( isset($applicant_profile['location_radius']) && $applicant_profile['location_radius'] != '' ) |
| 280 |
{ |
| 281 |
// 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. |
| 282 |
$location_value .= ' (Within '. $applicant_profile['location_radius'] .' Miles)'; |
| 283 |
} |
| 284 |
|
| 285 |
// 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. |
| 286 |
$requirements[] = array( |
| 287 |
'label' => __( 'Location', 'propertyhive' ), |
| 288 |
'value' => esc_html( $location_value ), |
| 289 |
); |
| 290 |
} |
| 291 |
} |
| 292 |
|
| 293 |
// 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. |
| 294 |
$requirements = apply_filters( 'propertyhive_applicant_requirements_display', $requirements, $contact_id, $applicant_profile ); |
| 295 |
|
| 296 |
if ( !empty($requirements) ) |
| 297 |
{ |
| 298 |
// 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. |
| 299 |
foreach ( $requirements as $requirement ) |
| 300 |
{ |
| 301 |
echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top"><strong>' . esc_html( $requirement['label'] ) . ':</strong><br>'; |
| 302 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Core requirement values escape stored text/attributes above; preserve trusted HTML supplied by propertyhive_applicant_requirements_display and currency-symbol filters. |
| 303 |
echo $requirement['value']; |
| 304 |
echo '</div>'; |
| 305 |
} |
| 306 |
} |
| 307 |
|
| 308 |
if ( isset($applicant_profile['notes']) && $applicant_profile['notes'] != '' ) |
| 309 |
{ |
| 310 |
echo '<div style="display:inline-block; width:100%; vertical-align:top; margin-top:15px;"> |
| 311 |
<strong>Additional Requirement Notes:</strong><br> |
| 312 |
' . nl2br( esc_html( wp_strip_all_tags( $applicant_profile['notes'] ) ) ) . ' |
| 313 |
</div>'; |
| 314 |
} |
| 315 |
|
| 316 |
echo '</div>'; |
| 317 |
?> |
| 318 |
|
| 319 |
<?php |
| 320 |
if ( !empty($properties) ) |
| 321 |
{ |
| 322 |
// 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. |
| 323 |
$select_all_actions = array( |
| 324 |
'email' => __( 'Email', 'propertyhive' ), |
| 325 |
'not_interested' => __( 'Not Suitable', 'propertyhive' ) |
| 326 |
); |
| 327 |
|
| 328 |
// 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. |
| 329 |
$select_all_actions = apply_filters( 'propertyhive_matching_select_all_actions', $select_all_actions ); |
| 330 |
?> |
| 331 |
<div class="select-actions" style="padding-top:15px"> |
| 332 |
<span style="display:inline-block; vertical-align:middle;"><?php echo esc_html(__( 'Select', 'propertyhive' )); ?>:</span> <?php |
| 333 |
// 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. |
| 334 |
foreach ( $select_all_actions as $key => $value ) |
| 335 |
{ |
| 336 |
echo '<a href="javascript:;" class="button" id="select_all_' . esc_attr(sanitize_title($key)) . '" style="display:inline-block; vertical-align:middle;">All - ' . esc_html($value) . '</a> '; |
| 337 |
} |
| 338 |
?> |
| 339 |
<a href="javascript:;" class="button" id="select_none" style="display:inline-block; vertical-align:middle;">None</a> |
| 340 |
</div> |
| 341 |
|
| 342 |
<?php |
| 343 |
// 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. |
| 344 |
foreach ( $properties as $property ) |
| 345 |
{ |
| 346 |
// 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. |
| 347 |
$previously_sent = array(); |
| 348 |
if ( isset($applicant_profile_match_history[$property->id]) && is_array($applicant_profile_match_history[$property->id]) && !empty($applicant_profile_match_history[$property->id]) ) |
| 349 |
{ |
| 350 |
// 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. |
| 351 |
$previously_sent = $applicant_profile_match_history[$property->id]; |
| 352 |
} |
| 353 |
|
| 354 |
// 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. |
| 355 |
$on_market_change_date = $property->_on_market_change_date; |
| 356 |
// 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. |
| 357 |
$price_change_date = $property->_price_change_date; |
| 358 |
|
| 359 |
echo '<div id="matching_applicant_' . (int)$contact_id . '_property_' . (int)$property->id . '" style="padding:20px 0; border-bottom:1px solid #CCC;">'; |
| 360 |
|
| 361 |
echo '<div style="float:left; width:18%;">'; |
| 362 |
|
| 363 |
// 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. |
| 364 |
$image_url = $property->get_main_photo_src(); |
| 365 |
if ( $image_url !== FALSE ) |
| 366 |
{ |
| 367 |
echo '<a href="' . esc_url(get_edit_post_link( $property->id )) . '" target="_blank"><img src="' . esc_url($image_url) . '" style="max-width:100%; margin:0 auto; display:block;" alt="' . esc_attr($property->get_formatted_summary_address()) . '"></a>'; |
| 368 |
} |
| 369 |
|
| 370 |
echo '</div>'; |
| 371 |
|
| 372 |
echo '<div style="float:right; width:80%;">'; |
| 373 |
|
| 374 |
echo '<h3 style="margin:0; padding:0; margin-bottom:9px;"><a href="' . esc_url(get_edit_post_link( $property->id )) . '" target="_blank">' . esc_html($property->get_formatted_summary_address()) . '</a></h3>'; |
| 375 |
|
| 376 |
echo '<div style="margin-bottom:7px; font-size:15px;"><strong>' . esc_html( ( $property->_department == 'residential-lettings' ) ? __( 'Rent', 'propertyhive' ) : __( 'Price', 'propertyhive' ) ) . ': ' . esc_html( $property->price_qualifier ) . ' '; |
| 377 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Price producers escape stored text before trusted currency/commercial/property price HTML filters. |
| 378 |
echo $property->get_formatted_price(); |
| 379 |
echo '</strong> | '; |
| 380 |
if ($property->department != 'commercial' || ph_get_custom_department_based_on($property->department) == 'commercial') |
| 381 |
{ |
| 382 |
echo esc_html( $property->bedrooms ) . ' bed | '; |
| 383 |
} |
| 384 |
else |
| 385 |
{ |
| 386 |
// 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. |
| 387 |
$floor_area = $property->get_formatted_floor_area(); |
| 388 |
if ( $floor_area != '' ) |
| 389 |
{ |
| 390 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Floor-area producer escapes base text before the trusted propertyhive_floor_area_output HTML filter. |
| 391 |
echo $floor_area . ' | '; |
| 392 |
} |
| 393 |
} |
| 394 |
// 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. |
| 395 |
$property_type = $property->get_property_type(); |
| 396 |
if ( $property_type != '' ) |
| 397 |
{ |
| 398 |
echo esc_html($property_type) . ' | '; |
| 399 |
} |
| 400 |
echo ' ' . esc_html($property->get_availability()) . ' |
| 401 |
</div>'; |
| 402 |
|
| 403 |
echo '<div style="margin-bottom:7px;">' . esc_html(wp_strip_all_tags(get_the_excerpt($property->id))) . '</div>'; |
| 404 |
|
| 405 |
echo '<div style="background:#F8F8F8; padding:12px 11px; line-height:1.7em; border:1px solid #DDD; font-weight:700"> |
| 406 |
|
| 407 |
<label><input type="checkbox" name="email_property_id[]" value="' . (int)$property->id . '" '; |
| 408 |
|
| 409 |
// 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. |
| 410 |
$post_tip = ''; |
| 411 |
if ( strpos($email_address, '@') === FALSE ) |
| 412 |
{ |
| 413 |
echo ' disabled title="Invalid email address: ' . esc_attr($email_address) . '"'; |
| 414 |
// 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. |
| 415 |
$post_tip = 'Invalid email address: ' . $email_address; |
| 416 |
} |
| 417 |
elseif ( $do_not_email ) |
| 418 |
{ |
| 419 |
echo ' disabled title="Contact via email not permitted - Set under contact details"'; |
| 420 |
// 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. |
| 421 |
$post_tip = 'Contact via email not permitted - Set under contact details'; |
| 422 |
} |
| 423 |
else |
| 424 |
{ |
| 425 |
if ( !empty($previously_sent) ) |
| 426 |
{ |
| 427 |
// 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. |
| 428 |
$post_tip = 'Sent previously via ' . $previously_sent[count($previously_sent) - 1]['method'] . ' on ' . gmdate("jS F Y", strtotime($previously_sent[count($previously_sent) - 1]['date'])); |
| 429 |
|
| 430 |
if ( |
| 431 |
$on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] || |
| 432 |
$price_change_date > $previously_sent[count($previously_sent) - 1]['date'] |
| 433 |
) |
| 434 |
{ |
| 435 |
if ( $price_change_date > $previously_sent[count($previously_sent) - 1]['date'] ) |
| 436 |
{ |
| 437 |
// 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. |
| 438 |
$post_tip .= ', however a price change occurred on ' . gmdate("jS F Y", strtotime($price_change_date)); |
| 439 |
} |
| 440 |
elseif ( $on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] ) |
| 441 |
{ |
| 442 |
// 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. |
| 443 |
$post_tip .= ', however a change to the on market status occurred on ' . gmdate("jS F Y", strtotime($on_market_change_date)); |
| 444 |
} |
| 445 |
echo ' checked'; |
| 446 |
} |
| 447 |
} |
| 448 |
else |
| 449 |
{ |
| 450 |
echo ' checked'; |
| 451 |
} |
| 452 |
} |
| 453 |
|
| 454 |
echo '> Email Property To Applicant<span style="font-weight:400;">' . ( ($post_tip != '') ? ' - ' . esc_html($post_tip) : '' ) . '</span></label> |
| 455 |
|
| 456 |
<br>'; |
| 457 |
|
| 458 |
do_action( 'propertyhive_applicant_match_send_methods', $contact_id, $applicant_profile_id, $property->id ); |
| 459 |
|
| 460 |
echo '<label><input type="checkbox" name="not_interested_property_id[]" value="' . (int)$property->id . '"> Property Not Suitable</label> |
| 461 |
|
| 462 |
</div>'; |
| 463 |
|
| 464 |
echo '</div>'; |
| 465 |
|
| 466 |
echo '<div style="clear:both"></div>'; |
| 467 |
|
| 468 |
echo '</div>'; |
| 469 |
} |
| 470 |
} |
| 471 |
?> |
| 472 |
|
| 473 |
<p class="submit"> |
| 474 |
|
| 475 |
<input name="save" class="button-primary" type="submit" value="<?php echo esc_html(__( 'Continue', 'propertyhive' )); ?>" /> |
| 476 |
|
| 477 |
<a href="<?php echo esc_url(get_edit_post_link( (int) $contact_id )); ?>" class="button"><?php echo esc_html(__( 'Cancel', 'propertyhive' )); ?></a> |
| 478 |
|
| 479 |
<input type="hidden" name="step" value="one" /> |
| 480 |
<?php wp_nonce_field( 'propertyhive-matching-properties' ); ?> |
| 481 |
|
| 482 |
</p> |
| 483 |
|
| 484 |
<p> |
| 485 |
<?php echo esc_html(__( "If you've opted to email any of the properties you'll have the ability to edit the contents of the email in the next step.", 'propertyhive' )); ?> |
| 486 |
</p> |
| 487 |
|
| 488 |
</div> |
| 489 |
|
| 490 |
</form> |
| 491 |
|
| 492 |
</div> |
| 493 |
|
| 494 |
<script> |
| 495 |
|
| 496 |
jQuery(document).ready(function() |
| 497 |
{ |
| 498 |
jQuery('body').on('change', 'input[name=\'not_interested_property_id[]\']', function() |
| 499 |
{ |
| 500 |
var property_id = jQuery(this).val(); |
| 501 |
|
| 502 |
jQuery('input[name=\'email_property_id[]\'][value=\'' + property_id + '\']').attr('checked', false); |
| 503 |
|
| 504 |
opacity = 0.4; |
| 505 |
if ( !jQuery(this).is(':checked') ) |
| 506 |
{ |
| 507 |
opacity = 1; |
| 508 |
} |
| 509 |
jQuery('#matching_applicant_<?php echo (int)$contact_id; ?>_property_' + property_id).animate({ |
| 510 |
opacity: opacity |
| 511 |
}, |
| 512 |
{ |
| 513 |
duration: 250 |
| 514 |
}); |
| 515 |
|
| 516 |
return false; |
| 517 |
}); |
| 518 |
|
| 519 |
jQuery('.select-actions a').click(function(e) |
| 520 |
{ |
| 521 |
e.preventDefault(); |
| 522 |
|
| 523 |
var id = jQuery(this).attr('id').replace("select_all_", ""); |
| 524 |
|
| 525 |
jQuery('input[name$=\'_property_id[]\']').prop('checked', false); |
| 526 |
|
| 527 |
if ( id != 'select_none' ) |
| 528 |
{ |
| 529 |
jQuery('input[name=\'' + id + '_property_id[]\']').prop('checked', 'checked'); |
| 530 |
} |
| 531 |
}); |
| 532 |
}); |
| 533 |
|
| 534 |
</script> |