- md5
- 8cc68eae9951a7b71930cc1f01f7e165
- sha1
- 9e3587750e88b922cc7fe4380a05a3c4d7a2aa4d
- sha256
- 0dcbff0e2356204373be57ff6f6ad9b737fe47f4fd86a4dc999a702fd94e6d87
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
<?php
/**
* @version $Id: view.html.php 20250 2011-01-10 14:27:02Z chdemko $
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
jimport('joomla.application.component.view');
/**
* HTML Article View class for the Weblinks component
*
* @package Joomla.Site
* @subpackage com_weblinks
* @since 1.5
*/
class WeblinksViewForm extends JView
{
protected $form;
protected $item;
protected $return_page;
protected $state;
public function display($tpl = null)
{
// Initialise variables.
$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_weblinks') || (count($user->getAuthorisedCategories('com_weblinks', 'core.create'))));
}
else {
$authorised = $user->authorise('core.edit', 'com_weblinks.weblink.'.$this->item->id);
}
if ($authorised !== true) {
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
return false;
}
if (!empty($this->item)) {
$this->form->bind($this->item);
}
// 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;
$this->user = $user;
$this->_prepareDocument();
parent::display($tpl);
}
/**
* Prepares the document
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu) {
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
} else {
$this->params->def('page_heading', JText::_('COM_WEBLINKS_FORM_EDIT_WEBLINK'));
}
$title = $this->params->def('page_title', JText::_('COM_WEBLINKS_FORM_EDIT_WEBLINK'));
if ($app->getCfg('sitename_pagetitles', 0)) {
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
}
$this->document->setTitle($title);
}
}
No other release has this exact content. See every version of this file.