mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-02-04 18:28:25 +00:00
missing change
This commit is contained in:
parent
3389bf4902
commit
99f239c8a5
@ -10,44 +10,53 @@
|
|||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HTML View class for the WebLinks component
|
* HTML Weblink View class for the Weblinks component
|
||||||
*
|
*
|
||||||
* @since 1.5
|
* @since __DEPLOY_VERSION__
|
||||||
*/
|
*/
|
||||||
class WeblinksViewWeblink extends JViewLegacy
|
class WeblinksViewWeblink extends JViewLegacy
|
||||||
{
|
{
|
||||||
protected $state;
|
|
||||||
|
|
||||||
protected $item;
|
protected $item;
|
||||||
|
|
||||||
|
protected $params;
|
||||||
|
|
||||||
|
protected $state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the view.
|
* Execute and display a template script.
|
||||||
*
|
*
|
||||||
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
|
* @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.
|
* @return mixed A string if successful, otherwise an Error object.
|
||||||
|
*
|
||||||
|
* @since __DEPLOY_VERSION__
|
||||||
*/
|
*/
|
||||||
public function display($tpl = null)
|
public function display($tpl = null)
|
||||||
{
|
{
|
||||||
// Get some data from the models
|
$dispatcher = JEventDispatcher::getInstance();
|
||||||
$item = $this->get('Item');
|
|
||||||
|
|
||||||
if ($this->getLayout() == 'edit')
|
$this->item = $this->get('Item');
|
||||||
{
|
$this->state = $this->get('State');
|
||||||
$this->_displayEdit($tpl);
|
$this->params = $this->state->get('params');
|
||||||
|
|
||||||
return;
|
// Create a shortcut for $item.
|
||||||
}
|
$item = $this->item;
|
||||||
|
|
||||||
if ($item->url)
|
$offset = $this->state->get('list.offset');
|
||||||
{
|
|
||||||
// Redirects to url if matching id found
|
$dispatcher->trigger('onContentPrepare', array ('com_weblinks.weblink', &$item, &$item->params, $offset));
|
||||||
JFactory::getApplication()->redirect($item->url);
|
|
||||||
}
|
$item->event = new stdClass;
|
||||||
else
|
|
||||||
{
|
$results = $dispatcher->trigger('onContentAfterTitle', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
||||||
// @TODO create proper error handling
|
$item->event->afterDisplayTitle = trim(implode("\n", $results));
|
||||||
JFactory::getApplication()->redirect(JRoute::_('index.php'), JText::_('COM_WEBLINKS_ERROR_WEBLINK_NOT_FOUND'), 'notice');
|
|
||||||
}
|
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
||||||
|
$item->event->beforeDisplayContent = trim(implode("\n", $results));
|
||||||
|
|
||||||
|
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
||||||
|
$item->event->afterDisplayContent = trim(implode("\n", $results));
|
||||||
|
|
||||||
|
parent::display($tpl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user