newsfeeds.php
2 KB
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
<?php
/**
* @package Joomla.Administrator
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Newsfeeds component helper.
*
* @since 1.6
*/
class NewsfeedsHelper extends JHelperContent
{
public static $extension = 'com_newsfeeds';
/**
* Configure the Linkbar.
*
* @param string $vName The name of the active view.
*
* @return void
*/
public static function addSubmenu($vName)
{
JHtmlSidebar::addEntry(
JText::_('COM_NEWSFEEDS_SUBMENU_NEWSFEEDS'),
'index.php?option=com_newsfeeds&view=newsfeeds',
$vName == 'newsfeeds'
);
JHtmlSidebar::addEntry(
JText::_('COM_NEWSFEEDS_SUBMENU_CATEGORIES'),
'index.php?option=com_categories&extension=com_newsfeeds',
$vName == 'categories'
);
}
/**
* Adds Count Items for Category Manager.
*
* @param stdClass[] &$items The category objects
*
* @return stdClass[]
*
* @since 3.5
*/
public static function countItems(&$items)
{
$config = (object) array(
'related_tbl' => 'newsfeeds',
'state_col' => 'published',
'group_col' => 'catid',
'relation_type' => 'category_or_group',
);
return parent::countRelations($items, $config);
}
/**
* Adds Count Items for Tag Manager.
*
* @param stdClass[] &$items The tag objects
* @param string $extension The name of the active view.
*
* @return stdClass[]
*
* @since 3.6
*/
public static function countTagItems(&$items, $extension)
{
$parts = explode('.', $extension);
$section = count($parts) > 1 ? $parts[1] : null;
$config = (object) array(
'related_tbl' => ($section === 'category' ? 'categories' : 'newsfeeds'),
'state_col' => 'published',
'group_col' => 'tag_id',
'extension' => $extension,
'relation_type' => 'tag_assigments',
);
return parent::countRelations($items, $config);
}
}