function search_fields(IDX $idx, $filter = '', $comparison = false) { /* FEED_search_fields Function */ $search_fields_func = preg_replace("|-|", "_", $idx->getLink()) . '_search_fields'; $search_fields_func = function_exists($search_fields_func) ? $search_fields_func : preg_replace("|-|", "_", $idx->getDatabase()) . '_search_fields'; /* Get Search Fields */ if (function_exists($search_fields_func)) { $search_fields = $search_fields_func($idx, $filter, $comparison); } else { $search_fields = array(); } /* Search Location */ $search_fields = array_merge($search_fields, array(array('name' => 'Search Location', 'form_field' => 'search_location', 'idx_field' => 'AddressCity', 'match' => 'like', 'group' => 'location'), array('name' => 'Search Location', 'form_field' => 'search_location', 'idx_field' => 'AddressSubdivision', 'match' => 'like', 'group' => 'location'), array('name' => 'Search Location', 'form_field' => 'search_location', 'idx_field' => 'AddressZipCode', 'match' => 'equals', 'group' => 'location'), array('name' => 'Search Location', 'form_field' => 'search_location', 'idx_field' => 'ListingMLS', 'match' => 'like', 'group' => 'location'))); // IDX Collab by Eric B. deployed by Adrian G. $search_fields = array_merge($search_fields, array(array('name' => 'Features', 'form_field' => 'search_features', 'idx_field' => 'DescriptionFeatures', 'match' => 'like'), array('name' => 'Interior Features', 'form_field' => 'search_interiorfeatures', 'idx_field' => 'DescriptionInteriorFeatures', 'match' => 'like'), array('name' => 'Exterior Features', 'form_field' => 'search_exteriorfeatures', 'idx_field' => 'DescriptionExteriorFeatures', 'match' => 'like'), array('name' => 'Price Reduced', 'form_field' => 'search_reduced', 'idx_field' => 'ListingPriceChanged', 'match' => 'datediff'), array('name' => 'Min. Garages', 'form_field' => 'minimum_garages', 'idx_field' => 'NumberOfGarages', 'match' => 'morethan'), array('name' => 'Max. Garages', 'form_field' => 'maximum_garages', 'idx_field' => 'NumberOfGarages', 'match' => 'lessthan'), array('name' => 'Min. Stories', 'form_field' => 'minimum_stories', 'idx_field' => 'NumberOfStories', 'match' => 'morethan'), array('name' => 'Max. Stories', 'form_field' => 'maximum_stories', 'idx_field' => 'NumberOfStories', 'match' => 'lessthan'))); /* Search Everything */ $search_fields = array_merge($search_fields, array(array('name' => 'Search Everything', 'form_field' => 'search_anything', 'idx_field' => 'Address', 'match' => 'like', 'group' => 'anything'), array('name' => 'Search Everything', 'form_field' => 'search_anything', 'idx_field' => 'AddressCity', 'match' => 'like', 'group' => 'anything'), array('name' => 'Search Everything', 'form_field' => 'search_anything', 'idx_field' => 'AddressSubdivision', 'match' => 'like', 'group' => 'anything'), array('name' => 'Search Everything', 'form_field' => 'search_anything', 'idx_field' => 'AddressZipCode', 'match' => 'equals', 'group' => 'anything'), array('name' => 'Search Everything', 'form_field' => 'search_anything', 'idx_field' => 'ListingMLS', 'match' => 'like', 'group' => 'anything'), array('name' => 'Search Everything', 'form_field' => 'search_anything', 'idx_field' => 'ListingType', 'match' => 'equals', 'group' => 'anything'), array('name' => 'Search Everything', 'form_field' => 'search_anything', 'idx_field' => 'ListingSubType', 'match' => 'findinset', 'group' => 'anything'))); // Search by Address if (in_array(Settings::getInstance()->SKIN, array('pt-2r', 'lec-2014'))) { $search_fields = array_merge($search_fields, array(array('name' => 'Search Address', 'form_field' => 'search_location', 'idx_field' => 'Address', 'match' => 'like', 'group' => 'location'))); } /* Return */ return $search_fields; }
protected function get_additional_team_bio_page_info( $team ) { /* code to get testimonials ordered by date new to old */ loadModel( "/entities/testimonials/EntityTestimonial" ); //$testimonials = EntityTestimonial::GetEntityTeamTestimonialsWithSubTestimonials( $team ); $testimonials = EntityTestimonial::GetEntityTestimonialsOrderByOrder( $team ); $testimonial_dicts = array(); foreach( $testimonials as $testimonial ) { $testimonial_dicts[] = $testimonial->getAsDictionary(); } /* get team listings */ loadModel( "/search/Search" ); $properties = array(); $search = new Search(); $search->addTerm( 'realtor', $team->rebrand_code ); $search->addOrderBy( 'list_price', false); $props = $search->run( 0, 7 ); $tmp_properties = Property::GetPropertiesFromIdArray($props, PropertyLoadLevel::IDX_SUMMARY, true); foreach( $props as $prop ) { try{ $property = $tmp_properties[$prop]; // add open house // $property->open_house = $property->getAllDates( true ); $temp_pic = $property->get_first_pic(); if ( is_object( $temp_pic ) ){ $property->photo = $temp_pic->getUrl(); } else { $property->photo = false; } $properties[] = $property; } catch( Exception $e ) {} } unset($tmp_properties); /* get team sold listings */ $sold_properties = array(); $sold_search = new Search(); $sold_search->addTerm( 'buyer_seller', $team->rebrand_code ); $sold_search->addFilter( SearchFilter::SOLD ); $sold_search->addOrderBy( 'list_price', false); $sold_props = $sold_search->run( 0, 3); //set idx view to the sold table to get the sold prop info IDX::Set_IDX_View_Name( IDX::SOLD ); $tmp_properties = Property::GetPropertiesFromIdArray($sold_props, PropertyLoadLevel::IDX_SUMMARY, true); foreach( $sold_props as $sold_prop ) { try{ $property = $tmp_properties[$sold_prop]; $temp_pic = $property->get_first_pic(); if ( is_object( $temp_pic ) ){ $property->photo = $temp_pic->getUrl(); } else { $property->photo = false; } $sold_properties[] = $property; } catch( Exception $e ) {} } unset($tmp_properties); //reset back to normal idx view IDX::Set_IDX_View_Name( IDX::MATERIALIZED ); $tpl_args = array( 'testimonials' => $testimonial_dicts, 'properties' => $properties, 'sold_properties' => $sold_properties, ); return $tpl_args; }