<?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');


JHtml::_('formbehavior.chosen', 'select');
$params = JComponentHelper::getParams('com_djevents');

if (version_compare(JVERSION, '4', '<')) { // Joomla 3) { // first must be the zoomer script
    JHtml::_('behavior.tooltip');
    JHtml::_('behavior.formvalidation');
    ?>
    <script type="text/javascript">
        Joomla.submitbutton = function (task) {
            var form = document.getElementById('edit-form');
            if (task == 'city.cancel') {
                Joomla.submitform(task, form);
            } else if (document.formvalidator.isValid(form)) {
                Joomla.submitform(task, form);
            } else {
                alert('<?php echo $this->escape(JText::_('JGLOBAL_VALIDATION_FORM_FAILED'));?>');
            }
        }
    </script>
    <?php
} else {
    JHtml::_('behavior.formvalidator');
}


?>


<form action="<?php echo JRoute::_('index.php?option=com_djevents&view=city&layout=edit&id=' . (int)$this->item->id); ?>"
      method="post" name="adminForm" id="edit-form" class="form-validate" enctype="multipart/form-data">
    <div class="<?php echo $this->classes->row ?>">
        <div class="<?php echo $this->classes->col ?>8">
            <fieldset class="form-horizontal">
                <legend><?php echo empty($this->item->id) ? JText::_('COM_DJEVENTS_NEW') : JText::_('COM_DJEVENTS_EDIT'); ?></legend>

                <div class="<?php echo $this->classes->row ?>">
                    <div class="<?php echo $this->classes->col ?>6">

                        <?php echo $this->form->getField('id')->renderField(); ?>
                        <?php echo $this->form->getField('name')->renderField(); ?>
                        <?php echo $this->form->getField('alias')->renderField(); ?>
                    </div>

                </div>

            </fieldset>
        </div>

        <input type="hidden" name="task" value=""/>
        <?php echo JHtml::_('form.token'); ?>
        <div class="clr"></div>
    </div>
</form>
