Source for file helper.php
Documentation is available at helper.php
* @subpackage mod_related_items
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
require_once JPATH_SITE .
'/components/com_content/helpers/route.php';
* Helper for mod_related_items
* @subpackage mod_related_items
public static function getList(&$params)
$groups =
implode(',', $user->getAuthorisedViewLevels());
$maximum = (int)
$params->get('maximum', 5);
$option =
$app->input->get('option');
$view =
$app->input->get('view');
$temp =
$app->input->getString('id');
$nullDate =
$db->getNullDate();
$query =
$db->getQuery(true);
if ($option ==
'com_content' &&
$view ==
'article' &&
$id)
// select the meta keywords from the item
$query->select('metakey')
->where('id = ' . (int)
$id);
if ($metakey =
trim($db->loadResult()))
// explode the meta keys on a comma
// assemble any non-blank word(s)
$likes[] =
$db->escape($key);
// select other items based on the metakey field 'like' the keys found
->select('DATE_FORMAT(a.created, "%Y-%m-%d") as created')
->select('cc.access AS cat_access')
->select('cc.published AS cat_state');
$case_when =
' CASE WHEN ';
$case_when .=
$query->charLength('a.alias', '!=', '0');
$a_id =
$query->castAsChar('a.id');
$case_when .=
$query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .=
$a_id .
' END as slug';
$query->select($case_when);
$case_when =
' CASE WHEN ';
$case_when .=
$query->charLength('cc.alias', '!=', '0');
$c_id =
$query->castAsChar('cc.id');
$case_when .=
$query->concatenate(array($c_id, 'cc.alias'), ':');
$case_when .=
$c_id .
' END as catslug';
$query->select($case_when)
->from('#__content AS a')
->join('LEFT', '#__content_frontpage AS f ON f.content_id = a.id')
->join('LEFT', '#__categories AS cc ON cc.id = a.catid')
->where('a.id != ' . (int)
$id)
->where('a.access IN (' .
$groups .
')');
$concat_string =
$query->concatenate(array('","', ' REPLACE(a.metakey, ", ", ",")', ' ","'));
$query->where('(' .
$concat_string .
' LIKE "%' .
implode('%" OR ' .
$concat_string .
' LIKE "%', $likes) .
'%")') //remove single space after commas in keywords)
->where('(a.publish_up = ' .
$db->quote($nullDate) .
' OR a.publish_up <= ' .
$db->quote($now) .
')')
->where('(a.publish_down = ' .
$db->quote($nullDate) .
' OR a.publish_down >= ' .
$db->quote($now) .
')');
$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) .
',' .
$db->quote('*') .
')');
$db->setQuery($query, 0, $maximum);
$temp =
$db->loadObjectList();
if ($row->cat_state ==
1)
Documentation generated on Tue, 19 Nov 2013 15:04:18 +0100 by phpDocumentor 1.4.3