Ejemplo n.º 1
0
 public function generate_search_form()
 {
     $this->property_types = wpl_global::get_property_types();
     $this->listings = wpl_global::get_listings();
     $this->users = wpl_users::get_wpl_users();
     parent::render($this->tpl_path, 'search_form');
 }
Ejemplo n.º 2
0
 private function get_listing_types()
 {
     $listing_types = wpl_global::get_listings();
     $enabled_listing_types = array();
     foreach ($listing_types as $value) {
         if ($value['enabled_in_mobile'] == 1) {
             $enabled_listing_types[] = $value;
         }
     }
     return $enabled_listing_types;
 }
Ejemplo n.º 3
0
 /**
  * Deprecated -> Use wpl_global::get_listings instead.
  * @author Howard R <*****@*****.**>
  * @static
  * @deprecated
  * @return array
  */
 public static function get_listing_types()
 {
     return wpl_global::get_listings('', 0);
 }
Ejemplo n.º 4
0
/** no direct access **/
defined('_WPLEXEC') or die('Restricted access');
?>
<div class="side-6 side-statistic1">
    <div class="panel-wp">
        <h3><?php 
echo __('Properties by listing types', WPL_TEXTDOMAIN);
?>
</h3>
        <div class="panel-body">
        	<?php 
$properties = wpl_db::select("SELECT COUNT(*) as count, `listing` FROM `#__wpl_properties` WHERE `finalized`='1' AND `confirmed`='1' AND `expired`='0' AND `deleted`='0' AND `listing`!='0' GROUP BY `listing`", 'loadAssocList');
$data = array();
$total = 0;
foreach ($properties as $property) {
    $listing = wpl_global::get_listings($property['listing']);
    if (is_object($listing)) {
        $data[__($listing->name, WPL_TEXTDOMAIN)] = $property['count'];
        $total += $property['count'];
    }
}
$params = array('chart_background' => '#fafafa', 'chart_width' => '100%', 'chart_height' => '250px', 'show_value' => 1, 'data' => $data);
if (count($data)) {
    echo '<div class="wpl-total-properties">' . sprintf(__('Total Properties: %s', WPL_TEXTDOMAIN), $total) . '</div>';
    wpl_global::import_activity('charts:bar', '', $params);
} else {
    echo __('No data!', WPL_TEXTDOMAIN);
}
?>
        </div>
    </div>
Ejemplo n.º 5
0
    if ($show == 'checkbox') {
        $html .= '<input value="1" ' . ($current_value == 1 ? 'checked="checked"' : '') . ' name="sf' . $widget_id . '_select_' . $field_data['table_column'] . '" type="checkbox" id="sf' . $widget_id . '_select_' . $field_data['table_column'] . '" class="wpl_search_widget_field_' . $field['id'] . '_check" />
        	<label for="sf' . $widget_id . '_select_' . $field_data['table_column'] . '">' . __($field['name'], WPL_TEXTDOMAIN) . '</label>';
    } elseif ($show == 'yesno') {
        $html .= '<input value="1" ' . ($current_value == 1 ? 'checked="checked"' : '') . ' name="sf' . $widget_id . '_select_' . $field_data['table_column'] . '" type="checkbox" id="sf' . $widget_id . '_select_' . $field_data['table_column'] . '" class="wpl_search_widget_field_' . $field['id'] . '_check yesno" />
        	<label for="sf' . $widget_id . '_select_' . $field_data['table_column'] . '">' . __($field['name'], WPL_TEXTDOMAIN) . '</label>';
    } elseif ($show == 'select') {
        $html .= '<label for="sf' . $widget_id . '_select_' . $field_data['table_column'] . '">' . __($field['name'], WPL_TEXTDOMAIN) . '</label>
			<select name="sf' . $widget_id . '_select_' . $field_data['table_column'] . '" id="sf' . $widget_id . '_select_' . $field_data['table_column'] . '" class="wpl_search_widget_field_' . $field['id'] . '_select">
				<option value="-1" ' . ($current_value == -1 ? 'selected="selected"' : '') . '>' . __('Any', WPL_TEXTDOMAIN) . '</option>
				<option value="1" ' . ($current_value == 1 ? 'selected="selected"' : '') . '>' . __('Yes', WPL_TEXTDOMAIN) . '</option>
			</select>';
    }
    $done_this = true;
} elseif ($type == 'listings' and !$done_this) {
    $listings = wpl_global::get_listings();
    switch ($field['type']) {
        case 'select':
            $show = 'select';
            $any = true;
            $multiple = false;
            $label = true;
            break;
        case 'multiple':
            $show = 'multiple';
            $any = false;
            $multiple = true;
            $label = true;
            break;
        case 'checkboxes':
            $show = 'checkboxes';
Ejemplo n.º 6
0
 /**
  * Updates property title
  * @author Howard <*****@*****.**>
  * @static
  * @param array $property_data
  * @param int $property_id
  * @param boolean $force
  * @return string
  */
 public static function update_property_title($property_data, $property_id = 0, $force = false)
 {
     /** fetch property data if property id is setted **/
     if ($property_id) {
         $property_data = self::get_property_raw_data($property_id);
     }
     if (!$property_id) {
         $property_id = $property_data['id'];
     }
     $column = 'field_313';
     $field_id = wpl_flex::get_dbst_id($column, $property_data['kind']);
     $field = wpl_flex::get_field($field_id);
     $base_column = NULL;
     if (isset($field->multilingual) and $field->multilingual and wpl_global::check_multilingual_status()) {
         $base_column = wpl_global::get_current_language() == wpl_addon_pro::get_default_language() ? $column : NULL;
         $column = wpl_addon_pro::get_column_lang_name($column, wpl_global::get_current_language(), false);
     }
     /** return current title if exists **/
     if (isset($property_data[$column]) and trim($property_data[$column]) != '' and !$force) {
         return $property_data[$column];
     }
     /** first validation **/
     if (!$property_data) {
         return '';
     }
     $listing_data = wpl_global::get_listings($property_data['listing']);
     $listing = isset($listing_data->name) ? $listing_data->name : '';
     $property_type_data = wpl_global::get_property_types($property_data['property_type']);
     $property_type = isset($property_type_data->name) ? $property_type_data->name : '';
     $title = array();
     $title['property_type'] = __($property_type, WPL_TEXTDOMAIN);
     $title['listing'] = __($listing, WPL_TEXTDOMAIN);
     if ($property_data['kind']) {
         $kind_label = wpl_flex::get_kind_label($property_data['kind']);
         if (trim($kind_label)) {
             $title['kind'] = '(' . __($kind_label, WPL_TEXTDOMAIN) . ')';
         }
     }
     $title_str = implode(' ', $title);
     /** apply filters **/
     _wpl_import('libraries.filters');
     @extract(wpl_filters::apply('generate_property_title', array('title' => $title, 'title_str' => $title_str)));
     /** update **/
     if (wpl_db::columns('wpl_properties', $column)) {
         $query = "UPDATE `#__wpl_properties` SET `" . $column . "`='" . $title_str . "' WHERE `id`='" . $property_id . "'";
         wpl_db::q($query, 'update');
     }
     /** update **/
     if ($base_column and wpl_db::columns('wpl_properties', $base_column)) {
         $query = "UPDATE `#__wpl_properties` SET `" . $base_column . "`='" . $title_str . "' WHERE `id`='" . $property_id . "'";
         wpl_db::q($query, 'update');
     }
     return $title_str;
 }
Ejemplo n.º 7
0
/** no direct access **/
defined('_WPLEXEC') or die('Restricted access');
if ($type == 'property_types' and !$done_this) {
    if (trim($value) != '0' or trim($value) != '-1') {
        /** get property type **/
        $property_type = wpl_global::get_property_types($value);
        $return['field_id'] = $field->id;
        $return['type'] = $field->type;
        $return['name'] = __($field->name, WPL_TEXTDOMAIN);
        $return['value'] = is_object($property_type) ? __($property_type->name, WPL_TEXTDOMAIN) : NULL;
    }
    $done_this = true;
} elseif ($type == 'listings' and !$done_this) {
    if (trim($value) != '0' or trim($value) != '-1') {
        /** get listing type **/
        $listing_type = wpl_global::get_listings($value);
        $return['field_id'] = $field->id;
        $return['type'] = $field->type;
        $return['name'] = __($field->name, WPL_TEXTDOMAIN);
        $return['value'] = is_object($listing_type) ? __($listing_type->name, WPL_TEXTDOMAIN) : NULL;
    }
    $done_this = true;
} elseif ($type == 'feature' and !$done_this) {
    if ($values[$field->table_column] != 0) {
        $return['field_id'] = $field->id;
        $return['type'] = $field->type;
        $return['name'] = __($field->name, WPL_TEXTDOMAIN);
        /** options of property column **/
        $column_options = $values[$field->table_column . '_options'];
        $column_values = explode(',', $column_options);
        $i = 0;
Ejemplo n.º 8
0
 /**
  * Returns property meta keywords, This function calls on sef service when meta description of property is empty
  * @author Howard <*****@*****.**>
  * @static
  * @param array $property_data
  * @param int $property_id
  * @return string
  */
 public static function get_meta_keywords($property_data, $property_id = 0)
 {
     /** fetch property data if property id is setted **/
     if ($property_id) {
         $property_data = self::get_property_raw_data($property_id);
     }
     if (!$property_id) {
         $property_id = $property_data['id'];
     }
     $keywords = array();
     if (isset($property_data['bedrooms']) and $property_data['bedrooms']) {
         $keywords[] = $property_data['bedrooms'] . ' ' . __('Bedroom' . ($property_data['bedrooms'] > 1 ? 's' : ''), WPL_TEXTDOMAIN);
     }
     if (isset($property_data['rooms']) and $property_data['rooms']) {
         $keywords[] = $property_data['rooms'] . ' ' . __('Room' . ($property_data['rooms'] > 1 ? 's' : ''), WPL_TEXTDOMAIN);
     }
     if (isset($property_data['bathrooms']) and $property_data['bathrooms']) {
         $keywords[] = $property_data['bathrooms'] . ' ' . __('Bathroom' . ($property_data['bathrooms'] > 1 ? 's' : ''), WPL_TEXTDOMAIN);
     }
     if (isset($property_data['property_type'])) {
         $property_type = wpl_global::get_property_types($property_data['property_type']);
         if (trim($property_type->name)) {
             $keywords[] = __($property_type->name, WPL_TEXTDOMAIN);
         }
     }
     if (isset($property_data['listing'])) {
         $listing = wpl_global::get_listings($property_data['listing']);
         if (trim($listing->name)) {
             $keywords[] = __($listing->name, WPL_TEXTDOMAIN);
         }
     }
     if (isset($property_data['mls_id'])) {
         $keywords[] = $property_data['mls_id'];
     }
     $keywords_str = implode(', ', $keywords);
     /** apply filters **/
     _wpl_import('libraries.filters');
     @extract(wpl_filters::apply('generate_meta_keywords', array('keywords_str' => $keywords_str, 'keywords' => $keywords, 'property_data' => $property_data)));
     return $keywords_str;
 }