| [ 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; 53 54 // Get some objects from the JApplication 55 $pathway =& $mainframe->getPathway(); 56 $document =& JFactory::getDocument(); 57 $model =& $this->getModel(); 58 $user =& JFactory::getUser(); 59 $uri =& JFactory::getURI(); 60 $params = &$mainframe->getParams(); 61 62 // Make sure you are logged in and have the necessary access rights 63 if ($user->get('gid') < 19) { 64 JResponse::setHeader('HTTP/1.0 403',true); 65 JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') ); 66 return; 67 } 68 69 //get the weblink 70 $weblink =& $this->get('data'); 71 $isNew = ($weblink->id < 1); 72 73 // Edit or Create? 74 if (!$isNew) 75 { 76 // Is this link checked out? If not by me fail 77 //if ($model->isCheckedOut($user->get('id'))) { 78 // $mainframe->redirect("index.php?option=$option", "The weblink $weblink->title is currently being edited by another administrator."); 79 //} 80 81 // Set page title 82 $menus = &JSite::getMenu(); 83 $menu = $menus->getActive(); 84 85 // because the application sets a default page title, we need to get it 86 // right from the menu item itself 87 if (is_object( $menu )) { 88 $menu_params = new JParameter( $menu->params ); 89 if (!$menu_params->get( 'page_title')) { 90 $params->set('page_title', JText::_( 'Web Links'.' - '.JText::_('Edit') )); 91 } 92 } else { 93 $params->set('page_title', JText::_( 'Web Links'.' - '.JText::_('Edit') )); 94 } 95 96 $document->setTitle( $params->get( 'page_title' ) ); 97 98 //set breadcrumbs 99 if($item->query['view'] != 'weblink') 100 { 101 switch ($item->query['view']) 102 { 103 case 'categories': 104 $pathway->addItem($weblink->category, 'index.php?view=category&id='.$weblink->catid); 105 $pathway->addItem(JText::_('Edit').' '.$weblink->title, ''); 106 break; 107 case 'category': 108 $pathway->addItem(JText::_('Edit').' '.$weblink->title, ''); 109 break; 110 } 111 } 112 } 113 else 114 { 115 /* 116 * The web link does not already exist so we are creating a new one. Here 117 * we want to manipulate the pathway and pagetitle to indicate this. Also, 118 * we need to initialize some values. 119 */ 120 $weblink->published = 0; 121 $weblink->approved = 1; 122 $weblink->ordering = 0; 123 124 // Set page title 125 // Set page title 126 $menus = &JSite::getMenu(); 127 $menu = $menus->getActive(); 128 129 // because the application sets a default page title, we need to get it 130 // right from the menu item itself 131 if (is_object( $menu )) { 132 $menu_params = new JParameter( $menu->params ); 133 if (!$menu_params->get( 'page_title')) { 134 $params->set('page_title', JText::_('Submit a Web Link') ); 135 } 136 } else { 137 $params->set('page_title', JText::_('Submit a Web Link') ); 138 } 139 140 $document->setTitle( $params->get( 'page_title' ) ); 141 142 // Add pathway item 143 $pathway->addItem(JText::_('New'), ''); 144 } 145 146 // build list of categories 147 $lists['catid'] = JHTML::_('list.category', 'jform[catid]', 'com_weblinks', intval($weblink->catid)); 148 149 // build the html select list for ordering 150 $query = 'SELECT ordering AS value, title AS text' 151 . ' FROM #__weblinks' 152 . ' WHERE catid = ' . (int) $weblink->catid 153 . ' ORDER BY ordering'; 154 155 $lists['ordering'] = JHTML::_('list.specificordering', $weblink, $weblink->id, $query ); 156 157 // Radio Buttons: Should the article be published 158 $lists['published'] = JHTML::_('select.booleanlist', 'jform[published]', 'class="inputbox"', $weblink->published ); 159 160 JFilterOutput::objectHTMLSafe( $weblink, ENT_QUOTES, 'description' ); 161 162 $this->assign('action', $uri->toString()); 163 164 $this->assignRef('lists' , $lists); 165 $this->assignRef('weblink' , $weblink); 166 $this->assignRef('params' , $params); 167 parent::display($tpl); 168 } 169 } 170 ?>
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 |