Files
MokoSuiteBackup/source/packages/com_mokojoombackup/src/View/Profiles/HtmlView.php
T

61 lines
1.7 KiB
PHP
Raw Normal View History

<?php
/**
* @package MokoJoomBackup
* @subpackage com_mokojoombackup
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
*/
namespace Joomla\Component\MokoJoomBackup\Administrator\View\Profiles;
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\MokoJoomBackup\Administrator\Engine\AkeebaImporter;
class HtmlView extends BaseHtmlView
{
protected $items;
protected $pagination;
protected $state;
public $filterForm;
public $activeFilters = [];
public bool $akeebaDetected = false;
public function display($tpl = null): void
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check if Akeeba Backup is installed
$importer = new AkeebaImporter();
$detection = $importer->detect();
$this->akeebaDetected = $detection['profiles'];
$this->addToolbar();
parent::display($tpl);
}
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_MOKOJOOMBACKUP_PROFILES_TITLE'), 'cog');
ToolbarHelper::addNew('profile.add');
ToolbarHelper::editList('profile.edit');
if ($this->akeebaDetected) {
ToolbarHelper::custom('profiles.importAkeeba', 'upload', '', 'COM_MOKOJOOMBACKUP_TOOLBAR_IMPORT_AKEEBA', false);
}
ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'profiles.delete');
ToolbarHelper::preferences('com_mokojoombackup');
}
}