2026-06-02 13:47:36 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
2026-06-11 12:24:27 -05:00
|
|
|
* @package MokoSuiteBackup
|
|
|
|
|
* @subpackage com_mokosuitebackup
|
2026-06-02 13:47:36 -05:00
|
|
|
* @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
|
|
|
|
|
*/
|
|
|
|
|
|
2026-06-11 12:24:27 -05:00
|
|
|
namespace Joomla\Component\MokoSuiteBackup\Administrator\View\Profiles;
|
2026-06-02 13:47:36 -05:00
|
|
|
|
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
|
|
2026-06-13 07:23:53 -05:00
|
|
|
use Joomla\CMS\Factory;
|
2026-06-02 13:47:36 -05:00
|
|
|
use Joomla\CMS\Language\Text;
|
|
|
|
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
|
|
|
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
2026-06-11 12:24:27 -05:00
|
|
|
use Joomla\Component\MokoSuiteBackup\Administrator\Engine\AkeebaImporter;
|
2026-06-02 13:47:36 -05:00
|
|
|
|
|
|
|
|
class HtmlView extends BaseHtmlView
|
|
|
|
|
{
|
|
|
|
|
protected $items;
|
|
|
|
|
protected $pagination;
|
|
|
|
|
protected $state;
|
|
|
|
|
public $filterForm;
|
|
|
|
|
public $activeFilters = [];
|
2026-06-02 15:48:31 -05:00
|
|
|
public bool $akeebaDetected = false;
|
2026-06-02 13:47:36 -05:00
|
|
|
|
|
|
|
|
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');
|
|
|
|
|
|
2026-06-02 15:48:31 -05:00
|
|
|
// Check if Akeeba Backup is installed
|
|
|
|
|
$importer = new AkeebaImporter();
|
|
|
|
|
$detection = $importer->detect();
|
|
|
|
|
$this->akeebaDetected = $detection['profiles'];
|
|
|
|
|
|
2026-06-02 13:47:36 -05:00
|
|
|
$this->addToolbar();
|
|
|
|
|
|
|
|
|
|
parent::display($tpl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function addToolbar(): void
|
|
|
|
|
{
|
2026-06-13 07:23:53 -05:00
|
|
|
$user = Factory::getApplication()->getIdentity();
|
|
|
|
|
|
2026-07-04 14:20:54 -05:00
|
|
|
ToolbarHelper::title(Text::_('COM_MOKOJOOMBACKUP_SHORT') . ': ' . Text::_('COM_MOKOJOOMBACKUP_PROFILES_TITLE'), 'cog');
|
2026-06-02 15:48:31 -05:00
|
|
|
|
2026-06-13 07:23:53 -05:00
|
|
|
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')) {
|
2026-06-06 14:52:27 -05:00
|
|
|
ToolbarHelper::custom('profiles.importAkeeba', 'upload', '', 'COM_MOKOJOOMBACKUP_TOOLBAR_IMPORT_AKEEBA', false);
|
2026-06-02 15:48:31 -05:00
|
|
|
}
|
|
|
|
|
|
2026-06-13 07:23:53 -05:00
|
|
|
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');
|
|
|
|
|
}
|
2026-06-02 13:47:36 -05:00
|
|
|
}
|
|
|
|
|
}
|