示例#1
0
	/**
	 * Creates the Venue View
	 */
	function display($tpl = null)
	{
		if ($this->getLayout() == 'calendar')
		{
			### Venue Calendar view ###

			$app = JFactory::getApplication();

			// Load tooltips behavior
			JHtml::_('behavior.tooltip');

			// initialize variables
			$document 		= JFactory::getDocument();
			$menu 			= $app->getMenu();
			$menuitem		= $menu->getActive();
			$jemsettings	= JEMHelper::config();
			$params 		= $app->getParams();
			$uri 			= JFactory::getURI();
			$pathway 		= $app->getPathWay();
			$jinput 		= $app->input;
			$print			= $jinput->getBool('print', false);
			$user			= JemFactory::getUser();

			// Load css
			JemHelper::loadCss('jem');
			JemHelper::loadCss('calendar');
			JemHelper::loadCustomCss();
			JemHelper::loadCustomTag();

			if ($print) {
				JemHelper::loadCss('print');
				$document->setMetaData('robots', 'noindex, nofollow');
			}

			$evlinkcolor = $params->get('eventlinkcolor');
			$evbackgroundcolor = $params->get('eventbackgroundcolor');
			$currentdaycolor = $params->get('currentdaycolor');
			$eventandmorecolor = $params->get('eventandmorecolor');

			$style = '
			div#jem .eventcontentinner a, div#jem .eventandmore a {color:' . $evlinkcolor . ';}
			.eventcontentinner {background-color:'.$evbackgroundcolor .';}
			.eventandmore {background-color:' . $eventandmorecolor . ';}
			.today .daynum {background-color:' . $currentdaycolor . ';}';
			$document->addStyleDeclaration ($style);

			// add javascript (using full path - see issue #590)
			JHtml::_('script', 'media/com_jem/js/calendar.js');

			// Retrieve year/month variables
			$year = $jinput->get('yearID', strftime("%Y"),'int');
			$month = $jinput->get('monthID', strftime("%m"),'int');

			// get data from model and set the month
			$model = $this->getModel('VenueCal');
			$model->setDate(mktime(0, 0, 1, $month, 1, $year));
			$rows = $this->get('Items','VenueCal');

			// Set Page title
			$pagetitle = $params->def('page_title', $menuitem->title);
			$params->def('page_heading', $params->get('page_title'));
			$pageclass_sfx = $params->get('pageclass_sfx');

			// Add site name to title if param is set
			if ($app->getCfg('sitename_pagetitles', 0) == 1) {
				$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
			}
			elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
				$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
			}

			$document->setTitle($pagetitle);
			$document->setMetaData('title', $pagetitle);

			// Check if the user has permission to add things
			$permissions = new stdClass();
			$permissions->canAddEvent = $user->can('add', 'event');
			$permissions->canAddVenue = $user->can('add', 'venue');

			$itemid  = $jinput->getInt('Itemid', 0);
			$venueID = $jinput->getInt('id', $params->get('id'));

			$partItemid = ($itemid > 0) ? '&Itemid=' . $itemid : '';
			$partVenid = ($venueID > 0) ? '&id=' . $venueID : '';
			$partLocid = ($venueID > 0) ? '&locid=' . $venueID : '';
			$partDate = ($year ? ('&yearID=' . $year) : '') . ($month ? ('&monthID=' . $month) : '');
			$url_base = 'index.php?option=com_jem&view=venue&layout=calendar' . $partVenid . $partItemid;

			$print_link = JRoute::_($url_base . $partDate . '&print=1&tmpl=component');

			// init calendar
			$cal = new JEMCalendar($year, $month, 0);
			$cal->enableMonthNav($url_base . ($print ? '&print=1&tmpl=component' : ''));
			$cal->setFirstWeekDay($params->get('firstweekday',1));
			$cal->enableDayLinks('index.php?option=com_jem&view=day'.$partLocid);

			// map variables
			$this->rows          = $rows;
			$this->locid         = $venueID;
			$this->params        = $params;
			$this->jemsettings   = $jemsettings;
			$this->permissions   = $permissions;
			$this->cal           = $cal;
			$this->pageclass_sfx = htmlspecialchars($pageclass_sfx);
			$this->print_link    = $print_link;

		} else
		{
			### Venue List view ###

			// initialize variables
			$app         = JFactory::getApplication();
			$document    = JFactory::getDocument();
			$menu        = $app->getMenu();
			$menuitem    = $menu->getActive();
			$jemsettings = JemHelper::config();
			$settings    = JemHelper::globalattribs();
			$params      = $app->getParams('com_jem');
			$pathway     = $app->getPathWay ();
			$uri         = JFactory::getURI();
			$jinput      = $app->input;
			$task        = $jinput->getCmd('task', '');
			$print       = $jinput->getBool('print', false);
			$user        = JemFactory::getUser();
			$itemid      = $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0);

			// Load css
			JemHelper::loadCss('jem');
			JemHelper::loadCustomCss();
			JemHelper::loadCustomTag();

			if ($print) {
				JemHelper::loadCss('print');
				$document->setMetaData('robots', 'noindex, nofollow');
			}

			// get data from model
			$rows	= $this->get('Items');
			$venue	= $this->get('Venue');

			// check for data error
			if (empty($venue)) {
				$app->enqueueMessage(JText::_('COM_JEM_VENUE_ERROR_VENUE_NOT_FOUND'), 'error');
				return false;
			}

			// are events available?
			$noevents = (!$rows) ? 1 : 0;

			// Decide which parameters should take priority
			$useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem'
			                                && $menuitem->query['view']   == 'venue'
			                                && (!isset($menuitem->query['layout']) || $menuitem->query['layout'] == 'default')
			                                && $menuitem->query['id']     == $venue->id);

			// get search & user-state variables
			$filter_order = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_order', 'filter_order', 'a.dates', 'cmd');
			$filter_order_DirDefault = 'ASC';
			// Reverse default order for dates in archive mode
			if($task == 'archive' && $filter_order == 'a.dates') {
				$filter_order_DirDefault = 'DESC';
			}
			$filter_order_Dir = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_order_Dir', 'filter_order_Dir', $filter_order_DirDefault, 'word');
			$filter_type      = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_type', 'filter_type', '', 'int');
			$search           = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_search', 'filter_search', '', 'string');

			// table ordering
			$lists['order_Dir'] = $filter_order_Dir;
			$lists['order']     = $filter_order;

			// Get image
			$limage = JemImage::flyercreator($venue->locimage,'venue');

			// Add feed links
			$link = '&format=feed&id='.$venue->id.'&limitstart=';
			$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
			$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);

			// pathway, page title, page heading
			if ($useMenuItemParams) {
				$pagetitle   = $params->get('page_title', $menuitem->title ? $menuitem->title : $venue->venue);
				$pageheading = $params->get('page_heading', $pagetitle);
				$pathway->setItemName(1, $menuitem->title);
			} else {
				$pagetitle   = $venue->venue;
				$pageheading = $pagetitle;
				$params->set('show_page_heading', 1); // ensure page heading is shown
				$pathway->addItem($pagetitle, JRoute::_(JemHelperRoute::getVenueRoute($venue->slug)));
			}
			$pageclass_sfx = $params->get('pageclass_sfx');

			// create the pathway
			if ($task == 'archive') {
				$pathway->addItem (JText::_('COM_JEM_ARCHIVE'), JRoute::_(JemHelperRoute::getVenueRoute($venue->slug).'&task=archive'));
				$print_link = JRoute::_(JEMHelperRoute::getVenueRoute($venue->slug).'&task=archive&print=1&tmpl=component');
				$pagetitle   .= ' - ' . JText::_('COM_JEM_ARCHIVE');
				$pageheading .= ' - ' . JText::_('COM_JEM_ARCHIVE');
			} else {
				//$pathway->addItem($venue->venue, JRoute::_(JEMHelperRoute::getVenueRoute($venue->slug)));
				$print_link = JRoute::_(JemHelperRoute::getVenueRoute($venue->slug).'&print=1&tmpl=component');
			}

			$params->set('page_heading', $pageheading);

			// Add site name to title if param is set
			if ($app->getCfg('sitename_pagetitles', 0) == 1) {
				$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
			}
			elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
				$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
			}

			// set Page title & Meta data
			$document->setTitle($pagetitle);
			$document->setMetaData('title', $pagetitle);
			$document->setMetadata('keywords', $venue->meta_keywords);
			$document->setDescription(strip_tags($venue->meta_description));

			// Check if the user has permission to add things
			$permissions = new stdClass();
			$permissions->canAddEvent = $user->can('add', 'event');
			$permissions->canAddVenue = $user->can('add', 'venue');

			// Check if the user has permission to edit-this venue
			$permissions->canEditVenue = $user->can('edit', 'venue', $venue->id, $venue->created_by);
			$permissions->canEditPublishVenue = $user->can(array('edit', 'publish'), 'venue', $venue->id, $venue->created_by);

			// Generate Venuedescription
			if (!$venue->locdescription == '' || !$venue->locdescription == '<br />') {
				// execute plugins
				$venue->text = $venue->locdescription;
				$venue->title = $venue->venue;
				JPluginHelper::importPlugin ('content');
				$app->triggerEvent ('onContentPrepare', array (
						'com_jem.venue',
						&$venue,
						&$params,
						0
				));
				$venuedescription = $venue->text;
			}

			// build the url
			if (!empty($venue->url) && !preg_match('%^http(s)?://%', $venue->url)) {
				$venue->url = 'http://' . $venue->url;
			}

			// prepare the url for output
			if (strlen($venue->url) > 35) {
				$venue->urlclean = $this->escape(substr($venue->url, 0, 35 )) . '...';
			} else {
				$venue->urlclean = $this->escape($venue->url);
			}

			// create flag
			if ($venue->country) {
				$venue->countryimg = JemHelperCountries::getCountryFlag($venue->country);
			}

			// Create the pagination object
			$pagination = $this->get('Pagination');

			// filters
			$filters = array ();

			// ALL events have the same venue - so hide this from filter and list
			$jemsettings->showlocate = 0;

			if ($jemsettings->showtitle == 1) {
				$filters[] = JHtml::_('select.option', '1', JText::_('COM_JEM_TITLE'));
			}
			if ($jemsettings->showlocate == 1) {
				$filters[] = JHtml::_('select.option', '2', JText::_('COM_JEM_VENUE'));
			}
			if ($jemsettings->showcity == 1) {
				$filters[] = JHtml::_('select.option', '3', JText::_('COM_JEM_CITY'));
			}
			if ($jemsettings->showcat == 1) {
				$filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_CATEGORY'));
			}
			if ($jemsettings->showstate == 1) {
				$filters[] = JHtml::_('select.option', '5', JText::_('COM_JEM_STATE'));
			}
			$lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size'=>'1','class'=>'inputbox'), 'value', 'text', $filter_type);
			$lists['search'] = $search;

			// mapping variables
			$this->lists            = $lists;
			$this->action           = $uri->toString();
			$this->rows             = $rows;
			$this->noevents         = $noevents;
			$this->venue            = $venue;
			$this->print_link       = $print_link;
			$this->params           = $params;
			$this->limage           = $limage;
			$this->venuedescription = $venuedescription;
			$this->pagination       = $pagination;
			$this->jemsettings      = $jemsettings;
			$this->settings         = $settings;
			$this->permissions      = $permissions;
			$this->show_status      = $permissions->canEditPublishVenue;
			$this->item             = $menuitem;
			$this->pagetitle        = $pagetitle;
			$this->task             = $task;
			$this->pageclass_sfx    = htmlspecialchars($pageclass_sfx);
		}

		parent::display($tpl);
	}
示例#2
0
    /**
     * Calendar-View
     */
    function display($tpl = null)
    {
        $app = JFactory::getApplication();
        $document = JFactory::getDocument();
        $menu = $app->getMenu();
        $menuitem = $menu->getActive();
        $jemsettings = JemHelper::config();
        $vsettings = JemHelper::viewSettings('vcalendar');
        $params = $app->getParams();
        $settings = JemHelper::globalattribs();
        // Load css
        JemHelper::loadCss('jem');
        JemHelper::loadCss('calendar');
        JemHelper::loadCustomCss();
        JemHelper::loadCustomTag();
        $evlinkcolor = $params->get('eventlinkcolor');
        $evbackgroundcolor = $params->get('eventbackgroundcolor');
        $currentdaycolor = $params->get('currentdaycolor');
        $eventandmorecolor = $params->get('eventandmorecolor');
        $style = '
		div#jem div[id^=\'catz\'] a {color:' . $evlinkcolor . ' !important;}
		div#jem div[id^=\'catz\'] {background-color:' . $evbackgroundcolor . ';}
		div#jem .eventcontent {background-color:' . $evbackgroundcolor . '; !important}
		div#jem .eventandmore {background-color:' . $eventandmorecolor . ' !important;}
		div#jem .today .daynum {background-color:' . $currentdaycolor . ' !important;}';
        $document->addStyleDeclaration($style);
        // add javascript (using full path - see issue #590)
        JHtml::_('script', 'media/com_jem/js/calendar.js');
        $year = $app->input->request->getInt('yearID', strftime("%Y"));
        $month = $app->input->request->getInt('monthID', strftime("%m"));
        //get data from model and set the month
        $model = $this->getModel();
        $model->setDate(mktime(0, 0, 1, $month, 1, $year));
        $rows = $this->get('Items');
        //Set Page title
        $pagetitle = $params->def('page_title', $menuitem->title);
        $params->def('page_heading', $pagetitle);
        $pageclass_sfx = $params->get('pageclass_sfx');
        // Add site name to title if param is set
        if ($app->getCfg('sitename_pagetitles', 0) == 1) {
            $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
        } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
            $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
        }
        $document->setTitle($pagetitle);
        $document->setMetaData('title', $pagetitle);
        //init calendar
        $cal = new JEMCalendar($year, $month, 0);
        $cal->enableMonthNav('index.php?view=calendar');
        $cal->setFirstWeekDay($params->get('firstweekday', 1));
        $cal->enableDayLinks(false);
        //$cal->enableDatePicker();
        $this->rows = $rows;
        $this->params = $params;
        $this->jemsettings = $jemsettings;
        $this->settings = $settings;
        $this->vsettings = $vsettings;
        $this->cal = $cal;
        $this->pageclass_sfx = htmlspecialchars($pageclass_sfx);
        parent::display($tpl);
    }
示例#3
0
	/**
	 * Calendar-View
	 */
	function display($tpl = null)
	{
		$app = JFactory::getApplication();

		// Load tooltips behavior
		JHtml::_('behavior.tooltip');
		JHtml::_('behavior.framework');

		// initialize variables
		$document     = JFactory::getDocument();
		$menu         = $app->getMenu();
		$menuitem     = $menu->getActive();
		$jemsettings  = JemHelper::config();
		$user         = JemFactory::getUser();
		$params       = $app->getParams();
		$top_category = (int)$params->get('top_category', 0);
		$jinput       = $app->input;
		$print        = $jinput->getBool('print', false);
		$this->param_topcat = $top_category > 0 ? ('&topcat='.$top_category) : '';

		// Load css
		JemHelper::loadCss('jem');
		JemHelper::loadCss('calendar');
		JemHelper::loadCustomCss();
		JemHelper::loadCustomTag();

		if ($print) {
			JemHelper::loadCss('print');
			$document->setMetaData('robots', 'noindex, nofollow');
		}

		$evlinkcolor = $params->get('eventlinkcolor');
		$evbackgroundcolor = $params->get('eventbackgroundcolor');
		$currentdaycolor = $params->get('currentdaycolor');
		$eventandmorecolor = $params->get('eventandmorecolor');

		$style = '
		div#jem .eventcontentinner a,
		div#jem .eventandmore a {
			color:' . $evlinkcolor . ';
		}
		.eventcontentinner {
			background-color:'.$evbackgroundcolor .';
		}
		.eventandmore {
			background-color:'.$eventandmorecolor .';
		}

		.today .daynum {
			background-color:'.$currentdaycolor.';
		}';

		$document->addStyleDeclaration($style);

		// add javascript (using full path - see issue #590)
		JHtml::_('script', 'media/com_jem/js/calendar.js');

		$year  = (int)$jinput->getInt('yearID', strftime("%Y"));
		$month = (int)$jinput->getInt('monthID', strftime("%m"));

		// get data from model and set the month
		$model = $this->getModel();
		$model->setDate(mktime(0, 0, 1, $month, 1, $year));

		$rows = $this->get('Items');

		// Set Page title
		$pagetitle = $params->def('page_title', $menuitem->title);
		$params->def('page_heading', $pagetitle);
		$pageclass_sfx = $params->get('pageclass_sfx');

		// Add site name to title if param is set
		if ($app->getCfg('sitename_pagetitles', 0) == 1) {
			$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
		}
		elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
			$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
		}

		$document->setTitle($pagetitle);
		$document->setMetaData('title', $pagetitle);

		// Check if the user has permission to add things
		$permissions = new stdClass();
		$catIds = $model->getCategories('all');
		$permissions->canAddEvent = $user->can('add', 'event', false, false, $catIds);
		$permissions->canAddVenue = $user->can('add', 'venue', false, false, $catIds);

		$itemid  = $jinput->getInt('Itemid', 0);

		$partItemid = ($itemid > 0) ? '&Itemid=' . $itemid : '';
		$partDate = ($year ? ('&yearID=' . $year) : '') . ($month ? ('&monthID=' . $month) : '');
		$url_base = 'index.php?option=com_jem&view=calendar' . $partItemid;

		$print_link = JRoute::_($url_base . $partDate . '&print=1&tmpl=component');

		// init calendar
		$cal = new JEMCalendar($year, $month, 0);
		$cal->enableMonthNav($url_base . ($print ? '&print=1&tmpl=component' : ''));
		$cal->setFirstWeekDay($params->get('firstweekday', 1));
		$cal->enableDayLinks('index.php?option=com_jem&view=day' . $this->param_topcat);

		$this->rows          = $rows;
		$this->catIds        = $catIds;
		$this->params        = $params;
		$this->jemsettings   = $jemsettings;
		$this->permissions   = $permissions;
		$this->cal           = $cal;
		$this->pageclass_sfx = htmlspecialchars($pageclass_sfx);
		$this->print_link    = $print_link;

		parent::display($tpl);
	}
示例#4
0
	/**
	 * Creates the Category View
	 */
	function display($tpl=null)
	{
		if ($this->getLayout() == 'calendar')
		{
			### Category Calendar view ###

			$app = JFactory::getApplication();

			// Load tooltips behavior
			JHtml::_('behavior.tooltip');

			//initialize variables
			$document 		= JFactory::getDocument();
			$jemsettings 	= JemHelper::config();
			$user			= JemFactory::getUser();
			$menu 			= $app->getMenu();
			$menuitem		= $menu->getActive();
			$params 		= $app->getParams();
			$uri 			= JFactory::getURI();
			$pathway 		= $app->getPathWay();
			$print			= $app->input->getBool('print', false);

			// Load css
			JemHelper::loadCss('jem');
			JemHelper::loadCss('calendar');
			JemHelper::loadCustomCss();
			JemHelper::loadCustomTag();

			if ($print) {
				JemHelper::loadCss('print');
				$document->setMetaData('robots', 'noindex, nofollow');
			}

			$evlinkcolor = $params->get('eventlinkcolor');
			$evbackgroundcolor = $params->get('eventbackgroundcolor');
			$currentdaycolor = $params->get('currentdaycolor');
			$eventandmorecolor = $params->get('eventandmorecolor');

			$style = '
			div#jem .eventcontentinner a, div#jem .eventandmore a {color:' . $evlinkcolor . ';}
			.eventcontentinner {background-color:'.$evbackgroundcolor .';}
			.eventandmore {background-color:'.$eventandmorecolor .';}
			.today .daynum {background-color:'.$currentdaycolor.';}';
			$document->addStyleDeclaration($style);

			// add javascript (using full path - see issue #590)
			JHtml::_('script', 'media/com_jem/js/calendar.js');

			// Retrieve date variables
			$year  = (int)$app->input->getInt('yearID', strftime("%Y"));
			$month = (int)$app->input->getInt('monthID', strftime("%m"));

			$catid = $app->input->getInt('id', 0);
			if (empty($catid)) {
				$catid = $params->get('id');
			}

			// get data from model and set the month
			$model = $this->getModel('CategoryCal');
			$model->setDate(mktime(0, 0, 1, $month, 1, $year));

			$category	= $this->get('Category', 'CategoryCal');
			$rows		= $this->get('Items', 'CategoryCal');

			// Set Page title
			$pagetitle   = $params->def('page_title', $menuitem->title);
			$params->def('page_heading', $params->get('page_title'));
			$pageclass_sfx = $params->get('pageclass_sfx');

			// Add site name to title if param is set
			if ($app->getCfg('sitename_pagetitles', 0) == 1) {
				$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
			}
			elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
				$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
			}

			$document->setTitle($pagetitle);
			$document->setMetaData('title', $pagetitle);

			// Check if the user has permission to add things
			$permissions = new stdClass();
			$permissions->canAddEvent = $user->can('add', 'event', false, false, $catid);
			$permissions->canAddVenue = $user->can('add', 'venue', false, false, $catid);

			$itemid = $app->input->getInt('Itemid', 0);
			$partItemid = ($itemid > 0) ? '&Itemid='.$itemid : '';
			$partCatid = ($catid > 0) ? '&id=' . $catid : '';
			$url_base = 'index.php?option=com_jem&view=category&layout=calendar' . $partCatid . $partItemid;
			$partDate = ($year ? ('&yearID=' . $year) : '') . ($month ? ('&monthID=' . $month) : '');

			$print_link = JRoute::_($url_base . $partDate . '&print=1&tmpl=component');

			// init calendar
			$cal = new JEMCalendar($year, $month, 0);
			$cal->enableMonthNav($url_base . ($print ? '&print=1&tmpl=component' : ''));
			$cal->setFirstWeekDay($params->get('firstweekday', 1));
			$cal->enableDayLinks('index.php?option=com_jem&view=day&catid='.$catid);

			$this->rows          = $rows;
			$this->catid         = $catid;
			$this->params        = $params;
			$this->jemsettings   = $jemsettings;
			$this->permissions   = $permissions;
			$this->cal           = $cal;
			$this->pageclass_sfx = htmlspecialchars($pageclass_sfx);
			$this->print_link    = $print_link;

		} else
		{
			### Category List view ###

			//initialize variables
			$app 			= JFactory::getApplication();
			$document 		= JFactory::getDocument();
			$jemsettings 	= JemHelper::config();
			$settings 		= JemHelper::globalattribs();
			$user			= JemFactory::getUser();
			$print			= $app->input->getBool('print', false);

			JHtml::_('behavior.tooltip');

			// get menu information
			$params 		= $app->getParams();
			$uri 			= JFactory::getURI();
			$pathway 		= $app->getPathWay();
			$menu			= $app->getMenu();
			$menuitem		= $menu->getActive();

			// Load css
			JemHelper::loadCss('jem');
			JemHelper::loadCustomCss();
			JemHelper::loadCustomTag();

			if ($print) {
				JemHelper::loadCss('print');
				$document->setMetaData('robots', 'noindex, nofollow');
			}

			// get data from model
			$state		= $this->get('State');
			$params		= $state->params;
			$items		= $this->get('Items');
			$category	= $this->get('Category');
			$children	= $this->get('Children');
			$parent		= $this->get('Parent');
			$pagination = $this->get('Pagination');

			if ($category == false)
			{
				return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
			}

			// are events available?
			if (!$items) {
				$noevents = 1;
			} else {
				$noevents = 0;
			}

			// Decide which parameters should take priority
			$useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem'
			                                && $menuitem->query['view']   == 'category'
			                                && (!isset($menuitem->query['layout']) || $menuitem->query['layout'] == 'default')
			                                && $menuitem->query['id']     == $category->id);

			// get variables
			$itemid				= $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0);

			$this->showsubcats      = (bool)$params->get('usecat', 1);
			$this->showemptysubcats = (bool)$params->get('showemptychilds', 1);

			$filter_order		= $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_order', 'filter_order', 	'a.dates', 'cmd');
			$filter_order_Dir	= $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_order_Dir', 'filter_order_Dir',	'', 'word');
			$filter_type		= $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_filtertype', 'filter_type', '', 'int');
			$search 			= $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_search', 'filter_search', '', 'string');
			$task 				= $app->input->get('task', '');

			// table ordering
			$lists['order_Dir'] = $filter_order_Dir;
			$lists['order'] 	= $filter_order;

			// search filter
			$filters = array();

			if ($jemsettings->showtitle == 1) {
				$filters[] = JHtml::_('select.option', '1', JText::_('COM_JEM_TITLE'));
			}
			if ($jemsettings->showlocate == 1) {
				$filters[] = JHtml::_('select.option', '2', JText::_('COM_JEM_VENUE'));
			}
			if ($jemsettings->showcity == 1) {
				$filters[] = JHtml::_('select.option', '3', JText::_('COM_JEM_CITY'));
			}
			if ($jemsettings->showcat == 1) {
				$filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_CATEGORY'));
			}
			if ($jemsettings->showstate == 1) {
				$filters[] = JHtml::_('select.option', '5', JText::_('COM_JEM_STATE'));
			}
			$lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size'=>'1','class'=>'inputbox'), 'value', 'text', $filter_type);

			// search filter
			$lists['search']= $search;

			// Add feed links
			$link = '&format=feed&id='.$category->id.'&limitstart=';
			$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
			$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);

			// create the pathway
			$cats		= new JEMCategories($category->id);
			$parents	= $cats->getParentlist();

			foreach($parents as $parent) {
				$pathway->addItem($this->escape($parent->catname), JRoute::_(JemHelperRoute::getCategoryRoute($parent->slug)) );
			}

			// Show page heading specified on menu item or category title as heading - idea taken from com_content.
			//
			// Check to see which parameters should take priority
			// If the current view is the active menuitem and an category view for this category, then the menu item params take priority
			if ($useMenuItemParams) {
				$pagetitle   = $params->get('page_title', $menuitem->title ? $menuitem->title : $category->catname);
				$pageheading = $params->get('page_heading', $pagetitle);
				$pathway->setItemName(1, $menuitem->title);
			} else {
				$pagetitle   = $category->catname;
				$pageheading = $pagetitle;
				$params->set('show_page_heading', 1); // ensure page heading is shown
				$pathway->addItem($category->catname, JRoute::_(JemHelperRoute::getCategoryRoute($category->slug)) );
			}
			$pageclass_sfx = $params->get('pageclass_sfx');

			if ($task == 'archive') {
				$pathway->addItem(JText::_('COM_JEM_ARCHIVE'), JRoute::_(JemHelperRoute::getCategoryRoute($category->slug).'&task=archive'));
				$print_link = JRoute::_(JemHelperRoute::getCategoryRoute($category->id) .'&task=archive&print=1&tmpl=component');
				$pagetitle   .= ' - '.JText::_('COM_JEM_ARCHIVE');
				$pageheading .= ' - '.JText::_('COM_JEM_ARCHIVE');
			} else {
				$print_link = JRoute::_(JemHelperRoute::getCategoryRoute($category->id) .'&print=1&tmpl=component');
			}

			$params->set('page_heading', $pageheading);

			// Add site name to title if param is set
			if ($app->getCfg('sitename_pagetitles', 0) == 1) {
				$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
			}
			elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
				$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
			}

			// Set Page title & Meta data
			$this->document->setTitle($pagetitle);
			$document->setMetaData('title', $pagetitle);
			$document->setMetadata('keywords', $category->meta_keywords);
			$document->setDescription(strip_tags($category->meta_description));

			// Check if the user has permission to add things
			$permissions = new stdClass();
			$permissions->canAddEvent = $user->can('add', 'event', false, false, $category->id);
			$permissions->canAddVenue = $user->can('add', 'venue', false, false, $category->id);

			// Create the pagination object
			$pagination = $this->get('Pagination');

			// Generate Categorydescription
			if (empty ($category->description)) {
				$description = JText::_('COM_JEM_NO_DESCRIPTION');
			} else {
				// execute plugins
				$category->text  = $category->description;
				$category->title = $category->catname;
				JPluginHelper::importPlugin('content');
				$app->triggerEvent('onContentPrepare', array('com_jem.category', &$category, &$params, 0));
				$description = $category->text;
			}

			$cimage = JemImage::flyercreator($category->image,'category');

			$children = array($category->id => $children);

			$this->lists			= $lists;
			$this->action			= $uri->toString();
			$this->cimage			= $cimage;
			$this->rows				= $items;
			$this->noevents			= $noevents;
			$this->print_link		= $print_link;
			$this->params			= $params;
			$this->dellink			= $permissions->canAddEvent; // deprecated
			$this->permissions		= $permissions;
			$this->task				= $task;
			$this->description		= $description;
			$this->pagination		= $pagination;
			$this->jemsettings		= $jemsettings;
			$this->settings			= $settings;
			$this->pageclass_sfx	= htmlspecialchars($pageclass_sfx);
			$this->maxLevel			= $params->get('maxLevel', -1);
			$this->category			= $category;
			$this->children			= $children;
			$this->parent			= $parent;
			$this->user				= $user;
		}

		parent::display($tpl);
	}