Source for file articles.php

Documentation is available at articles.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_content
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * This models supports retrieving lists of articles.
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_content
  17.  * @since       1.6
  18.  */
  19. {
  20.     /**
  21.      * Constructor.
  22.      *
  23.      * @param   array  $config  An optional associative array of configuration settings.
  24.      *
  25.      * @see     JController
  26.      * @since   1.6
  27.      */
  28.     public function __construct($config array())
  29.     {
  30.         if (empty($config['filter_fields']))
  31.         {
  32.             $config['filter_fields'array(
  33.                 'id''a.id',
  34.                 'title''a.title',
  35.                 'alias''a.alias',
  36.                 'checked_out''a.checked_out',
  37.                 'checked_out_time''a.checked_out_time',
  38.                 'catid''a.catid''category_title',
  39.                 'state''a.state',
  40.                 'access''a.access''access_level',
  41.                 'created''a.created',
  42.                 'created_by''a.created_by',
  43.                 'ordering''a.ordering',
  44.                 'featured''a.featured',
  45.                 'language''a.language',
  46.                 'hits''a.hits',
  47.                 'publish_up''a.publish_up',
  48.                 'publish_down''a.publish_down',
  49.                 'images''a.images',
  50.                 'urls''a.urls',
  51.             );
  52.         }
  53.  
  54.         parent::__construct($config);
  55.     }
  56.  
  57.     /**
  58.      * Method to auto-populate the model state.
  59.      *
  60.      * This method should only be called once per instantiation and is designed
  61.      * to be called on the first call to the getState() method unless the model
  62.      * configuration flag to ignore the request is set.
  63.      *
  64.      * Note. Calling getState in this method will result in recursion.
  65.      *
  66.      * @param   string  $ordering   An optional ordering field.
  67.      * @param   string  $direction  An optional direction (asc|desc).
  68.      *
  69.      * @return  void 
  70.      *
  71.      * @since   12.2
  72.      */
  73.     protected function populateState($ordering 'ordering'$direction 'ASC')
  74.     {
  75.         $app JFactory::getApplication();
  76.  
  77.         // List state information
  78.         $value $app->input->get('limit'$app->getCfg('list_limit'0)'uint');
  79.         $this->setState('list.limit'$value);
  80.  
  81.         $value $app->input->get('limitstart'0'uint');
  82.         $this->setState('list.start'$value);
  83.  
  84.         $orderCol $app->input->get('filter_order''a.ordering');
  85.  
  86.         if (!in_array($orderCol$this->filter_fields))
  87.         {
  88.             $orderCol 'a.ordering';
  89.         }
  90.  
  91.         $this->setState('list.ordering'$orderCol);
  92.  
  93.         $listOrder $app->input->get('filter_order_Dir''ASC');
  94.  
  95.         if (!in_array(strtoupper($listOrder)array('ASC''DESC''')))
  96.         {
  97.             $listOrder 'ASC';
  98.         }
  99.  
  100.         $this->setState('list.direction'$listOrder);
  101.  
  102.         $params $app->getParams();
  103.         $this->setState('params'$params);
  104.         $user JFactory::getUser();
  105.  
  106.         if ((!$user->authorise('core.edit.state''com_content')) && (!$user->authorise('core.edit''com_content')))
  107.         {
  108.             // Filter on published for those who do not have edit or edit.state rights.
  109.             $this->setState('filter.published'1);
  110.         }
  111.  
  112.         $this->setState('filter.language'JLanguageMultilang::isEnabled());
  113.  
  114.         // Process show_noauth parameter
  115.         if (!$params->get('show_noauth'))
  116.         {
  117.             $this->setState('filter.access'true);
  118.         }
  119.         else
  120.         {
  121.             $this->setState('filter.access'false);
  122.         }
  123.  
  124.         $this->setState('layout'$app->input->get('layout'));
  125.     }
  126.  
  127.     /**
  128.      * Method to get a store id based on model configuration state.
  129.      *
  130.      * This is necessary because the model is used by the component and
  131.      * different modules that might need different sets of data or different
  132.      * ordering requirements.
  133.      *
  134.      * @param   string  $id  A prefix for the store id.
  135.      *
  136.      * @return  string  A store id.
  137.      *
  138.      * @since   1.6
  139.      */
  140.     protected function getStoreId($id '')
  141.     {
  142.         // Compile the store id.
  143.         $id .= ':' serialize($this->getState('filter.published'));
  144.         $id .= ':' $this->getState('filter.access');
  145.         $id .= ':' $this->getState('filter.featured');
  146.         $id .= ':' $this->getState('filter.article_id');
  147.         $id .= ':' $this->getState('filter.article_id.include');
  148.         $id .= ':' serialize($this->getState('filter.category_id'));
  149.         $id .= ':' $this->getState('filter.category_id.include');
  150.         $id .= ':' serialize($this->getState('filter.author_id'));
  151.         $id .= ':' $this->getState('filter.author_id.include');
  152.         $id .= ':' serialize($this->getState('filter.author_alias'));
  153.         $id .= ':' $this->getState('filter.author_alias.include');
  154.         $id .= ':' $this->getState('filter.date_filtering');
  155.         $id .= ':' $this->getState('filter.date_field');
  156.         $id .= ':' $this->getState('filter.start_date_range');
  157.         $id .= ':' $this->getState('filter.end_date_range');
  158.         $id .= ':' $this->getState('filter.relative_date');
  159.  
  160.         return parent::getStoreId($id);
  161.     }
  162.  
  163.     /**
  164.      * Get the master query for retrieving a list of articles subject to the model state.
  165.      *
  166.      * @return  JDatabaseQuery 
  167.      *
  168.      * @since   1.6
  169.      */
  170.     protected function getListQuery()
  171.     {
  172.         // Create a new query object.
  173.         $db $this->getDbo();
  174.         $query $db->getQuery(true);
  175.  
  176.         // Select the required fields from the table.
  177.         $query->select(
  178.             $this->getState(
  179.                 'list.select',
  180.                 'a.id, a.title, a.alias, a.introtext, a.fulltext, ' .
  181.                     'a.checked_out, a.checked_out_time, ' .
  182.                     'a.catid, a.created, a.created_by, a.created_by_alias, ' .
  183.                     // Use created if modified is 0
  184.                     'CASE WHEN a.modified = ' $db->quote($db->getNullDate()) ' THEN a.created ELSE a.modified END as modified, ' .
  185.                     'a.modified_by, uam.name as modified_by_name,' .
  186.                     // Use created if publish_up is 0
  187.                     'CASE WHEN a.publish_up = ' $db->quote($db->getNullDate()) ' THEN a.created ELSE a.publish_up END as publish_up,' .
  188.                     'a.publish_down, a.images, a.urls, a.attribs, a.metadata, a.metakey, a.metadesc, a.access, ' .
  189.                     'a.hits, a.xreference, a.featured,' ' ' $query->length('a.fulltext'' AS readmore'
  190.             )
  191.         );
  192.  
  193.         // Process an Archived Article layout
  194.         if ($this->getState('filter.published'== 2)
  195.         {
  196.             // If badcats is not null, this means that the article is inside an archived category
  197.             // In this case, the state is set to 2 to indicate Archived (even if the article state is Published)
  198.             $query->select($this->getState('list.select''CASE WHEN badcats.id is null THEN a.state ELSE 2 END AS state'));
  199.         }
  200.         else
  201.         {
  202.             /*
  203.             Process non-archived layout
  204.             If badcats is not null, this means that the article is inside an unpublished category
  205.             In this case, the state is set to 0 to indicate Unpublished (even if the article state is Published)
  206.             */
  207.             $query->select($this->getState('list.select''CASE WHEN badcats.id is not null THEN 0 ELSE a.state END AS state'));
  208.         }
  209.  
  210.         $query->from('#__content AS a');
  211.  
  212.         // Join over the frontpage articles.
  213.         if ($this->context != 'com_content.featured')
  214.         {
  215.             $query->join('LEFT''#__content_frontpage AS fp ON fp.content_id = a.id');
  216.         }
  217.  
  218.         // Join over the categories.
  219.         $query->select('c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias')
  220.             ->join('LEFT''#__categories AS c ON c.id = a.catid');
  221.  
  222.         // Join over the users for the author and modified_by names.
  223.         $query->select("CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author")
  224.             ->select("ua.email AS author_email")
  225.  
  226.             ->join('LEFT''#__users AS ua ON ua.id = a.created_by')
  227.             ->join('LEFT''#__users AS uam ON uam.id = a.modified_by');
  228.  
  229.         // Get contact id
  230.         $subQuery $db->getQuery(true)
  231.             ->select('MAX(contact.id) AS id')
  232.             ->from('#__contact_details AS contact')
  233.             ->where('contact.published = 1')
  234.             ->where('contact.user_id = a.created_by');
  235.  
  236.             // Filter by language
  237.             if ($this->getState('filter.language'))
  238.             {
  239.                 $subQuery->where('(contact.language in (' $db->quote(JFactory::getLanguage()->getTag()) ',' $db->quote('*'') OR contact.language IS NULL)');
  240.             }
  241.  
  242.         $query->select('(' $subQuery ') as contactid');
  243.  
  244.         // Join over the categories to get parent category titles
  245.         $query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias')
  246.             ->join('LEFT''#__categories as parent ON parent.id = c.parent_id');
  247.  
  248.         // Join on voting table
  249.         $query->select('ROUND(v.rating_sum / v.rating_count, 0) AS rating, v.rating_count as rating_count')
  250.             ->join('LEFT''#__content_rating AS v ON a.id = v.content_id');
  251.  
  252.         // Join to check for category published state in parent categories up the tree
  253.         $query->select('c.published, CASE WHEN badcats.id is null THEN c.published ELSE 0 END AS parents_published');
  254.         $subquery 'SELECT cat.id as id FROM #__categories AS cat JOIN #__categories AS parent ';
  255.         $subquery .= 'ON cat.lft BETWEEN parent.lft AND parent.rgt ';
  256.         $subquery .= 'WHERE parent.extension = ' $db->quote('com_content');
  257.  
  258.         if ($this->getState('filter.published'== 2)
  259.         {
  260.             // Find any up-path categories that are archived
  261.             // If any up-path categories are archived, include all children in archived layout
  262.             $subquery .= ' AND parent.published = 2 GROUP BY cat.id ';
  263.  
  264.             // Set effective state to archived if up-path category is archived
  265.             $publishedWhere 'CASE WHEN badcats.id is null THEN a.state ELSE 2 END';
  266.         }
  267.         else
  268.         {
  269.             // Find any up-path categories that are not published
  270.             // If all categories are published, badcats.id will be null, and we just use the article state
  271.             $subquery .= ' AND parent.published != 1 GROUP BY cat.id ';
  272.  
  273.             // Select state to unpublished if up-path category is unpublished
  274.             $publishedWhere 'CASE WHEN badcats.id is null THEN a.state ELSE 0 END';
  275.         }
  276.  
  277.         $query->join('LEFT OUTER''(' $subquery ') AS badcats ON badcats.id = c.id');
  278.  
  279.         // Filter by access level.
  280.         if ($access $this->getState('filter.access'))
  281.         {
  282.             $user JFactory::getUser();
  283.             $groups implode(','$user->getAuthorisedViewLevels());
  284.             $query->where('a.access IN (' $groups ')')
  285.                 ->where('c.access IN (' $groups ')');
  286.         }
  287.  
  288.         // Filter by published state
  289.         $published $this->getState('filter.published');
  290.  
  291.         if (is_numeric($published))
  292.         {
  293.             // Use article state if badcats.id is null, otherwise, force 0 for unpublished
  294.             $query->where($publishedWhere ' = ' . (int) $published);
  295.         }
  296.         elseif (is_array($published))
  297.         {
  298.             JArrayHelper::toInteger($published);
  299.             $published implode(','$published);
  300.  
  301.             // Use article state if badcats.id is null, otherwise, force 0 for unpublished
  302.             $query->where($publishedWhere ' IN (' $published ')');
  303.         }
  304.  
  305.         // Filter by featured state
  306.         $featured $this->getState('filter.featured');
  307.  
  308.         switch ($featured)
  309.         {
  310.             case 'hide':
  311.                 $query->where('a.featured = 0');
  312.                 break;
  313.  
  314.             case 'only':
  315.                 $query->where('a.featured = 1');
  316.                 break;
  317.  
  318.             case 'show':
  319.             default:
  320.                 // Normally we do not discriminate
  321.                 // between featured/unfeatured items.
  322.                 break;
  323.         }
  324.  
  325.         // Filter by a single or group of articles.
  326.         $articleId $this->getState('filter.article_id');
  327.  
  328.         if (is_numeric($articleId))
  329.         {
  330.             $type $this->getState('filter.article_id.include'true'= ' '<> ';
  331.             $query->where('a.id ' $type . (int) $articleId);
  332.         }
  333.         elseif (is_array($articleId))
  334.         {
  335.             JArrayHelper::toInteger($articleId);
  336.             $articleId implode(','$articleId);
  337.             $type $this->getState('filter.article_id.include'true'IN' 'NOT IN';
  338.             $query->where('a.id ' $type ' (' $articleId ')');
  339.         }
  340.  
  341.         // Filter by a single or group of categories
  342.         $categoryId $this->getState('filter.category_id');
  343.  
  344.         if (is_numeric($categoryId))
  345.         {
  346.             $type $this->getState('filter.category_id.include'true'= ' '<> ';
  347.  
  348.             // Add subcategory check
  349.             $includeSubcategories $this->getState('filter.subcategories'false);
  350.             $categoryEquals 'a.catid ' $type . (int) $categoryId;
  351.  
  352.             if ($includeSubcategories)
  353.             {
  354.                 $levels = (int) $this->getState('filter.max_category_levels''1');
  355.  
  356.                 // Create a subquery for the subcategory list
  357.                 $subQuery $db->getQuery(true)
  358.                     ->select('sub.id')
  359.                     ->from('#__categories as sub')
  360.                     ->join('INNER''#__categories as this ON sub.lft > this.lft AND sub.rgt < this.rgt')
  361.                     ->where('this.id = ' . (int) $categoryId);
  362.  
  363.                 if ($levels >= 0)
  364.                 {
  365.                     $subQuery->where('sub.level <= this.level + ' $levels);
  366.                 }
  367.  
  368.                 // Add the subquery to the main query
  369.                 $query->where('(' $categoryEquals ' OR a.catid IN (' $subQuery->__toString('))');
  370.             }
  371.             else
  372.             {
  373.                 $query->where($categoryEquals);
  374.             }
  375.         }
  376.         elseif (is_array($categoryId&& (count($categoryId0))
  377.         {
  378.             JArrayHelper::toInteger($categoryId);
  379.             $categoryId implode(','$categoryId);
  380.  
  381.             if (!empty($categoryId))
  382.             {
  383.                 $type $this->getState('filter.category_id.include'true'IN' 'NOT IN';
  384.                 $query->where('a.catid ' $type ' (' $categoryId ')');
  385.             }
  386.         }
  387.  
  388.         // Filter by author
  389.         $authorId $this->getState('filter.author_id');
  390.         $authorWhere '';
  391.  
  392.         if (is_numeric($authorId))
  393.         {
  394.             $type $this->getState('filter.author_id.include'true'= ' '<> ';
  395.             $authorWhere 'a.created_by ' $type . (int) $authorId;
  396.         }
  397.         elseif (is_array($authorId))
  398.         {
  399.             JArrayHelper::toInteger($authorId);
  400.             $authorId implode(','$authorId);
  401.  
  402.             if ($authorId)
  403.             {
  404.                 $type $this->getState('filter.author_id.include'true'IN' 'NOT IN';
  405.                 $authorWhere 'a.created_by ' $type ' (' $authorId ')';
  406.             }
  407.         }
  408.  
  409.         // Filter by author alias
  410.         $authorAlias $this->getState('filter.author_alias');
  411.         $authorAliasWhere '';
  412.  
  413.         if (is_string($authorAlias))
  414.         {
  415.             $type $this->getState('filter.author_alias.include'true'= ' '<> ';
  416.             $authorAliasWhere 'a.created_by_alias ' $type $db->quote($authorAlias);
  417.         }
  418.         elseif (is_array($authorAlias))
  419.         {
  420.             $first current($authorAlias);
  421.  
  422.             if (!empty($first))
  423.             {
  424.                 JArrayHelper::toString($authorAlias);
  425.  
  426.                 foreach ($authorAlias as $key => $alias)
  427.                 {
  428.                     $authorAlias[$key$db->quote($alias);
  429.                 }
  430.  
  431.                 $authorAlias implode(','$authorAlias);
  432.  
  433.                 if ($authorAlias)
  434.                 {
  435.                     $type $this->getState('filter.author_alias.include'true'IN' 'NOT IN';
  436.                     $authorAliasWhere 'a.created_by_alias ' $type ' (' $authorAlias .
  437.                         ')';
  438.                 }
  439.             }
  440.         }
  441.  
  442.         if (!empty($authorWhere&& !empty($authorAliasWhere))
  443.         {
  444.             $query->where('(' $authorWhere ' OR ' $authorAliasWhere ')');
  445.         }
  446.         elseif (empty($authorWhere&& empty($authorAliasWhere))
  447.         {
  448.             // If both are empty we don't want to add to the query
  449.         }
  450.         else
  451.         {
  452.             // One of these is empty, the other is not so we just add both
  453.             $query->where($authorWhere $authorAliasWhere);
  454.         }
  455.  
  456.         // Filter by start and end dates.
  457.         $nullDate $db->quote($db->getNullDate());
  458.         $nowDate $db->quote(JFactory::getDate()->toSql());
  459.  
  460.         $query->where('(a.publish_up = ' $nullDate ' OR a.publish_up <= ' $nowDate ')')
  461.             ->where('(a.publish_down = ' $nullDate ' OR a.publish_down >= ' $nowDate ')');
  462.  
  463.         // Filter by Date Range or Relative Date
  464.         $dateFiltering $this->getState('filter.date_filtering''off');
  465.         $dateField $this->getState('filter.date_field''a.created');
  466.  
  467.         switch ($dateFiltering)
  468.         {
  469.             case 'range':
  470.                 $startDateRange $db->quote($this->getState('filter.start_date_range'$nullDate));
  471.                 $endDateRange $db->quote($this->getState('filter.end_date_range'$nullDate));
  472.                 $query->where(
  473.                     '(' $dateField ' >= ' $startDateRange ' AND ' $dateField .
  474.                         ' <= ' $endDateRange ')'
  475.                 );
  476.                 break;
  477.  
  478.             case 'relative':
  479.                 $relativeDate = (int) $this->getState('filter.relative_date'0);
  480.                 $query->where(
  481.                     $dateField ' >= DATE_SUB(' $nowDate ', INTERVAL ' .
  482.                         $relativeDate ' DAY)'
  483.                 );
  484.                 break;
  485.  
  486.             case 'off':
  487.             default:
  488.                 break;
  489.         }
  490.  
  491.         // Process the filter for list views with user-entered filters
  492.         $params $this->getState('params');
  493.  
  494.         if ((is_object($params)) && ($params->get('filter_field'!= 'hide'&& ($filter $this->getState('list.filter')))
  495.         {
  496.             // Clean filter variable
  497.             $filter JString::strtolower($filter);
  498.             $hitsFilter = (int) $filter;
  499.             $filter $db->quote('%' $db->escape($filtertrue'%'false);
  500.  
  501.             switch ($params->get('filter_field'))
  502.             {
  503.                 case 'author':
  504.                     $query->where(
  505.                         'LOWER( CASE WHEN a.created_by_alias > ' $db->quote(' '.
  506.                             ' THEN a.created_by_alias ELSE ua.name END ) LIKE ' $filter ' '
  507.                     );
  508.                     break;
  509.  
  510.                 case 'hits':
  511.                     $query->where('a.hits >= ' $hitsFilter ' ');
  512.                     break;
  513.  
  514.                 case 'title':
  515.                 default:
  516.                     // Default to 'title' if parameter is not valid
  517.                     $query->where('LOWER( a.title ) LIKE ' $filter);
  518.                     break;
  519.             }
  520.         }
  521.  
  522.         // Filter by language
  523.         if ($this->getState('filter.language'))
  524.         {
  525.             $query->where('a.language in (' $db->quote(JFactory::getLanguage()->getTag()) ',' $db->quote('*'')');
  526.         }
  527.  
  528.         // Add the list ordering clause.
  529.         $query->order($this->getState('list.ordering''a.ordering'' ' $this->getState('list.direction''ASC'));
  530.  
  531.         return $query;
  532.     }
  533.  
  534.     /**
  535.      * Method to get a list of articles.
  536.      *
  537.      * Overriden to inject convert the attribs field into a JParameter object.
  538.      *
  539.      * @return  mixed  An array of objects on success, false on failure.
  540.      *
  541.      * @since   1.6
  542.      */
  543.     public function getItems()
  544.     {
  545.         $items parent::getItems();
  546.         $user JFactory::getUser();
  547.         $userId $user->get('id');
  548.         $guest $user->get('guest');
  549.         $groups $user->getAuthorisedViewLevels();
  550.         $input JFactory::getApplication()->input;
  551.  
  552.         // Get the global params
  553.         $globalParams JComponentHelper::getParams('com_content'true);
  554.  
  555.         // Convert the parameter fields into objects.
  556.         foreach ($items as &$item)
  557.         {
  558.             $articleParams new JRegistry;
  559.             $articleParams->loadString($item->attribs);
  560.  
  561.             // Unpack readmore and layout params
  562.             $item->alternative_readmore $articleParams->get('alternative_readmore');
  563.             $item->layout $articleParams->get('layout');
  564.  
  565.             $item->params clone $this->getState('params');
  566.  
  567.             /*For blogs, article params override menu item params only if menu param = 'use_article'
  568.             Otherwise, menu item params control the layout
  569.             If menu item is 'use_article' and there is no article param, use global*/
  570.             if (($input->getString('layout'== 'blog'|| ($input->getString('view'== 'featured')
  571.                 || ($this->getState('params')->get('layout_type'== 'blog'))
  572.             {
  573.                 // Create an array of just the params set to 'use_article'
  574.                 $menuParamsArray $this->getState('params')->toArray();
  575.                 $articleArray array();
  576.  
  577.                 foreach ($menuParamsArray as $key => $value)
  578.                 {
  579.                     if ($value === 'use_article')
  580.                     {
  581.                         // If the article has a value, use it
  582.                         if ($articleParams->get($key!= '')
  583.                         {
  584.                             // Get the value from the article
  585.                             $articleArray[$key$articleParams->get($key);
  586.                         }
  587.                         else
  588.                         {
  589.                             // Otherwise, use the global value
  590.                             $articleArray[$key$globalParams->get($key);
  591.                         }
  592.                     }
  593.                 }
  594.  
  595.                 // Merge the selected article params
  596.                 if (count($articleArray0)
  597.                 {
  598.                     $articleParams new JRegistry;
  599.                     $articleParams->loadArray($articleArray);
  600.                     $item->params->merge($articleParams);
  601.                 }
  602.             }
  603.             else
  604.             {
  605.                 // For non-blog layouts, merge all of the article params
  606.                 $item->params->merge($articleParams);
  607.             }
  608.  
  609.             // Get display date
  610.             switch ($item->params->get('list_show_date'))
  611.             {
  612.                 case 'modified':
  613.                     $item->displayDate $item->modified;
  614.                     break;
  615.  
  616.                 case 'published':
  617.                     $item->displayDate ($item->publish_up == 0$item->created $item->publish_up;
  618.                     break;
  619.  
  620.                 default:
  621.                 case 'created':
  622.                     $item->displayDate $item->created;
  623.                     break;
  624.             }
  625.  
  626.             // Compute the asset access permissions.
  627.             // Technically guest could edit an article, but lets not check that to improve performance a little.
  628.             if (!$guest)
  629.             {
  630.                 $asset 'com_content.article.' $item->id;
  631.  
  632.                 // Check general edit permission first.
  633.                 if ($user->authorise('core.edit'$asset))
  634.                 {
  635.                     $item->params->set('access-edit'true);
  636.                 }
  637.  
  638.                 // Now check if edit.own is available.
  639.                 elseif (!empty($userId&& $user->authorise('core.edit.own'$asset))
  640.                 {
  641.                     // Check for a valid user and that they are the owner.
  642.                     if ($userId == $item->created_by)
  643.                     {
  644.                         $item->params->set('access-edit'true);
  645.                     }
  646.                 }
  647.             }
  648.  
  649.             $access $this->getState('filter.access');
  650.  
  651.             if ($access)
  652.             {
  653.                 // If the access filter has been set, we already have only the articles this user can view.
  654.                 $item->params->set('access-view'true);
  655.             }
  656.             else
  657.             {
  658.                 // If no access filter is set, the layout takes some responsibility for display of limited information.
  659.                 if ($item->catid == || $item->category_access === null)
  660.                 {
  661.                     $item->params->set('access-view'in_array($item->access$groups));
  662.                 }
  663.                 else
  664.                 {
  665.                     $item->params->set('access-view'in_array($item->access$groups&& in_array($item->category_access$groups));
  666.                 }
  667.             }
  668.  
  669.             // Get the tags
  670.             $item->tags new JHelperTags;
  671.             $item->tags->getItemTags('com_content.article'$item->id);
  672.         }
  673.  
  674.         return $items;
  675.     }
  676.  
  677.     /**
  678.      * Method to get the starting number of items for the data set.
  679.      *
  680.      * @return  integer  The starting number of items available in the data set.
  681.      *
  682.      * @since   12.2
  683.      */
  684.     public function getStart()
  685.     {
  686.         return $this->getState('list.start');
  687.     }
  688. }

Documentation generated on Tue, 19 Nov 2013 14:54:03 +0100 by phpDocumentor 1.4.3