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; }
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; }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); $this->_wpl_import($this->tpl_path . '.scripts.js', true, true); $js = (object) array('param1' => 'jquery-video-js-script', 'param2' => 'packages/video-js/video.js'); $style = (object) array('param1' => 'ajax-video-js-style', 'param2' => 'packages/video-js/video-js.min.css'); /** import styles and javascripts **/ wpl_extensions::import_javascript($js); wpl_extensions::import_style($style); /** set params **/ $wpl_properties = isset($params['wpl_properties']) ? $params['wpl_properties'] : array(); $property_id = isset($wpl_properties['current']['data']['id']) ? $wpl_properties['current']['data']['id'] : NULL; $raw_videos = isset($wpl_properties['current']['items']['video']) ? $wpl_properties['current']['items']['video'] : NULL; $videos = wpl_items::render_videos($raw_videos); $video_width = isset($params['video_width']) ? $params['video_width'] : 640; $video_height = isset($params['video_height']) ? $params['video_height'] : 270; if (!count($videos) or !is_array($videos)) { return; } ?> <div class="wpl_videos_container" id="wpl_videos_container<?php echo $property_id; ?> "> <ul class="wpl_videos_list_container"> <?php foreach ($videos as $video) { ?> <li class="wpl_videos_video wpl_video_type<?php echo isset($video['item_cat']) ? $video['item_cat'] : '';