| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: view.pdf.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla 5 * @subpackage Content 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 to the 9 * GNU General Public License, and as distributed it includes or is derivative 10 * of works licensed under the GNU General Public License or other free or open 11 * source software licenses. See COPYRIGHT.php for copyright notices and 12 * 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 Article View class for the Content component 22 * 23 * @package Joomla 24 * @subpackage Content 25 * @since 1.5 26 */ 27 class ContentViewArticle extends JView 28 { 29 function display($tpl = null) 30 { 31 global $mainframe; 32 $user =& JFactory::getUser(); 33 $dispatcher =& JDispatcher::getInstance(); 34 35 // Initialize some variables 36 $article = & $this->get( 'Article' ); 37 $params = & $article->parameters; 38 39 // Create a user access object for the current user 40 $access = new stdClass(); 41 $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all'); 42 $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own'); 43 $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all'); 44 45 // Check to see if the user has access to view the full article 46 $aid = $user->get('aid'); 47 48 if (($article->access > $aid) && ( ! $aid )) { 49 // Redirect to login 50 $uri = JFactory::getURI(); 51 $return = $uri->toString(); 52 53 $url = 'index.php?option=com_user&view=login'; 54 $url .= '&return='.base64_encode($return);; 55 56 //$url = JRoute::_($url, false); 57 $mainframe->redirect($url, JText::_('You must login first') ); 58 } 59 else if ($article->access > $aid) { 60 $document = &JFactory::getDocument(); 61 $document->setTitle($article->title); 62 $document->setHeader($this->_getHeaderText($article, $params)); 63 echo '<h1>' . JText::_('ALERTNOTAUTH') . '</h1>'; 64 return; 65 } 66 67 // process the new plugins 68 JPluginHelper::importPlugin('content', 'image'); 69 $dispatcher->trigger('onPrepareContent', array (& $article, & $params, 0)); 70 71 $document = &JFactory::getDocument(); 72 73 // set document information 74 $document->setTitle($article->title); 75 $document->setName($article->alias); 76 $document->setDescription($article->metadesc); 77 $document->setMetaData('keywords', $article->metakey); 78 79 // prepare header lines 80 $document->setHeader($this->_getHeaderText($article, $params)); 81 82 echo $article->text; 83 } 84 85 function _getHeaderText(& $article, & $params) 86 { 87 // Initialize some variables 88 $text = ''; 89 90 // Display Author name 91 if ($params->get('show_author')) { 92 // Display Author name 93 $text .= "\n"; 94 $text .= JText::sprintf( 'Written by', ($article->created_by_alias ? $article->created_by_alias : $article->author) ); 95 } 96 97 if ($params->get('show_create_date') && $params->get('show_author')) { 98 // Display Separator 99 $text .= "\n"; 100 } 101 102 if ($params->get('show_create_date')) { 103 // Display Created Date 104 if (intval($article->created)) { 105 $create_date = JHTML::_('date', $article->created, JText::_('DATE_FORMAT_LC2')); 106 $text .= $create_date; 107 } 108 } 109 110 if ($params->get('show_modify_date') && ($params->get('show_author') || $params->get('show_create_date'))) { 111 // Display Separator 112 $text .= " - "; 113 } 114 115 if ($params->get('show_modify_date')) { 116 // Display Modified Date 117 if (intval($article->modified)) { 118 $mod_date = JHTML::_('date', $article->modified, JText::_('DATE_FORMAT_LC2')); 119 $text .= JText::_('Last Updated').' '.$mod_date; 120 } 121 } 122 return $text; 123 } 124 } 125 ?>
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 |