<?php

/*
 * @component UserPoints
 * @copyright Copyright (C) Martin Brampton
 * @license : GNU/GPL
 * @Website : https://remository.com
 */

namespace BlackSheepResearch\Component\UserPoints\Site\Viewers;

// no direct access
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Component\ComponentHelper;
use BlackSheepResearch\Component\UserPoints\Site\View;
use BlackSheepResearch\Component\UserPoints\Site\WebAssetManager;

class UserView extends View {

    static protected $viewpath = '/components/com_userpoints/views/';

    public function display ($tpl = null) {
        WebAssetManager::getInstance('com_userpoints')->useStyle('userpoints.styles');
        parent::display($tpl);
    }

    public function getModel($name = null) {
        return $this->controller->getModel($name);
    }

    protected function getCopyrightNotice() {
        $cparams = ComponentHelper::getParams('com_userpoints');
        $hide_credits = $cparams->get('hide_credits', 0);

        $copySite = USERPOINTS_COPYRIGHT;
        if (!$hide_credits) {
            /**
             *  IMPORTANT !
             *  Provide copyright on frontend
             *  If you remove or hide this lines below,
             *  please make a donation if you find UserPoints useful
             *  and want to support its continued development.
             *  Your donations help by hardware, hosting services and other expenses that come up as we develop,
             *  protect and promote UserPoints and other free components.
             *  You can donate by PayPal to orders@black-sheep-research.com
             *
             */
             echo <<<COPYRIGHT_NOTICE

            <p>&nbsp;</p>
            <div style="clear:both;text-align:center;">
		<span>Powered by
                    <a href="https://remository.com/component/remository/User-Points/" target="_blank">
                        UserPoints
                    </a> $copySite
                </span>
            </div>
            <p>&nbsp;</p>

COPYRIGHT_NOTICE;
        }
    }

}
