* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved. * @license GNU General Public License version 3 or later; see LICENSE */ namespace Joomla\Component\MokoSuiteBackup\Administrator\View\Profiles; defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Component\MokoSuiteBackup\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 { $user = Factory::getApplication()->getIdentity(); ToolbarHelper::title(Text::_('COM_MOKOJOOMBACKUP_SHORT') . ': ' . Text::_('COM_MOKOJOOMBACKUP_PROFILES_TITLE'), 'cog'); if ($user->authorise('core.create', 'com_mokosuitebackup')) { ToolbarHelper::addNew('profile.add'); } if ($user->authorise('core.edit', 'com_mokosuitebackup')) { ToolbarHelper::editList('profile.edit'); } if ($this->akeebaDetected && $user->authorise('core.create', 'com_mokosuitebackup')) { ToolbarHelper::custom('profiles.importAkeeba', 'upload', '', 'COM_MOKOJOOMBACKUP_TOOLBAR_IMPORT_AKEEBA', false); } if ($user->authorise('core.delete', 'com_mokosuitebackup')) { ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'profiles.delete'); } if ($user->authorise('core.admin', 'com_mokosuitebackup')) { ToolbarHelper::preferences('com_mokosuitebackup'); } } }