Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
e7112fa7 | 6 | | Copyright CiviCRM LLC (c) 2004-2015 | |
6a488035 TO |
7 | +--------------------------------------------------------------------+ |
8 | | This file is a part of CiviCRM. | | |
9 | | | | |
10 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
11 | | under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
13 | | | | |
14 | | CiviCRM is distributed in the hope that it will be useful, but | | |
15 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
17 | | See the GNU Affero General Public License for more details. | | |
18 | | | | |
19 | | You should have received a copy of the GNU Affero General Public | | |
20 | | License and the CiviCRM Licensing Exception along | | |
21 | | with this program; if not, contact CiviCRM LLC | | |
22 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
23 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
24 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
25 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | /** | |
29 | * This class introduces component to the system and provides all the | |
30 | * information about it. It needs to extend CRM_Core_Component_Info | |
31 | * abstract class. | |
32 | * | |
33 | * @package CRM | |
e7112fa7 | 34 | * @copyright CiviCRM LLC (c) 2004-2015 |
6a488035 TO |
35 | * $Id$ |
36 | * | |
37 | */ | |
38 | class CRM_Campaign_Info extends CRM_Core_Component_Info { | |
39 | ||
e7c15cb6 CW |
40 | /** |
41 | * @inheritDoc | |
42 | */ | |
6a488035 TO |
43 | protected $keyword = 'campaign'; |
44 | ||
30c4e065 | 45 | /** |
e7c15cb6 | 46 | * @inheritDoc |
30c4e065 EM |
47 | * @return array |
48 | */ | |
6a488035 TO |
49 | public function getInfo() { |
50 | return array( | |
51 | 'name' => 'CiviCampaign', | |
52 | 'translatedName' => ts('CiviCampaign'), | |
53 | 'title' => 'CiviCRM Campaign Engine', | |
54 | 'search' => 1, | |
55 | 'showActivitiesInCore' => 1, | |
56 | ); | |
57 | } | |
58 | ||
59 | ||
30c4e065 | 60 | /** |
e7c15cb6 | 61 | * @inheritDoc |
30c4e065 | 62 | * @param bool $getAllUnconditionally |
221b21b4 AH |
63 | * @param bool $descriptions |
64 | * Whether to return permission descriptions | |
30c4e065 EM |
65 | * |
66 | * @return array | |
67 | */ | |
221b21b4 AH |
68 | public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) { |
69 | $permissions = array( | |
70 | 'administer CiviCampaign' => array( | |
71 | ts('administer CiviCampaign'), | |
72 | ts('Create new campaign, survey and petition types and their status'), | |
73 | ), | |
74 | 'manage campaign' => array( | |
75 | ts('manage campaign'), | |
76 | ts('Create new campaigns, surveys and petitions, reserve respondents'), | |
77 | ), | |
78 | 'reserve campaign contacts' => array( | |
79 | ts('reserve campaign contacts'), | |
80 | ts('Reserve campaign contacts for surveys and petitions'), | |
81 | ), | |
82 | 'release campaign contacts' => array( | |
83 | ts('release campaign contacts'), | |
84 | ts('Release reserved campaign contacts for surveys and petitions'), | |
85 | ), | |
86 | 'interview campaign contacts' => array( | |
87 | ts('interview campaign contacts'), | |
88 | ts('Record survey and petition responses from their reserved contacts'), | |
89 | ), | |
90 | 'gotv campaign contacts' => array( | |
91 | ts('GOTV campaign contacts'), | |
92 | ts('Record that contacts voted'), | |
93 | ), | |
94 | 'sign CiviCRM Petition' => array( | |
95 | ts('sign CiviCRM Petition'), | |
96 | ), | |
6a488035 | 97 | ); |
221b21b4 AH |
98 | |
99 | if (!$descriptions) { | |
100 | foreach ($permissions as $name => $attr) { | |
101 | $permissions[$name] = array_shift($attr); | |
102 | } | |
103 | } | |
104 | ||
105 | return $permissions; | |
6a488035 TO |
106 | } |
107 | ||
108 | ||
30c4e065 | 109 | /** |
e7c15cb6 | 110 | * @inheritDoc |
30c4e065 EM |
111 | * @return null |
112 | */ | |
6a488035 TO |
113 | public function getUserDashboardElement() { |
114 | // no dashboard element for this component | |
115 | return NULL; | |
116 | } | |
117 | ||
30c4e065 EM |
118 | /** |
119 | * @return null | |
120 | */ | |
6a488035 TO |
121 | public function getUserDashboardObject() { |
122 | // no dashboard element for this component | |
123 | return NULL; | |
124 | } | |
125 | ||
30c4e065 | 126 | /** |
e7c15cb6 | 127 | * @inheritDoc |
30c4e065 EM |
128 | * @return null |
129 | */ | |
6a488035 TO |
130 | public function registerTab() { |
131 | // this component doesn't use contact record tabs | |
132 | return NULL; | |
133 | } | |
134 | ||
30c4e065 | 135 | /** |
e7c15cb6 | 136 | * @inheritDoc |
30c4e065 EM |
137 | * @return null |
138 | */ | |
6a488035 TO |
139 | public function registerAdvancedSearchPane() { |
140 | // this component doesn't use advanced search | |
141 | return NULL; | |
142 | } | |
143 | ||
30c4e065 | 144 | /** |
e7c15cb6 | 145 | * @inheritDoc |
30c4e065 | 146 | */ |
6a488035 TO |
147 | public function getActivityTypes() { |
148 | return NULL; | |
149 | } | |
150 | ||
30c4e065 | 151 | /** |
fe482240 | 152 | * add shortcut to Create New. |
30c4e065 EM |
153 | * @param $shortCuts |
154 | */ | |
6a488035 TO |
155 | public function creatNewShortcut(&$shortCuts) { |
156 | if (CRM_Core_Permission::check('manage campaign') || | |
157 | CRM_Core_Permission::check('administer CiviCampaign') | |
158 | ) { | |
159 | $shortCuts = array_merge($shortCuts, array( | |
94880218 | 160 | array( |
353ffa53 TO |
161 | 'path' => 'civicrm/campaign/add', |
162 | 'query' => "reset=1&action=add", | |
163 | 'ref' => 'new-campaign', | |
164 | 'title' => ts('Campaign'), | |
165 | ), | |
166 | array( | |
167 | 'path' => 'civicrm/survey/add', | |
168 | 'query' => "reset=1&action=add", | |
169 | 'ref' => 'new-survey', | |
170 | 'title' => ts('Survey'), | |
171 | ), | |
172 | )); | |
6a488035 TO |
173 | } |
174 | } | |
96025800 | 175 | |
6a488035 | 176 | } |