2026-06-21 11:38:41 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @package MokoSuiteCross
|
|
|
|
|
* @subpackage com_mokosuitecross
|
|
|
|
|
* @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
|
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace Joomla\Component\MokoSuiteCross\Administrator\View\Service;
|
|
|
|
|
|
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
|
|
|
|
|
|
use Joomla\CMS\Factory;
|
|
|
|
|
use Joomla\CMS\Language\Text;
|
|
|
|
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
|
|
|
|
use Joomla\CMS\Router\Route;
|
|
|
|
|
use Joomla\CMS\Toolbar\Toolbar;
|
|
|
|
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
2026-06-23 14:21:47 -05:00
|
|
|
use Joomla\Component\MokoSuiteCross\Administrator\Helper\MokoSuiteCrossHelper;
|
2026-06-21 11:38:41 -05:00
|
|
|
|
|
|
|
|
class HtmlView extends BaseHtmlView
|
|
|
|
|
{
|
|
|
|
|
protected $form;
|
|
|
|
|
protected $item;
|
|
|
|
|
|
|
|
|
|
public function display($tpl = null): void
|
|
|
|
|
{
|
|
|
|
|
$this->form = $this->get('Form');
|
|
|
|
|
$this->item = $this->get('Item');
|
|
|
|
|
|
|
|
|
|
$this->addToolbar();
|
|
|
|
|
|
|
|
|
|
parent::display($tpl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function addToolbar(): void
|
|
|
|
|
{
|
|
|
|
|
$isNew = empty($this->item->id);
|
2026-06-23 14:21:47 -05:00
|
|
|
$canDo = MokoSuiteCrossHelper::getActions();
|
2026-06-21 11:38:41 -05:00
|
|
|
|
|
|
|
|
ToolbarHelper::title(
|
|
|
|
|
'MokoSuiteCross — ' . ($isNew ? Text::_('COM_MOKOSUITECROSS_NEW_SERVICE') : Text::_('COM_MOKOSUITECROSS_EDIT_SERVICE')),
|
|
|
|
|
'share-alt'
|
|
|
|
|
);
|
|
|
|
|
|
2026-06-23 14:21:47 -05:00
|
|
|
if ($canDo->get('mokosuitecross.services.manage')) {
|
|
|
|
|
ToolbarHelper::apply('service.apply');
|
|
|
|
|
ToolbarHelper::save('service.save');
|
|
|
|
|
}
|
2026-06-21 11:38:41 -05:00
|
|
|
|
|
|
|
|
// Dashboard button in toolbar
|
|
|
|
|
$toolbar = Toolbar::getInstance('toolbar');
|
|
|
|
|
$toolbar->appendButton(
|
|
|
|
|
'Link',
|
|
|
|
|
'home',
|
|
|
|
|
'COM_MOKOSUITECROSS_SUBMENU_DASHBOARD',
|
|
|
|
|
Route::_('index.php?option=com_mokosuitecross&view=dashboard', false)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
ToolbarHelper::cancel('service.cancel');
|
|
|
|
|
}
|
|
|
|
|
}
|