Merge pull request #14922 from civicrm/5.16
[civicrm-core.git] / CRM / Campaign / Info.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
fee14197 4 | CiviCRM version 5 |
6a488035 5 +--------------------------------------------------------------------+
6b83d5bd 6 | Copyright CiviCRM LLC (c) 2004-2019 |
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
6b83d5bd 34 * @copyright CiviCRM LLC (c) 2004-2019
6a488035
TO
35 */
36class CRM_Campaign_Info extends CRM_Core_Component_Info {
37
e7c15cb6 38 /**
f157740d 39 * @var string
e7c15cb6
CW
40 * @inheritDoc
41 */
6a488035
TO
42 protected $keyword = 'campaign';
43
30c4e065 44 /**
e7c15cb6 45 * @inheritDoc
30c4e065
EM
46 * @return array
47 */
6a488035 48 public function getInfo() {
be2fb01f 49 return [
6a488035
TO
50 'name' => 'CiviCampaign',
51 'translatedName' => ts('CiviCampaign'),
e300cf31 52 'title' => ts('CiviCRM Campaign Engine'),
6a488035
TO
53 'search' => 1,
54 'showActivitiesInCore' => 1,
be2fb01f 55 ];
6a488035
TO
56 }
57
30c4e065 58 /**
e7c15cb6 59 * @inheritDoc
30c4e065 60 * @param bool $getAllUnconditionally
221b21b4
AH
61 * @param bool $descriptions
62 * Whether to return permission descriptions
30c4e065
EM
63 *
64 * @return array
65 */
221b21b4 66 public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) {
be2fb01f
CW
67 $permissions = [
68 'administer CiviCampaign' => [
221b21b4
AH
69 ts('administer CiviCampaign'),
70 ts('Create new campaign, survey and petition types and their status'),
be2fb01f
CW
71 ],
72 'manage campaign' => [
221b21b4
AH
73 ts('manage campaign'),
74 ts('Create new campaigns, surveys and petitions, reserve respondents'),
be2fb01f
CW
75 ],
76 'reserve campaign contacts' => [
221b21b4
AH
77 ts('reserve campaign contacts'),
78 ts('Reserve campaign contacts for surveys and petitions'),
be2fb01f
CW
79 ],
80 'release campaign contacts' => [
221b21b4
AH
81 ts('release campaign contacts'),
82 ts('Release reserved campaign contacts for surveys and petitions'),
be2fb01f
CW
83 ],
84 'interview campaign contacts' => [
221b21b4
AH
85 ts('interview campaign contacts'),
86 ts('Record survey and petition responses from their reserved contacts'),
be2fb01f
CW
87 ],
88 'gotv campaign contacts' => [
221b21b4
AH
89 ts('GOTV campaign contacts'),
90 ts('Record that contacts voted'),
be2fb01f
CW
91 ],
92 'sign CiviCRM Petition' => [
221b21b4 93 ts('sign CiviCRM Petition'),
be2fb01f
CW
94 ],
95 ];
221b21b4
AH
96
97 if (!$descriptions) {
98 foreach ($permissions as $name => $attr) {
99 $permissions[$name] = array_shift($attr);
100 }
101 }
102
103 return $permissions;
6a488035
TO
104 }
105
30c4e065 106 /**
e7c15cb6 107 * @inheritDoc
30c4e065
EM
108 * @return null
109 */
6a488035
TO
110 public function getUserDashboardElement() {
111 // no dashboard element for this component
112 return NULL;
113 }
114
30c4e065
EM
115 /**
116 * @return null
117 */
6a488035
TO
118 public function getUserDashboardObject() {
119 // no dashboard element for this component
120 return NULL;
121 }
122
30c4e065 123 /**
e7c15cb6 124 * @inheritDoc
30c4e065
EM
125 * @return null
126 */
6a488035
TO
127 public function registerTab() {
128 // this component doesn't use contact record tabs
129 return NULL;
130 }
131
b04115b4
CW
132 /**
133 * @inheritDoc
134 * @return string
135 */
136 public function getIcon() {
137 return 'crm-i fa-star-o';
138 }
139
30c4e065 140 /**
e7c15cb6 141 * @inheritDoc
30c4e065
EM
142 * @return null
143 */
6a488035
TO
144 public function registerAdvancedSearchPane() {
145 // this component doesn't use advanced search
146 return NULL;
147 }
148
30c4e065 149 /**
e7c15cb6 150 * @inheritDoc
30c4e065 151 */
6a488035
TO
152 public function getActivityTypes() {
153 return NULL;
154 }
155
30c4e065 156 /**
fe482240 157 * add shortcut to Create New.
30c4e065
EM
158 * @param $shortCuts
159 */
6a488035
TO
160 public function creatNewShortcut(&$shortCuts) {
161 if (CRM_Core_Permission::check('manage campaign') ||
162 CRM_Core_Permission::check('administer CiviCampaign')
163 ) {
be2fb01f
CW
164 $shortCuts = array_merge($shortCuts, [
165 [
353ffa53
TO
166 'path' => 'civicrm/campaign/add',
167 'query' => "reset=1&action=add",
168 'ref' => 'new-campaign',
169 'title' => ts('Campaign'),
be2fb01f
CW
170 ],
171 [
353ffa53
TO
172 'path' => 'civicrm/survey/add',
173 'query' => "reset=1&action=add",
174 'ref' => 'new-survey',
175 'title' => ts('Survey'),
be2fb01f
CW
176 ],
177 ]);
6a488035
TO
178 }
179 }
96025800 180
6a488035 181}