Your IP : 216.73.216.240
<?php
/**
*----------------------------------------------------------------------------
* iCagenda Events Management Extension for Joomla!
*----------------------------------------------------------------------------
* @version 3.8.8 2022-07-28
*
* @package iCagenda.Site
* @link https://www.icagenda.com
*
* @author Cyril Rezé
* @copyright (c) 2012-2024 Cyril Rezé / iCagenda. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE.txt
*
* @since 1.0
*----------------------------------------------------------------------------
*/
defined('_JEXEC') or die;
/**
* HTML Manager View class for the iCagenda component
*
* @since 3.8.0
*/
class iCagendaViewManager extends JViewLegacy
{
protected $form;
protected $item;
protected $state;
/**
* Should we show a captcha form for the submission of the event?
*
* @var bool
* @since 3.8.0
*/
// protected $captchaEnabled = false;
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*
* @since 3.8.0
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
// Get model data.
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->form = $this->get('Form');
$this->return_page = $this->get('ReturnPage');
if (empty($this->item->id))
{
// $authorised = $user->authorise('core.create', 'com_icagenda') || count($user->getAuthorisedCategories('com_icagenda', 'core.create'));
$authorised = false;
}
else
{
$authorised = $this->item->params->get('access-edit');
}
if ($authorised !== true)
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$app->setHeader('status', 403, true);
return false;
}
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
// Create a shortcut to the parameters.
$params = &$this->state->params;
// Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx', ''));
$this->params = $params;
// Override global params with event specific params
$this->params->merge($this->item->params);
$this->user = $user;
// Propose current language as default when creating new article
// if (empty($this->item->id) && JLanguageMultilang::isEnabled())
// {
// $lang = JFactory::getLanguage()->getTag();
// $this->form->setFieldAttribute('language', 'default', $lang);
// }
// $captchaSet = $params->get('captcha', JFactory::getApplication()->get('captcha', '0'));
// foreach (JPluginHelper::getPlugin('captcha') as $plugin)
// {
// if ($captchaSet === $plugin->name)
// {
// $this->captchaEnabled = true;
// break;
// }
// }
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document
*
* @return void
*
* @since 3.8.0
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
// $title = null;
if ($app->input->get('layout') == 'event_edit')
{
$this->params->def('page_heading', JText::_('COM_ICAGENDA_LEGEND_EDIT_EVENT'));
}
// $title = $this->params->def('page_title', JText::_('COM_ICAGENDA_LEGEND_EDIT_EVENT'));
// if ($app->get('sitename_pagetitles', 0) == 1)
// {
// $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
// }
// elseif ($app->get('sitename_pagetitles', 0) == 2)
// {
// $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
// }
$this->document->setTitle($this->item->title);
$pathway = $app->getPathWay();
$pathway->addItem($this->item->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'));
}
}
}