Stable release of v5.0.0-alpha1

First alpha release of Component Builder towards Joomla 5 (very unstable...).
This commit is contained in:
2024-03-09 21:52:51 +02:00
parent 3c91a5cdbb
commit 87cd4305bb
3040 changed files with 296309 additions and 269802 deletions

View File

@ -0,0 +1,236 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Admin_custom_tabs;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Admin_custom_tabs Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Admin_custom_tabs view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('admin_custom_tabs', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_NEW' : 'COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('admin_custom_tabs.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('admin_custom_tabs.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('admin_custom_tabs.edit'))
{
// We can save the record.
ToolbarHelper::save('admin_custom_tabs.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('admin_custom_tabs.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('admin_custom_tabs.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('admin_custom_tabs.create'))
{
ToolbarHelper::apply('admin_custom_tabs.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('admin_custom_tabs.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('admin_custom_tabs.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('admin_custom_tabs.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('admin_custom_tabs.edit'))
{
// We can save the new record
ToolbarHelper::apply('admin_custom_tabs.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('admin_custom_tabs.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('admin_custom_tabs.create'))
{
ToolbarHelper::custom('admin_custom_tabs.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('admin_custom_tabs.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('admin_custom_tabs.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.admin_custom_tabs', $this->item->id);
}
if ($this->canDo->get('admin_custom_tabs.create'))
{
ToolbarHelper::custom('admin_custom_tabs.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('admin_custom_tabs.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('admin_custom_tabs');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_NEW' : 'COM_COMPONENTBUILDER_ADMIN_CUSTOM_TABS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,251 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Admin_fields;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Admin_fields Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Admin_fields view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('admin_fields', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_ADMIN_FIELDS_NEW' : 'COM_COMPONENTBUILDER_ADMIN_FIELDS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('admin_fields.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('admin_fields.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('admin_fields.edit'))
{
// We can save the record.
ToolbarHelper::save('admin_fields.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('admin_fields.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('admin_fields.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('admin_fields.create'))
{
ToolbarHelper::apply('admin_fields.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('admin_fields.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('admin_fields.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('admin_fields.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('admin_fields.edit'))
{
// We can save the new record
ToolbarHelper::apply('admin_fields.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('admin_fields.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('admin_fields.create'))
{
ToolbarHelper::custom('admin_fields.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('admin_fields.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('admin_fields.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.admin_fields', $this->item->id);
}
if ($this->canDo->get('admin_fields.create'))
{
ToolbarHelper::custom('admin_fields.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('admin_fields.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('admin_fields');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_ADMIN_FIELDS_NEW' : 'COM_COMPONENTBUILDER_ADMIN_FIELDS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
// add the Uikit v2 extra style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 extra JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']);
Text::script('COM_COMPONENTBUILDER_THE_BNONE_DBB_OPTION_WILL_REMOVE_THIS_FIELD_FROM_BEING_SAVED_IN_THE_DATABASE');
Text::script('COM_COMPONENTBUILDER_ONLY_USE_THE_BNONE_DBB_OPTION_IF_YOU_ARE_PLANNING_ON_TARGETING_THIS_FIELD_WITH_JAVASCRIPTCUSTOM_PHP_TO_MOVE_ITS_VALUE_INTO_ANOTHER_FIELD_THAT_DOES_GET_SAVED_TO_THE_DATABASE');
Text::script('COM_COMPONENTBUILDER_THE_BSHOW_IN_ALL_LIST_VIEWSB_OPTION_WILL_ADD_THIS_FIELD_TO_ALL_LIST_VIEWS_ADMIN_AMP_LINKED');
Text::script('COM_COMPONENTBUILDER_THE_BONLY_IN_ADMIN_LIST_VIEWB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_ADMIN_LIST_VIEW_NOT_TO_ANY_LINKED_VIEWS');
Text::script('COM_COMPONENTBUILDER_THE_BONLY_IN_LINKED_LIST_VIEWSB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_LINKED_LIST_VIEW_IF_THIS_VIEW_GETS_LINKED_TO_OTHER_VIEW_NOT_TO_THIS_ADMIN_LIST_VIEW');
Text::script('COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_NOT_AVAILABLE_TO_THE_FIELD_IF_BNONE_DBB_OPTION_IS_SELECTED');
Text::script('COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_ONLY_AVAILABLE_TO_THE_FIELD_IF_BSHOW_IN_LIST_VIEWB_OPTION_IS_SELECTED');
Text::script('COM_COMPONENTBUILDER_THE_BMULTI_FILTERB_SELECTION_OPTION_ALLOWS_THE_USER_TO_SELECT_MORE_THEN_ONE_VALUE_IN_THIS_FILTERFIELD_PLEASE_NOTE_THAT_THIS_OPTION_BONLY_WORKSB_WITH_THE_BNEWB_FILTERS_THAT_LOAD_ABOVE_THE_ADMIN_LIST_VIEW_YOU_CAN_SELECT_THE_NEW_FILTER_OPTION_WHENWHERE_YOU_ADD_THE_VIEW_TO_THE_COMPONENT');
Text::script('COM_COMPONENTBUILDER_THE_BSINGLE_FILTERB_SELECTION_OPTION_ALLOWS_THE_USER_TO_SELECT_JUST_ONE_VALUE_IN_THIS_FILTERFIELD');
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,238 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Admin_fields_conditions;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Admin_fields_conditions Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Admin_fields_conditions view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('admin_fields_conditions', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_NEW' : 'COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('admin_fields_conditions.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('admin_fields_conditions.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('admin_fields_conditions.edit'))
{
// We can save the record.
ToolbarHelper::save('admin_fields_conditions.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('admin_fields_conditions.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('admin_fields_conditions.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('admin_fields_conditions.create'))
{
ToolbarHelper::apply('admin_fields_conditions.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('admin_fields_conditions.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('admin_fields_conditions.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('admin_fields_conditions.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('admin_fields_conditions.edit'))
{
// We can save the new record
ToolbarHelper::apply('admin_fields_conditions.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('admin_fields_conditions.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('admin_fields_conditions.create'))
{
ToolbarHelper::custom('admin_fields_conditions.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('admin_fields_conditions.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('admin_fields_conditions.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.admin_fields_conditions', $this->item->id);
}
if ($this->canDo->get('admin_fields_conditions.create'))
{
ToolbarHelper::custom('admin_fields_conditions.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('admin_fields_conditions.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('admin_fields_conditions');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_NEW' : 'COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,242 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Admin_fields_relations;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Admin_fields_relations Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Admin_fields_relations view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('admin_fields_relations', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_NEW' : 'COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('admin_fields_relations.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('admin_fields_relations.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('admin_fields_relations.edit'))
{
// We can save the record.
ToolbarHelper::save('admin_fields_relations.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('admin_fields_relations.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('admin_fields_relations.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('admin_fields_relations.create'))
{
ToolbarHelper::apply('admin_fields_relations.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('admin_fields_relations.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('admin_fields_relations.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('admin_fields_relations.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('admin_fields_relations.edit'))
{
// We can save the new record
ToolbarHelper::apply('admin_fields_relations.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('admin_fields_relations.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('admin_fields_relations.create'))
{
ToolbarHelper::custom('admin_fields_relations.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('admin_fields_relations.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('admin_fields_relations.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.admin_fields_relations', $this->item->id);
}
if ($this->canDo->get('admin_fields_relations.create'))
{
ToolbarHelper::custom('admin_fields_relations.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('admin_fields_relations.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('admin_fields_relations');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_NEW' : 'COM_COMPONENTBUILDER_ADMIN_FIELDS_RELATIONS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,248 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Admin_view;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Admin_view Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Admin_view view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('admin_view', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_ADMIN_VIEW_NEW' : 'COM_COMPONENTBUILDER_ADMIN_VIEW_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('admin_view.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('admin_view.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('admin_view.edit'))
{
// We can save the record.
ToolbarHelper::save('admin_view.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('admin_view.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('admin_view.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('admin_view.create'))
{
ToolbarHelper::apply('admin_view.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('admin_view.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('admin_view.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('admin_view.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('admin_view.edit'))
{
// We can save the new record
ToolbarHelper::apply('admin_view.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('admin_view.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('admin_view.create'))
{
ToolbarHelper::custom('admin_view.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('admin_view.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('admin_view.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.admin_view', $this->item->id);
}
if ($this->canDo->get('admin_view.create'))
{
ToolbarHelper::custom('admin_view.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('admin_view.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('admin_view');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_ADMIN_VIEW_NEW' : 'COM_COMPONENTBUILDER_ADMIN_VIEW_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
// add the Uikit v2 extra style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 extra JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,224 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Admin_views;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Admin_views
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Admin_views view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'desc'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('admin_view');
$this->canEdit = $this->canDo->get('admin_view.edit');
$this->canState = $this->canDo->get('admin_view.edit.state');
$this->canCreate = $this->canDo->get('admin_view.create');
$this->canDelete = $this->canDo->get('admin_view.delete');
$this->canBatch = ($this->canDo->get('admin_view.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_ADMIN_VIEWS'), 'stack');
if ($this->canCreate)
{
ToolbarHelper::addNew('admin_view.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('admin_view.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('admin_views.publish');
ToolbarHelper::unpublishList('admin_views.unpublish');
ToolbarHelper::archiveList('admin_views.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('admin_views.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'admin_views.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('admin_views.trash');
}
}
if ($this->user->authorise('admin_view.run_expansion', 'com_componentbuilder'))
{
// add Run Expansion button.
ToolbarHelper::custom('admin_views.runExpansion', 'expand-2 custom-button-runexpansion', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false);
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('admin_views');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_ADMIN_VIEWS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.system_name' => Text::_('COM_COMPONENTBUILDER_ADMIN_VIEW_SYSTEM_NAME_LABEL'),
'a.name_single' => Text::_('COM_COMPONENTBUILDER_ADMIN_VIEW_NAME_SINGLE_LABEL'),
'a.short_description' => Text::_('COM_COMPONENTBUILDER_ADMIN_VIEW_SHORT_DESCRIPTION_LABEL'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Admins_custom_tabs;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Admins_custom_tabs
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Admins_custom_tabs view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('admin_custom_tabs');
$this->canEdit = $this->canDo->get('admin_custom_tabs.edit');
$this->canState = $this->canDo->get('admin_custom_tabs.edit.state');
$this->canCreate = $this->canDo->get('admin_custom_tabs.create');
$this->canDelete = $this->canDo->get('admin_custom_tabs.delete');
$this->canBatch = ($this->canDo->get('admin_custom_tabs.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('admin_custom_tabs.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('admin_custom_tabs.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('admins_custom_tabs.publish');
ToolbarHelper::unpublishList('admins_custom_tabs.unpublish');
ToolbarHelper::archiveList('admins_custom_tabs.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('admins_custom_tabs.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'admins_custom_tabs.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('admins_custom_tabs.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('admins_custom_tabs');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_ADMINS_CUSTOM_TABS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Admins_fields;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Admins_fields
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Admins_fields view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('admin_fields');
$this->canEdit = $this->canDo->get('admin_fields.edit');
$this->canState = $this->canDo->get('admin_fields.edit.state');
$this->canCreate = $this->canDo->get('admin_fields.create');
$this->canDelete = $this->canDo->get('admin_fields.delete');
$this->canBatch = ($this->canDo->get('admin_fields.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_ADMINS_FIELDS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('admin_fields.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('admin_fields.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('admins_fields.publish');
ToolbarHelper::unpublishList('admins_fields.unpublish');
ToolbarHelper::archiveList('admins_fields.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('admins_fields.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'admins_fields.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('admins_fields.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('admins_fields');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_ADMINS_FIELDS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Admins_fields_conditions;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Admins_fields_conditions
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Admins_fields_conditions view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('admin_fields_conditions');
$this->canEdit = $this->canDo->get('admin_fields_conditions.edit');
$this->canState = $this->canDo->get('admin_fields_conditions.edit.state');
$this->canCreate = $this->canDo->get('admin_fields_conditions.create');
$this->canDelete = $this->canDo->get('admin_fields_conditions.delete');
$this->canBatch = ($this->canDo->get('admin_fields_conditions.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('admin_fields_conditions.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('admin_fields_conditions.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('admins_fields_conditions.publish');
ToolbarHelper::unpublishList('admins_fields_conditions.unpublish');
ToolbarHelper::archiveList('admins_fields_conditions.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('admins_fields_conditions.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'admins_fields_conditions.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('admins_fields_conditions.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('admins_fields_conditions');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_CONDITIONS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Admins_fields_relations;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Admins_fields_relations
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Admins_fields_relations view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('admin_fields_relations');
$this->canEdit = $this->canDo->get('admin_fields_relations.edit');
$this->canState = $this->canDo->get('admin_fields_relations.edit.state');
$this->canCreate = $this->canDo->get('admin_fields_relations.create');
$this->canDelete = $this->canDo->get('admin_fields_relations.delete');
$this->canBatch = ($this->canDo->get('admin_fields_relations.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('admin_fields_relations.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('admin_fields_relations.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('admins_fields_relations.publish');
ToolbarHelper::unpublishList('admins_fields_relations.unpublish');
ToolbarHelper::archiveList('admins_fields_relations.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('admins_fields_relations.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'admins_fields_relations.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('admins_fields_relations.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('admins_fields_relations');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_ADMINS_FIELDS_RELATIONS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,218 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Class_extendings;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Class_extendings
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Class_extendings view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('class_extends');
$this->canEdit = $this->canDo->get('class_extends.edit');
$this->canState = $this->canDo->get('class_extends.edit.state');
$this->canCreate = $this->canDo->get('class_extends.create');
$this->canDelete = $this->canDo->get('class_extends.delete');
$this->canBatch = ($this->canDo->get('class_extends.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('class_extends.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('class_extends.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('class_extendings.publish');
ToolbarHelper::unpublishList('class_extendings.unpublish');
ToolbarHelper::archiveList('class_extendings.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('class_extendings.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'class_extendings.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('class_extendings.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('class_extendings');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDINGS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.name' => Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_NAME_LABEL'),
'a.extension_type' => Text::_('COM_COMPONENTBUILDER_CLASS_EXTENDS_EXTENSION_TYPE_LABEL'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,248 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Class_extends;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Class_extends Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Class_extends view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('class_extends', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_EXTENDS_NEW' : 'COM_COMPONENTBUILDER_CLASS_EXTENDS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('class_extends.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('class_extends.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('class_extends.edit'))
{
// We can save the record.
ToolbarHelper::save('class_extends.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('class_extends.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('class_extends.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('class_extends.create'))
{
ToolbarHelper::apply('class_extends.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('class_extends.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('class_extends.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('class_extends.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('class_extends.edit'))
{
// We can save the new record
ToolbarHelper::apply('class_extends.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('class_extends.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('class_extends.create'))
{
ToolbarHelper::custom('class_extends.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('class_extends.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('class_extends.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.class_extends', $this->item->id);
}
if ($this->canDo->get('class_extends.create'))
{
ToolbarHelper::custom('class_extends.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('class_extends.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('class_extends');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_EXTENDS_NEW' : 'COM_COMPONENTBUILDER_CLASS_EXTENDS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
// add the Uikit v2 extra style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 extra JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,248 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Class_method;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Class_method Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Class_method view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('class_method', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_METHOD_NEW' : 'COM_COMPONENTBUILDER_CLASS_METHOD_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('class_method.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('class_method.edit'))
{
// We can save the record.
ToolbarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('class_method.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('class_method.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('class_method.create'))
{
ToolbarHelper::apply('class_method.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('class_method.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('class_method.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('class_method.edit'))
{
// We can save the new record
ToolbarHelper::apply('class_method.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('class_method.create'))
{
ToolbarHelper::custom('class_method.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('class_method.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('class_method.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.class_method', $this->item->id);
}
if ($this->canDo->get('class_method.create'))
{
ToolbarHelper::custom('class_method.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('class_method.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('class_method');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_METHOD_NEW' : 'COM_COMPONENTBUILDER_CLASS_METHOD_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
// add the Uikit v2 extra style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 extra JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,219 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Class_methods;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Class_methods
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Class_methods view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'desc'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('class_method');
$this->canEdit = $this->canDo->get('class_method.edit');
$this->canState = $this->canDo->get('class_method.edit.state');
$this->canCreate = $this->canDo->get('class_method.create');
$this->canDelete = $this->canDo->get('class_method.delete');
$this->canBatch = ($this->canDo->get('class_method.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_CLASS_METHODS'), 'cube');
if ($this->canCreate)
{
ToolbarHelper::addNew('class_method.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('class_method.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('class_methods.publish');
ToolbarHelper::unpublishList('class_methods.unpublish');
ToolbarHelper::archiveList('class_methods.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('class_methods.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'class_methods.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('class_methods.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('class_methods');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_CLASS_METHODS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.name' => Text::_('COM_COMPONENTBUILDER_CLASS_METHOD_NAME_LABEL'),
'a.visibility' => Text::_('COM_COMPONENTBUILDER_CLASS_METHOD_VISIBILITY_LABEL'),
'a.extension_type' => Text::_('COM_COMPONENTBUILDER_CLASS_METHOD_EXTENSION_TYPE_LABEL'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,219 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Class_properties;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Class_properties
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Class_properties view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'desc'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('class_property');
$this->canEdit = $this->canDo->get('class_property.edit');
$this->canState = $this->canDo->get('class_property.edit.state');
$this->canCreate = $this->canDo->get('class_property.create');
$this->canDelete = $this->canDo->get('class_property.delete');
$this->canBatch = ($this->canDo->get('class_property.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_CLASS_PROPERTIES'), 'cube');
if ($this->canCreate)
{
ToolbarHelper::addNew('class_property.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('class_property.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('class_properties.publish');
ToolbarHelper::unpublishList('class_properties.unpublish');
ToolbarHelper::archiveList('class_properties.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('class_properties.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'class_properties.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('class_properties.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('class_properties');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_CLASS_PROPERTIES'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.name' => Text::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_NAME_LABEL'),
'a.visibility' => Text::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_VISIBILITY_LABEL'),
'a.extension_type' => Text::_('COM_COMPONENTBUILDER_CLASS_PROPERTY_EXTENSION_TYPE_LABEL'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,248 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Class_property;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Class_property Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Class_property view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('class_property', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_PROPERTY_NEW' : 'COM_COMPONENTBUILDER_CLASS_PROPERTY_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('class_property.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('class_property.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('class_property.edit'))
{
// We can save the record.
ToolbarHelper::save('class_property.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('class_property.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('class_property.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('class_property.create'))
{
ToolbarHelper::apply('class_property.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('class_property.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('class_property.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('class_property.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('class_property.edit'))
{
// We can save the new record
ToolbarHelper::apply('class_property.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('class_property.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('class_property.create'))
{
ToolbarHelper::custom('class_property.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('class_property.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('class_property.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.class_property', $this->item->id);
}
if ($this->canDo->get('class_property.create'))
{
ToolbarHelper::custom('class_property.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('class_property.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('class_property');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_PROPERTY_NEW' : 'COM_COMPONENTBUILDER_CLASS_PROPERTY_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
// add the Uikit v2 extra style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 extra JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,819 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Compiler;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\HeaderCheck;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Layout\LayoutHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\FormHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Compiler
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Display the view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// get component params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// get the application
$this->app ??= Factory::getApplication();
// get the user object
$this->user ??= $this->app->getIdentity();
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('compiler');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
// Initialise variables.
$this->items = $this->get('Items');
// get the success message if set
$this->SuccessMessage = $this->app->getUserState('com_componentbuilder.success_message', false);
// get active components
$this->Components = $this->get('Components');
// get the needed form fields
$this->form = $this->getDynamicForm();
// set the compiler artwork from global settings
$this->builder_gif_size = $this->params->get('builder_gif_size', '480-272');
// only run these checks if he has access
if ($this->canDo->get('compiler.compiler_animations'))
{
// if the new artwork is not being targeted hide download option of artwork
if ('480-540' !== $this->builder_gif_size)
{
$this->canDo->set('compiler.compiler_animations', false);
}
// we count of all the files are already there
else
{
$directory_path = JPATH_ROOT . "/administrator/components/com_componentbuilder/assets/images/builder-gif";
// get all the gif files in the gif folder
$all_gifs = null;
if (is_dir($directory_path) && is_readable($directory_path))
{
$all_gifs = scandir($directory_path);
}
// check if we have any values
if ($all_gifs !== null && ArrayHelper::check($all_gifs))
{
// count number of files but remove the 2 dot values
$num_gifs = count($all_gifs) - 2;
// if we have more or the same number of files that are in the array, the we hide the download option
if ($num_gifs >= ComponentbuilderHelper::getDynamicContentSize('builder-gif', '480-540'))
{
$this->canDo->set('compiler.compiler_animations', false);
}
}
}
}
// just get it on the page for now....
ToolbarHelper::inlinehelp();
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
// add the tool bar
$this->addToolBar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode(PHP_EOL, $errors), 500);
}
parent::display($tpl);
// Set the html view document stuff
$this->_prepareDocument();
}
// These are subform layouts used in JCB
// LayoutHelper::render('sectionjcb', [?]); // added to ensure the layout are loaded
// LayoutHelper::render('repeatablejcb', [?]); // added to ensure the layout are loaded
/**
* Get the dynamic build form fields needed on the page
*
* @return Form|null The form fields
*
* @since 3.2.0
*/
public function getDynamicForm(): ?Form
{
if(ArrayHelper::check($this->Components))
{
// start the form
$form = new Form('Builder');
$form->load('<form
addruleprefix="VDM\Component\Componentbuilder\Administrator\Rule"
addfieldprefix="VDM\Component\Componentbuilder\Administrator\Field">
<config><inlinehelp button="show"/></config>
<fieldset name="builder"></fieldset>
<fieldset name="advanced"></fieldset></form>');
// sales attributes
$attributes = [
'type' => 'radio',
'name' => 'backup',
'label' => 'COM_COMPONENTBUILDER_ADD_TO_BACKUP_FOLDER_AMP_SALES_SERVER_SMALLIF_SETSMALL',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_ZIPPED_PACKAGE_OF_THE_COMPONENT_BE_MOVED_TO_THE_LOCAL_BACKUP_AND_REMOTE_SALES_SERVER_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_THOSE_VALUES_SET',
'default' => '0'];
// set the sales options
$options = [
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// repository attributes
$attributes = [
'type' => 'radio',
'name' => 'repository',
'label' => 'COM_COMPONENTBUILDER_ADD_TO_REPOSITORY_FOLDER',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_COMPONENT_BE_MOVED_TO_YOUR_LOCAL_REPOSITORY_FOLDER',
'default' => '1'];
// start the repository options
$options = [
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// placeholders attributes
$attributes = [
'type' => 'radio',
'name' => 'add_placeholders',
'label' => 'COM_COMPONENTBUILDER_ADD_CUSTOM_CODE_PLACEHOLDERS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_JCB_INSERT_THE_CUSTOM_CODE_PLACEHOLDERS_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_CUSTOM_CODE',
'default' => '2'];
// start the placeholders options
$options = [
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// debuglinenr attributes
$attributes = [
'type' => 'radio',
'name' => 'debug_line_nr',
'label' => 'COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_ADD_CORRESPONDING_LINE_NUMBERS_TO_THE_DYNAMIC_COMMENTS_SO_TO_SEE_WHERE_IN_THE_COMPILER_THE_LINES_OF_CODE_WAS_BUILD_THIS_WILL_HELP_IF_YOU_NEED_TO_GET_MORE_TECHNICAL_WITH_AN_ISSUE_ON_GITHUB_OR_EVEN_FOR_YOUR_OWN_DEBUGGING',
'default' => '2'];
$options = [
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// minify attributes
$attributes = [
'type' => 'radio',
'name' => 'minify',
'label' => 'COM_COMPONENTBUILDER_MINIFY_JAVASCRIPT',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_JAVASCRIPT_BE_MINIFIED_IN_THE_COMPONENT',
'default' => '2'];
$options = [
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// powers attributes
$attributes = [
'type' => 'radio',
'name' => 'powers',
'label' => 'COM_COMPONENTBUILDER_ADD_POWERS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_JCB_ADD_ANY_POWERS_THAT_ARE_CONNECTED_TO_THIS_COMPONENT_THIS_MAY_BE_HELPFUL_IF_YOU_ARE_LOADING_POWERS_VIA_ANOTHER_COMPONENT_AND_WOULD_LIKE_TO_AVOID_ADDING_IT_TO_BOTH_JUST_REMEMBER_THAT_IN_THIS_CASE_YOU_NEED_TO_LOAD_THE_POWERS_VIA_A_PLUGIN',
'default' => '2'];
$options = [
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// component attributes
$attributes = [
'type' => 'list',
'name' => 'component_id',
'label' => 'COM_COMPONENTBUILDER_COMPONENTS',
'class' => 'list_class',
'description' => 'COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_COMPILE',
'required' => 'true'];
// start the component options
$options = [];
$options[''] = 'COM_COMPONENTBUILDER__SELECT_COMPONENT_';
// load component options from array
foreach($this->Components as $component)
{
$options[(int) $component->id] = $this->escape($component->name);
}
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// Joomla Versions attributes
$attributes = [
'type' => 'list',
'name' => 'joomla_version',
'label' => 'COM_COMPONENTBUILDER_JOOMLA_VERSION',
'class' => 'list_class',
'description' => 'COM_COMPONENTBUILDER_WHAT_VERSION_OF_JOOMLA_WOULD_YOU_LIKE_TO_TARGET',
'default' => '3'];
// start the joomla versions options
$options = [
'3' => 'COM_COMPONENTBUILDER_JOOMLA_THREE',
'4' => 'COM_COMPONENTBUILDER_JOOMLA_FOUR',
'5' => 'COM_COMPONENTBUILDER_JOOMLA_FIVE'
];
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// Joomla Version 3 attributes
$attributes = [
'type' => 'note',
'name' => 'joomla_version_note_three',
'description' => 'COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_THREE',
'class' => 'alert alert-success',
'showon' => 'joomla_version:3'];
// add to form
$xml = FormHelper::xml($attributes);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// Joomla Version 4 and five attributes
$attributes = [
'type' => 'note',
'name' => 'joomla_version_note_four',
'description' => 'COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FOUR',
'class' => 'alert alert-success',
'showon' => 'joomla_version:4'];
// add to form
$xml = FormHelper::xml($attributes);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// Joomla Version 5 and five attributes
$attributes = [
'type' => 'note',
'name' => 'joomla_version_note_five',
'description' => 'COM_COMPONENTBUILDER_YOUR_COMPONENT_WILL_BE_COMPILED_TO_WORK_IN_JOOMLA_FIVE',
'class' => 'alert alert-success',
'showon' => 'joomla_version:5'];
// add to form
$xml = FormHelper::xml($attributes);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// Advanced Options
$attributes = [
'type' => 'radio',
'name' => 'show_advanced_options',
'label' => 'COM_COMPONENTBUILDER_SHOW_ADVANCED_OPTIONS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_SEE_THE_ADVANCED_COMPILER_OPTIONS',
'default' => '0'];
// start the advanced options switch
$options = [
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'builder');
}
// Advanced Options note attributes
$attributes = [
'type' => 'note',
'name' => 'show_advanced_options_note',
'label' => "COM_COMPONENTBUILDER_ADVANCED_OPTIONS",
'heading' => 'h3',
'showon' => 'show_advanced_options:1'];
// add to form
$xml = FormHelper::xml($attributes);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// powers repository attributes
$attributes = [
'type' => 'radio',
'name' => 'powers_repository',
'label' => 'COM_COMPONENTBUILDER_ACTIVATE_SUPER_POWERS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_THIS_ADDS_POWERS_TO_A_LOCAL_REPOSITORY_FOLDER_ALL_BAPPROVEDB_POWERS_LINKED_TO_THIS_COMPONENT_WILL_BE_MOVED_TO_YOUR_BLOCALB_POWERS_REPOSITORY_FOLDER_INTO_THEIR_SELECTIVE_TARGET_PATHS_THIS_LOCAL_FOLDER_PATH_MUST_BE_SET_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_BSUPER_POWERB_TAB',
'default' => '2',
'showon' => 'show_advanced_options:1'];
// start the repository options
$options = [
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO'];
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// powers local path to repositories attributes
$attributes = [
'type' => 'text',
'name' => 'local_powers_repository_path',
'label' => 'COM_COMPONENTBUILDER_LOCAL_POWERS_REPOSITORY_PATH',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_HERE_YOU_CAN_SET_THE_PATH_TO_THE_SUPER_POWERS_LOCAL_REPOSITORY_FOLDER_WHERE_BLAYERCOREB_AND_ALL_TARGETED_BLAYEROWNB_SUB_PATHS_WILL_BE_PLACED_WITH_THEIR_SELECTIVE_BSWITCHAPPROVEDB_POWERS',
'default' => $this->params->get('local_powers_repository_path', ''),
'showon' => 'show_advanced_options:1[AND]powers_repository:1'];
// add to form
$xml = FormHelper::xml($attributes);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Indentation attributes
$attributes = [
'type' => 'radio',
'name' => 'indentation_value',
'label' => 'COM_COMPONENTBUILDER_INDENTATION_OPTIONS',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_WHICH_TYPE_OF_INDENTATION_WOULD_YOU_LIKE_TO_USE_PLEASE_NOTE_THAT_THIS_DOES_NOT_YET_IMPACT_THE_STATIC_TEMPLATES',
'default' => '1',
'showon' => 'show_advanced_options:1'];
// start the indentation options
$options = [
'1' => 'COM_COMPONENTBUILDER_TAB',
'2' => 'COM_COMPONENTBUILDER_TWO_SPACES',
'4' => 'COM_COMPONENTBUILDER_FOUR_SPACES'];
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date attributes
$attributes = [
'type' => 'radio',
'name' => 'add_build_date',
'label' => 'COM_COMPONENTBUILDER_BUILD_DATE',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_WOULD_YOU_LIKE_TO_OVERRIDE_THE_BUILD_DATE',
'default' => '1',
'showon' => 'show_advanced_options:1'];
// start the build date options
$options = [
'1' => 'COM_COMPONENTBUILDER_DEFAULT',
'2' => 'COM_COMPONENTBUILDER_MANUAL',
'3' => 'COM_COMPONENTBUILDER_COMPONENT'];
// add to form
$xml = FormHelper::xml($attributes, $options);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date note attributes
$attributes = [
'type' => 'note',
'name' => 'add_build_date_note_two',
'description' => 'COM_COMPONENTBUILDER_ALLOWS_YOU_TO_OVERRIDE_THE_BUILD_DATE_BY_SELECTING_A_DATE_MANUALLY_FROM_THE_CALENDER',
'class' => 'alert alert-info',
'showon' => 'show_advanced_options:1[AND]add_build_date:2'];
// add to form
$xml = FormHelper::xml($attributes);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date note attributes
$attributes = [
'type' => 'note',
'name' => 'add_build_date_note_three',
'description' => "COM_COMPONENTBUILDER_THE_COMPONENTS_LAST_MODIFIED_DATE_WILL_BE_USED",
'class' => 'alert alert-info',
'showon' => 'show_advanced_options:1[AND]add_build_date:3'];
// add to form
$xml = FormHelper::xml($attributes);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date calendar attributes
$attributes = [
'type' => 'calendar',
'name' => 'build_date',
'label' => 'COM_COMPONENTBUILDER_SELECT_BUILD_DATE',
'format' => '%Y-%m-%d',
'filter' => 'user_utc',
'default' => 'now',
'size' => '22',
'showon' => 'show_advanced_options:1[AND]add_build_date:2'];
// add to form
$xml = FormHelper::xml($attributes);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date note attributes
$attributes = [
'type' => 'note',
'name' => 'donations_note',
'label' => "COM_COMPONENTBUILDER_DONATIONS",
'description' => $this->getSupportMessage(),
'class' => 'alert alert-success',
'heading' => 'h1',
'showon' => 'show_advanced_options:1'];
// add to form
$xml = FormHelper::xml($attributes);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// Build date note line attributes
$attributes = [
'type' => 'note',
'name' => 'donations_note_line',
'description' => '<hr />',
'showon' => 'show_advanced_options:1'];
// add to form
$xml = FormHelper::xml($attributes);
if ($xml instanceof \SimpleXMLElement)
{
$form->setField($xml, null, true, 'advanced');
}
// return the form array
return $form;
}
return null;
}
/**
* Get the dynamic support request/gratitude message
*
* @return string The support message
*
* @since 3.2.0
*/
protected function getSupportMessage(): string
{
return LayoutHelper::render('jcbsupportmessage', []);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Only load jQuery if needed. (default is true)
if ($this->params->get('add_jquery_framework', 1) == 1)
{
Html::_('jquery.framework');
}
// Load the header checker class.
// Initialize the header checker.
$HeaderCheck = new HeaderCheck();
// 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)
{
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit'.$style.$size.'.css', ['version' => 'auto']);
}
// The uikit js.
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
{
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit'.$size.'.js', ['version' => 'auto']);
}
// Load the needed uikit components in this view.
$uikitComp = $this->get('UikitComp');
if ($uikit != 2 && isset($uikitComp) && ArrayHelper::check($uikitComp))
{
// loading...
foreach ($uikitComp as $class)
{
foreach (ComponentbuilderHelper::$uk_components[$class] as $name)
{
// check if the CSS file exists.
if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css'))
{
// load the css.
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/'.$name.$style.$size.'.css', ['version' => 'auto']);
}
// check if the JavaScript file exists.
if (File::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js'))
{
// load the js.
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/'.$name.$size.'.js', ['version' => 'auto'], ['type' => 'text/javascript', 'async' => 'async']);
}
}
}
}
// add marked library
Html::_('script', 'administrator/components/com_componentbuilder/custom/marked.js', ['version' => 'auto']);
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// Set the Custom JS script to view
$this->getDocument()->addScriptDeclaration("
function getComponentDetails_server(id) {
let getUrl = JRouter(\"index.php?option=com_componentbuilder&task=ajax.getComponentDetails&format=json&raw=true\");
let request = new URLSearchParams();
if (token.length > 0 && id > 0) {
request.append(token, '1');
request.append('id', id);
}
return fetch(getUrl + '&' + request.toString(), {
method: 'GET',
headers: {
'Accept': 'application/json'
}
}).then(response => response.json());
}
function getComponentDetails(id) {
getComponentDetails_server(id).then(function(result) {
if (result.html) {
document.getElementById('component-details').innerHTML = result.html;
if (result.preferred_joomla_version) {
jQuery('#joomla_version').val(result.preferred_joomla_version);
jQuery('#joomla_version').trigger('liszt:updated');
jQuery('#joomla_version').trigger('change');
}
}
});
}
document.addEventListener('DOMContentLoaded', function() {
fetchNoticeboard(\"https://vdm.bz/componentbuilder-noticeboard-md\", \".noticeboard-md\", true);
fetchNoticeboard(\"https://vdm.bz/componentbuilder-pro-noticeboard-md\", \".proboard-md\", false);
});
function fetchNoticeboard(url, selector, processGetIS) {
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.text();
})
.then(board => {
var elements = document.querySelectorAll(selector);
if (board.length > 5) {
let html_board = marked.parse(board);
elements.forEach(element => {
element.innerHTML = html_board;
});
if (processGetIS) {
getIS(1, board).then(result => {
if (result) {
document.querySelectorAll(\".vdm-new-notice\").forEach(element => {
element.style.display = 'block';
});
getIS(2, board);
}
});
}
} else {
elements.forEach(element => {
element.innerHTML = all_is_good;
});
}
})
.catch(error => {
console.error('There was an error!', error);
document.querySelectorAll(selector).forEach(element => {
element.innerHTML = all_is_good;
});
});
}
// to check is READ/NEW
function getIS(type, notice) {
let getUrl = \"\";
if (type === 1) {
getUrl = JRouter(\"index.php?option=com_componentbuilder&task=ajax.isNew&format=json&raw=true\");
} else if (type === 2) {
getUrl = JRouter(\"index.php?option=com_componentbuilder&task=ajax.isRead&format=json&raw=true\");
}
let request = new URLSearchParams();
if (token.length > 0 && notice.length) {
request.append(token, \"1\");
request.append(\"notice\", notice);
}
return fetch(getUrl, {
method: \"POST\",
headers: {
\"Content-Type\": \"application/x-www-form-urlencoded;charset=UTF-8\"
},
body: request
}).then(response => response.json());
}
");
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
// hide the main menu
$this->app->input->set('hidemainmenu', true);
// add title to the page
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPILER'),'cogs');
// add cpanel button
ToolbarHelper::custom('compiler.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false);
if ($this->canDo->get('compiler.run_expansion'))
{
// add Run Expansion button.
ToolbarHelper::custom('compiler.runExpansion', 'expand-2 custom-button-runexpansion', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false);
}
if ($this->canDo->get('compiler.translate'))
{
// add Translate button.
ToolbarHelper::custom('compiler.runTranslator', 'comments-2 custom-button-runtranslator', '', 'COM_COMPONENTBUILDER_TRANSLATE', false);
}
if ($this->canDo->get('compiler.compiler_animations'))
{
// add Compiler Animations button.
ToolbarHelper::custom('compiler.getDynamicContent', 'download custom-button-getdynamiccontent', '', 'COM_COMPONENTBUILDER_COMPILER_ANIMATIONS', false);
}
if ($this->canDo->get('compiler.clear_tmp'))
{
// add Clear tmp button.
ToolbarHelper::custom('compiler.clearTmp', 'purge custom-button-cleartmp', '', 'COM_COMPONENTBUILDER_CLEAR_TMP', false);
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('compiler');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = false, int $length = 40)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,236 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_admin_views;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_admin_views Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_admin_views view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_admin_views', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_admin_views.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_admin_views.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_admin_views.edit'))
{
// We can save the record.
ToolbarHelper::save('component_admin_views.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_admin_views.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_admin_views.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_admin_views.create'))
{
ToolbarHelper::apply('component_admin_views.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_admin_views.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_admin_views.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_admin_views.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_admin_views.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_admin_views.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_admin_views.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_admin_views.create'))
{
ToolbarHelper::custom('component_admin_views.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_admin_views.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_admin_views.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_admin_views', $this->item->id);
}
if ($this->canDo->get('component_admin_views.create'))
{
ToolbarHelper::custom('component_admin_views.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_admin_views.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_admin_views');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,230 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_config;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_config Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_config view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_config', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_CONFIG_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_CONFIG_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_config.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_config.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_config.edit'))
{
// We can save the record.
ToolbarHelper::save('component_config.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_config.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_config.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_config.create'))
{
ToolbarHelper::apply('component_config.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_config.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_config.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_config.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_config.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_config.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_config.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_config.create'))
{
ToolbarHelper::custom('component_config.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_config.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_config.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_config', $this->item->id);
}
if ($this->canDo->get('component_config.create'))
{
ToolbarHelper::custom('component_config.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_config.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_config');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_CONFIG_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_CONFIG_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,236 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_custom_admin_menus;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_custom_admin_menus Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_custom_admin_menus view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_menus', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_custom_admin_menus.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_custom_admin_menus.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_custom_admin_menus.edit'))
{
// We can save the record.
ToolbarHelper::save('component_custom_admin_menus.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_custom_admin_menus.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_custom_admin_menus.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_custom_admin_menus.create'))
{
ToolbarHelper::apply('component_custom_admin_menus.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_custom_admin_menus.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_custom_admin_menus.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_custom_admin_menus.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_custom_admin_menus.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_custom_admin_menus.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_custom_admin_menus.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_custom_admin_menus.create'))
{
ToolbarHelper::custom('component_custom_admin_menus.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_custom_admin_menus.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_custom_admin_menus.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_custom_admin_menus', $this->item->id);
}
if ($this->canDo->get('component_custom_admin_menus.create'))
{
ToolbarHelper::custom('component_custom_admin_menus.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_custom_admin_menus.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_custom_admin_menus');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,236 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_custom_admin_views;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_custom_admin_views Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_custom_admin_views view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_views', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_custom_admin_views.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_custom_admin_views.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_custom_admin_views.edit'))
{
// We can save the record.
ToolbarHelper::save('component_custom_admin_views.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_custom_admin_views.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_custom_admin_views.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_custom_admin_views.create'))
{
ToolbarHelper::apply('component_custom_admin_views.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_custom_admin_views.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_custom_admin_views.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_custom_admin_views.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_custom_admin_views.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_custom_admin_views.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_custom_admin_views.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_custom_admin_views.create'))
{
ToolbarHelper::custom('component_custom_admin_views.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_custom_admin_views.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_custom_admin_views.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_custom_admin_views', $this->item->id);
}
if ($this->canDo->get('component_custom_admin_views.create'))
{
ToolbarHelper::custom('component_custom_admin_views.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_custom_admin_views.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_custom_admin_views');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,248 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_dashboard;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_dashboard Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_dashboard view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_dashboard', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_dashboard.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_dashboard.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_dashboard.edit'))
{
// We can save the record.
ToolbarHelper::save('component_dashboard.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_dashboard.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_dashboard.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_dashboard.create'))
{
ToolbarHelper::apply('component_dashboard.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_dashboard.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_dashboard.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_dashboard.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_dashboard.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_dashboard.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_dashboard.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_dashboard.create'))
{
ToolbarHelper::custom('component_dashboard.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_dashboard.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_dashboard.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_dashboard', $this->item->id);
}
if ($this->canDo->get('component_dashboard.create'))
{
ToolbarHelper::custom('component_dashboard.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_dashboard.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_dashboard');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
// add the Uikit v2 extra style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 extra JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,230 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_files_folders;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_files_folders Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_files_folders view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_files_folders', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_files_folders.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_files_folders.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_files_folders.edit'))
{
// We can save the record.
ToolbarHelper::save('component_files_folders.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_files_folders.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_files_folders.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_files_folders.create'))
{
ToolbarHelper::apply('component_files_folders.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_files_folders.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_files_folders.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_files_folders.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_files_folders.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_files_folders.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_files_folders.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_files_folders.create'))
{
ToolbarHelper::custom('component_files_folders.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_files_folders.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_files_folders.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_files_folders', $this->item->id);
}
if ($this->canDo->get('component_files_folders.create'))
{
ToolbarHelper::custom('component_files_folders.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_files_folders.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_files_folders');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,230 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_modules;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_modules Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_modules view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_modules', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_MODULES_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_MODULES_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_modules.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_modules.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_modules.edit'))
{
// We can save the record.
ToolbarHelper::save('component_modules.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_modules.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_modules.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_modules.create'))
{
ToolbarHelper::apply('component_modules.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_modules.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_modules.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_modules.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_modules.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_modules.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_modules.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_modules.create'))
{
ToolbarHelper::custom('component_modules.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_modules.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_modules.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_modules', $this->item->id);
}
if ($this->canDo->get('component_modules.create'))
{
ToolbarHelper::custom('component_modules.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_modules.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_modules');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_MODULES_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_MODULES_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,230 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_mysql_tweaks;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_mysql_tweaks Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_mysql_tweaks view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_mysql_tweaks', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_mysql_tweaks.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_mysql_tweaks.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_mysql_tweaks.edit'))
{
// We can save the record.
ToolbarHelper::save('component_mysql_tweaks.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_mysql_tweaks.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_mysql_tweaks.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_mysql_tweaks.create'))
{
ToolbarHelper::apply('component_mysql_tweaks.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_mysql_tweaks.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_mysql_tweaks.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_mysql_tweaks.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_mysql_tweaks.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_mysql_tweaks.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_mysql_tweaks.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_mysql_tweaks.create'))
{
ToolbarHelper::custom('component_mysql_tweaks.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_mysql_tweaks.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_mysql_tweaks.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_mysql_tweaks', $this->item->id);
}
if ($this->canDo->get('component_mysql_tweaks.create'))
{
ToolbarHelper::custom('component_mysql_tweaks.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_mysql_tweaks.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_mysql_tweaks');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,230 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_placeholders;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_placeholders Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_placeholders view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_placeholders', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_placeholders.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_placeholders.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_placeholders.edit'))
{
// We can save the record.
ToolbarHelper::save('component_placeholders.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_placeholders.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_placeholders.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_placeholders.create'))
{
ToolbarHelper::apply('component_placeholders.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_placeholders.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_placeholders.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_placeholders.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_placeholders.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_placeholders.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_placeholders.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_placeholders.create'))
{
ToolbarHelper::custom('component_placeholders.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_placeholders.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_placeholders.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_placeholders', $this->item->id);
}
if ($this->canDo->get('component_placeholders.create'))
{
ToolbarHelper::custom('component_placeholders.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_placeholders.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_placeholders');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,230 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_plugins;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_plugins Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_plugins view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_plugins', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_plugins.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_plugins.edit'))
{
// We can save the record.
ToolbarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_plugins.create'))
{
ToolbarHelper::apply('component_plugins.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_plugins.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_plugins.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_plugins.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_plugins.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_plugins.create'))
{
ToolbarHelper::custom('component_plugins.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_plugins.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_plugins.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_plugins', $this->item->id);
}
if ($this->canDo->get('component_plugins.create'))
{
ToolbarHelper::custom('component_plugins.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_plugins.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_plugins');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_PLUGINS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,238 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_router;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_router Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_router view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_router', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_router.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_router.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_router.edit'))
{
// We can save the record.
ToolbarHelper::save('component_router.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_router.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_router.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_router.create'))
{
ToolbarHelper::apply('component_router.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_router.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_router.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_router.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_router.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_router.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_router.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_router.create'))
{
ToolbarHelper::custom('component_router.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_router.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_router.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_router', $this->item->id);
}
if ($this->canDo->get('component_router.create'))
{
ToolbarHelper::custom('component_router.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_router.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_router');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_ROUTER_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,236 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_site_views;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_site_views Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_site_views view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_site_views', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_site_views.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_site_views.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_site_views.edit'))
{
// We can save the record.
ToolbarHelper::save('component_site_views.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_site_views.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_site_views.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_site_views.create'))
{
ToolbarHelper::apply('component_site_views.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_site_views.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_site_views.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_site_views.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_site_views.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_site_views.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_site_views.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_site_views.create'))
{
ToolbarHelper::custom('component_site_views.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_site_views.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_site_views.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_site_views', $this->item->id);
}
if ($this->canDo->get('component_site_views.create'))
{
ToolbarHelper::custom('component_site_views.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_site_views.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_site_views');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,230 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Component_updates;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Component_updates Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Component_updates view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_updates', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_UPDATES_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_UPDATES_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('component_updates.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('component_updates.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('component_updates.edit'))
{
// We can save the record.
ToolbarHelper::save('component_updates.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('component_updates.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('component_updates.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('component_updates.create'))
{
ToolbarHelper::apply('component_updates.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_updates.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('component_updates.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('component_updates.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('component_updates.edit'))
{
// We can save the new record
ToolbarHelper::apply('component_updates.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('component_updates.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('component_updates.create'))
{
ToolbarHelper::custom('component_updates.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('component_updates.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('component_updates.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.component_updates', $this->item->id);
}
if ($this->canDo->get('component_updates.create'))
{
ToolbarHelper::custom('component_updates.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('component_updates.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('component_updates');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_UPDATES_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_UPDATES_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,106 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Componentbuilder;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* View display method
* @return void
*/
function display($tpl = null)
{
// Assign data to the view
$this->icons = $this->get('Icons');
$this->contributors = ComponentbuilderHelper::getContributors();
// get the manifest details of the component
$this->manifest = ComponentbuilderHelper::manifest();
$this->wiki = $this->get('Wiki');
$this->noticeboard = $this->get('Noticeboard');
$this->readme = $this->get('Readme');
$this->version = $this->get('Version');
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
$canDo = ComponentbuilderHelper::getActions('componentbuilder');
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_DASHBOARD'), 'grid-2');
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('componentbuilder');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// set page title
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_DASHBOARD'));
// add manifest to page JavaScript
$this->getDocument()->addScriptDeclaration("var manifest = JSON.parse('" . json_encode($this->manifest) . "');", "text/javascript");
// add dashboard style sheets
Html::_('stylesheet', "administrator/components/com_componentbuilder/assets/css/dashboard.css", ['version' => 'auto']);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_admin_views;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_admin_views
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_admin_views view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_admin_views');
$this->canEdit = $this->canDo->get('component_admin_views.edit');
$this->canState = $this->canDo->get('component_admin_views.edit.state');
$this->canCreate = $this->canDo->get('component_admin_views.create');
$this->canDelete = $this->canDo->get('component_admin_views.delete');
$this->canBatch = ($this->canDo->get('component_admin_views.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_admin_views.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_admin_views.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_admin_views.publish');
ToolbarHelper::unpublishList('components_admin_views.unpublish');
ToolbarHelper::archiveList('components_admin_views.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_admin_views.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_admin_views.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_admin_views.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_admin_views');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_ADMIN_VIEWS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_config;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_config
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_config view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_config');
$this->canEdit = $this->canDo->get('component_config.edit');
$this->canState = $this->canDo->get('component_config.edit.state');
$this->canCreate = $this->canDo->get('component_config.create');
$this->canDelete = $this->canDo->get('component_config.delete');
$this->canBatch = ($this->canDo->get('component_config.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_CONFIG'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_config.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_config.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_config.publish');
ToolbarHelper::unpublishList('components_config.unpublish');
ToolbarHelper::archiveList('components_config.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_config.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_config.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_config.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_config');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_CONFIG'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_custom_admin_menus;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_custom_admin_menus
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_custom_admin_menus view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_menus');
$this->canEdit = $this->canDo->get('component_custom_admin_menus.edit');
$this->canState = $this->canDo->get('component_custom_admin_menus.edit.state');
$this->canCreate = $this->canDo->get('component_custom_admin_menus.create');
$this->canDelete = $this->canDo->get('component_custom_admin_menus.delete');
$this->canBatch = ($this->canDo->get('component_custom_admin_menus.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_custom_admin_menus.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_custom_admin_menus.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_custom_admin_menus.publish');
ToolbarHelper::unpublishList('components_custom_admin_menus.unpublish');
ToolbarHelper::archiveList('components_custom_admin_menus.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_custom_admin_menus.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_custom_admin_menus.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_custom_admin_menus.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_custom_admin_menus');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_MENUS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_custom_admin_views;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_custom_admin_views
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_custom_admin_views view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_custom_admin_views');
$this->canEdit = $this->canDo->get('component_custom_admin_views.edit');
$this->canState = $this->canDo->get('component_custom_admin_views.edit.state');
$this->canCreate = $this->canDo->get('component_custom_admin_views.create');
$this->canDelete = $this->canDo->get('component_custom_admin_views.delete');
$this->canBatch = ($this->canDo->get('component_custom_admin_views.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_custom_admin_views.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_custom_admin_views.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_custom_admin_views.publish');
ToolbarHelper::unpublishList('components_custom_admin_views.unpublish');
ToolbarHelper::archiveList('components_custom_admin_views.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_custom_admin_views.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_custom_admin_views.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_custom_admin_views.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_custom_admin_views');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_CUSTOM_ADMIN_VIEWS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_dashboard;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_dashboard
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_dashboard view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_dashboard');
$this->canEdit = $this->canDo->get('component_dashboard.edit');
$this->canState = $this->canDo->get('component_dashboard.edit.state');
$this->canCreate = $this->canDo->get('component_dashboard.create');
$this->canDelete = $this->canDo->get('component_dashboard.delete');
$this->canBatch = ($this->canDo->get('component_dashboard.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_dashboard.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_dashboard.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_dashboard.publish');
ToolbarHelper::unpublishList('components_dashboard.unpublish');
ToolbarHelper::archiveList('components_dashboard.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_dashboard.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_dashboard.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_dashboard.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_dashboard');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_DASHBOARD'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_files_folders;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_files_folders
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_files_folders view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_files_folders');
$this->canEdit = $this->canDo->get('component_files_folders.edit');
$this->canState = $this->canDo->get('component_files_folders.edit.state');
$this->canCreate = $this->canDo->get('component_files_folders.create');
$this->canDelete = $this->canDo->get('component_files_folders.delete');
$this->canBatch = ($this->canDo->get('component_files_folders.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_files_folders.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_files_folders.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_files_folders.publish');
ToolbarHelper::unpublishList('components_files_folders.unpublish');
ToolbarHelper::archiveList('components_files_folders.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_files_folders.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_files_folders.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_files_folders.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_files_folders');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_modules;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_modules
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_modules view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_modules');
$this->canEdit = $this->canDo->get('component_modules.edit');
$this->canState = $this->canDo->get('component_modules.edit.state');
$this->canCreate = $this->canDo->get('component_modules.create');
$this->canDelete = $this->canDo->get('component_modules.delete');
$this->canBatch = ($this->canDo->get('component_modules.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_MODULES'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_modules.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_modules.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_modules.publish');
ToolbarHelper::unpublishList('components_modules.unpublish');
ToolbarHelper::archiveList('components_modules.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_modules.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_modules.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_modules.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_modules');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_MODULES'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_mysql_tweaks;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_mysql_tweaks
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_mysql_tweaks view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_mysql_tweaks');
$this->canEdit = $this->canDo->get('component_mysql_tweaks.edit');
$this->canState = $this->canDo->get('component_mysql_tweaks.edit.state');
$this->canCreate = $this->canDo->get('component_mysql_tweaks.create');
$this->canDelete = $this->canDo->get('component_mysql_tweaks.delete');
$this->canBatch = ($this->canDo->get('component_mysql_tweaks.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_mysql_tweaks.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_mysql_tweaks.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_mysql_tweaks.publish');
ToolbarHelper::unpublishList('components_mysql_tweaks.unpublish');
ToolbarHelper::archiveList('components_mysql_tweaks.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_mysql_tweaks.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_mysql_tweaks.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_mysql_tweaks.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_mysql_tweaks');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_placeholders;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_placeholders
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_placeholders view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_placeholders');
$this->canEdit = $this->canDo->get('component_placeholders.edit');
$this->canState = $this->canDo->get('component_placeholders.edit.state');
$this->canCreate = $this->canDo->get('component_placeholders.create');
$this->canDelete = $this->canDo->get('component_placeholders.delete');
$this->canBatch = ($this->canDo->get('component_placeholders.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_placeholders.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_placeholders.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_placeholders.publish');
ToolbarHelper::unpublishList('components_placeholders.unpublish');
ToolbarHelper::archiveList('components_placeholders.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_placeholders.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_placeholders.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_placeholders.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_placeholders');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_PLACEHOLDERS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_plugins;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_plugins
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_plugins view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_plugins');
$this->canEdit = $this->canDo->get('component_plugins.edit');
$this->canState = $this->canDo->get('component_plugins.edit.state');
$this->canCreate = $this->canDo->get('component_plugins.create');
$this->canDelete = $this->canDo->get('component_plugins.delete');
$this->canBatch = ($this->canDo->get('component_plugins.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_PLUGINS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_plugins.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_plugins.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_plugins.publish');
ToolbarHelper::unpublishList('components_plugins.unpublish');
ToolbarHelper::archiveList('components_plugins.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_plugins.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_plugins.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_plugins.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_plugins');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_PLUGINS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_routers;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_routers
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_routers view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_router');
$this->canEdit = $this->canDo->get('component_router.edit');
$this->canState = $this->canDo->get('component_router.edit.state');
$this->canCreate = $this->canDo->get('component_router.create');
$this->canDelete = $this->canDo->get('component_router.delete');
$this->canBatch = ($this->canDo->get('component_router.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_ROUTERS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_router.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_router.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_routers.publish');
ToolbarHelper::unpublishList('components_routers.unpublish');
ToolbarHelper::archiveList('components_routers.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_routers.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_routers.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_routers.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_routers');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_ROUTERS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_site_views;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_site_views
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_site_views view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_site_views');
$this->canEdit = $this->canDo->get('component_site_views.edit');
$this->canState = $this->canDo->get('component_site_views.edit.state');
$this->canCreate = $this->canDo->get('component_site_views.create');
$this->canDelete = $this->canDo->get('component_site_views.delete');
$this->canBatch = ($this->canDo->get('component_site_views.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_site_views.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_site_views.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_site_views.publish');
ToolbarHelper::unpublishList('components_site_views.unpublish');
ToolbarHelper::archiveList('components_site_views.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_site_views.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_site_views.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_site_views.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_site_views');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_SITE_VIEWS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,216 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Components_updates;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Components_updates
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Components_updates view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'DESC'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('component_updates');
$this->canEdit = $this->canDo->get('component_updates.edit');
$this->canState = $this->canDo->get('component_updates.edit.state');
$this->canCreate = $this->canDo->get('component_updates.create');
$this->canDelete = $this->canDo->get('component_updates.delete');
$this->canBatch = ($this->canDo->get('component_updates.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_COMPONENTS_UPDATES'), 'joomla');
if ($this->canCreate)
{
ToolbarHelper::addNew('component_updates.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('component_updates.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('components_updates.publish');
ToolbarHelper::unpublishList('components_updates.unpublish');
ToolbarHelper::archiveList('components_updates.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('components_updates.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'components_updates.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('components_updates.trash');
}
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('components_updates');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_COMPONENTS_UPDATES'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,248 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Custom_admin_view;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Custom_admin_view Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Custom_admin_view view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('custom_admin_view', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NEW' : 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('core.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('custom_admin_view.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('core.edit'))
{
// We can save the record.
ToolbarHelper::save('custom_admin_view.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('custom_admin_view.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('custom_admin_view.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('core.create'))
{
ToolbarHelper::apply('custom_admin_view.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('custom_admin_view.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('custom_admin_view.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('custom_admin_view.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('core.edit'))
{
// We can save the new record
ToolbarHelper::apply('custom_admin_view.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('custom_admin_view.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('core.create'))
{
ToolbarHelper::custom('custom_admin_view.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('custom_admin_view.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.custom_admin_view', $this->item->id);
}
if ($this->canDo->get('core.create'))
{
ToolbarHelper::custom('custom_admin_view.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('custom_admin_view.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('custom_admin_view');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NEW' : 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
// add the Uikit v2 extra style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 extra JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,225 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Custom_admin_views;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Custom_admin_views
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Custom_admin_views view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'desc'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('custom_admin_view');
$this->canEdit = $this->canDo->get('core.edit');
$this->canState = $this->canDo->get('core.edit.state');
$this->canCreate = $this->canDo->get('core.create');
$this->canDelete = $this->canDo->get('core.delete');
$this->canBatch = ($this->canDo->get('custom_admin_view.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS'), 'screen');
if ($this->canCreate)
{
ToolbarHelper::addNew('custom_admin_view.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('custom_admin_view.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('custom_admin_views.publish');
ToolbarHelper::unpublishList('custom_admin_views.unpublish');
ToolbarHelper::archiveList('custom_admin_views.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('custom_admin_views.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'custom_admin_views.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('custom_admin_views.trash');
}
}
if ($this->user->authorise('custom_admin_view.get_snippets', 'com_componentbuilder'))
{
// add Get Snippets button.
ToolbarHelper::custom('custom_admin_views.getSnippets', 'search custom-button-getsnippets', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('custom_admin_views');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEWS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.system_name' => Text::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_SYSTEM_NAME_LABEL'),
'a.name' => Text::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NAME_LABEL'),
'a.description' => Text::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DESCRIPTION_LABEL'),
'g.name' => Text::_('COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_MAIN_GET_LABEL'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,251 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Custom_code;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Custom_code Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Custom_code view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('custom_code', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_CUSTOM_CODE_NEW' : 'COM_COMPONENTBUILDER_CUSTOM_CODE_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('custom_code.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('custom_code.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('custom_code.edit'))
{
// We can save the record.
ToolbarHelper::save('custom_code.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('custom_code.create'))
{
ToolbarHelper::apply('custom_code.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('custom_code.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('custom_code.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('custom_code.edit'))
{
// We can save the new record
ToolbarHelper::apply('custom_code.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('custom_code.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('custom_code.create'))
{
ToolbarHelper::custom('custom_code.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('custom_code.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('custom_code.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.custom_code', $this->item->id);
}
if ($this->canDo->get('custom_code.create'))
{
ToolbarHelper::custom('custom_code.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('custom_code.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('custom_code');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_CUSTOM_CODE_NEW' : 'COM_COMPONENTBUILDER_CUSTOM_CODE_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
// add the Uikit v2 extra style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 extra JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
// need to add some language strings
Text::script('COM_COMPONENTBUILDER_FUNCTION_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN');
Text::script('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_FUNCTION_NAME');
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,227 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Custom_codes;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Custom_codes
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Custom_codes view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'desc'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('custom_code');
$this->canEdit = $this->canDo->get('custom_code.edit');
$this->canState = $this->canDo->get('custom_code.edit.state');
$this->canCreate = $this->canDo->get('custom_code.create');
$this->canDelete = $this->canDo->get('custom_code.delete');
$this->canBatch = ($this->canDo->get('custom_code.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_CUSTOM_CODES'), 'shuffle');
if ($this->canCreate)
{
ToolbarHelper::addNew('custom_code.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('custom_code.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('custom_codes.publish');
ToolbarHelper::unpublishList('custom_codes.unpublish');
ToolbarHelper::archiveList('custom_codes.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('custom_codes.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'custom_codes.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('custom_codes.trash');
}
}
if ($this->user->authorise('custom_code.run_expansion', 'com_componentbuilder'))
{
// add Run Expansion button.
ToolbarHelper::custom('custom_codes.runExpansion', 'expand-2 custom-button-runexpansion', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false);
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('custom_codes');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_CUSTOM_CODES'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'g.system_name' => Text::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMPONENT_LABEL'),
'a.path' => Text::_('COM_COMPONENTBUILDER_CUSTOM_CODE_PATH_LABEL'),
'a.target' => Text::_('COM_COMPONENTBUILDER_CUSTOM_CODE_TARGET_LABEL'),
'a.type' => Text::_('COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL'),
'a.comment_type' => Text::_('COM_COMPONENTBUILDER_CUSTOM_CODE_COMMENT_TYPE_LABEL'),
'a.joomla_version' => Text::_('COM_COMPONENTBUILDER_CUSTOM_CODE_JOOMLA_VERSION_LABEL'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,248 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Dynamic_get;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Dynamic_get Html View class
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Dynamic_get view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// set params
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->state = $this->get('State');
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('dynamic_get', $this->item);
// get input
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
// set the referral string
$this->referral = '';
if ($this->refid && $this->ref)
{
// return to the item that referred to this item
$this->referral = '&ref=' . (string) $this->ref . '&refid=' . (int) $this->refid;
}
elseif($this->ref)
{
// return to the list view that referred to this item
$this->referral = '&ref=' . (string) $this->ref;
}
// check return value
if (!is_null($return))
{
// add the return value
$this->referral .= '&return=' . (string) $return;
}
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getApplication()->getIdentity();
$userId = $user->id;
$isNew = $this->item->id == 0;
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_DYNAMIC_GET_NEW' : 'COM_COMPONENTBUILDER_DYNAMIC_GET_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('dynamic_get.create') && $isNew)
{
// We can create the record.
ToolbarHelper::save('dynamic_get.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('dynamic_get.edit'))
{
// We can save the record.
ToolbarHelper::save('dynamic_get.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
ToolbarHelper::cancel('dynamic_get.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
ToolbarHelper::cancel('dynamic_get.cancel', 'JTOOLBAR_CLOSE');
}
}
else
{
if ($isNew)
{
// For new records, check the create permission.
if ($this->canDo->get('dynamic_get.create'))
{
ToolbarHelper::apply('dynamic_get.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('dynamic_get.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('dynamic_get.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
ToolbarHelper::cancel('dynamic_get.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('dynamic_get.edit'))
{
// We can save the new record
ToolbarHelper::apply('dynamic_get.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('dynamic_get.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('dynamic_get.create'))
{
ToolbarHelper::custom('dynamic_get.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('dynamic_get.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('dynamic_get.edit') && $canVersion)
{
ToolbarHelper::versions('com_componentbuilder.dynamic_get', $this->item->id);
}
if ($this->canDo->get('dynamic_get.create'))
{
ToolbarHelper::custom('dynamic_get.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
ToolbarHelper::cancel('dynamic_get.cancel', 'JTOOLBAR_CLOSE');
}
}
ToolbarHelper::divider();
ToolbarHelper::inlinehelp();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('dynamic_get');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 30)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$isNew = ($this->item->id < 1);
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_DYNAMIC_GET_NEW' : 'COM_COMPONENTBUILDER_DYNAMIC_GET_EDIT'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// Add Ajax Token
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
// add the Uikit v2 style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
// add the Uikit v2 extra style sheets
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 extra JavaScripts
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) \JUri::getInstance())) . "';");
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,224 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Component\Componentbuilder\Administrator\View\Dynamic_gets;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\Document\Document;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
// No direct access to this file
\defined('_JEXEC') or die;
/**
* Componentbuilder Html View class for the Dynamic_gets
*
* @since 1.6
*/
class HtmlView extends BaseHtmlView
{
/**
* Dynamic_gets view display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
* @since 1.6
*/
public function display($tpl = null)
{
// Assign data to the view
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->styles = $this->get('Styles');
$this->scripts = $this->get('Scripts');
$this->user ??= Factory::getApplication()->getIdentity();
// Load the filter form from xml.
$this->filterForm = $this->get('FilterForm');
// Load the active filters.
$this->activeFilters = $this->get('ActiveFilters');
// Add the list ordering clause.
$this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id'));
$this->listDirn = $this->escape($this->state->get('list.direction', 'desc'));
$this->saveOrder = $this->listOrder == 'a.ordering';
// set the return here value
$this->return_here = urlencode(base64_encode((string) Uri::getInstance()));
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('dynamic_get');
$this->canEdit = $this->canDo->get('dynamic_get.edit');
$this->canState = $this->canDo->get('dynamic_get.edit.state');
$this->canCreate = $this->canDo->get('dynamic_get.create');
$this->canDelete = $this->canDo->get('dynamic_get.delete');
$this->canBatch = ($this->canDo->get('dynamic_get.batch') && $this->canDo->get('core.batch'));
// If we don't have items we load the empty state
if (is_array($this->items) && !count((array) $this->items) && $this->isEmptyState = $this->get('IsEmptyState'))
{
$this->setLayout('emptystate');
}
// We don't need toolbar in the modal window.
if ($this->getLayout() !== 'modal')
{
$this->addToolbar();
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new \Exception(implode("\n", $errors), 500);
}
// Set the html view document stuff
$this->_prepareDocument();
// Display the template
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
* @since 1.6
*/
protected function addToolbar(): void
{
ToolbarHelper::title(Text::_('COM_COMPONENTBUILDER_DYNAMIC_GETS'), 'database');
if ($this->canCreate)
{
ToolbarHelper::addNew('dynamic_get.add');
}
// Only load if there are items
if (ArrayHelper::check($this->items))
{
if ($this->canEdit)
{
ToolbarHelper::editList('dynamic_get.edit');
}
if ($this->canState)
{
ToolbarHelper::publishList('dynamic_gets.publish');
ToolbarHelper::unpublishList('dynamic_gets.unpublish');
ToolbarHelper::archiveList('dynamic_gets.archive');
if ($this->canDo->get('core.admin'))
{
ToolbarHelper::checkin('dynamic_gets.checkin');
}
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
ToolbarHelper::deleteList('', 'dynamic_gets.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
ToolbarHelper::trash('dynamic_gets.trash');
}
}
if ($this->user->authorise('dynamic_get.run_expansion', 'com_componentbuilder'))
{
// add Run Expansion button.
ToolbarHelper::custom('dynamic_gets.runExpansion', 'expand-2 custom-button-runexpansion', '', 'COM_COMPONENTBUILDER_RUN_EXPANSION', false);
}
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('dynamic_gets');
if (StringHelper::check($this->help_url))
{
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
ToolbarHelper::preferences('com_componentbuilder');
}
}
/**
* Prepare some document related stuff.
*
* @return void
* @since 1.6
*/
protected function _prepareDocument(): void
{
// Load jQuery
Html::_('jquery.framework');
$this->getDocument()->setTitle(Text::_('COM_COMPONENTBUILDER_DYNAMIC_GETS'));
// add styles
foreach ($this->styles as $style)
{
Html::_('stylesheet', $style, ['version' => 'auto']);
}
// add scripts
foreach ($this->scripts as $script)
{
Html::_('script', $script, ['version' => 'auto']);
}
}
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
* @param bool $shorten The switch to shorten.
* @param int $length The shorting length.
*
* @return mixed The escaped value.
* @since 1.6
*/
public function escape($var, bool $shorten = true, int $length = 50)
{
if (!is_string($var))
{
return $var;
}
return StringHelper::html($var, $this->_charset ?? 'UTF-8', $shorten, $length);
}
/**
* Returns an array of fields the table can be sorted by
*
* @return array containing the field name to sort by as the key and display text as value
* @since 1.6
*/
protected function getSortFields()
{
return array(
'a.ordering' => Text::_('JGRID_HEADING_ORDERING'),
'a.published' => Text::_('JSTATUS'),
'a.name' => Text::_('COM_COMPONENTBUILDER_DYNAMIC_GET_NAME_LABEL'),
'a.main_source' => Text::_('COM_COMPONENTBUILDER_DYNAMIC_GET_MAIN_SOURCE_LABEL'),
'a.gettype' => Text::_('COM_COMPONENTBUILDER_DYNAMIC_GET_GETTYPE_LABEL'),
'a.id' => Text::_('JGRID_HEADING_ID')
);
}
}

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

Some files were not shown because too many files have changed in this diff Show More