2017-08-20 17:52:35 +00:00
|
|
|
<?php
|
|
|
|
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
|
|
|
__ __ _ _____ _ _ __ __ _ _ _
|
|
|
|
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
|
|
|
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
|
|
|
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
|
|
|
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
|
|
|
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
|
|
|
| |
|
|
|
|
|_|
|
|
|
|
/-------------------------------------------------------------------------------------------------------------------------------/
|
|
|
|
|
|
|
|
@version @update number 7 of this MVC
|
2017-10-20 23:53:13 +00:00
|
|
|
@build 20th October, 2017
|
2017-08-20 17:52:35 +00:00
|
|
|
@created 19th August, 2017
|
|
|
|
@package Component Builder
|
|
|
|
@subpackage view.html.php
|
|
|
|
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
|
|
|
@copyright Copyright (C) 2015. All Rights Reserved
|
|
|
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
|
|
|
|
Builds Complex Joomla Components
|
|
|
|
|
|
|
|
/-----------------------------------------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
|
|
|
|
// import Joomla view library
|
|
|
|
jimport('joomla.application.component.view');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Componentbuilder View class for the Api
|
|
|
|
*/
|
|
|
|
class ComponentbuilderViewApi extends JViewLegacy
|
|
|
|
{
|
|
|
|
// Overwriting JView display method
|
|
|
|
function display($tpl = null)
|
2017-10-14 17:18:29 +00:00
|
|
|
{
|
2017-08-20 17:52:35 +00:00
|
|
|
// get combined params of both component and menu
|
|
|
|
$this->app = JFactory::getApplication();
|
|
|
|
$this->params = $this->app->getParams();
|
|
|
|
$this->menu = $this->app->getMenu()->getActive();
|
|
|
|
// get the user object
|
|
|
|
$this->user = JFactory::getUser();
|
|
|
|
// Initialise variables.
|
|
|
|
$this->item = $this->get('Item');
|
|
|
|
|
|
|
|
// Set the toolbar
|
|
|
|
$this->addToolBar();
|
|
|
|
|
|
|
|
// set the document
|
|
|
|
$this->_prepareDocument();
|
|
|
|
|
2017-10-14 17:18:29 +00:00
|
|
|
// Check for errors.
|
|
|
|
if (count($errors = $this->get('Errors')))
|
|
|
|
{
|
2017-10-14 18:07:23 +00:00
|
|
|
throw new Exception(implode("\n", $errors), 500);
|
2017-10-14 17:18:29 +00:00
|
|
|
}
|
|
|
|
|
2017-08-20 17:52:35 +00:00
|
|
|
parent::display($tpl);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepares the document
|
|
|
|
*/
|
|
|
|
protected function _prepareDocument()
|
|
|
|
{
|
|
|
|
|
|
|
|
// always make sure jquery is loaded.
|
|
|
|
JHtml::_('jquery.framework');
|
|
|
|
// Load the header checker class.
|
|
|
|
require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );
|
|
|
|
// Initialize the header checker.
|
|
|
|
$HeaderCheck = new componentbuilderHeaderCheck;
|
|
|
|
|
|
|
|
// Load uikit options.
|
|
|
|
$uikit = $this->params->get('uikit_load');
|
|
|
|
// Set script size.
|
|
|
|
$size = $this->params->get('uikit_min');
|
|
|
|
// Set css style.
|
|
|
|
$style = $this->params->get('uikit_style');
|
|
|
|
|
|
|
|
// The uikit css.
|
|
|
|
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
|
|
|
{
|
|
|
|
$this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit/css/uikit'.$style.$size.'.css');
|
|
|
|
}
|
|
|
|
// The uikit js.
|
|
|
|
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
|
|
|
{
|
|
|
|
$this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit/js/uikit'.$size.'.js');
|
|
|
|
}
|
|
|
|
// add the document default css file
|
|
|
|
$this->document->addStyleSheet(JURI::root(true) .'/components/com_componentbuilder/assets/css/api.css');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setting the toolbar
|
|
|
|
*/
|
|
|
|
protected function addToolBar()
|
|
|
|
{
|
|
|
|
// adding the joomla toolbar to the front
|
|
|
|
JLoader::register('JToolbarHelper', JPATH_ADMINISTRATOR.'/includes/toolbar.php');
|
|
|
|
|
|
|
|
// set help url for this view if found
|
|
|
|
$help_url = ComponentbuilderHelper::getHelpUrl('api');
|
|
|
|
if (ComponentbuilderHelper::checkString($help_url))
|
|
|
|
{
|
|
|
|
JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url);
|
|
|
|
}
|
|
|
|
// now initiate the toolbar
|
|
|
|
$this->toolbar = JToolbar::getInstance();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Escapes a value for output in a view script.
|
|
|
|
*
|
|
|
|
* @param mixed $var The output to escape.
|
|
|
|
*
|
|
|
|
* @return mixed The escaped value.
|
|
|
|
*/
|
|
|
|
public function escape($var, $sorten = false, $length = 40)
|
|
|
|
{
|
|
|
|
// use the helper htmlEscape method instead.
|
|
|
|
return ComponentbuilderHelper::htmlEscape($var, $this->_charset, $sorten, $length);
|
|
|
|
}
|
|
|
|
}
|