2016-01-30 20:28:43 +00:00
|
|
|
<?php
|
2021-03-05 03:08:47 +00:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
2022-07-09 15:45:08 +00:00
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2021-03-05 03:08:47 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
2024-03-02 20:10:30 +00:00
|
|
|
use Joomla\CMS\Factory;
|
|
|
|
use Joomla\CMS\Language\Text;
|
|
|
|
use Joomla\CMS\HTML\HTMLHelper as Html;
|
|
|
|
use Joomla\CMS\MVC\View\HtmlView;
|
|
|
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
|
|
|
use VDM\Joomla\Utilities\StringHelper;
|
2021-12-21 14:44:50 +00:00
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
/**
|
|
|
|
* Componentbuilder View class
|
|
|
|
*/
|
2024-03-02 20:10:30 +00:00
|
|
|
class ComponentbuilderViewComponentbuilder extends HtmlView
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* View display method
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function display($tpl = null)
|
|
|
|
{
|
|
|
|
// Assign data to the view
|
2024-03-02 20:10:30 +00:00
|
|
|
$this->icons = $this->get('Icons');
|
|
|
|
$this->contributors = ComponentbuilderHelper::getContributors();
|
2017-12-27 03:45:35 +00:00
|
|
|
$this->wiki = $this->get('Wiki');
|
|
|
|
$this->noticeboard = $this->get('Noticeboard');
|
2021-03-05 03:08:47 +00:00
|
|
|
$this->readme = $this->get('Readme');
|
2022-07-09 20:37:56 +00:00
|
|
|
$this->version = $this->get('Version');
|
2024-03-02 20:10:30 +00:00
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
// get the manifest details of the component
|
|
|
|
$this->manifest = ComponentbuilderHelper::manifest();
|
2024-03-02 20:10:30 +00:00
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
// Set the toolbar
|
|
|
|
$this->addToolBar();
|
2024-03-02 20:10:30 +00:00
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
// Check for errors.
|
|
|
|
if (count($errors = $this->get('Errors')))
|
|
|
|
{
|
|
|
|
throw new Exception(implode("\n", $errors), 500);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display the template
|
|
|
|
parent::display($tpl);
|
|
|
|
|
|
|
|
// Set the document
|
|
|
|
$this->setDocument();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setting the toolbar
|
|
|
|
*/
|
|
|
|
protected function addToolBar()
|
|
|
|
{
|
|
|
|
$canDo = ComponentbuilderHelper::getActions('componentbuilder');
|
2024-03-02 20:10:30 +00:00
|
|
|
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_DASHBOARD'), 'grid-2');
|
2021-03-05 03:08:47 +00:00
|
|
|
|
|
|
|
// set help url for this view if found
|
2022-02-12 22:28:17 +00:00
|
|
|
$this->help_url = ComponentbuilderHelper::getHelpUrl('componentbuilder');
|
2024-03-02 20:10:30 +00:00
|
|
|
if (StringHelper::check($this->help_url))
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($canDo->get('core.admin') || $canDo->get('core.options'))
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
ToolbarHelper::preferences('com_componentbuilder');
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to set up the document properties
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function setDocument()
|
|
|
|
{
|
2024-03-02 20:10:30 +00:00
|
|
|
if (!isset($this->document))
|
|
|
|
{
|
|
|
|
$this->document = Factory::getDocument();
|
|
|
|
}
|
2021-03-05 03:08:47 +00:00
|
|
|
// set page title
|
2024-03-02 20:10:30 +00:00
|
|
|
$this->document->setTitle(Text::_('COM_COMPONENTBUILDER_DASHBOARD'));
|
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
// add manifest to page JavaScript
|
2024-03-02 20:10:30 +00:00
|
|
|
$this->document->addScriptDeclaration("var manifest = jQuery.parseJSON('" . json_encode($this->manifest) . "');", "text/javascript");
|
|
|
|
|
|
|
|
// add dashboard style sheets
|
|
|
|
Html::_('stylesheet', "administrator/components/com_componentbuilder/assets/css/dashboard.css", ['version' => 'auto']);
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
}
|