<?php
/**
* @version		3.0.0
* @package		JomLand TicketCenter
* @copyright	Copyright (C) 2010 JomLand.com. All rights reserved.
* @link 		www.jomland.com
* @license		GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport('joomla.application.component.view');

class JLTicketCenterViewCategories extends JViewLegacy
{
	function display($tpl = null)
	{
		if (!JLoader::import('components.com_jlticketcenter.models.category',JPATH_BASE)){
			return false; 
		}
        $app = JFactory::getApplication();
		$model = JModelLegacy::getInstance('Category', 'JLTicketCenterModel');

		//$items = $model->getCategories();
		$items = $model->getItems();

		$document = JFactory::getDocument();
		$document->addStyleSheet(JURI::base().'components/com_jlticketcenter/assets/jlticketcenter.css');
		
		$pparams = new JLTicketCenterHelperSetup;
		
		
		$this->assignRef('items',	$items);
		$this->assignRef('params',	$pparams);

        $menu = $app->getMenu()->getActive();

		
		if ($menu->component!='com_jlticketcenter'){
			$menu 		= $app->getMenu()->getActive();
			$bit_itemid = $menu->getItems('component','com_jlticketcenter');
			$Itemid  	= $bit_itemid[0]->id;
		}
		else{
			$Itemid  	= $menu->id;
		}
		if ($Itemid){
		    $menu = $app->getMenu();
		    $menuparams = $menu->getParams($Itemid);
		 }else{
			$menuparams = JComponentHelper::getParams('com_jlticketcenter');
		 }
		
		$this->assignRef('itemid',	$Itemid );
		$this->assignRef('menuparams', $menuparams);
		 
		parent::display($tpl);
		
		JLTicketCenterLinksHelper::renderinfo();
	}
} // EOC VIEW