<?php
/**
 * @package DJ-Events
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 * @developer Szymon Woronowski - szymon.woronowski@design-joomla.eu
 *
 */

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

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

class DJEventsViewCity extends JViewLegacy
{
    protected $state;
    protected $item;
    protected $form;

    public function display($tpl = null)
    {
        $this->state = $this->get('State');
        $this->item = $this->get('Item');
        $this->form = $this->get('Form');

        // Check for errors.
        if (count($errors = $this->get('Errors'))) {
            throw new Exception(implode("\n", $errors), 500);
            return false;
        }

        $this->addToolbar();

        $params = JComponentHelper::getParams('com_djevents');

        JHtml::_('jquery.framework');



        parent::display($tpl);
    }

    protected function addToolbar()
    {
        JFactory::getApplication()->input->set('hidemainmenu', true);

        $user = JFactory::getUser();
        $isNew = ($this->item->id == 0);

        $text = $isNew ? JText::_('COM_DJEVENTS_NEW') : JText::_('COM_DJEVENTS_EDIT');
        JToolBarHelper::title(JText::_('COM_DJEVENTS_CITY') . ': <small><small>[ ' . $text . ' ]</small></small>', 'generic.png');

        JToolBarHelper::apply('city.apply', 'JTOOLBAR_APPLY');
        JToolBarHelper::save('city.save', 'JTOOLBAR_SAVE');
        JToolBarHelper::custom('city.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
        JToolBarHelper::custom('city.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
        //JToolBarHelper::custom('event.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
        JToolBarHelper::cancel('city.cancel', 'JTOOLBAR_CANCEL');
    }
}
