public function build()
 {
     $this->model = new wpl_property();
     $property = (array) $this->model->get_property_raw_data($this->pid);
     /** no property found **/
     if (!$property) {
         $this->error = "ERROR: Property id is not valid.";
         return false;
     }
     $items = wpl_items::get_items($this->pid, '', $property['kind'], '', 1);
     /** render gallery **/
     $images = wpl_items::render_gallery($items['gallery']);
     $this->built['listing']['images'] = $images;
     return $this->built;
 }
示例#2
0
 public function build()
 {
     /** property listing model **/
     $this->model = new wpl_property();
     $property = (array) $this->model->get_property_raw_data($this->pid);
     /** no property found **/
     if (!$property) {
         $this->error = "ERROR: Property id is not valid.";
         return false;
     }
     $this->pshow_fields = $this->model->get_pshow_fields('', $property['kind']);
     $this->pshow_categories = wpl_flex::get_categories('', '', " AND `enabled`>='1' AND `kind`='" . $property['kind'] . "' AND `pshow`='1'");
     /** BUILD **/
     $this->built['listing']['raw'] = $property;
     $find_files = array();
     $rendered_fields = $this->model->render_property($property, $this->pshow_fields, $find_files, true);
     $this->built['listing']['materials'] = $rendered_fields['columns'];
     foreach ($this->pshow_categories as $pshow_category) {
         $pshow_cat_fields = $this->model->get_pshow_fields($pshow_category->id, $property['kind']);
         $this->built['listing']['rendered'][$pshow_category->id]['self'] = (array) $pshow_category;
         $this->built['listing']['rendered'][$pshow_category->id]['data'] = $this->model->render_property($property, $pshow_cat_fields);
     }
     $items = wpl_items::get_items($this->pid, '', $property['kind'], '', 1);
     /** render gallery **/
     $this->built['listing']['images'] = wpl_items::render_gallery($items['gallery']);
     /** render attachments **/
     $this->built['listing']['attachments'] = wpl_items::render_attachments($items['attachment']);
     /** render videos **/
     $this->built['listing']['videos'] = wpl_items::render_videos($items['video']);
     /** render rooms **/
     $this->built['listing']['rooms'] = $items['rooms'];
     /** render gallery custom sizes **/
     if (is_array($this->image_sizes)) {
         $this->built['listing']['custom_sizes'] = wpl_items::render_gallery_custom_sizes($this->pid, $items['gallery'], $this->image_sizes);
     }
     /** property full link **/
     $this->built['listing']['property_link'] = $this->model->get_property_link($property);
     /** location text **/
     $this->built['listing']['location_text'] = $property['location_text'];
     /** render agent data **/
     $rendered_agent = wpl_users::full_render($property['user_id']);
     unset($rendered_agent['data']);
     $this->built['listing']['agent'] = $rendered_agent;
     /** updating the visited times and etc **/
     $this->model->property_visited($this->pid);
     return $this->built;
 }
示例#3
0
 public function build()
 {
     /** property listing model **/
     $this->model = new wpl_property();
     if (!in_array($this->kind, wpl_flex::get_valid_kinds())) {
         $this->error = "ERROR: Invalid property kind!";
         return false;
     }
     $default_where = array('sf_select_confirmed' => 1, 'sf_select_finalized' => 1, 'sf_select_deleted' => 0, 'sf_select_expired' => 0, 'sf_select_kind' => $this->kind);
     $this->where = array_merge($default_where, $this->where);
     /** Add search conditions to the where **/
     $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET'));
     $this->where = array_merge($vars, $this->where);
     /** start search **/
     $this->model->start($this->start, $this->limit, $this->orderby, $this->order, $this->where);
     $this->model->total = $this->model->get_properties_count();
     $this->built['listings']['total'] = $this->model->total;
     /** run the search **/
     $query = $this->model->query();
     $properties = $this->model->search();
     /** finish search **/
     $this->model->finish();
     $plisting_fields = $this->model->get_plisting_fields();
     foreach ($properties as $property) {
         $rendered = array();
         $rendered = $this->model->full_render($property->id, $plisting_fields, $property);
         $rendered['property_id'] = $property->id;
         $items = $rendered['items'];
         /** render gallery **/
         if ($this->pictures) {
             $rendered['images'] = wpl_items::render_gallery($items['gallery']);
         }
         /** render attachments **/
         if ($this->attachments) {
             $rendered['attachments'] = wpl_items::render_attachments($items['attachment']);
         }
         /** render videos **/
         if ($this->videos) {
             $rendered['videos'] = wpl_items::render_videos($items['video']);
         }
         /** render rooms **/
         if ($this->rooms) {
             $rendered['rooms'] = $items['rooms'];
         }
         /** render gallery custom sizes **/
         if (is_array($this->image_sizes)) {
             $rendered['custom_sizes'] = wpl_items::render_gallery_custom_sizes($property_id, $items['gallery'], $this->image_sizes);
         }
         /** render agent data **/
         if ($this->agentinfo) {
             $rendered['agent'] = wpl_users::full_render($property->user_id);
             unset($rendered['agent']['data']);
             unset($rendered['agent']['items']);
         }
         unset($rendered['items']);
         $this->built['listings'][$property->id] = $rendered;
     }
     return $this->built;
 }
示例#4
0
$forclosure = '';
if (isset($wpl_properties['current']['materials']['sp_featured']) and $wpl_properties['current']['materials']['sp_featured']) {
    $features = '<div class="wpl-listing-tag-feature">' . $wpl_properties['current']['materials']['sp_featured']['name'] . '</div>';
}
if (isset($wpl_properties['current']['materials']['sp_hot']) and $wpl_properties['current']['materials']['sp_hot']) {
    $hot_offer = '<div class="wpl-listing-tag-hot-offer">' . $wpl_properties['current']['materials']['sp_hot']['name'] . '</div>';
}
if (isset($wpl_properties['current']['materials']['sp_openhouse']) and $wpl_properties['current']['materials']['sp_openhouse']) {
    $open_house = '<div class="wpl-listing-tag-open-house">' . $wpl_properties['current']['materials']['sp_openhouse']['name'] . '</div>';
}
if (isset($wpl_properties['current']['materials']['sp_forclosure']) and $wpl_properties['current']['materials']['sp_forclosure']) {
    $forclosure = '<div class="wpl-listing-tag-forclosure">' . $wpl_properties['current']['materials']['sp_forclosure']['name'] . '</div>';
}
/** render gallery **/
$raw_gallery = isset($wpl_properties['current']['items']['gallery']) ? $wpl_properties['current']['items']['gallery'] : array();
$gallery = wpl_items::render_gallery($raw_gallery);
?>
<div class="wpl_gallery_container" id="wpl_gallery_container<?php 
echo $this->property_id;
?>
">
    <?php 
if (!count($gallery)) {
    echo '<div class="no_image_box"></div>';
} else {
    $image_url = $gallery[0]['url'];
    if (isset($gallery[0]['item_extra2'])) {
        $image_alt = $gallery[0]['item_extra2'];
    } elseif (isset($wpl_properties['current']['raw']['meta_keywords'])) {
        $image_alt = $wpl_properties['current']['raw']['meta_keywords'];
    }
示例#5
0
 /**
  * Returns gallery of a property
  * @author Howard R <*****@*****.**>
  * @static
  * @param int $parent_id
  * @param int $parent_kind
  * @param mixed $category
  * @param int $enabled
  * @return array
  */
 public static function get_gallery($parent_id, $parent_kind = 0, $category = '', $enabled = 1)
 {
     $items = wpl_items::get_items($parent_id, 'gallery', $parent_kind, $category, $enabled);
     /** render items **/
     return wpl_items::render_gallery($items);
 }