<?php

/**
 * ------------------------------------------------------------------------
 * JA Megafilter Component
 * ------------------------------------------------------------------------
 * Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights Reserved.
 * @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
 * Author: J.O.O.M Solutions Co., Ltd
 * Websites: http://www.joomlart.com - http://www.joomlancers.com
 * This file may not be redistributed in whole or significant part.
 * ------------------------------------------------------------------------
 */

defined('_JEXEC') or die('Restricted access');

class JaMegafilterViewCron extends JViewLegacy {
	
	function display($tpl = null) {
		$this->form = $this->get('Form');
		$this->item = $this->get('Item');
		if ($this->item) {
			$this->form->bind($this->item);
		} else {
			$app = JFactory::getApplication();
			$app->enqueueMessage( JText::_('COM_JAMEGAFILTER_SAVE_CONFIG_TO_GET_CRON_URL'), 'warning');
		}
		
		$this->addToolBar();
		$this->sidebar = JHtmlSidebar::render();
		
		parent::display($tpl);
	}
	
	function addToolBar()
	{
		JaMegafilterHelper::addSubmenu('cron');
		
		JToolBarHelper::title('JA Megafilter ' . JText::_('COM_JAMEGAFILTER_CRON'));
		JToolBarHelper::apply('cron.save');
		JToolBarHelper::custom('cron.newCronUrl', 'link','link',JText::_('COM_JAMEGAFILTER_NEW_CRON_URL'), false);
		JToolBarHelper::custom('cron.reset', 'loop','loop',JText::_('COM_JAMEGAFILTER_RESET_LAST_CRON'), false);
	}
}