<?php

/*
 * @component UserPoints
 * @copyright Copyright (C) 2015-2022 Bernard Gilly - Adrien Roussel - Martin Brampton
 * @license : GNU/GPL
 * @Website : https://remository.com
 */

namespace BlackSheepResearch\Component\UserPoints\Administrator\Viewers;

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
use BlackSheepResearch\Component\UserPoints\Site\UserPoints;

class MaxpointsHTML extends AdminHTML {

    function show($tpl = null) {
        $document = Factory::getDocument();
        Factory::getApplication()->input->set('hidemainmenu', 1);
        $logo = '<img src="' . Uri::root() . 'administrator/components/com_userpoints/assets/images/icon-48-userpoints.png" />&nbsp;&nbsp;';
        ToolbarHelper::title($logo . 'UserPoints :: ' . Text::_('AUP_SETMAXPOINST'), 'cpanel');
        $this->getCpanelToolbar();
        if (UserPoints::getUser()->authorise('core.edit.state', 'com_userpoints')) {
            ToolbarHelper::save('savemaxpoints');
        }
        $this->getPrefHelpToolbar();
        $document->addScriptDeclaration("window.addEvent('domready', function(){ var JTooltips = new Tips($$('.hasTip'), { maxTitleChars: 50, fixed: false}); });");
        parent::display($tpl);
    }

}
