| [ 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 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 require_once (JPATH_COMPONENT.DS.'view.php'); 19 20 /** 21 * Frontpage View class 22 * 23 * @static 24 * @package Joomla 25 * @subpackage Content 26 * @since 1.5 27 */ 28 class ContentViewFrontpage extends ContentView 29 { 30 function display($tpl = null) 31 { 32 global $mainframe, $option; 33 34 // Initialize variables 35 $user =& JFactory::getUser(); 36 $document =& JFactory::getDocument(); 37 38 // Request variables 39 $id = JRequest::getVar('id', null, '', 'int'); 40 $limit = JRequest::getVar('limit', 5, '', 'int'); 41 $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); 42 43 // Get the page/component configuration 44 $params = &$mainframe->getParams(); 45 46 // parameters 47 $intro = $params->def('num_intro_articles', 4); 48 $leading = $params->def('num_leading_articles', 1); 49 $links = $params->def('num_links', 4); 50 51 $descrip = $params->def('show_description', 1); 52 $descrip_image = $params->def('show_description_image',1); 53 54 $params->set('show_intro', 1); 55 56 $limit = $intro + $leading + $links; 57 JRequest::setVar('limit', (int) $limit); 58 59 //set data model 60 $items =& $this->get('data' ); 61 $total =& $this->get('total'); 62 63 // Create a user access object for the user 64 $access = new stdClass(); 65 $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all'); 66 $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own'); 67 $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all'); 68 69 //add alternate feed link 70 if($params->get('show_feed_link', 1) == 1) 71 { 72 $link = '&format=feed&limitstart='; 73 $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); 74 $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs); 75 $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); 76 $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs); 77 } 78 79 $menus = &JSite::getMenu(); 80 $menu = $menus->getActive(); 81 82 // because the application sets a default page title, we need to get it 83 // right from the menu item itself 84 if (is_object( $menu )) { 85 $menu_params = new JParameter( $menu->params ); 86 if (!$menu_params->get( 'page_title')) { 87 $params->set('page_title', htmlspecialchars_decode($mainframe->getCfg('sitename' ))); 88 } 89 } else { 90 $params->set('page_title', htmlspecialchars_decode($mainframe->getCfg('sitename' ))); 91 } 92 $document->setTitle( $params->get( 'page_title' ) ); 93 94 jimport('joomla.html.pagination'); 95 $this->pagination = new JPagination($total, $limitstart, $limit - $links); 96 97 $this->assign('total', $total); 98 99 $this->assignRef('user', $user); 100 $this->assignRef('access', $access); 101 $this->assignRef('params', $params); 102 $this->assignRef('items', $items); 103 104 parent::display($tpl); 105 } 106 107 function &getItem($index = 0, &$params) 108 { 109 global $mainframe; 110 111 // Initialize some variables 112 $user =& JFactory::getUser(); 113 $dispatcher =& JDispatcher::getInstance(); 114 115 $SiteName = $mainframe->getCfg('sitename'); 116 117 $task = JRequest::getCmd('task'); 118 119 $linkOn = null; 120 $linkText = null; 121 122 $item =& $this->items[$index]; 123 $item->text = $item->introtext; 124 125 // Get the page/component configuration and article parameters 126 $item->params = clone($params); 127 $aparams = new JParameter($item->attribs); 128 129 // Merge article parameters into the page configuration 130 $item->params->merge($aparams); 131 132 // Process the content preparation plugins 133 JPluginHelper::importPlugin('content'); 134 $results = $dispatcher->trigger('onPrepareContent', array (& $item, & $item->params, 0)); 135 136 // Build the link and text of the readmore button 137 if (($item->params->get('show_readmore') && @ $item->readmore) || $item->params->get('link_titles')) 138 { 139 // checks if the item is a public or registered/special item 140 if ($item->access <= $user->get('aid', 0)) 141 { 142 $item->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid)); 143 $item->readmore_register = false; 144 } 145 else 146 { 147 $item->readmore_link = JRoute::_("index.php?option=com_user&view=login"); 148 $item->readmore_register = true; 149 } 150 } 151 152 $item->event = new stdClass(); 153 $results = $dispatcher->trigger('onAfterDisplayTitle', array (& $item, & $item->params,0)); 154 $item->event->afterDisplayTitle = trim(implode("\n", $results)); 155 156 $results = $dispatcher->trigger('onBeforeDisplayContent', array (& $item, & $item->params, 0)); 157 $item->event->beforeDisplayContent = trim(implode("\n", $results)); 158 159 $results = $dispatcher->trigger('onAfterDisplayContent', array (& $item, & $item->params, 0)); 160 $item->event->afterDisplayContent = trim(implode("\n", $results)); 161 162 return $item; 163 } 164 }
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 |