| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/brest/components/com_djcatalog2/views/itemform/ |
Upload File : |
<?php
/**
* @package DJ-Catalog2
* @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
* @license http://www.gnu.org/licenses GNU/GPL
* @author url: http://dj-extensions.com
* @author email contact@dj-extensions.com
*/
defined('_JEXEC') or die;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
jimport('joomla.application.component.view');
class Djcatalog2ViewItemform extends HtmlView {
protected $state;
protected $item;
protected $form;
public function __construct($config = array())
{
parent::__construct($config);
$this->_addPath('template', JPATH_ROOT.'/components/com_djcatalog2'. '/themes/default/views/itemform');
$theme = DJCatalog2ThemeHelper::getThemeName();
if ($theme && $theme != 'default') {
$this->_addPath('template', JPATH_ROOT.'/components/com_djcatalog2'. '/themes/'.$theme.'/views/itemform');
}
}
public function display($tpl = null)
{
$app = Factory::getApplication();
$user = Factory::getUser();
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$this->params = Djcatalog2Helper::getParams();
// Check for errors.
if (count($errors = $this->get('Errors'))) {
throw new Joomla\CMS\MVC\View\GenericDataException(implode("\n", $errors), 500);
return false;
}
$authorised = false;
if (empty($this->item->id)) {
$authorised = $user->authorise('core.create', 'com_djcatalog2');
}
else {
if ($user->authorise('core.edit', 'com_djcatalog2')) {
$authorised = true;
} else {
$ownerId = (int) $this->item->created_by;
if (!$user->guest && $ownerId == $user->id && $user->authorise('core.edit.own', 'com_djcatalog2')) {
$authorised = true;
}
}
}
if ($authorised !== true) {
if ((bool)$user->guest && empty($this->item->id)) {
$return_url = base64_encode(DJCatalogHelperRoute::getMyItemsRoute());
$app->enqueueMessage(Text::_('COM_DJCATALOG2_PLEASE_LOGIN'));
$app->redirect(Route::_('index.php?option=com_users&view=login&return='.$return_url, false), 303);
return true;
} else {
throw new Joomla\CMS\MVC\View\GenericDataException(Text::_('JERROR_ALERTNOAUTHOR'), 403);
return false;
}
}
$document = Factory::getDocument();
//Joomla\CMS\HTML\HTMLHelper::_('behavior.framework');
//Joomla\CMS\HTML\HTMLHelper::_('behavior.calendar');
$document->addScriptDeclaration('var djc_joomla_base_url = \''.Uri::base().'\';');
$document->addScript(JURI::base() . "components/com_djcatalog2/views/itemform/itemform.js");
$document->addScript(JURI::base() . "components/com_djcatalog2/assets/nicEdit/nicEdit.js");
$this->_prepareDocument();
parent::display($tpl);
}
protected function _prepareDocument() {
$app = Factory::getApplication();
$title = ($this->item->id > 0) ? Text::sprintf('COM_DJCATALOG2_ITEM_EDIT_HEADING', $this->item->name) : Text::_('COM_DJCATALOG2_ITEM_SUBMISSION_HEADING');
$this->params->set('page_heading', $title);
if ($app->getCfg('sitename_pagetitles', 0)) {
if ($app->getCfg('sitename_pagetitles', 0) == '2') {
$title = Text::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
} else {
$title = Text::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
}
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description'))
{
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords'))
{
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots'))
{
$this->document->setMetadata('robots', $this->params->get('robots'));
}
}
}
?>