本文整理汇总了PHP中JHelperTags::getTagItemsQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP JHelperTags::getTagItemsQuery方法的具体用法?PHP JHelperTags::getTagItemsQuery怎么用?PHP JHelperTags::getTagItemsQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHelperTags
的用法示例。
在下文中一共展示了JHelperTags::getTagItemsQuery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContentList
public static function getContentList($params)
{
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
//$matchtype = $params->get('matchtype', 'all');
$maximum = $params->get('maximum', 5);
$tagsHelper = new JHelperTags();
$option = $app->input->get('option');
$view = $app->input->get('view');
$prefix = $option . '.' . $view;
$id = (array) $app->input->getObject('id');
$selectedTag = $params->get('selected_tag');
// Strip off any slug data.
foreach ($id as $id) {
if (substr_count($id, ':') > 0) {
$idexplode = explode(':', $id);
$id = $idexplode[0];
}
}
$tagsToMatch = $selectedTag;
if (!$tagsToMatch || is_null($tagsToMatch)) {
return $results = false;
}
$query = $tagsHelper->getTagItemsQuery($tagsToMatch, $typesr = null, $includeChildren = false, $orderByOption = 'c.core_title', $orderDir = 'ASC', $anyOrAll = true, $languageFilter = 'all', $stateFilter = '0,1');
$db->setQuery($query, 0, $maximum);
$results = $db->loadObjectList();
foreach ($results as $result) {
$explodedAlias = explode('.', $result->type_alias);
$result->link = 'index.php?option=' . $explodedAlias[0] . '&view=' . $explodedAlias[1] . '&id=' . $result->content_item_id . '-' . $result->core_alias;
}
return $results;
}
示例2: getListQuery
/**
* Method to build an SQL query to load the list data of all items with a given tag.
*
* @return string An SQL query
*
* @since 3.1
*/
protected function getListQuery()
{
$tagId = $this->getState('tag.id') ?: '';
$typesr = $this->getState('tag.typesr');
$orderByOption = $this->getState('list.ordering', 'c.core_title');
$includeChildren = $this->state->params->get('include_children', 0);
$orderDir = $this->getState('list.direction', 'ASC');
$matchAll = $this->getState('params')->get('return_any_or_all', 1);
$language = $this->getState('tag.language');
$stateFilter = $this->getState('tag.state');
// Optionally filter on language
if (empty($language)) {
$language = JComponentHelper::getParams('com_tags')->get('tag_list_language_filter', 'all');
}
$listQuery = new JHelperTags();
$query = $listQuery->getTagItemsQuery($tagId, $typesr, $includeChildren, $orderByOption, $orderDir, $matchAll, $language, $stateFilter);
if ($this->state->get('list.filter')) {
$query->where($this->_db->quoteName('c.core_title') . ' LIKE ' . $this->_db->quote('%' . $this->state->get('list.filter') . '%'));
}
return $query;
}
示例3: getList
//.........这里部分代码省略.........
}
}
//if category
$items = array();
if ($source == 'category') {
$category_ids = self::getCategoryIds();
if (!empty($category_ids) && $params->get('limit_items_for_each')) {
$db->setQuery('SELECT id from #__categories where id in (' . implode($category_ids, ',') . ') order by lft');
$category_ids = $db->loadColumn();
foreach ($category_ids as $category_id) {
$model->setState('filter.category_id', array($category_id));
$itemsPerCategory = $model->getItems();
$items = array_merge($items, $itemsPerCategory);
}
} else {
// Category filter
$model->setState('filter.category_id', $category_ids);
$items = $model->getItems();
}
//esle article_ids
} else {
if ($source == 'article_ids') {
$ids = preg_split('/,/', $params->get('article_ids', ''));
$tmp = array();
foreach ($ids as $id) {
$tmp[] = (int) trim($id);
}
$model->setState('filter.article_id', $tmp);
$items = $model->getItems();
} else {
$tagsHelper = new JHelperTags();
$tagIds = $this->_params->get('joomla_tags');
if ($tagsIds) {
$query = $tagsHelper->getTagItemsQuery(implode(',', $tagIds));
$db->setQuery($query);
$rs = $db->loadObjectList();
if (!$rs) {
$items = $model->getItems();
} else {
$articleIds = array();
foreach ($rs as $article) {
if ($article->type_alias != 'com_content.article') {
continue;
}
$articleIds[] = $article->content_item_id;
}
$model->setState('filter.article_id', $articleIds);
$items = $model->getItems();
}
} else {
$items = $model->getItems();
}
}
}
foreach ($items as &$item) {
// setting for route link
$item->slug = $item->id . ':' . $item->alias;
$item->catslug = $item->catid . ':' . $item->category_alias;
// item link
$item->link = '';
if ($access || in_array($item->access, $authorised)) {
// We know that user has the privilege to view the article
//Item link
if ($use_linka && $item->urls) {
$item->urls = json_decode($item->urls);
$item->link = $item->urls->urla;
示例4: getTagTree
/**
* @param XmapDisplayerInterface $xmap
* @param stdClass $parent
* @param array $params
* @param array $tagIds
* @param array $typesr
*/
private static function getTagTree($xmap, stdClass $parent, array &$params, array $tagIds, array $typesr = null)
{
$db = JFactory::getDbo();
$rows = array();
foreach ($tagIds as $tagId) {
$listQuery = new JHelperTags();
$query = $listQuery->getTagItemsQuery($tagId, $typesr, false, 'c.core_title', 'ASC', true, $params['language_filter']);
$db->setQuery($query);
$result = $db->loadObjectList();
if (is_array($result)) {
$rows += $result;
}
}
if (empty($rows)) {
return;
}
$xmap->changeLevel(1);
foreach ($rows as $row) {
$node = new stdclass();
$node->id = $parent->id;
$node->name = $row->core_title;
$node->uid = $parent->uid . '_' . $row->content_item_id;
$node->browserNav = $parent->browserNav;
$node->priority = $params['tag_priority'];
$node->changefreq = $params['tag_changefreq'];
$node->link = TagsHelperRoute::getItemRoute($row->content_item_id, $row->core_alias, $row->core_catid, $row->core_language, $row->type_alias, $row->router);
$xmap->printNode($node);
}
$xmap->changeLevel(-1);
}