forked from techjoomla/TJ-Notifications
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtjnotifications.php
More file actions
98 lines (86 loc) · 2.9 KB
/
tjnotifications.php
File metadata and controls
98 lines (86 loc) · 2.9 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
90
91
92
93
94
95
96
97
98
<?php
/**
* @package Tjnotifications
* @subpackage com_tjnotifications
*
* @copyright Copyright (C) 2009 - 2020 Techjoomla. All rights reserved.
* @license http:/www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\Filesystem\Path;
use Joomla\CMS\Helper\ContentHelper;
/**
* helper class for tjnotificationss
*
* @package TJnotification
* @subpackage com_tjnotifications
* @since 2.2
*/
class TjnotificationsHelper extends ContentHelper
{
/**
* Configure the Linkbar.
*
* @param STRING $view view name
*
* @return null
*/
public static function addSubmenu($view = '')
{
$input = Factory::getApplication()->input;
$full_client = $input->getCmd('extension', '');
$full_client = explode('.', $full_client);
// Eg com_jgive
$component = $full_client[0];
$eName = str_replace('com_', '', $component);
$file = Path::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/helpers/' . $eName . '.php');
if (file_exists($file))
{
require_once $file;
$prefix = ucfirst(str_replace('com_', '', $component));
$cName = $prefix . 'Helper';
if (class_exists($cName) && is_callable(array($cName, 'addSubmenu')))
{
$lang = Factory::getLanguage();
// Loading language file from the administrator/language directory then
// Loading language file from the administrator/components/*extension*/language directory
$lang->load($component, JPATH_BASE, null, false, false)
|| $lang->load($component, Path::clean(JPATH_ADMINISTRATOR . '/components/' . $component), null, false, false)
|| $lang->load($component, JPATH_BASE, $lang->getDefault(), false, false)
|| $lang->load($component, Path::clean(JPATH_ADMINISTRATOR . '/components/' . $component), $lang->getDefault(), false, false);
// Call_user_func(array($cName, 'addSubmenu'), 'categories' . (isset($section) ? '.' . $section : ''));
call_user_func(array($cName, 'addSubmenu'), $view . (isset($section) ? '.' . $section : ''));
}
}
/*JHtmlSidebar::addEntry(
Text::_('COM_TJNOTIFICATIONS_TITLE_NOTIFICATIONS'),
'index.php?option=com_tjnotifications&view=notifications',
$view == 'notifications'
);
JHtmlSidebar::addEntry(
Text::_('COM_TJNOTIFICATIONS_TITLE_NOTIFICATIONLOGS'),
'index.php?option=com_tjnotifications&view=logs',
$view == 'logs'
);*/
}
/**
* Gets a list of the actions that can be performed.
*
* @param string $component The component name.
* @param string $section The access section name.
* @param integer $id The item ID.
*
* @return \JObject
*
* @since 2.0.0
*/
public static function getActions($component = '', $section = '', $id = 0)
{
// Get list of actions
return ContentHelper::getActions($component, $section, $id);
}
}