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