2021-03-05 03:08:47 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
2024-03-09 19:47:28 +00:00
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2021-03-05 03:08:47 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');
|
|
|
|
?>
|
|
|
|
###BOM###
|
|
|
|
|
|
|
|
// No direct access to this file
|
|
|
|
defined('_JEXEC') or die('Restricted access');###LICENSE_LOCKED_DEFINED###
|
2022-05-25 08:30:55 +00:00
|
|
|
|
2021-03-08 22:36:30 +00:00
|
|
|
###ADMIN_VIEW_HTML_HEADER###
|
2022-05-25 08:30:55 +00:00
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
/**
|
2022-05-25 08:30:55 +00:00
|
|
|
* ###View### Html View class
|
2021-03-05 03:08:47 +00:00
|
|
|
*/
|
2022-05-25 08:30:55 +00:00
|
|
|
class ###Component###View###View### extends HtmlView
|
2021-03-05 03:08:47 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* display method of View
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function display($tpl = null)
|
|
|
|
{
|
|
|
|
// set params
|
2024-03-09 19:47:28 +00:00
|
|
|
$this->params = ComponentHelper::getParams('com_###component###');
|
2021-03-05 03:08:47 +00:00
|
|
|
// Assign the variables
|
|
|
|
$this->form = $this->get('Form');
|
|
|
|
$this->item = $this->get('Item');
|
|
|
|
$this->script = $this->get('Script');
|
|
|
|
$this->state = $this->get('State');
|
|
|
|
// get action permissions
|
|
|
|
$this->canDo = ###Component###Helper::getActions('###view###', $this->item);
|
|
|
|
// get input
|
2024-03-09 19:47:28 +00:00
|
|
|
$jinput = Factory::getApplication()->input;
|
2021-03-05 03:08:47 +00:00
|
|
|
$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;
|
|
|
|
}###LINKEDVIEWITEMS###
|
|
|
|
|
|
|
|
// Set the toolbar
|
|
|
|
$this->addToolBar();
|
2024-03-09 19:47:28 +00:00
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
// Check for errors.
|
|
|
|
if (count($errors = $this->get('Errors')))
|
|
|
|
{
|
|
|
|
throw new Exception(implode("\n", $errors), 500);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Display the template
|
|
|
|
parent::display($tpl);
|
|
|
|
|
|
|
|
// Set the document
|
|
|
|
$this->setDocument();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Setting the toolbar
|
|
|
|
*/
|
|
|
|
protected function addToolBar()
|
|
|
|
{
|
|
|
|
###ADDTOOLBAR###
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Escapes a value for output in a view script.
|
|
|
|
*
|
|
|
|
* @param mixed $var The output to escape.
|
|
|
|
*
|
|
|
|
* @return mixed The escaped value.
|
|
|
|
*/
|
|
|
|
public function escape($var)
|
|
|
|
{
|
|
|
|
if(strlen($var) > 30)
|
|
|
|
{
|
2024-03-09 19:47:28 +00:00
|
|
|
// use the helper htmlEscape method instead and shorten the string
|
|
|
|
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset, true, 30);
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
// use the helper htmlEscape method instead.
|
2024-03-09 19:47:28 +00:00
|
|
|
return Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::html($var, $this->_charset);
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Method to set up the document properties
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function setDocument()
|
|
|
|
{
|
|
|
|
$isNew = ($this->item->id < 1);
|
2024-03-09 19:47:28 +00:00
|
|
|
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_###COMPONENT###_###VIEW###_NEW' : 'COM_###COMPONENT###_###VIEW###_EDIT'));
|
|
|
|
Html::_('stylesheet', "administrator/components/com_###component###/assets/css/###view###.css", ['version' => 'auto']);###AJAXTOKE######LINKEDVIEWTABLESCRIPTS###
|
|
|
|
Html::_('script', $this->script, ['version' => 'auto']);
|
|
|
|
Html::_('script', "administrator/components/com_###component###/views/###view###/submitbutton.js", ['version' => 'auto']);###DOCUMENT_CUSTOM_PHP###
|
|
|
|
Text::script('view not acceptable. Error');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the Document (helper method toward Joomla 4 and 5)
|
|
|
|
*/
|
|
|
|
public function getDocument()
|
|
|
|
{
|
|
|
|
$this->document ??= JFactory::getDocument();
|
|
|
|
|
|
|
|
return $this->document;
|
2021-03-05 03:08:47 +00:00
|
|
|
}
|
|
|
|
}
|