Files
@ a45f0dabc59c
Branch filter:
Location: hot67beta/components/com_content/views/frontpage/view.html.php
a45f0dabc59c
5.3 KiB
text/x-php
mneh
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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | <?php
/**
* @version $Id: view.html.php 10868 2008-08-30 07:22:26Z willebil $
* @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' );
require_once (JPATH_COMPONENT.DS.'view.php');
/**
* Frontpage View class
*
* @static
* @package Joomla
* @subpackage Content
* @since 1.5
*/
class ContentViewFrontpage extends ContentView
{
function display($tpl = null)
{
global $mainframe, $option;
// Initialize variables
$user =& JFactory::getUser();
$document =& JFactory::getDocument();
// Request variables
$id = JRequest::getVar('id', null, '', 'int');
$limit = JRequest::getVar('limit', 5, '', 'int');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');
// Get the page/component configuration
$params = &$mainframe->getParams();
// parameters
$intro = $params->def('num_intro_articles', 4);
$leading = $params->def('num_leading_articles', 1);
$links = $params->def('num_links', 4);
$descrip = $params->def('show_description', 1);
$descrip_image = $params->def('show_description_image',1);
$params->set('show_intro', 1);
$limit = $intro + $leading + $links;
JRequest::setVar('limit', (int) $limit);
//set data model
$items =& $this->get('data' );
$total =& $this->get('total');
// Create a user access object for the 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');
//add alternate feed link
if($params->get('show_feed_link', 1) == 1)
{
$link = '&format=feed&limitstart=';
$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
$document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs);
$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
$document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs);
}
$menus = &JSite::getMenu();
$menu = $menus->getActive();
// because the application sets a default page title, we need to get it
// right from the menu item itself
if (is_object( $menu )) {
$menu_params = new JParameter( $menu->params );
if (!$menu_params->get( 'page_title')) {
$params->set('page_title', htmlspecialchars_decode($mainframe->getCfg('sitename' )));
}
} else {
$params->set('page_title', htmlspecialchars_decode($mainframe->getCfg('sitename' )));
}
$document->setTitle( $params->get( 'page_title' ) );
jimport('joomla.html.pagination');
$this->pagination = new JPagination($total, $limitstart, $limit - $links);
$this->assign('total', $total);
$this->assignRef('user', $user);
$this->assignRef('access', $access);
$this->assignRef('params', $params);
$this->assignRef('items', $items);
parent::display($tpl);
}
function &getItem($index = 0, &$params)
{
global $mainframe;
// Initialize some variables
$user =& JFactory::getUser();
$dispatcher =& JDispatcher::getInstance();
$SiteName = $mainframe->getCfg('sitename');
$task = JRequest::getCmd('task');
$linkOn = null;
$linkText = null;
$item =& $this->items[$index];
$item->text = $item->introtext;
// Get the page/component configuration and article parameters
$item->params = clone($params);
$aparams = new JParameter($item->attribs);
// Merge article parameters into the page configuration
$item->params->merge($aparams);
// Process the content preparation plugins
JPluginHelper::importPlugin('content');
$results = $dispatcher->trigger('onPrepareContent', array (& $item, & $item->params, 0));
// Build the link and text of the readmore button
if (($item->params->get('show_readmore') && @ $item->readmore) || $item->params->get('link_titles'))
{
// checks if the item is a public or registered/special item
if ($item->access <= $user->get('aid', 0))
{
$item->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid));
$item->readmore_register = false;
}
else
{
$item->readmore_link = JRoute::_("index.php?option=com_user&view=login");
$item->readmore_register = true;
}
}
$item->event = new stdClass();
$results = $dispatcher->trigger('onAfterDisplayTitle', array (& $item, & $item->params,0));
$item->event->afterDisplayTitle = trim(implode("\n", $results));
$results = $dispatcher->trigger('onBeforeDisplayContent', array (& $item, & $item->params, 0));
$item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $dispatcher->trigger('onAfterDisplayContent', array (& $item, & $item->params, 0));
$item->event->afterDisplayContent = trim(implode("\n", $results));
return $item;
}
}
|