Your IP : 216.73.216.240
<?php
/*
* @package Tech Fry Library
* @license https://www.gnu.org/licenses/gpl-3.0.en.html
*/
namespace TechFry\Library\Controller\Back;
defined('_JEXEC') or die;
use Joomla\CMS\MVC\Controller\AdminController;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use Joomla\Input\Input;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Router\Route;
use TechFry\Library\TDb;
class TfControllerAdmin extends AdminController
{
// Controller for Backend List Layouts
public $cparams;
public $today;
public $date_sql;
public $date_unix;
public $date_lc3;
public $juser;
public $user_levels;
public $url;
public $post;
public $get;
protected $text_prefix = 'COM_TF';
public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSApplication $app = null, ?Input $input = null)
{
parent::__construct($config, $factory, $app, $input);
// Available: $this->app, $this->input, $this->option
$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();
}
// Empty table after checking existing records
public function deleteTable()
{
$this->checkToken();
$model = $this->getModel();
$result = $model->deleteTable($model->table_name);
if ($result)
{
$this->setMessage('Table Truncated Successfully: <strong>' . $model->table_name . '</strong>');
}
$this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
}
// Empty table without checking existing records
public function truncateTable()
{
$this->checkToken();
$model = $this->getModel();
$db = new TDb($model->table_name);
$db->truncate_table();
$this->setMessage('Table truncated successfully: ' . $model->table_name);
$this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
}
/*
$view_list
delete(), publish()
*/
}