| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: view.html.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla 5 * @subpackage Weblinks 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant 9 * to the GNU General Public License, and as distributed it includes or 10 * is derivative of works licensed under the GNU General Public License or 11 * other free or open source software licenses. 12 * See COPYRIGHT.php for copyright notices and details. 13 */ 14 15 // Check to ensure this file is included in Joomla! 16 defined('_JEXEC') or die( 'Restricted access' ); 17 18 jimport( 'joomla.application.component.view'); 19 20 /** 21 * HTML View class for the WebLinks component 22 * 23 * @static 24 * @package Joomla 25 * @subpackage Weblinks 26 * @since 1.0 27 */ 28 class WeblinksViewWeblink extends JView 29 { 30 function display($tpl = null) 31 { 32 global $mainframe; 33 34 if($this->getLayout() == 'form') { 35 $this->_displayForm($tpl); 36 return; 37 } 38 39 //get the weblink 40 $weblink =& $this->get('data'); 41 42 if ($weblink->url) { 43 // redirects to url if matching id found 44 $mainframe->redirect($weblink->url); 45 } 46 47 parent::display($tpl); 48 } 49 50 function _displayForm($tpl) 51 { 52 global $mainframe, $option; 53 54 $db =& JFactory::getDBO(); 55 $uri =& JFactory::getURI(); 56 $user =& JFactory::getUser(); 57 $model =& $this->getModel(); 58 59 60 $lists = array(); 61 62 //get the weblink 63 $weblink =& $this->get('data'); 64 $isNew = ($weblink->id < 1); 65 66 // fail if checked out not by 'me' 67 if ($model->isCheckedOut( $user->get('id') )) { 68 $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The weblink' ), $weblink->title ); 69 $mainframe->redirect( 'index.php?option='. $option, $msg ); 70 } 71 72 // Edit or Create? 73 if (!$isNew) 74 { 75 $model->checkout( $user->get('id') ); 76 } 77 else 78 { 79 // initialise new record 80 $weblink->published = 1; 81 $weblink->approved = 1; 82 $weblink->order = 0; 83 $weblink->catid = JRequest::getVar( 'catid', 0, 'post', 'int' ); 84 } 85 86 // build the html select list for ordering 87 $query = 'SELECT ordering AS value, title AS text' 88 . ' FROM #__weblinks' 89 . ' WHERE catid = ' . (int) $weblink->catid 90 . ' ORDER BY ordering'; 91 92 $lists['ordering'] = JHTML::_('list.specificordering', $weblink, $weblink->id, $query ); 93 94 // build list of categories 95 $lists['catid'] = JHTML::_('list.category', 'catid', $option, intval( $weblink->catid ) ); 96 // build the html select list 97 $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $weblink->published ); 98 99 //clean weblink data 100 JFilterOutput::objectHTMLSafe( $weblink, ENT_QUOTES, 'description' ); 101 102 $file = JPATH_COMPONENT.DS.'models'.DS.'weblink.xml'; 103 $params = new JParameter( $weblink->params, $file ); 104 105 $this->assignRef('lists', $lists); 106 $this->assignRef('weblink', $weblink); 107 $this->assignRef('params', $params); 108 109 parent::display($tpl); 110 } 111 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |