This commit is contained in:
ThemeLexus 2019-09-30 11:11:35 +07:00
parent 65d06225d5
commit 2ccc8611b6
4 changed files with 93 additions and 45 deletions

View File

@ -23,6 +23,17 @@ if ( ! defined( 'ABSPATH' ) ) {
*/ */
class OpalEstate_Shortcodes { class OpalEstate_Shortcodes {
/**
* Get instance of this object
*/
public static function get_instance(){
static $_instance;
if( !$_instance ){
$_instance = new OpalEstate_Shortcodes();
}
return $_instance;
}
/** /**
* Static $shortcodes * Static $shortcodes
*/ */
@ -39,7 +50,7 @@ class OpalEstate_Shortcodes {
'properties' => [ 'code' => 'properties', 'label' => esc_html__( 'Properties', 'opalestate-pro' ) ], 'properties' => [ 'code' => 'properties', 'label' => esc_html__( 'Properties', 'opalestate-pro' ) ],
'search_properties_result' => [ 'code' => 'search_properties_result', 'label' => esc_html__( 'Search Properties Result', 'opalestate-pro' ) ], 'search_properties_result' => [ 'code' => 'search_properties_result', 'label' => esc_html__( 'Search Properties Result', 'opalestate-pro' ) ],
'search_properties' => [ 'code' => 'search_properties', 'label' => esc_html__( 'Search Properties', 'opalestate-pro' ) ], 'search_properties' => [ 'code' => 'search_properties', 'label' => esc_html__( 'Search Properties', 'opalestate-pro' ) ],
'search_properties_v' => [ 'code' => 'search_properties_v', 'label' => esc_html__( 'Search Properties Vertical', 'opalestate-pro' ) ], 'search_split_maps' => [ 'code' => 'search_split_maps', 'label' => esc_html__( 'Search Split Maps', 'opalestate-pro' ) ],
'search_map_properties' => [ 'code' => 'search_map_properties', 'label' => esc_html__( 'Search Map Properties', 'opalestate-pro' ) ], 'search_map_properties' => [ 'code' => 'search_map_properties', 'label' => esc_html__( 'Search Map Properties', 'opalestate-pro' ) ],
'ajax_map_search' => [ 'code' => 'ajax_map_search', 'label' => esc_html__( 'Ajax Search Map Properties', 'opalestate-pro' ) ], 'ajax_map_search' => [ 'code' => 'ajax_map_search', 'label' => esc_html__( 'Ajax Search Map Properties', 'opalestate-pro' ) ],
@ -58,6 +69,9 @@ class OpalEstate_Shortcodes {
} }
/**
* Display all properties follow user when logined
*/
public function shortcode_button() { public function shortcode_button() {
} }
@ -115,7 +129,19 @@ class OpalEstate_Shortcodes {
$atts = is_array( $atts ) ? $atts : []; $atts = is_array( $atts ) ? $atts : [];
return opalestate_load_template_path( 'shortcodes/search-properties-result', $atts ); $default = array(
'style' => null,
'style_list' => null,
'column' => null,
);
$atts = array_merge( $default, $atts );
$html = '<div class="opalesate-properties-ajax opalesate-properties-results" data-mode="html">';
$html .= opalestate_load_template_path( 'shortcodes/ajax-map-search-result', $atts );
$html .= '</div>';
return $html;
} }
/** /**
@ -135,25 +161,46 @@ class OpalEstate_Shortcodes {
/** /**
* Render search property page with vertical form and map * Render search property page with vertical form and map
*/ */
public function search_properties_v() { public function search_split_maps( $atts=[] ) {
return opalestate_load_template_path( 'shortcodes/search-properties-v', [ 'loop' => '' ] );
$atts = is_array( $atts ) ? $atts : [];
$default = array(
'search_form' => 'simple-city',
'paged' => 1
);
$atts = array_merge( $default, $atts );
return opalestate_load_template_path( 'shortcodes/search-split-maps', $atts );
} }
/**
* Render search property page with vertical form and map
*/
public function search_map_properties() { public function search_map_properties() {
return opalestate_load_template_path( 'shortcodes/search-map-properties', [ 'loop' => '' ] ); return opalestate_load_template_path( 'shortcodes/search-map-properties', [ 'loop' => '' ] );
} }
/**
* Render search property page with vertical form and map
*/
public function ajax_map_search() { public function ajax_map_search() {
wp_enqueue_script( 'sticky-kit', OPALESTATE_PLUGIN_URL . 'assets/js/jquery.sticky-kit.min.js' ); wp_enqueue_script( 'sticky-kit', OPALESTATE_PLUGIN_URL . 'assets/js/jquery.sticky-kit.min.js' );
return opalestate_load_template_path( 'shortcodes/ajax-map-search', [ 'loop' => '' ] ); return opalestate_load_template_path( 'shortcodes/ajax-map-search', [ 'loop' => '' ] );
} }
/**
* Render search property page with vertical form and map
*/
public function ajax_map_quick_search() { public function ajax_map_quick_search() {
return opalestate_load_template_path( 'shortcodes/ajax-map-quick-search', [ 'loop' => '' ] ); return opalestate_load_template_path( 'shortcodes/ajax-map-quick-search', [ 'loop' => '' ] );
} }
/* register form show up */ /*
* Register form show up
*/
public function register_form( $atts = [] ) { public function register_form( $atts = [] ) {
$atts = shortcode_atts( [ $atts = shortcode_atts( [
'message' => '', 'message' => '',
@ -164,7 +211,9 @@ class OpalEstate_Shortcodes {
return opalestate_load_template_path( 'user/register-form', $atts ); return opalestate_load_template_path( 'user/register-form', $atts );
} }
/* sign in show up */ /*
* sign in show up
*/
public function login_form( $atts = [] ) { public function login_form( $atts = [] ) {
$atts = shortcode_atts( [ $atts = shortcode_atts( [
'message' => '', 'message' => '',
@ -177,4 +226,4 @@ class OpalEstate_Shortcodes {
} }
new OpalEstate_Shortcodes(); OpalEstate_Shortcodes::get_instance();

View File

@ -1,37 +1,10 @@
<?php <?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$rowcls = apply_filters( 'opalestate_row_container_class', 'opal-row' ); $rowcls = apply_filters( 'opalestate_row_container_class', 'opal-row' );
$atts = array(
'paged' => 1,
'search_form' => $settings['search_form']
);
?> ?>
<div class="ajax-map-search-split full-width"> <?php echo opalestate_load_template_path( 'shortcodes/search-split-maps', $atts ); ?>
<div class="inner">
<div class="<?php echo esc_attr( $rowcls ); ?>">
<div class="col-lg-6 col-md-12 col-sm-12 split-maps-container">
<div id="opalestate-map-preview" style="height:800px;" data-page="<?php echo esc_attr( $paged ); ?>">
<div id="mapView">
<div class="mapPlaceholder"><span class="fa fa-spin fa-spinner"></span> <?php esc_html_e( 'Loading map...', 'opalestate-pro' ); ?>
<div class="sk-folding-cube">
<div class="sk-cube1 sk-cube"></div>
<div class="sk-cube2 sk-cube"></div>
<div class="sk-cube4 sk-cube"></div>
<div class="sk-cube3 sk-cube"></div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-12 pull-right">
<div class="split-search-container">
<div class="ajax-search-form">
<?php echo opalestate_load_template_path( 'search-box/' . $settings['search_form'], [ 'nobutton' => true ] ); ?>
</div>
<div class="opalesate-properties-ajax opalesate-properties-results" data-mode="html">
<?php echo opalestate_load_template_path( 'shortcodes/ajax-map-search-result', [ 'column' => 2 ] ); ?>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,5 +0,0 @@
<div class="opalestate-search-properties-v">
<div class="search-properies-form">
<?php echo opalestate_load_template_path( 'parts/search-form-v' ); ?>
</div>
</div>

View File

@ -0,0 +1,31 @@
<div class="ajax-map-search-split full-width">
<div class="inner">
<div class="opal-row">
<div class="col-lg-6 col-md-12 col-sm-12 split-maps-container">
<div id="opalestate-map-preview" style="height:800px;" data-page="<?php echo esc_attr( $paged ); ?>">
<div id="mapView">
<div class="mapPlaceholder"><span class="fa fa-spin fa-spinner"></span> <?php esc_html_e( 'Loading map...', 'opalestate-pro' ); ?>
<div class="sk-folding-cube">
<div class="sk-cube1 sk-cube"></div>
<div class="sk-cube2 sk-cube"></div>
<div class="sk-cube4 sk-cube"></div>
<div class="sk-cube3 sk-cube"></div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6 col-md-12 col-sm-12 pull-right">
<div class="split-search-container">
<div class="ajax-search-form">
<?php echo opalestate_load_template_path( 'search-box/'.$search_form, [ 'nobutton' => true ] ); ?>
</div>
<div class="opalesate-properties-ajax opalesate-properties-results" data-mode="html">
<?php echo opalestate_load_template_path( 'shortcodes/ajax-map-search-result', [ 'column' => 2 ] ); ?>
</div>
</div>
</div>
</div>
</div>
</div>