Your IP : 216.73.216.240


Current Path : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/View/Back/
Upload File :
Current File : /home/juvelize/saulnois/tmp/install_695d2cf0b4957/src/View/Back/TfView.php

<?php
/*
* @package		Tech Fry Library
* @license		https://www.gnu.org/licenses/gpl-3.0.en.html
*/

namespace TechFry\Library\View\Back;

\defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use TechFry\Library\TVersion;

// Basic View Class for Backend - No Model Required 
class TfView extends BaseHtmlView
{
    use TfViewDisplayTrait, TfViewToolbarTrait;
    
    /*
    General view class for backend
    icon, title, toolbar (TfViewToolbarTrait)
    */

    public $view_type;
    
    public $input;
    
    public $option;
    
    public $com_name;
    
    public $view_name;
  
  	public $app;

    public $today;
    public $date_sql;
	public $date_unix;
	public $date_lc3;
    
    public $juser;
    public $user_levels;

    public $url;

	public $post;
	public $get;
    
    public $help_url = '';
    
    public $layout;

    public $title_prefix;

    public $cparams;
    
    public $is_pro = false;

    public $jmajor; // Joomla Major Version

    public function __construct($config = [])
    {
        parent::__construct($config);

        $version = new TVersion();
        $this->jmajor = $version->get_major();

        $this->app = Factory::getApplication();
      
      	$this->input = Factory::getApplication()->input;
        
        $this->option = $this->input->get('option');

        $this->view_name = $this->getName();

        $this->com_name = substr($this->option, 6);

        $this->title_prefix = 'TF ' . ucwords($this->com_name) . ': ';

        $this->today = Factory::getDate();
        $this->date_sql = $this->today->toSql();
		$this->date_unix = $this->today->toUnix();
		$this->date_lc3 = $this->today->format(Text::_('DATE_FORMAT_LC3'));

        $this->juser = $this->app->getIdentity();
        $this->user_levels = $this->juser->getAuthorisedViewLevels();

        $this->cparams = ComponentHelper::getParams($this->option);

        $this->url = Uri::getInstance()->toString();

		$this->post = $this->input->post->getArray();

		$this->get = $this->input->get->getArray();
    }
    
    public function display($tpl = null)
    {
        $this->initiate_view();
    /*    
        // Check for Pro Version
        $model = $this->getModel();
        if ($this->is_pro && !$model->is_pro())
        {
            $model->set_message(Text::_('COM_TF_PRO_UPGRADE_MESSAGE'), 'error');
            
            return;
        }
        */

        $this->addToolbar();
        
        // Display the template
        parent::display($tpl);
    }
    
    public function initiate_view()
    {   
        $this->layout = $this->getLayout();

        // TO DO: Load Library Language File
        /*
        $lang = Factory::getLanguage();
        $lang->load('lib_techfry', JPATH_ADMINISTRATOR);
        */
    }

    // Use for Debugging
    public function printme($data)
    {
        echo '<pre>';
            print_r($data);
        echo '</pre>';
    }
}