Your IP : 216.73.216.84


Current Path : /home/helpink/www/components/com_jbusinessdirectory/views/events/
Upload File :
Current File : /home/helpink/www/components/com_jbusinessdirectory/views/events/view.html.php

<?php
/**
 * @package    J-BusinessDirectory
 *
 * @author     CMSJunkie http://www.cmsjunkie.com/
 * @copyright  Copyright (C) 2007 - 2022 CMSJunkie. All rights reserved.
 * @license    https://www.gnu.org/licenses/agpl-3.0.en.html
 */
defined('_JEXEC') or die('Restricted access');

JBusinessUtil::loadJQueryChosen();

// following translations will be used in js
JText::script('LNG_SHOW_FILTER');
JText::script('LNG_HIDE_FILTER');
JText::script('LNG_DISTANCE');
JText::script('LNG_MILES');
JText::script('LNG_KM');
JText::script('LNG_CATEGORIES');
JText::script('LNG_MORE');
JText::script('LNG_LESS');
JText::script('LNG_TYPES');
JText::script('LNG_COUNTRIES');
JText::script('LNG_REGIONS');
JText::script('LNG_CITIES');
JText::script('LNG_AREA');
JText::script('LNG_PROVINCE');
JText::script('LNG_MONTHS');
JText::script('LNG_CATEGORY');
JText::script('LNG_SELECT_OPTION');
JText::script('LNG_SELECT_RATING');
JText::script('LNG_SELECT_TYPE');
JText::script('LNG_SELECT_MEMBERSHIP');
JText::script('LNG_SELECT_COUNTRY');
JText::script('LNG_SELECT_REGION');
JText::script('LNG_SELECT_CITY');
JText::script('LNG_SELECT_AREA');
JText::script('LNG_SELECT_PROVINCE');
JText::script('LNG_RADIUS');
JText::script('LNG_CLEAR');
JText::script('LNG_FILTERS');
JText::script('LNG_SHOW_ONLY_LOCAL');
JText::script('LNG_CLEAR_ALL_FILTERS');

JText::script('LNG_AGE');
JText::script('LNG_START_TIME');
JText::script('LNG_END_TIME');
JText::script('LNG_START');
JText::script('LNG_END');
JText::script('LNG_APPLIED_FILTERS');
JText::script('LNG_GEO_LOCATION');
JText::script('LNG_ALL');

class JBusinessDirectoryViewEvents extends JViewLegacy {
	public function __construct() {
		parent::__construct();
	}
	
	public function display($tpl = null) {
		$session = JFactory::getSession();
		$this->appSettings =  JBusinessUtil::getApplicationSettings();

		if ($this->appSettings->enable_ratings) {
			JBusinessUtil::enqueueScript('libraries/star-rating/star-rating.js');
			JBusinessUtil::enqueueStyle('libraries/star-rating/star-rating.css');
		}
		
		$state = $this->get('State');
		$this->params = $state->get("parameters.menu");

		if(!$this->appSettings->search_results_loading){
			$this->events = $this->get('Items');
		}

		//$this->assignRef('events', $events);
		$input = JFactory::getApplication()->input;
		$this->categoryId= $input->getInt('categoryId');
		//$this->assignRef('categoryId', $categoryId);

		// $this->categoryOptions = JBusinessUtil::getCategoriesOptions(true, CATEGORY_TYPE_EVENT);
		$this->searchkeyword= $input->getString('searchkeyword');
		$this->defaultAttributes = JBusinessUtil::getAttributeConfiguration(DEFAULT_ATTRIBUTE_TYPE_EVENT);
		$this->zipCode = $input->getString('zipcode');
        $this->age = $input->getInt('age', null);

        $this->startTime = $input->getString('start_time', null);
        $this->endTime = $input->getString('end_time', null);

		$this->location = $this->get("Location");
		$this->orderBy = $input->getString("orderBy", $this->appSettings->order_search_events);

		$this->categorySearch = $input->getInt('categorySearch', null);
		$this->citySearch = $input->getString('citySearch', null);
		$this->regionSearch = $input->getString('regionSearch', null);
		$this->provinceSearch = $input->getString('provinceSearch', null);
		$this->areaSearch = $input->getString('areaSearch', null);

		$this->typeSearch = $input->getInt('typeSearch', null);
		if (!empty($this->typeSearch)) {
			$this->typeSearchName = $this->get('Type')->name;
		}
		$this->startDate = $session->get('ev-startDate', null);
		$this->endDate = $session->get('ev-endDate', null);
		
		$this->dateRange = $input->getString('dateRange');
		if (!empty($this->dateRange)) {
			$this->dateRange = explode(':', $this->dateRange);
			if (count($this->dateRange) == 2) {
				$this->startDate = $this->dateRange[0];
				$this->endDate = $this->dateRange[1];
			}
		}
		
		$this->countrySearch = $input->get('countrySearch', null);
		$this->country = $this->get('Country');

		$this->customAtrributes = $session->get('customAtrributes');
		$this->customAtrributesValues = $this->get("CustomAttributeValues");

		$this->selectedParams = $this->get('SelectedParams');
		$this->type = $this->get("EventType");
		
		$this->categories = implode(";", $this->get("SelectedCategories"));
		if (!empty($this->categories)) {
			$this->categories.=";";
		}

		$this->selectedCategories = $this->get("SelectedCategories");

		if ($this->appSettings->enable_search_filter_events) {
			$this->searchFilter = $this->get('SeachFilter');
		}

		$session = JFactory::getSession();
		$this->radius= $session->get('ev-radius');
		$this->geoLatitude = $session->get('geo-latitude');
		
		$categoryId= $this->get('CategoryId');
		if (!empty($categoryId)) {
			$this->categoryId=$categoryId;
			$this->category = $this->get('Category');
		}
		
		$this->pagination = $this->get('Pagination');
		$this->sortByOptions = $this->get('SortByConfiguration');
		
		$this->filterMonths = $this->get("FilterMonths");

		parent::display($tpl);
	}

	public function displayItems($items, $grid = false){
        $this->events = $items;
        $this->defaultAttributes = JBusinessUtil::getAttributeConfiguration(DEFAULT_ATTRIBUTE_TYPE_EVENT);
        
        $input = JFactory::getApplication()->input;
        $menu_list_layout = $input->getInt("list_layout");
        $menu_grid_layout = $input->getInt("grid_layout");

        $this->setLayout("events");

        if ($grid) {
            if($menu_grid_layout == 2){
                echo $this->loadTemplate('grid_view_style_1');
            }else{
                echo $this->loadTemplate('calendar');
            }
        } else {
            if($menu_list_layout == 3){
                echo $this->loadTemplate('list_style_3');
			}else if($menu_list_layout == 2){
                echo $this->loadTemplate('list_style_2');
            }else{
                echo $this->loadTemplate('list_style_1');
            }
        }
    }
}