Changeset 1527834
- Timestamp:
- 11/04/2016 03:47:37 AM (9 years ago)
- Location:
- track-connect/trunk
- Files:
-
- 6 edited
-
includes/api/request.php (modified) (5 diffs)
-
includes/class-listings-search-widget.php (modified) (4 diffs)
-
includes/class-listings.php (modified) (2 diffs)
-
includes/views/search-widget.php (modified) (1 diff)
-
plugin.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
track-connect/trunk/includes/api/request.php
r1523437 r1527834 12 12 $this->debug = $debug; 13 13 $this->endpoint = 'https://'.strtolower($domain).'.trackhs.com'; 14 //$this->endpoint = 'http://SVRTEST.trackstaging.info';15 //$this->endpoint = 'http://SVRTEST.jreed.trackhs.com';16 // $this->endpoint = 'http://local.ap.trackdev.info';17 14 } 18 15 … … 431 428 ) 432 429 ); 433 434 435 // Check for unit id436 // $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '".$wpdb->prefix."posts' AND column_name = 'unit_id'" );437 // if(empty($row)){438 // $wpdb->query("ALTER TABLE ".$wpdb->prefix."posts ADD COLUMN unit_id bigint(20)");439 // }440 //441 // // Check for grouping column442 // $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '".$wpdb->prefix."posts' AND column_name = 'group_id'" );443 // if(empty($row)){444 // $wpdb->query("ALTER TABLE ".$wpdb->prefix."posts ADD COLUMN group_id varchar(50)");445 // }446 //447 // // Check for parent column448 // $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '".$wpdb->prefix."posts' AND column_name = 'parent_listing'" );449 // if(empty($row)){450 // $wpdb->query("ALTER TABLE ".$wpdb->prefix."posts ADD COLUMN parent_listing bigint(20)");451 // }452 430 453 431 $term = $wpdb->get_row("SELECT term_taxonomy_id FROM ".$wpdb->prefix."term_taxonomy … … 819 797 ) 820 798 ); 821 822 /* Check for node stuff */823 // $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '".$wpdb->prefix."terms' AND column_name = 'node_id'" );824 // if(empty($row)){825 // $wpdb->query("ALTER TABLE ".$wpdb->prefix."terms ADD COLUMN node_id bigint(20)");826 // }827 //828 // $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '".$wpdb->prefix."terms' AND column_name = 'node_type_id'" );829 // if(empty($row)){830 // $wpdb->query("ALTER TABLE ".$wpdb->prefix."terms ADD COLUMN node_type_id bigint(20)");831 // }832 //833 // $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '".$wpdb->prefix."track_node_types' AND column_name = 'name'" );834 // if(empty($row)){835 // $wpdb->query("CREATE TABLE ".$wpdb->prefix."track_node_types (836 // id int(12) unsigned NOT NULL AUTO_INCREMENT,837 // name varchar(250) DEFAULT NULL,838 // type_id int(11) NOT NULL,839 // active tinyint(1) NOT NULL DEFAULT '0',840 // PRIMARY KEY (id)841 // ) ENGINE=InnoDB");842 // }843 /* End Check */844 799 845 800 $wpdb->query("UPDATE ".$wpdb->prefix."track_node_types set active = 0"); … … 890 845 array( '%s', '%d', '%s' ), array( '%d' ) ); 891 846 892 /*893 $wpdb->update( 'wp_term_taxonomy',894 array( 'description' => $node->typename ),895 array( 'term_id' => $term->term_id ),896 array( '%s' ), array( '%d' ) );897 */898 899 847 $term = $wpdb->get_row("SELECT term_taxonomy_id FROM ".$wpdb->prefix."term_taxonomy 900 848 JOIN ".$wpdb->prefix."terms ON ".$wpdb->prefix."terms.term_id = ".$wpdb->prefix."term_taxonomy.term_id … … 933 881 ) 934 882 ); 935 936 /* Check for Amenity stuff */937 // $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '".$wpdb->prefix."track_amenities' AND column_name = 'name'" );938 // if(empty($row)){939 // $wpdb->query("CREATE TABLE `".$wpdb->prefix."track_amenities` (940 // `id` int(15) unsigned NOT NULL AUTO_INCREMENT,941 // `amenity_id` int(15) DEFAULT NULL,942 // `name` varchar(100) DEFAULT NULL,943 // `group_id` int(15) DEFAULT NULL,944 // `group_name` varchar(100) DEFAULT NULL,945 // `active` tinyint(1) NOT NULL DEFAULT '0',946 // PRIMARY KEY (`id`)947 // ) ENGINE=InnoDB");948 // }949 //950 // $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '".$wpdb->prefix."terms' AND column_name = 'amenity_id'" );951 // if(empty($row)){952 // $wpdb->query("ALTER TABLE ".$wpdb->prefix."terms ADD COLUMN amenity_id bigint(20)");953 // }954 /* End Check */955 883 956 884 $wpdb->query("UPDATE ".$wpdb->prefix."track_amenities set active = 0"); -
track-connect/trunk/includes/class-listings-search-widget.php
r1523437 r1527834 1 1 <?php 2 2 3 /** 3 4 * This widget creates a search form which uses listings' taxonomy for search fields. … … 7 8 */ 8 9 class WP_Listings_Search_Widget extends WP_Widget { 9 10 // used to be WP_Listings_Search_Widget 11 function WP_Listings_Search_Widget() { 12 $widget_ops = array( 'classname' => 'listings-search wp-listings-search wp-listings-search-sidebar', 'description' => __( 'Display listings search dropdown', 'wp_listings' ) ); 10 11 function __construct() { 12 $widget_ops = array( 13 'classname' => 'listings-search wp-listings-search wp-listings-search-sidebar', 14 'description' => __( 'Display listings search dropdown', 'wp_listings' ) 15 ); 16 13 17 $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'listings-search' ); 14 $this->__construct( 'listings-search', __( 'WP Listings - Search', 'wp_listings' ), $widget_ops, $control_ops ); 18 19 parent::__construct( 'listings-search', __( 'WP Listings - Search', 'wp_listings' ), $widget_ops, $control_ops ); 15 20 } 16 17 function wp_get_locations_postcount($id) {18 19 //return $count;20 $args = array(21 'post_type' => 'listing',22 'post_status' => 'publish',23 'posts_per_page' => -1,24 'tax_query' => array(25 'relation' => 'AND',26 array(27 'taxonomy' => 'locations',28 'field' => 'id',29 'terms' => array( $id )30 )31 )32 );33 34 $query = new WP_Query( $args);35 36 return (int)$query->post_count;37 38 }39 21 40 22 function widget( $args, $instance ) { 41 global $wpdb;23 global $wpdb, $_wp_listings_taxonomies, $wp_query, $wp_the_query; 42 24 43 $checkin = (isset($_REQUEST['checkin']) && $_REQUEST['checkin'] != '' )? date('m/d/Y', strtotime($_REQUEST['checkin'])):null; 44 $checkout = (isset($_REQUEST['checkout']) && $_REQUEST['checkout'] != '')? date('m/d/Y', strtotime($_REQUEST['checkout'])):null; 45 $rooms = (isset($_REQUEST['bedrooms']))? $_REQUEST['bedrooms']:''; 46 $features = (isset($_REQUEST['features']))? $_REQUEST['features']:array(); 47 $locations = (isset($_REQUEST['locations']))? $_REQUEST['locations']:null; 48 $lowRate = (isset($_REQUEST['low']))? $_REQUEST['low']:false; 49 $highRate = (isset($_REQUEST['high']))? $_REQUEST['high']:false; 50 $lowBed = (isset($_REQUEST['lowbed']))? $_REQUEST['lowbed']:false; 51 $highBed = (isset($_REQUEST['highbed']))? $_REQUEST['highbed']:false; 52 $sleeps = (isset($_REQUEST['sleeps']))? $_REQUEST['sleeps']:''; 53 $lodgingType = (isset($_REQUEST['lodging']))? $_REQUEST['lodging']:''; 54 55 $ratesMin = $wpdb->get_row("SELECT meta_value as rate FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_listing_min_rate' AND meta_value > 0 ORDER BY ABS(meta_value) ASC;"); 56 $ratesMax = $wpdb->get_row("SELECT meta_value as rate FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_listing_max_rate' ORDER BY ABS(meta_value) DESC;"); 57 58 $bedsMin = $wpdb->get_row("SELECT meta_value as bed FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_listing_bedrooms' AND meta_value > 0 ORDER BY ABS(meta_value) ASC;"); 59 $bedsMax = $wpdb->get_row("SELECT meta_value as bed FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_listing_bedrooms' ORDER BY ABS(meta_value) DESC;"); 60 61 $amenities = $wpdb->get_results("SELECT name FROM ".$wpdb->prefix."track_amenities WHERE active = 1"); 62 $activeAmenities = array(); 63 foreach($amenities as $a){ 64 $activeAmenities[] = $a->name; 65 } 66 25 $checkin = ( isset( $_REQUEST['checkin'] ) && $_REQUEST['checkin'] != '' ) ? date( 'm/d/Y', 26 strtotime( $_REQUEST['checkin'] ) ) : null; 27 $checkout = ( isset( $_REQUEST['checkout'] ) && $_REQUEST['checkout'] != '' ) ? date( 'm/d/Y', 28 strtotime( $_REQUEST['checkout'] ) ) : null; 29 $rooms = ( isset( $_REQUEST['bedrooms'] ) ) ? $_REQUEST['bedrooms'] : ''; 30 $features = ( isset( $_REQUEST['features'] ) ) ? $_REQUEST['features'] : array(); 31 $locations = ( isset( $_REQUEST['locations'] ) ) ? $_REQUEST['locations'] : null; 32 $lowRate = ( isset( $_REQUEST['low'] ) ) ? $_REQUEST['low'] : false; 33 $highRate = ( isset( $_REQUEST['high'] ) ) ? $_REQUEST['high'] : false; 34 $lowBed = ( isset( $_REQUEST['lowbed'] ) ) ? $_REQUEST['lowbed'] : false; 35 $highBed = ( isset( $_REQUEST['highbed'] ) ) ? $_REQUEST['highbed'] : false; 36 $sleeps = ( isset( $_REQUEST['sleeps'] ) ) ? $_REQUEST['sleeps'] : ''; 37 $lodgingType = ( isset( $_REQUEST['lodging'] ) ) ? $_REQUEST['lodging'] : ''; 38 39 $ratesMin = $wpdb->get_row( "SELECT meta_value as rate FROM " . $wpdb->prefix . "postmeta WHERE meta_key = '_listing_min_rate' AND meta_value > 0 ORDER BY ABS(meta_value) ASC;" ); 40 $ratesMax = $wpdb->get_row( "SELECT meta_value as rate FROM " . $wpdb->prefix . "postmeta WHERE meta_key = '_listing_max_rate' ORDER BY ABS(meta_value) DESC;" ); 41 42 $bedsMin = $wpdb->get_row( "SELECT meta_value as bed FROM " . $wpdb->prefix . "postmeta WHERE meta_key = '_listing_bedrooms' AND meta_value > 0 ORDER BY ABS(meta_value) ASC;" ); 43 $bedsMax = $wpdb->get_row( "SELECT meta_value as bed FROM " . $wpdb->prefix . "postmeta WHERE meta_key = '_listing_bedrooms' ORDER BY ABS(meta_value) DESC;" ); 44 45 $amenities = $wpdb->get_results( "SELECT name FROM " . $wpdb->prefix . "track_amenities WHERE active = 1" ); 46 $activeAmenities = array(); 47 foreach ( $amenities as $a ) { 48 $activeAmenities[] = $a->name; 49 } 50 67 51 $instance = wp_parse_args( (array) $instance, array( 68 'title' => '',69 'button_text' => __( 'Search Listings', 'wp_listings' )52 'title' => '', 53 'button_text' => __( 'Search Listings', 'wp_listings' ) 70 54 ) ); 71 72 global $_wp_listings_taxonomies,$post,$wp_query,$wp_the_query;73 55 74 56 $listings_taxonomies = $_wp_listings_taxonomies->get_taxonomies(); … … 76 58 extract( $args ); 77 59 78 $template_name = 'search-widget.php';79 if (file_exists(WP_LISTINGS_VIEWS_DIR."custom_$template_name")) {80 include(WP_LISTINGS_VIEWS_DIR."custom_$template_name");81 } else {82 include("views/$template_name");83 }60 $template_name = 'search-widget.php'; 61 if ( file_exists( WP_LISTINGS_VIEWS_DIR . "custom_$template_name" ) ) { 62 include( WP_LISTINGS_VIEWS_DIR . "custom_$template_name" ); 63 } else { 64 include( "views/$template_name" ); 65 } 84 66 } 85 67 … … 89 71 90 72 function form( $instance ) { 73 global $_wp_listings_taxonomies; 91 74 92 75 $instance = wp_parse_args( (array) $instance, array( 93 'title' => '',94 'button_text' => __( 'Search Listings', 'wp_listings' )76 'title' => '', 77 'button_text' => __( 'Search Listings', 'wp_listings' ) 95 78 ) ); 96 79 97 global $_wp_listings_taxonomies; 80 $listings_taxonomies = $_wp_listings_taxonomies->get_taxonomies(); 81 $new_widget = empty( $instance ); 98 82 99 $listings_taxonomies = $_wp_listings_taxonomies->get_taxonomies(); 100 $new_widget = empty( $instance ); 83 $template_name = 'search-form.php'; 84 if ( file_exists( WP_LISTINGS_VIEWS_DIR . "custom_$template_name" ) ) { 85 include( WP_LISTINGS_VIEWS_DIR . "custom_$template_name" ); 86 } else { 87 include( "views/$template_name" ); 88 } 89 } 101 90 102 $template_name = 'search-form.php'; 103 if (file_exists(WP_LISTINGS_VIEWS_DIR."custom_$template_name")) { 104 include(WP_LISTINGS_VIEWS_DIR."custom_$template_name"); 105 } else { 106 include("views/$template_name"); 107 } 91 protected function getNodeTypes() { 92 global $wpdb; 93 return $wpdb->get_results("SELECT id, name, type_id FROM ".$wpdb->prefix."track_node_types WHERE active = 1 ORDER BY name;"); 94 } 95 96 protected function getNodes($type) { 97 global $wpdb; 98 return $wpdb->get_results("SELECT name, slug, t.term_id, count FROM ".$wpdb->prefix."terms as t JOIN ".$wpdb->prefix."term_taxonomy tt on tt.term_id = t.term_id and taxonomy = 'locations' WHERE node_type_id = ".$type->type_id." ORDER BY name"); 99 } 100 101 protected function getLodgingTypes() { 102 global $wpdb; 103 return $wpdb->get_results("SELECT meta_value FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_listing_lodging_type_name' AND meta_value != '' GROUP BY meta_value ORDER BY meta_value ASC"); 108 104 } 109 105 } -
track-connect/trunk/includes/class-listings.php
r1523437 r1527834 37 37 __( 'ZIP:', 'wp_listings' ) => '_listing_zip', 38 38 __( 'Track Unit ID:', 'wp_listings' ) => '_listing_unit_id', 39 //__( 'Open House Time & Date:', 'wp_listings' ) => '_listing_open_house'40 39 ), 41 40 'col2' => array( 42 //__( 'Year Built:', 'wp_listings' ) => '_listing_year_built',43 //__( 'Floors:', 'wp_listings' ) => '_listing_floors',44 //__( 'Square Feet:', 'wp_listings' ) => '_listing_sqft',45 //__( 'Lot Square Feet:', 'wp_listings' ) => '_listing_lot_sqft',46 41 __( 'Bedrooms:', 'wp_listings' ) => '_listing_bedrooms', 47 42 __( 'Bathrooms:', 'wp_listings' ) => '_listing_bathrooms', 48 43 __( 'Youtube ID:', 'wp_listings' ) => '_listing_youtube_id', 49 //__( 'Pool:', 'wp_listings' ) => '_listing_pool'50 44 ), 51 45 ) ); … … 139 133 140 134 function register_meta_boxes() { 141 142 135 add_meta_box( 'listing_details_metabox', __( 'Property Details', 'wp_listings' ), array( &$this, 'listing_details_metabox' ), 'listing', 'normal', 'high' ); 143 136 add_meta_box( 'listing_features_metabox', __( 'Additional Details', 'wp_listings' ), array( &$this, 'listing_features_metabox' ), 'listing', 'normal', 'high' ); 144 //add_meta_box( 'agentevo_metabox', __( 'Agent Evolution', 'wp_listings' ), array( &$this, 'agentevo_metabox' ), 'wp-listings-options', 'side', 'core' );145 146 137 } 147 138 -
track-connect/trunk/includes/views/search-widget.php
r1523437 r1527834 1 <?php 2 echo $before_widget; 3 echo '<div id="search-widget">'; 4 if ( $instance['title'] ) echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title; 1 <?= $before_widget ?> 2 <div id="search-widget"> 3 <?php if ( $instance['title'] ) { 4 echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, 5 $this->id_base ) . $after_title; 6 } ?> 5 7 6 echo '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" ><input type="hidden" value="" name="s" /><input type="hidden" value="listing" name="post_type" />'; 8 <form role="search" method="get" id="searchform" action="<?= home_url( '/' ) ?>"><input type="hidden" value="" 9 name="s"/><input 10 type="hidden" value="listing" name="post_type"/> 11 <div id="datepicker-search-container"> 12 <div class="input-daterange input-group" id="datepicker-search"> 13 <span>Arrival Date</span> 14 <input type="text" class="input-sm form-control" name="checkin" id="checkin_date-search" 15 value="<?= $checkin ?>"> 16 <span>Departure Date</span> 17 <input type="text" class="input-sm form-control" name="checkout" id="checkout_date-search" 18 value="<?= $checkout ?>"> 19 </div> 20 </div> 7 21 8 //echo '<input type="hidden" name="checkin" id="checkin-search" value="'.$checkin.'">'; 9 //echo '<input type="hidden" name="checkout" id="checkout-search" value="'.$checkout.'">'; 22 <span class="search-locations-header"><strong>Locations</strong></span> 10 23 11 echo '<div id="datepicker-search-container">'. 12 '<div class="input-daterange input-group" id="datepicker-search">'. 13 '<span>Arrival Date</span>'. 14 '<input type="text" class="input-sm form-control" name="checkin" id="checkin_date-search" value="'.$checkin.'">'. 15 '<span>Departure Date</span>'. 16 '<input type="text" class="input-sm form-control" name="checkout" id="checkout_date-search" value="'.$checkout.'">'. 17 '</div>'. 18 '</div>'; 24 <?php $current = ! empty( $wp_query->query_vars['tax_query'][0]['terms'] ) ? $wp_query->query_vars['tax_query'][0]['terms'] : ''; ?> 25 <select name='locations' id='locations-select' class='wp-listings-taxonomy'> 26 <option value="">All</option> 27 <?php foreach ( $this->getNodeTypes() as $type ): ?> 28 <optgroup label="<?= $type->name ?>"> 29 <?php foreach ( $this->getNodes( $type ) as $node ): ?> 30 <?php if ( $node->count ): ?> 31 <option 32 value="<?= $node->slug ?>" <?= ( $node->slug == $locations ) ? ' selected ' : '' ?>><?= $node->name ?> 33 (<?= $node->count ?>) 34 </option> 35 <?php endif; ?> 36 <?php endforeach; ?> 37 </optgroup> 38 <?php endforeach; ?> 39 </select> 40 <br/> 19 41 42 <span class="sleeps-header"><strong>Sleeps</strong></span> 43 <br/> 44 <select name="sleeps" class="sleeps-input"> 45 <option value=""></option> 46 <?php for ( $i = 1; $i <= 32; $i ++ ) : ?> 47 <option <?= $i == $sleeps ? ' selected ' : ''; ?> value="<?= $i ?>"><?= $i ?></option> 48 <?php endfor; ?> 49 </select> 50 <br/> 20 51 21 // For locations only 22 $nodeTypes = $wpdb->get_results("SELECT id, name, type_id FROM ".$wpdb->prefix."track_node_types WHERE active = 1 ORDER BY name;"); 52 <span class="lodging-header"><b>Lodging Types</b></span> 53 <br/> 23 54 24 echo '<span class="search-locations-header"><b>Locations</b></span>'; 25 $current = ! empty( $wp_query->query_vars['tax_query'][0]['terms'] ) ? $wp_query->query_vars['tax_query'][0]['terms'] : ''; 55 <select name="lodging" id="lodging" class="listing-lodging"> 56 <option value="">No Preference</option> 57 <?php foreach ( $this->getLodgingTypes() as $lodge ): ?> 58 <option <?= ( $lodgingType == $lodge->meta_value ) ? 'SELECTED' : ''; ?> 59 value="<?= $lodge->meta_value ?>"><?= $lodge->meta_value ?></option>'; 60 <?php endforeach; ?> 61 </select> 62 <br> 26 63 27 echo "<select name='locations' id='locations-select' class='wp-listings-taxonomy'>\n\t"; 28 echo "\t<option value >All</option>\n"; 29 foreach ( $nodeTypes as $type ) { 64 <span class="beds-header"><b>Bedrooms</b></span> 65 <input type="hidden" id="lowbed" name="lowbed"/> 66 <input type="hidden" id="highbed" name="highbed"/> 67 <br/> 30 68 31 echo "\t<optgroup label='$type->name'>\n"; 32 $nodes = $wpdb->get_results("SELECT name, slug, term_id FROM ".$wpdb->prefix."terms WHERE node_type_id = ".$type->type_id." ORDER BY name;"); 69 <input class="slider-beds" type="text" id="slider-beds" readonly 70 style="border:0; color:#f6931f; font-weight:bold;"> 71 <br/> 33 72 34 foreach($nodes as $node){ 35 $count = $this->wp_get_locations_postcount($node->term_id); 36 if($count > 0){ 37 $selected = ( $node->slug == $locations)?' SELECTED ':''; 38 echo "\t<option value='{$node->slug}' $selected >{$node->name} ($count)</option>\n"; 39 } 40 } 41 echo "\t</optgroup>\n"; 42 } 43 echo '</select><br>'; 73 <div id="bed-range"></div> 74 <br/> 44 75 45 echo '<span class="sleeps-header"><b>Sleeps</b></span><br>'; 46 //echo '<input class="sleeps-input" type="text" placeholder"Sleeps #" value="'.$sleeps.'"><br>'; 76 <span class="price-header" for="amount"><strong>Price range</strong></span> 77 <input type="hidden" id="lowrate" name="low"/> 78 <input type="hidden" id="highrate" name="high"/> 79 <br> 47 80 81 <input class="slider-amount" type="text" id="amount" readonly 82 style="border:0; color:#f6931f; font-weight:bold;"> 83 <br/> 48 84 49 echo '<select name="sleeps" class="sleeps-input">'; 50 echo "<option value=''></option>"; 51 for($i = 1; $i <= 32; $i++){ 52 $selected = $i == $sleeps? ' SELECTED ':NULL; 53 echo "<option $selected value='$i'>$i</option>"; 54 } 55 echo '</select><br>'; 85 <div id="price-range"></div> 86 <br/> 56 87 57 $lodgingTypes = $wpdb->get_results("SELECT meta_value FROM ".$wpdb->prefix."postmeta WHERE meta_key = '_listing_lodging_type_name' AND meta_value != '' GROUP BY meta_value ORDER BY meta_value ASC"); 58 echo '<span class="lodging-header"><b>Lodging Types</b></span><br>'; 59 echo '<select name="lodging" id="lodging" class="listing-lodging">'; 60 echo '<option value="">No Preference</option>'; 61 foreach($lodgingTypes as $lodge){ 62 $selected = ($lodgingType == $lodge->meta_value)? 'SELECTED' : ''; 63 echo '<option '.$selected.' value="'.$lodge->meta_value.'">'.$lodge->meta_value.'</option>'; 64 } 65 echo '</select><br>'; 88 <span class="search-amenities-header"><b>Amenities</b></span> 89 <div class="listing-amenities" style="max-height:200px;overflow: hidden;overflow-y: scroll"> 90 <?php foreach ( $listings_taxonomies as $tax => $data ): ?> 91 <?php if ( $tax != 'features' || ! isset( $instance[ $tax ] ) || ! $instance[ $tax ] ) { 92 continue; 93 } ?> 66 94 67 // Bedrooms 68 //$bedrooms = $wpdb->get_row("SELECT meta_value as beds FROM wp_postmeta WHERE meta_key = '_listing_bedrooms' GROUP BY meta_value ORDER BY ABS(meta_value) ASC"); 69 /* 70 echo '<select name="bedrooms" id="bedrooms" class="listing-bedrooms">'; 71 echo '<option value="">Bedrooms</option>'; 72 foreach($bedrooms as $bedroom){ 73 $selected = ($rooms == $bedroom)? 'SELECTED' : ''; 74 echo '<option '.$selected.' value="'.$bedroom.'">'.$bedroom.'</option>'; 75 } 76 echo '</select>'; 77 */ 78 echo '<span class="beds-header"><b>Bedrooms</b></span><input type="hidden" id="lowbed" name="lowbed" /><input type="hidden" id="highbed" name="highbed" /><br>'; 79 echo '<input class="slider-beds" type="text" id="slider-beds" readonly style="border:0; color:#f6931f; font-weight:bold;"><br>'; 80 echo '<div id="bed-range"></div><br>'; 95 <?php $terms = get_terms( $tax, 96 array( 'orderby' => 'title', 'number' => 100, 'hierarchical' => false ) ); ?> 97 <?php if ( empty( $terms ) ) { 98 continue; 99 } ?> 81 100 82 // Price Range 83 echo '<span class="price-header" for="amount"><b>Price range</b></span><input type="hidden" id="lowrate" name="low" /><input type="hidden" id="highrate" name="high" /><br>'; 84 echo '<input class="slider-amount" type="text" id="amount" readonly style="border:0; color:#f6931f; font-weight:bold;"><br>'; 85 echo '<div id="price-range"></div><br>'; 101 <?php $current = ! empty( $wp_query->query_vars['tax_query']['terms'] ) ? $wp_query->query_vars['tax_query']['terms'] : ''; ?> 102 <?php foreach ( (array) $terms as $term ): ?> 103 <?php if ( in_array( $term->name, $activeAmenities ) ): ?> 104 <input type="checkbox" name="features[]" value="<?= $term->slug ?>" 105 id="<?= $tax ?>" <?= ( in_array( $term->slug, $features ) ) ? ' checked ' : ''; ?> 106 class='wp-listings-taxonomy-checkbox'><?= $term->name ?><br/> 107 <?php endif; ?> 108 <?php endforeach; ?> 109 <?php endforeach; ?> 110 </div> 111 <br/> 112 <div class="btn-search"> 113 <button type="submit" class="searchsubmit"><i class="fa fa-search"></i><span 114 class="button-text"><?= esc_attr( $instance['button_text'] ) ?></span></button> 115 <button type="reset" class="searchclear">Reset</button> 116 </div> 117 <div class="clear"></div> 118 </form> 119 <script type="text/javascript"> 120 jQuery(function ($) { 121 $("#bed-range").slider({ 122 range: true, 123 min: <?=$bedsMin->bed?>, 124 max: <?=$bedsMax->bed?>, 125 step: 1, 126 values: [ <?=( $lowBed ) ? $lowBed : $bedsMin->bed?>, <?=( $highBed ) ? $highBed : $bedsMax->bed?> ], 127 slide: function (event, ui) { 128 $("#slider-beds").val(ui.values[0] + " - " + ui.values[1]); 129 $("#lowbed").val(ui.values[0]); 130 $("#highbed").val(ui.values[1]); 131 } 132 }); 133 $("#slider-beds").val($("#bed-range").slider("values", 0) + 134 " - " + $("#bed-range").slider("values", 1)); 135 $("#lowbed").val($("#bed-range").slider("values", 0)); 136 $("#highbed").val($("#bed-range").slider("values", 1)); 86 137 138 $("#price-range").slider({ 139 range: true, 140 min: 0, 141 max: 2500, 142 step: 100, 143 values: [0, 2500], 144 slide: function (event, ui) { 145 var plus = (ui.values[1] == 2500) ? '+' : ''; 146 $("#amount").val("$" + ui.values[0] + " - $" + ui.values[1] + plus); 147 $("#lowrate").val(ui.values[0]); 148 $("#highrate").val(ui.values[1]); 149 } 150 }); 151 $("#amount").val("$" + $("#price-range").slider("values", 0) + 152 " - $" + $("#price-range").slider("values", 1) + '+'); 153 $("#lowrate").val($("#price-range").slider("values", 0)); 154 $("#highrate").val($("#price-range").slider("values", 1)); 87 155 156 $('#datepicker-search-container .input-daterange').datepicker({ 157 autoclose: true, 158 clearBtn: true, 159 startDate: '+1d' 160 }); 88 161 89 /* OLD LOCATION SEARCH 90 foreach ( $listings_taxonomies as $tax => $data ) { 91 if($tax != 'locations'){ 92 continue; 93 } 94 if ( ! isset( $instance[$tax] ) || ! $instance[$tax] ) 95 continue; 96 $terms = get_terms( $tax, array( 'orderby' => 'title', 'number' => 1000, 'hierarchical' => false ) ); 97 if ( empty( $terms ) ) 98 continue; 99 100 echo '<span class="search-locations-header"><b>Locations</b></span>'; 101 $current = ! empty( $wp_query->query_vars['tax_query'][0]['terms'] ) ? $wp_query->query_vars['tax_query'][0]['terms'] : ''; 102 echo "<select name='$tax' id='$tax' class='wp-listings-taxonomy'>\n\t"; 103 echo '<option value="" ' . selected( $current == '', false, false ) . ">All {$data['labels']['name']}</option>\n"; 104 foreach ( (array) $terms as $term ){ 105 $selected = ( $term->slug == $locations)?' SELECTED ':''; 106 echo "\t<option value='{$term->slug}' $selected >{$term->name}</option>\n"; 107 } 108 echo '</select><br>'; 109 } 110 */ 111 112 // For amenities/features only 113 echo '<span class="search-amenities-header"><b>Amenities</b></span>'; 114 echo '<div class="listing-amenities" style="max-height:200px;overflow: hidden;overflow-y: scroll">'; 115 foreach ( $listings_taxonomies as $tax => $data ) { 116 if($tax != 'features'){ 117 continue; 118 } 119 if ( ! isset( $instance[$tax] ) || ! $instance[$tax] ) 120 continue; 121 $terms = get_terms( $tax, array( 'orderby' => 'title', 'number' => 100, 'hierarchical' => false ) ); 122 if ( empty( $terms ) ) 123 continue; 124 125 $current = ! empty( $wp_query->query_vars['tax_query']['terms'] ) ? $wp_query->query_vars['tax_query']['terms'] : ''; 126 foreach ( (array) $terms as $term ){ 127 if(in_array($term->name, $activeAmenities)){ 128 $checked = ( in_array($term->slug, $features) )?' CHECKED ':''; 129 echo "<input type='checkbox' name='features[]' value='{$term->slug}' id='$tax' " . $checked . " class='wp-listings-taxonomy-checkbox'>{$term->name}\n\t<br>"; 130 } 131 } 132 } 133 echo '</div><br>'; 134 135 echo '<div class="btn-search"><button type="submit" class="searchsubmit"><i class="fa fa-search"></i><span class="button-text">'. esc_attr( $instance['button_text'] ) .'</span></button> <button type="reset" class="searchclear">Reset</button></div>'; 136 echo '<div class="clear"></div> 137 </form></div>'; 138 139 echo $after_widget; 140 ?> 141 142 <script type="text/javascript"> 143 jQuery(function($) { 144 145 /* 146 $('.datepicker').on('click', function() { 147 $(this).datepicker({ dateFormat: "mm/dd/yy" }); 148 $(this).datepicker('show'); 149 }); 150 */ 151 $( "#bed-range" ).slider({ 152 range: true, 153 min: <?=$bedsMin->bed?>, 154 max: <?=$bedsMax->bed?>, 155 step: 1, 156 values: [ <?=($lowBed)?$lowBed:$bedsMin->bed?>, <?=($highBed)?$highBed:$bedsMax->bed?> ], 157 slide: function( event, ui ) { 158 $( "#slider-beds" ).val( ui.values[ 0 ] + " - " + ui.values[ 1 ] ); 159 $( "#lowbed" ).val( ui.values[ 0 ] ); 160 $( "#highbed" ).val( ui.values[ 1 ] ); 161 } 162 }); 163 $( "#slider-beds" ).val( $( "#bed-range" ).slider( "values", 0 ) + 164 " - " + $( "#bed-range" ).slider( "values", 1 ) ); 165 $( "#lowbed" ).val( $( "#bed-range" ).slider( "values", 0 )); 166 $( "#highbed" ).val( $( "#bed-range" ).slider( "values", 1 )); 167 168 $( "#price-range" ).slider({ 169 range: true, 170 min: 0, 171 max: 2500, 172 step: 100, 173 values: [ 0, 2500 ], 174 slide: function( event, ui ) { 175 var plus = (ui.values[ 1 ] == 2500)?'+':''; 176 $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] + plus ); 177 $( "#lowrate" ).val( ui.values[ 0 ] ); 178 $( "#highrate" ).val( ui.values[ 1 ] ); 179 } 180 }); 181 $( "#amount" ).val( "$" + $( "#price-range" ).slider( "values", 0 ) + 182 " - $" + $( "#price-range" ).slider( "values", 1 ) + '+' ); 183 $( "#lowrate" ).val( $( "#price-range" ).slider( "values", 0 )); 184 $( "#highrate" ).val( $( "#price-range" ).slider( "values", 1 )); 185 186 187 $('#datepicker-search-container .input-daterange').datepicker({ 188 autoclose: true, 189 clearBtn: true, 190 startDate: '+1d' 191 }).on('changeDate', function(e) { 192 //$('#checkin-search').val( moment($('#checkin_date-search').val()).format("MM/DD/YYYY") ); 193 //$('#checkout-search').val( moment($('#checkout_date-search').val()).format("MM/DD/YYYY") ); 194 195 }); 196 197 $('#checkin_date-search').datepicker().on('hide', function(e) { 198 $('#checkout_date-search').datepicker('show'); 199 }); 200 201 /* 202 $('#daterange-search').dateRangePicker( 203 { 204 startOfWeek: 'sunday', 205 separator : ' to ', 206 format: 'MM/DD/YYYY', 207 customTopBar: '<b>Please select a Check In and Check Out date...</b>', 208 autoClose: true, 209 selectForward: true, 210 minDays: 2, 211 stickyMonths: true, 212 hoveringTooltip: false, 213 startDate: moment().format('MM/DD/YYYY'), 214 215 }).bind('datepicker-change',function(event,obj) 216 { 217 218 $('#checkin').val(moment(obj.date1).format("MM/DD/YYYY")); 219 $('#checkout').val(moment(obj.date2).format("MM/DD/YYYY")); 220 221 }); 222 223 $(document).on('click', '.searchclear', function(){ 224 $('#daterange-search').data('dateRangePicker').clear(); 225 }); 226 */ 227 228 229 }); 230 </script> 231 162 $('#checkin_date-search').datepicker().on('hide', function (e) { 163 $('#checkout_date-search').datepicker('show'); 164 }); 165 }); 166 </script> 167 </div> 168 <?= $after_widget; ?> -
track-connect/trunk/plugin.php
r1523441 r1527834 7 7 Author URI: http://www.trackhs.com 8 8 9 Version: 3.0. 09 Version: 3.0.1 10 10 11 11 License: GNU General Public License v2.0 (or later) -
track-connect/trunk/readme.txt
r1523444 r1527834 4 4 Requires at least: 3.7 5 5 Tested up to: 4.6.1 6 Stable tag: 3.0. 06 Stable tag: 3.0.1 7 7 8 8 Creates and syncs listing-type posts from TRACK PM, a cloud-based property management system (www.trackhs.com). … … 45 45 == Changelog == 46 46 47 = 3.0 = 47 = 3.0.1 = 48 Major performance improvement to search widget 49 50 = 3.0.0 = 48 51 Changes to architecture. 49 52 Node tree support.
Note: See TracChangeset
for help on using the changeset viewer.