- md5
- 94a7a6b406663f45aae7267b3a0ec582
- sha1
- d0a07770029254c30cd7e6cfef67bf0d0c41de26
- sha256
- bc5b763151189f04b30232c548d10b3c05727db89f88270a5461882d8f5b792f
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
<?php
/**
* @version $Id: view.html.php 10094 2008-03-02 04:35:10Z instance $
* @package Joomla
* @subpackage Weblinks
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
jimport( 'joomla.application.component.view');
/**
* HTML View class for the WebLinks component
*
* @static
* @package Joomla
* @subpackage Weblinks
* @since 1.0
*/
class WeblinksViewWeblink extends JView
{
function display($tpl = null)
{
global $mainframe;
if($this->getLayout() == 'form') {
$this->_displayForm($tpl);
return;
}
//get the weblink
$weblink =& $this->get('data');
if ($weblink->url) {
// redirects to url if matching id found
$mainframe->redirect($weblink->url);
}
parent::display($tpl);
}
function _displayForm($tpl)
{
global $mainframe, $option;
$db =& JFactory::getDBO();
$uri =& JFactory::getURI();
$user =& JFactory::getUser();
$model =& $this->getModel();
$lists = array();
//get the weblink
$weblink =& $this->get('data');
$isNew = ($weblink->id < 1);
// fail if checked out not by 'me'
if ($model->isCheckedOut( $user->get('id') )) {
$msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The weblink' ), $weblink->title );
$mainframe->redirect( 'index.php?option='. $option, $msg );
}
// Edit or Create?
if (!$isNew)
{
$model->checkout( $user->get('id') );
}
else
{
// initialise new record
$weblink->published = 1;
$weblink->approved = 1;
$weblink->order = 0;
$weblink->catid = JRequest::getVar( 'catid', 0, 'post', 'int' );
}
// build the html select list for ordering
$query = 'SELECT ordering AS value, title AS text'
. ' FROM #__weblinks'
. ' WHERE catid = ' . (int) $weblink->catid
. ' ORDER BY ordering';
$lists['ordering'] = JHTML::_('list.specificordering', $weblink, $weblink->id, $query );
// build list of categories
$lists['catid'] = JHTML::_('list.category', 'catid', $option, intval( $weblink->catid ) );
// build the html select list
$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $weblink->published );
//clean weblink data
JFilterOutput::objectHTMLSafe( $weblink, ENT_QUOTES, 'description' );
$file = JPATH_COMPONENT.DS.'models'.DS.'weblink.xml';
$params = new JParameter( $weblink->params, $file );
$this->assignRef('lists', $lists);
$this->assignRef('weblink', $weblink);
$this->assignRef('params', $params);
parent::display($tpl);
}
}
The same content is in 2 releases, Joomla 1.5.2 to 1.5.3. See them all, or every version of this file.