/
contact.php
81 lines (73 loc) · 1.8 KB
/
contact.php
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
<?php
/**
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
defined('_JEXEC') or die;
/**
* Contact component helper.
*
* @package Joomla.Administrator
* @subpackage com_contact
* @since 1.6
*/
class ContactHelper
{
/**
* Configure the Linkbar.
*
* @param string $vName The name of the active view.
*
* @return void
* @since 1.6
*/
public static function addSubmenu($vName)
{
JSubMenuHelper::addEntry(
JText::_('COM_CONTACT_SUBMENU_CONTACTS'),
'index.php?option=com_contact&view=contacts',
$vName == 'contacts'
);
JSubMenuHelper::addEntry(
JText::_('COM_CONTACT_SUBMENU_CATEGORIES'),
'index.php?option=com_categories&extension=com_contact',
$vName == 'categories'
);
if ($vName=='categories') {
JToolBarHelper::title(
JText::sprintf('COM_CATEGORIES_CATEGORIES_TITLE',JText::_('com_contact')),
'contact-categories');
}
}
/**
* Gets a list of the actions that can be performed.
*
* @param int The category ID.
* @param int The contact ID.
*
* @return JObject
* @since 1.6
*/
public static function getActions($categoryId = 0, $contactId = 0)
{
$user = JFactory::getUser();
$result = new JObject;
if (empty($contactId) && empty($categoryId)) {
$assetName = 'com_contact';
}
elseif (empty($contactId)) {
$assetName = 'com_contact.category.'.(int) $categoryId;
}
else {
$assetName = 'com_contact.contact.'.(int) $contactId;
}
$actions = array(
'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.own', 'core.edit.state', 'core.delete'
);
foreach ($actions as $action) {
$result->set($action, $user->authorise($action, $assetName));
}
return $result;
}
}