Example #1
0
 protected function generate_slide($category)
 {
     $tpl = 'internal_slide';
     $this->settings = wpl_settings::get_settings($category->id, 1, true);
     $this->setting_category = $category;
     /** import tpl **/
     parent::render($this->tpl_path, $tpl);
 }
Example #2
0
 /**
  * written by Francis
  * description: initialize pagination and properties for property manager page
  */
 private function init_page()
 {
     /** global settings **/
     $settings = wpl_settings::get_settings();
     /** listing settings **/
     $this->page_number = wpl_request::getVar('wplpage', 1);
     $limit = wpl_request::getVar('limit', $settings['default_page_size']);
     $start = wpl_request::getVar('start', ($this->page_number - 1) * $limit);
     $orderby = wpl_request::getVar('orderby', $settings['default_orderby']);
     $order = wpl_request::getVar('order', $settings['default_order']);
     $current_user_id = wpl_users::get_cur_user_id();
     $where = array();
     /** set page if start var passed **/
     $this->page_number = $start / $limit + 1;
     wpl_request::setVar('wplpage', $this->page_number);
     $this->model = new wpl_property();
     /** load user properties **/
     if (!wpl_users::is_administrator($current_user_id)) {
         $where['sf_select_user_id'] = $current_user_id;
     }
     /** detect kind **/
     $this->kind = wpl_request::getVar('kind', 0);
     if (!in_array($this->kind, wpl_flex::get_valid_kinds())) {
         /** import message tpl **/
         $this->message = __('Invalid Request!', WPL_TEXTDOMAIN);
         parent::render($this->tpl_path, 'message');
         return false;
     }
     $this->kind_label = wpl_flex::get_kind_label($this->kind);
     $where['sf_select_kind'] = $this->kind;
     /** Add search conditions to the where **/
     $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET'));
     $where = array_merge($vars, $where);
     $this->model->start($start, $limit, $orderby, $order, $where, $this->kind);
     $query = $this->model->query();
     $properties = $this->model->search($query);
     $this->model->finish();
     /** get the number of all properties according to our query **/
     $properties_count = $this->model->get_properties_count();
     /** set pagination according to the number of items and limit **/
     $this->pagination = wpl_pagination::get_pagination($properties_count, $limit);
     $plisting_fields = $this->model->get_plisting_fields();
     $wpl_properties = array();
     foreach ($properties as $property) {
         $wpl_properties[$property->id] = $this->model->full_render($property->id, $plisting_fields, $property);
     }
     $this->wpl_properties = $wpl_properties;
     return true;
 }
Example #3
0
 public function display($instance = array())
 {
     /** check access **/
     if (!wpl_users::check_access('propertylisting')) {
         /** import message tpl **/
         $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message', false, true);
     }
     $this->tpl = wpl_request::getVar('tpl', 'default');
     $this->method = wpl_request::getVar('wplmethod', NULL);
     /** global settings **/
     $this->settings = wpl_settings::get_settings();
     /** listing settings **/
     $this->page_number = wpl_request::getVar('wplpage', 1, '', true);
     $this->limit = wpl_request::getVar('limit', $this->settings['default_page_size']);
     $this->start = wpl_request::getVar('start', ($this->page_number - 1) * $this->limit, '', true);
     $this->orderby = wpl_request::getVar('wplorderby', $this->settings['default_orderby'], '', true);
     $this->order = wpl_request::getVar('wplorder', $this->settings['default_order'], '', true);
     /** Set Property CSS class **/
     $this->property_css_class = !$this->wplraw ? wpl_request::getVar('wplpcc', NULL) : NULL;
     if (!$this->property_css_class) {
         $this->property_css_class = wpl_request::getVar('wplpcc', 'grid_box', 'COOKIE');
     }
     $this->property_css_class_switcher = wpl_request::getVar('wplpcc_switcher', '1');
     $this->property_listview = wpl_request::getVar('wplplv', '1');
     #Show listview or not
     /** RSS Feed Setting **/
     $this->listings_rss_enabled = isset($this->settings['listings_rss_enabled']) ? $this->settings['listings_rss_enabled'] : 0;
     /** detect kind **/
     $this->kind = wpl_request::getVar('kind', 0);
     if (!$this->kind) {
         $this->kind = wpl_request::getVar('sf_select_kind', 0);
     }
     if (!in_array($this->kind, wpl_flex::get_valid_kinds())) {
         /** import message tpl **/
         $this->message = __('Invalid Request!', WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message', false, true);
     }
     /** pagination types **/
     $this->wplpagination = wpl_request::getVar('wplpagination', 'normal', '', true);
     wpl_request::setVar('wplpagination', $this->wplpagination);
     /** property listing model **/
     $this->model = new wpl_property();
     /** set page if start var passed **/
     $this->page_number = $this->start / $this->limit + 1;
     wpl_request::setVar('wplpage', $this->page_number);
     $where = array('sf_select_confirmed' => 1, 'sf_select_finalized' => 1, 'sf_select_deleted' => 0, 'sf_select_expired' => 0, 'sf_select_kind' => $this->kind);
     /** Add search conditions to the where **/
     $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET'));
     $where = array_merge($vars, $where);
     /** start search **/
     $this->model->start($this->start, $this->limit, $this->orderby, $this->order, $where, $this->kind);
     $this->model->total = $this->model->get_properties_count();
     /** validation for page_number **/
     $this->total_pages = ceil($this->model->total / $this->limit);
     if ($this->page_number <= 0 or $this->page_number > $this->total_pages) {
         $this->model->start = 0;
     }
     /** run the search **/
     $query = $this->model->query();
     $properties = $this->model->search();
     /** finish search **/
     $this->model->finish();
     $plisting_fields = $this->model->get_plisting_fields('', $this->kind);
     $wpl_properties = array();
     foreach ($properties as $property) {
         $wpl_properties[$property->id] = $this->model->full_render($property->id, $plisting_fields, $property);
     }
     /** define current index **/
     $wpl_properties['current'] = array();
     /** apply filters (This filter must place after all proccess) **/
     _wpl_import('libraries.filters');
     @extract(wpl_filters::apply('property_listing_after_render', array('wpl_properties' => $wpl_properties)));
     $this->pagination = wpl_pagination::get_pagination($this->model->total, $this->limit, true, $this->wplraw);
     $this->wpl_properties = $wpl_properties;
     if ($this->wplraw and $this->method == 'get_markers') {
         $markers = array('markers' => $this->model->render_markers($wpl_properties), 'total' => $this->model->total);
         echo json_encode($markers);
         exit;
     } elseif ($this->wplraw and $this->method == 'get_listings') {
         if ($this->return_listings) {
             return $wpl_properties;
         } else {
             echo json_encode($wpl_properties);
             exit;
         }
     }
     /** import tpl **/
     $this->tpl = wpl_flex::get_kind_tpl($this->tpl_path, $this->tpl, $this->kind);
     return parent::render($this->tpl_path, $this->tpl, false, true);
 }
Example #4
0
 function __construct($username, $password, $vars, $settings)
 {
     /** smart set of settings **/
     foreach ($settings as $setting => $setval) {
         if ($setval != '') {
             $this->settings[$setting] = $setval;
         }
     }
     // Authenticating
     if ($username != '') {
         $authenticate = wpl_users::authenticate($username, $password);
         if ($authenticate['status'] != 1) {
             $this->error = "ERROR: Authentication failed!";
             return false;
         }
         $this->uid = $authenticate['uid'];
     } else {
         $this->uid = 0;
     }
     if (!wpl_global::check_access($this->settings['access_view'], $this->uid)) {
         $this->error = "ERROR: No access to the command!";
         return false;
     }
     /** global settings **/
     $this->wpl_settings = wpl_settings::get_settings();
     $this->orderby = $this->wpl_settings['default_orderby'];
     $this->order = $this->wpl_settings['default_order'];
     // Include Thumbnails
     if (trim($vars['ithmb']) != '' and in_array($vars['ithmb'], array('0', '1'))) {
         $this->include_thumbnails = $vars['ithmb'];
     }
     // get special keys
     if (trim($vars['get_special_key']) != '' and in_array($vars['get_special_key'], array('0', '1'))) {
         $this->get_special_key = $vars['get_special_key'];
         $this->special_keys = explode('-', $vars['special_keys']);
     }
     // Set result type
     if (trim($vars['result_type']) != '' and in_array($vars['result_type'], array('1', '2', '3'))) {
         $this->result_type = $vars['result_type'];
     }
     // translate status
     if (trim($vars['dtranslated']) != '' and in_array($vars['dtranslated'], array('0', '1'))) {
         $this->dtranslated = $vars['dtranslated'];
     }
     // setting vars
     if (isset($vars['pictures'])) {
         $this->pictures = $vars['pictures'];
     }
     if (isset($vars['attachments'])) {
         $this->attachments = $vars['attachments'];
     }
     if (isset($vars['videos'])) {
         $this->attachments = $vars['videos'];
     }
     if (isset($vars['rooms'])) {
         $this->attachments = $vars['rooms'];
     }
     if (isset($vars['agentinfo'])) {
         $this->agentinfo = $vars['agentinfo'];
     }
     if (isset($vars['sort'])) {
         $this->orderby = $vars['sort'];
     }
     if (isset($vars['asc'])) {
         $this->order = $vars['asc'];
     }
     if (isset($vars['start'])) {
         $this->start = $vars['start'];
     }
     if (isset($vars['limit'])) {
         $this->limit = $vars['limit'];
     }
     if (isset($vars['type'])) {
         $this->type = $vars['type'];
     }
     if (isset($vars['kind'])) {
         $this->kind = $vars['kind'];
     }
     /** customized size of images **/
     $this->image_sizes = trim($vars['image_sizes']) != '' ? explode('-', $vars['image_sizes']) : '';
     // Checking essential vars
     foreach ($vars as $field => $value) {
         if (substr($field, 0, 3) != 'sf_') {
             continue;
         }
         if (strpos($field, 'sf_select_') === false) {
             $field = str_replace('sf_select', 'sf_select_', $field);
         }
         if (strpos($field, 'sf_unit_') === false) {
             $field = str_replace('sf_unit', 'sf_unit_', $field);
         }
         if (strpos($field, 'sf_min_') === false) {
             $field = str_replace('sf_min', 'sf_min_', $field);
         }
         if (strpos($field, 'sf_max_') === false) {
             $field = str_replace('sf_max', 'sf_max_', $field);
         }
         if (strpos($field, 'sf_tmin_') === false) {
             $field = str_replace('sf_tmin', 'sf_tmin_', $field);
         }
         if (strpos($field, 'sf_tmax_') === false) {
             $field = str_replace('sf_tmax', 'sf_tmax_', $field);
         }
         if (strpos($field, 'sf_multiple_') === false) {
             $field = str_replace('sf_multiple', 'sf_multiple_', $field);
         }
         if (strpos($field, 'sf_datemin_') === false) {
             $field = str_replace('sf_datemin', 'sf_datemin_', $field);
         }
         if (strpos($field, 'sf_datemax_') === false) {
             $field = str_replace('sf_datemax', 'sf_datemax_', $field);
         }
         if (strpos($field, 'sf_locationtextsearch_') === false) {
             $field = str_replace('sf_locationtextsearch', 'sf_locationtextsearch_', $field);
         }
         if (strpos($field, 'sf_notselect_') === false) {
             $field = str_replace('sf_notselect', 'sf_notselect_', $field);
         }
         if (strpos($field, 'sf_radiussearchunit_') === false) {
             $field = str_replace('sf_radiussearchunit', 'sf_radiussearchunit_', $field);
         }
         if (strpos($field, 'sf_text_') === false) {
             $field = str_replace('sf_text', 'sf_text_', $field);
         }
         if (strpos($field, 'sf_textsearch_') === false) {
             $field = str_replace('sf_textsearch', 'sf_textsearch_', $field);
         }
         $this->where[$field] = $value;
     }
 }
Example #5
0
 /**
  * Returns couple of WPL settings based on category
  * @author Howard <*****@*****.**>
  * @static
  * @param int|string $category
  * @param int $showable
  * @param boolean $return_records
  * @return array
  */
 public static function get_settings($category = '', $showable = 0, $return_records = false)
 {
     /** import library **/
     _wpl_import('libraries.settings');
     return wpl_settings::get_settings($category, $showable, $return_records);
 }
Example #6
0
 public function display($instance = array())
 {
     /** property listing model **/
     $this->model = new wpl_users();
     /** global settings **/
     $settings = wpl_settings::get_settings();
     /** listing settings **/
     $this->page_number = wpl_request::getVar('wplpage', 1, '', true);
     $this->limit = wpl_request::getVar('limit', $settings['default_profile_page_size'], '', true);
     $this->start = wpl_request::getVar('start', ($this->page_number - 1) * $this->limit, '', true);
     $this->orderby = wpl_request::getVar('wplorderby', $settings['default_profile_orderby'], '', true);
     $this->order = wpl_request::getVar('wplorder', $settings['default_profile_order'], '', true);
     /** Set Property CSS class **/
     $this->property_css_class = wpl_request::getVar('wplpcc', NULL);
     if (!$this->property_css_class) {
         $this->property_css_class = wpl_request::getVar('wplpcc', 'grid_box', 'COOKIE');
     }
     $this->property_css_class_switcher = wpl_request::getVar('wplpcc_switcher', '1');
     /** set page if start var passed **/
     $this->page_number = $this->start / $this->limit + 1;
     wpl_request::setVar('wplpage', $this->page_number);
     /** detect kind **/
     $this->kind = wpl_request::getVar('kind', 2);
     if (!in_array($this->kind, wpl_flex::get_valid_kinds())) {
         /** import message tpl **/
         $this->message = __('Invalid Request!', WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message', false, true);
     }
     /** pagination types **/
     $this->wplpagination = wpl_request::getVar('wplpagination', 'normal', '', true);
     wpl_request::setVar('wplpagination', $this->wplpagination);
     $where = array('sf_tmin_id' => 1, 'sf_select_access_public_profile' => 1, 'sf_select_expired' => 0);
     /** Add search conditions to the where **/
     $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET'));
     $where = array_merge($vars, $where);
     /** start search **/
     $this->model->start($this->start, $this->limit, $this->orderby, $this->order, $where);
     $this->model->total = $this->model->get_users_count();
     /** validation for page_number **/
     $this->total_pages = ceil($this->model->total / $this->limit);
     if ($this->page_number <= 0 or $this->page_number > $this->total_pages) {
         $this->model->start = 0;
     }
     /** run the search **/
     $query = $this->model->query();
     $profiles = $this->model->search();
     /** finish search **/
     $this->model->finish();
     $plisting_fields = $this->model->get_plisting_fields();
     $wpl_profiles = array();
     foreach ($profiles as $profile) {
         $wpl_profiles[$profile->id] = $this->model->full_render($profile->id, $plisting_fields);
     }
     /** define current index **/
     $wpl_profiles['current'] = array();
     /** apply filters (This filter must place after all proccess) **/
     _wpl_import('libraries.filters');
     @extract(wpl_filters::apply('profile_listing_after_render', array('wpl_profiles' => $wpl_profiles)));
     $this->pagination = wpl_pagination::get_pagination($this->model->total, $this->limit, true);
     $this->wpl_profiles = $wpl_profiles;
     /** import tpl **/
     return parent::render($this->tpl_path, $this->tpl, false, true);
 }
Example #7
0
 /**
  * Creates gallery image
  * @author Francis <*****@*****.**>
  * @param int $width
  * @param int $height
  * @param array $params
  * @param boolean $watermark
  * @param boolean $rewrite
  * description: resize and watermark images specially for gallery activity
  */
 public static function create_gallary_image($width, $height, $params, $watermark = 0, $rewrite = 0, $crop = '')
 {
     $image_name = wpl_file::stripExt($params['image_name']);
     $image_ext = wpl_file::getExt($params['image_name']);
     $resized_image_name = 'th' . $image_name . '_' . $width . 'x' . $height . '.' . $image_ext;
     $image_dest = wpl_items::get_path($params['image_parentid'], $params['image_parentkind']) . $resized_image_name;
     $image_url = wpl_items::get_folder($params['image_parentid'], $params['image_parentkind']) . $resized_image_name;
     /** check resized files existance and rewrite option **/
     if ($rewrite or !wpl_file::exists($image_dest)) {
         if ($watermark) {
             self::resize_watermark_image($params['image_source'], $image_dest, $width, $height);
         } else {
             /** if crop was not set, read from wpl settings **/
             if (!trim($crop)) {
                 $settings = wpl_settings::get_settings(2);
                 $crop = $settings['image_resize_method'];
             }
             self::resize_image($params['image_source'], $image_dest, $width, $height, $crop);
         }
     }
     return $image_url;
 }
Example #8
0
 public function display($instance = array())
 {
     /** do cronjobs **/
     _wpl_import('libraries.events');
     wpl_events::do_cronjobs();
     /** check access **/
     if (!wpl_users::check_access('propertyshow')) {
         /** import message tpl **/
         $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message', false, true);
     }
     $this->tpl = wpl_request::getVar('tpl', 'default');
     /** property listing model **/
     $this->model = new wpl_property();
     $this->pid = wpl_request::getVar('pid', 0);
     $listing_id = wpl_request::getVar('mls_id', 0);
     if (trim($listing_id)) {
         $this->pid = wpl_property::pid($listing_id);
         wpl_request::setVar('pid', $this->pid);
     }
     $property = $this->model->get_property_raw_data($this->pid);
     /** no property found **/
     if (!$property or $property['finalized'] == 0 or $property['confirmed'] == 0 or $property['deleted'] == 1 or $property['expired'] >= 1) {
         /** import message tpl **/
         $this->message = __("No property found or it's not available now!", WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message', false, true);
     }
     /** global settings **/
     $this->settings = wpl_settings::get_settings();
     $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'");
     $wpl_properties = array();
     /** define current index **/
     $wpl_properties['current']['data'] = (array) $property;
     $wpl_properties['current']['raw'] = (array) $property;
     $find_files = array();
     $rendered_fields = $this->model->render_property($property, $this->pshow_fields, $find_files, true);
     $wpl_properties['current']['rendered_raw'] = $rendered_fields['ids'];
     $wpl_properties['current']['materials'] = $rendered_fields['columns'];
     foreach ($this->pshow_categories as $pshow_category) {
         $pshow_cat_fields = $this->model->get_pshow_fields($pshow_category->id, $property['kind']);
         $wpl_properties['current']['rendered'][$pshow_category->id]['self'] = (array) $pshow_category;
         $wpl_properties['current']['rendered'][$pshow_category->id]['data'] = $this->model->render_property($property, $pshow_cat_fields);
     }
     $wpl_properties['current']['items'] = wpl_items::get_items($this->pid, '', $property['kind'], '', 1);
     /** property location text **/
     $wpl_properties['current']['location_text'] = $this->model->generate_location_text((array) $property);
     /** property full link **/
     $wpl_properties['current']['property_link'] = $this->model->get_property_link((array) $property);
     /** property page title **/
     $wpl_properties['current']['property_page_title'] = $this->model->update_property_page_title($property);
     /** property title **/
     $wpl_properties['current']['property_title'] = $this->model->update_property_title($property);
     /** apply filters (This filter must place after all proccess) **/
     _wpl_import('libraries.filters');
     @extract(wpl_filters::apply('property_listing_after_render', array('wpl_properties' => $wpl_properties)));
     $this->wpl_properties = $wpl_properties;
     $this->kind = $property['kind'];
     $this->property = $wpl_properties['current'];
     /** updating the visited times and etc **/
     wpl_property::property_visited($this->pid);
     /** trigger event **/
     wpl_global::event_handler('property_show', array('id' => $this->pid));
     /** import tpl **/
     $this->tpl = wpl_flex::get_kind_tpl($this->tpl_path, $this->tpl, $this->kind);
     return parent::render($this->tpl_path, $this->tpl, false, true);
 }
Example #9
0
if (isset($this->pagination->max_page) and $this->pagination->max_page > 1) {
    ?>
            <div class="pagination-wp">
                <?php 
    echo $this->pagination->show();
    ?>
            </div>
            <?php 
}
?>
            <div id="wpl_location_fancybox_cnt" class="wpl_hidden_element"></div>
            <div id="wpl_location_settings_lightbox" class="wpl_hidden_element">
                <div class="fanc-content size-width-1 fanc-settings">
                    <h2><?php 
echo __('Location Settings', WPL_TEXTDOMAIN);
?>
</h2>
                    <div class="fanc-body label-x2">
					<?php 
$setting_records = wpl_settings::get_settings(3, 1, true);
wpl_settings::generate_setting_forms($setting_records);
?>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <footer>
        <div class="logo"></div>
    </footer>
</div>