Your IP : 216.73.216.209


Current Path : /home/megadansyp/www/administrator/components/com_eventgallery/views/downloadlog/
Upload File :
Current File : /home/megadansyp/www/administrator/components/com_eventgallery/views/downloadlog/view.html.php

<?php
/**
 * @package     Sven.Bluege
 * @subpackage  com_eventgallery
 *
 * @copyright   Copyright (C) 2005 - 2019 Sven Bluege All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;



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


class EventgalleryViewDownloadlog extends EventgalleryLibraryCommonView
{

    protected $items;
    protected $pagination;
    protected $state;

    /**
     * Display the view
     * @param null $tpl
     * @return bool|mixed
     */
    public function display($tpl = null)
    {
        $config = \Joomla\Component\Eventgallery\Site\Library\Configuration\Main::getInstance();
        if (!$config->getGeneral()->isDownloadLogEnabled()) {
            $app = \Joomla\CMS\Factory::getApplication();
            $app->enqueueMessage(\Joomla\CMS\Language\Text::_('COM_EVENTGALLERY_DOWNLOADLOG_NOT_ENABLED'), "warning");
        }

        $this->state = $this->get('State');
        $this->items = $this->get('Items');
        $this->pagination = $this->get('Pagination');

        // Check for errors.
        if (count($errors = $this->get('Errors'))) {
            throw new Exception(implode("\n", $errors));
        }
        $this->addToolbar();
        EventgalleryHelpersEventgallery::addSubmenu('downloadlog');
        $this->sidebar = JHtmlSidebar::render();
        return parent::display($tpl);
    }

    protected function addToolbar() {
        \Joomla\CMS\Toolbar\ToolbarHelper::title(   JText::_( 'COM_EVENTGALLERY_DOWNLOADLOG' ), 'generic.png' );
        \Joomla\CMS\Toolbar\ToolbarHelper::link(\Joomla\CMS\Router\Route::_("index.php?option=com_eventgallery&task=downloadlog.export"), JText::_( 'COM_EVENTGALLERY_DOWNLOADLOG_DOWNLOADBUTTON_ALT' ), "download");

        $options= [];
        foreach(EventgalleryLibraryCommonDownloadlog::$TYPES as $key=>$value) {
            $options[] = JHtml::_('select.option', $key, $value);
        }


        JHtmlSidebar::addFilter(
            JText::_('COM_EVENTGALLERY_DOWNLOADLOG_TYPE'),
            'filter_type',
            JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.type'), true)
        );

        $options= [];
        $options[] = JHtml::_('select.option', 'reg', 'COM_EVENTGALLERY_DOWNLOADLOG_USERTYPE_REG');
        $options[] = JHtml::_('select.option', 'guest', 'COM_EVENTGALLERY_DOWNLOADLOG_USERTYPE_UNREG');

        JHtmlSidebar::addFilter(
            JText::_('COM_EVENTGALLERY_DOWNLOADLOG_USERTYPE'),
            'filter_usertype',
            JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.usertype'), true)
        );

        $options= [];
        $options[] = JHtml::_('select.option', 'yes', 'COM_EVENTGALLERY_DOWNLOADLOG_ISBOT_YES');
        $options[] = JHtml::_('select.option', 'no', 'COM_EVENTGALLERY_DOWNLOADLOG_ISBOT_NO');

        JHtmlSidebar::addFilter(
            JText::_('COM_EVENTGALLERY_DOWNLOADLOG_ISBOT'),
            'filter_isbot',
            JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.isbot'), true)
        );

        $options = [];
        for ($i = 2021; $i <= date("Y"); $i++) {
            $options[] = JHtml::_('select.option', $i, $i);
        }

        JHtmlSidebar::addFilter(
            JText::_('COM_EVENTGALLERY_DOWNLOADLOG_YEAR'),
            'filter_year',
            JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.year'), true)
        );

        $options = [];
        for ($i = 1; $i < 18; $i++) {
            $options[] = JHtml::_('select.option', $i, EventgalleryModelDownloadlog::monthToString($i));
        }

        JHtmlSidebar::addFilter(
            JText::_('COM_EVENTGALLERY_DOWNLOADLOG_MONTH'),
            'filter_month',
            JHtml::_('select.options', $options, 'value', 'text', $this->state->get('filter.month'), true)
        );


    }

}