<?php
/**
 * @package DJ-Catalog2
 * @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
 *
 */

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

jimport('joomla.application.component.view');
jimport('joomla.application.categories');
jimport('joomla.html.pane');

class Djcatalog2ViewCpanel extends JViewLegacy
{
    function display($tpl = null)
    {
        $model = $this->getModel();
        $model->performChecks();
        JToolBarHelper::title(JText::_('COM_DJCATALOG2_DJCATALOG'));

        if (JFactory::getUser()->authorise('core.admin', 'com_djcatalog2')) {
            $params = JComponentHelper::getParams('com_djcatalog2');

            if ($params->get('backend_ecommerce_button', 1)) {
               // JToolbarHelper::custom('toggleModeDefault', 'cart', '', 'eCommerce Mode', false);
            }


            if ($params->get('backend_catalog_button', 1)) {
              //  JToolbarHelper::custom('toggleModeCatalog', 'image', '', 'Catalog Mode', false);
            }
        }

        if (JFactory::getUser()->authorise('core.admin', 'com_djcatalog2') || JFactory::getUser()->authorise('core.options', 'com_djcatalog2')) {
            JToolBarHelper::preferences('com_djcatalog2', '450', '900');
        }
        if (class_exists('JHtmlSidebar')) {
            $this->sidebar = JHtmlSidebar::render();
        }
        $version = new JVersion;
        if (version_compare($version->getShortVersion(), '3.0.0', '<')) {
            $tpl = 'legacy';
        }

        parent::display($tpl);
    }
}
