public function manager($instance = array()) { /** check access **/ if (!wpl_users::check_access('propertymanager')) { /** import message tpl **/ $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message'); } $init = $this->init_page(); if (!$init) { return false; } $this->tpl = wpl_flex::get_kind_tpl($this->tpl_path, 'manager', $this->kind); parent::render($this->tpl_path, $this->tpl); }
public function wizard($instance = array()) { /** load assets **/ $this->load_assets(); /** check access **/ if (!wpl_users::check_access('propertywizard')) { /** import message tpl **/ $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message'); } $this->kind = trim(wpl_request::getVar('kind')) != '' ? wpl_request::getVar('kind') : 0; $this->property_id = trim(wpl_request::getVar('pid')) != '' ? wpl_request::getVar('pid') : 0; $this->mode = $this->property_id ? 'edit' : 'add'; if ($this->mode == 'add') { /** checking access **/ if (!wpl_users::check_access($this->mode)) { $this->message = __("Limit reached. You can not add more property!", WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message'); } /** generate new property **/ $this->property_id = wpl_property::create_property_default('', $this->kind); } $this->values = wpl_property::get_property_raw_data($this->property_id); $this->finalized = isset($this->values['finalized']) ? $this->values['finalized'] : 0; $this->kind = isset($this->values['kind']) ? $this->values['kind'] : 0; $this->field_categories = wpl_flex::get_categories(0, $this->kind); $this->kind_label = wpl_flex::get_kind_label($this->kind); if ($this->mode == 'edit') { if (!$this->values) { $this->message = __("Property does not exist!", WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message'); } /** checking access **/ if (!wpl_users::check_access($this->mode, $this->values['user_id'])) { $this->message = __("You can not edit this property.", WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message'); } } /** import tpl **/ $this->tpl = wpl_flex::get_kind_tpl($this->tpl_path, 'wizard', $this->kind); parent::render($this->tpl_path, $this->tpl); }
public function profile($instance = array()) { /** check access **/ if (!wpl_users::check_access('profilewizard')) { /** import message tpl **/ $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN); return parent::render($this->tpl_path, 'message'); } _wpl_import('libraries.flex'); $this->tpl = 'profile'; $this->kind = wpl_flex::get_kind_id('user'); $this->user_id = wpl_users::get_cur_user_id(); if (wpl_users::is_administrator($this->user_id) and wpl_request::getVar('id', 0)) { $this->user_id = wpl_request::getVar('id'); } $this->user_fields = wpl_flex::get_fields('', 1, $this->kind, 'pwizard', 1); $this->user_data = (array) wpl_users::get_wpl_data($this->user_id); /** import tpl **/ parent::render($this->tpl_path, $this->tpl); }
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); }
<?php /** no direct access **/ defined('_WPLEXEC') or die('Restricted access'); _wpl_import($this->tpl_path . '.scripts.css'); $property_data = isset($params['property_data']['data']) ? $params['property_data']['data'] : NULL; $pid = isset($property_data['id']) ? $property_data['id'] : NULL; ?> <div id="pmanager_action_div<?php echo $pid; ?> " class="p-actions-wp pmanager_actions"> <?php if (wpl_users::check_access('change_user')) { ?> <div id="pmanager_change_user<?php echo $pid; ?> " class="change-user-cnt-wp"> <div class="change-user-wp"> <label id="pmanager_change_user_label<?php echo $pid; ?> " for="pmanager_change_user_select<?php echo $pid; ?> "><?php echo __('User', WPL_TEXTDOMAIN); ?> : </label>
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); } $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); }
/** * Sends notification * @author Howard R <*****@*****.**> */ public function send() { $mail_subject = $this->notification_data['subject']; $mail_message = $this->rendered_content; $mail_headers = $this->get_mail_headers(); foreach ($this->recipients as $recipient) { if (is_array($recipient)) { $mail_to = $recipient[1]; $user_id = $recipient[0]; } else { $mail_to = $recipient; $user_id = wpl_users::get_id_by_email($mail_to); } // Check receive notification access level if ($user_id > 0 and !wpl_users::check_access('receive_notifications', 0, $user_id)) { continue; } $this->wp_mail($mail_to, $mail_subject, $mail_message, $mail_headers); } }
/** * author Howard * desctiption: change user of a property */ private function change_user() { $pid = wpl_request::getVar('pid'); $uid = wpl_request::getVar('uid'); /** purge property **/ if (wpl_users::check_access('change_user')) { $res = (int) wpl_property::change_user($pid, $uid); $message = __("User changed.", WPL_TEXTDOMAIN); } else { $res = 0; $message = __("You don't have access to this action.", WPL_TEXTDOMAIN); } /** echo response **/ echo json_encode(array('success' => $res, 'message' => $message, 'data' => NULL)); exit; }