<?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');
jimport( 'joomla.utilities.date');


class JLTicketCenterViewCredit_Error extends JViewLegacy
{
	function display($tpl = null)
	{
		global $mainframe, $option;
		
		$user =&JFactory::getUser();
		
		$document =& JFactory::getDocument();
		$document->addStyleSheet(JURI::base().'components/com_jlticketcenter/assets/jlticketcenter.css');
		
		JHTML::_('behavior.mootools');
		
		$pparams = new JLTicketCenterHelperSetup;
		
		if ($menu->component!='com_jlticketcenter'){
			$menu 		= JSite::getMenu();
			$bit_itemid = $menu->getItems('component','com_jlticketcenter');
			$itemid  	= $bit_itemid[0]->id;
		}
		else{
			$itemid  	= $menu->id;
		}
		
		if ($itemid){
		    $menu = JSite::getMenu();
		    $menuparams = $menu->getParams($itemid);
		 }else{
			$menuparams = JComponentHelper::getParams('com_jlticketcenter');
		 }
		
		$session = JFactory::getSession();
		$data = $session->get('jlticketcenter_credit');
		
		//$formAction =JRoute::_('index.php?option=com_jlticketcenter&view=cart&Itemid='.$Itemid );
		
		JHTML::_('behavior.formvalidation');
		
		$credit_card_year = $this->year_select('expDateYear',$data['expDateYear']);
		
		$this->assignRef('formAction',$formAction);
		$this->assignRef('credit_card_year',$credit_card_year);
		$this->assignRef('params',	$pparams);
		$this->assignRef('menuparams', $menuparams);
		$this->assignRef('data',	$data);

		$document =& JFactory::getDocument();
		$document->addScript(JURI::root().'components/com_jlticketcenter/assets/toggle_credit_error.js');
		
		
		
		parent::display($tpl);
		
	}
	
	
	 function year_select($name='expDateYear',$val=0){
		$yearRange = 7;
		
		$thisYear = date('Y');
		$startYear = ($thisYear + $yearRange);
		foreach (range($thisYear, $startYear) as $year) {
	  		$options[] = JHTML::_('select.option', $year, $year);
	  	}
	  	if ($val>0){
	  		$selected = $val;	
	  	}else{
	  		$selected = $thisYear ;
	  	}
	  	
	  				 				
		$dropdown = JHTML::_('select.genericlist',   $options, $name, 'class="inputbox"', 'value', 'text',$selected);
		 return $dropdown ;
	 	
	 }

	 function creditCardInit($payment_methods=array()){
	 }
		
} // EOC VIEW