示例#1
0
 public function display($instance = array())
 {
     $this->uid = wpl_request::getVar('uid', 0);
     if (!$this->uid) {
         $this->uid = wpl_request::getVar('sf_select_user_id', 0);
         wpl_request::setVar('uid', $this->uid);
     }
     /** check user id **/
     if (!$this->uid) {
         /** import message tpl **/
         $this->message = __("No profile found or it's not available now!", WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message', false, true);
     }
     /** set the user id to search credentials **/
     wpl_request::setVar('sf_select_user_id', $this->uid);
     /** set the kind **/
     $this->kind = wpl_request::getVar('kind', '0');
     wpl_request::setVar('kind', $this->kind);
     /** User Type **/
     $this->user_type = wpl_users::get_user_user_type($this->uid);
     /** trigger event **/
     wpl_global::event_handler('profile_show', array('id' => $this->uid, 'kind' => $this->kind));
     /** import tpl **/
     $this->tpl = wpl_users::get_user_type_tpl($this->tpl_path, $this->tpl, $this->user_type);
     /** import tpl **/
     return parent::render($this->tpl_path, $this->tpl, false, true);
 }
示例#2
0
 public function home()
 {
     /** check permission **/
     wpl_global::min_access('administrator');
     $this->level = trim(wpl_request::getVar('level')) != '' ? wpl_request::getVar('level') : 1;
     $this->parent = trim(wpl_request::getVar('sf_select_parent')) != '' ? wpl_request::getVar('sf_select_parent') : "";
     $this->enabled = trim(wpl_request::getVar('sf_select_enabled')) != '' ? wpl_request::getVar('sf_select_enabled') : 1;
     $this->text_search = trim(wpl_request::getVar('sf_text_name')) != '' ? wpl_request::getVar('sf_text_name') : '';
     $this->admin_url = wpl_global::get_wp_admin_url();
     $this->load_zipcodes = trim(wpl_request::getVar('load_zipcodes')) != '' ? 1 : 0;
     /** set show all based on level **/
     if ($this->level != 1) {
         $this->enabled = '';
     }
     $possible_orders = array('id', 'name');
     $orderby = in_array(wpl_request::getVar('orderby'), $possible_orders) ? wpl_request::getVar('orderby') : $possible_orders[0];
     $order = in_array(strtoupper(wpl_request::getVar('order')), array('ASC', 'DESC')) ? wpl_request::getVar('order') : 'ASC';
     $page_size = trim(wpl_request::getVar('page_size')) != '' ? wpl_request::getVar('page_size') : NULL;
     /** create where **/
     $vars = array_merge(wpl_request::get('POST'), wpl_request::get('GET'));
     $vars = array_merge($vars, array('sf_select_parent' => $this->parent, 'sf_select_enabled' => $this->enabled));
     $where_query = wpl_db::create_query($vars);
     $num_result = wpl_db::num("SELECT COUNT(id) FROM `#__wpl_location" . $this->level . "` WHERE 1 " . $where_query);
     $this->pagination = wpl_pagination::get_pagination($num_result, $page_size);
     $where_query .= " ORDER BY {$orderby} {$order} " . $this->pagination->limit_query;
     $this->wp_locations = wpl_locations::get_locations(!$this->load_zipcodes ? $this->level : 'zips', '', '', $where_query);
     $this->zipcode_parent_level = wpl_settings::get('zipcode_parent_level');
     /** import tpl **/
     parent::render($this->tpl_path, $this->tpl);
 }
示例#3
0
 protected function generate_slide($category)
 {
     $tpl = wpl_flex::get_kind_tpl($this->tpl_path, 'internal_slide', $this->kind);
     $this->fields = wpl_property::get_pwizard_fields($category->id, $this->kind, 1);
     $this->field_category = $category;
     /** import tpl **/
     parent::render($this->tpl_path, $tpl);
 }
 /**
  *	{$type} 
  *	$type is a unit type for filtering
  **/
 private function generate_new_page($type)
 {
     $this->units = wpl_units::get_units($type, "", "");
     if ($type == 4) {
         parent::render($this->tpl_path, 'internal_unit_manager_currency');
     } else {
         parent::render($this->tpl_path, 'internal_unit_manager_general');
     }
     exit;
 }
示例#5
0
 public function home()
 {
     /** check permission **/
     wpl_global::min_access('administrator');
     // get list of all activity
     $this->activities = wpl_activity::get_activities('', '', ' ORDER BY `index` ASC, `ID` DESC');
     $this->available_activities = wpl_activity::get_available_activities();
     /** import tpl * */
     parent::render($this->tpl_path, $this->tpl);
 }
示例#6
0
 private function report_abuse_form()
 {
     $this->property_id = wpl_request::getVar('pid', 0);
     $this->form_id = wpl_request::getVar('form_id', 0);
     if (!$this->form_id) {
         $HTML = parent::render($this->tpl_path, 'report_abuse_form', false, true);
     } else {
         /**
          * @todo Generate form via Form Builder addon
          */
     }
     echo $HTML;
     exit;
 }
示例#7
0
 private function generate_modify_page($field_type, $field_id, $kind = 0)
 {
     if (trim($field_type) == '') {
         $field_type = wpl_request::getVar('field_type', 0);
     }
     if (trim($field_id) == '') {
         $field_id = wpl_request::getVar('field_id', 0);
     }
     $this->field_type = $field_type;
     $this->field_id = $field_id;
     $this->kind = $kind;
     parent::render($this->tpl_path, 'internal_modify');
     exit;
 }
示例#8
0
 private function generate_modify_page()
 {
     $this->activity_id = wpl_request::getVar('activity_id');
     $activity_name = wpl_request::getVar('activity_name');
     if (!$this->activity_id) {
         $this->activity_data = new stdClass();
         $this->activity_raw_name = wpl_activity::get_activity_name_layout($activity_name);
     } else {
         $this->activity_data = wpl_activity::get_activity("AND `id`='" . wpl_db::escape($this->activity_id) . "'");
         $this->activity_raw_name = wpl_activity::get_activity_name_layout($this->activity_data->activity);
     }
     $this->activity_layouts = wpl_activity::get_activity_layout($this->activity_raw_name[0]);
     if (!isset($this->activity_raw_name[1])) {
         $this->activity_raw_name[1] = '';
     }
     $this->options = isset($this->activity_data->params) ? json_decode($this->activity_data->params) : new stdClass();
     parent::render($this->tpl_path, 'internal_modify');
     exit;
 }
示例#9
0
 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);
 }
示例#10
0
 protected function generate_advanced_options()
 {
     parent::render($this->tpl_path, 'internal_advanced');
 }
示例#11
0
 protected function include_tabs()
 {
     $this->kinds = wpl_flex::get_kinds(NULL);
     /** include the layout **/
     parent::render($this->tpl_path, 'internal_tabs');
 }
示例#12
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);
     }
     $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);
 }
示例#13
0
 public function generate_currency_page()
 {
     $this->units = wpl_units::get_units(4, '', '');
     /** import tpl **/
     parent::render($this->tpl_path, 'internal_unit_manager_currency');
 }
 private function generate_new_room_type()
 {
     parent::render($this->tpl_path, 'internal_new_room_type');
     exit;
 }
示例#15
0
 /**
  * For creating admin bar menu
  * @author Howard <*****@*****.**>
  * @global object $wp_admin_bar
  */
 public function wpl_admin_bar_menu()
 {
     $cur_user_id = wpl_users::get_cur_user_id();
     $cur_user_data = wpl_users::get_user($cur_user_id);
     $cur_role = wpl_users::get_role($cur_user_id, false);
     $wpl_roles = wpl_users::get_wpl_roles();
     $menus = wpl_global::get_menus('menu', 'backend');
     $submenus = wpl_global::get_menus('submenu', 'backend');
     global $wp_admin_bar;
     /** generate pages object **/
     $controller = new wpl_controller();
     if (wpl_users::is_administrator($cur_user_id) or $cur_user_data->data->wpl_data->id) {
         /** add menus **/
         foreach ($menus as $menu) {
             $menu_slug = (!wpl_users::is_administrator($cur_user_id) and $menu->capability != 'current') ? 'wpl_admin_profile' : $menu->menu_slug;
             $wp_admin_bar->add_menu(array('id' => $menu->menu_slug, 'title' => __($menu->menu_title, WPL_TEXTDOMAIN), 'href' => wpl_global::get_wp_admin_url() . 'admin.php?page=' . $menu_slug));
         }
         /** add sub menus **/
         foreach ($submenus as $submenu) {
             if (!wpl_users::has_menu_access($submenu->menu_slug)) {
                 continue;
             }
             if (!wpl_users::is_administrator($cur_user_id) and $submenu->capability != 'current') {
                 continue;
             }
             $menu_title = $submenu->separator ? $controller->wpl_add_separator() . __($submenu->menu_title, WPL_TEXTDOMAIN) : __($submenu->menu_title, WPL_TEXTDOMAIN);
             $wp_admin_bar->add_menu(array('id' => $submenu->menu_slug, 'parent' => $submenu->parent, 'title' => $menu_title, 'href' => wpl_global::get_wp_admin_url() . 'admin.php?page=' . $submenu->menu_slug));
         }
     }
 }
 private function generate_delete_page()
 {
     $this->listing_type_id = wpl_request::getVar('listing_type_id');
     $this->listing_type_data = wpl_listing_types::get_listing_type($this->listing_type_id);
     $this->listing_types = wpl_listing_types::get_listing_types();
     parent::render($this->tpl_path, 'internal_delete_listing_types');
     exit;
 }
示例#17
0
 public function statistic()
 {
     $tpl = 'internal_statistic';
     /** import tpl **/
     parent::render($this->tpl_path, $tpl);
 }
示例#18
0
 protected function generate_internal($layout_name)
 {
     $tpl = 'internal_' . $layout_name;
     /** import tpl **/
     parent::render($this->tpl_path, $tpl);
 }
示例#19
0
 private function generate_modify_page($level = '1', $parent = '0', $location_id = '')
 {
     if (trim($level) == '') {
         $level = wpl_request::getVar('level');
     }
     if (trim($parent) == '') {
         $parent = wpl_request::getVar('parent');
     }
     if (trim($location_id) == '') {
         $location_id = wpl_request::getVar('location_id');
     }
     $this->location_data = '';
     $this->level = $level;
     $this->parent = $parent;
     $this->location_id = $location_id;
     /** get location data for edit **/
     if (trim($location_id) != '') {
         $this->location_data = wpl_locations::get_location($location_id, $level);
     }
     parent::render($this->tpl_path, 'edit');
     exit;
 }
示例#20
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);
 }
示例#21
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);
 }
示例#22
0
 public function generate_tab($tpl = 'internal_setting_advanced')
 {
     /** checking PRO addon **/
     if (!wpl_global::check_addon('membership')) {
         echo __('Membership addon must be installed for this!', WPL_TEXTDOMAIN);
         return;
     }
     if ($tpl == 'internal_setting_crm' && !wpl_global::check_addon('crm')) {
         echo __('CRM addon must be installed for this!', WPL_TEXTDOMAIN);
         return;
     }
     /** include the layout **/
     parent::render($this->tpl_path, $tpl);
 }