Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
7e9e8871 | 4 | | CiviCRM version 4.7 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
0f03f337 | 6 | | Copyright CiviCRM LLC (c) 2004-2017 | |
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 | |
0f03f337 | 34 | * @copyright CiviCRM LLC (c) 2004-2017 |
6a488035 TO |
35 | */ |
36 | class CRM_Campaign_Info extends CRM_Core_Component_Info { | |
37 | ||
e7c15cb6 CW |
38 | /** |
39 | * @inheritDoc | |
40 | */ | |
6a488035 TO |
41 | protected $keyword = 'campaign'; |
42 | ||
30c4e065 | 43 | /** |
e7c15cb6 | 44 | * @inheritDoc |
30c4e065 EM |
45 | * @return array |
46 | */ | |
6a488035 TO |
47 | public function getInfo() { |
48 | return array( | |
49 | 'name' => 'CiviCampaign', | |
50 | 'translatedName' => ts('CiviCampaign'), | |
51 | 'title' => 'CiviCRM Campaign Engine', | |
52 | 'search' => 1, | |
53 | 'showActivitiesInCore' => 1, | |
54 | ); | |
55 | } | |
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 AH |
66 | public function getPermissions($getAllUnconditionally = FALSE, $descriptions = FALSE) { |
67 | $permissions = array( | |
68 | 'administer CiviCampaign' => array( | |
69 | ts('administer CiviCampaign'), | |
70 | ts('Create new campaign, survey and petition types and their status'), | |
71 | ), | |
72 | 'manage campaign' => array( | |
73 | ts('manage campaign'), | |
74 | ts('Create new campaigns, surveys and petitions, reserve respondents'), | |
75 | ), | |
76 | 'reserve campaign contacts' => array( | |
77 | ts('reserve campaign contacts'), | |
78 | ts('Reserve campaign contacts for surveys and petitions'), | |
79 | ), | |
80 | 'release campaign contacts' => array( | |
81 | ts('release campaign contacts'), | |
82 | ts('Release reserved campaign contacts for surveys and petitions'), | |
83 | ), | |
84 | 'interview campaign contacts' => array( | |
85 | ts('interview campaign contacts'), | |
86 | ts('Record survey and petition responses from their reserved contacts'), | |
87 | ), | |
88 | 'gotv campaign contacts' => array( | |
89 | ts('GOTV campaign contacts'), | |
90 | ts('Record that contacts voted'), | |
91 | ), | |
92 | 'sign CiviCRM Petition' => array( | |
93 | ts('sign CiviCRM Petition'), | |
94 | ), | |
6a488035 | 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 | ||
106 | ||
30c4e065 | 107 | /** |
e7c15cb6 | 108 | * @inheritDoc |
30c4e065 EM |
109 | * @return null |
110 | */ | |
6a488035 TO |
111 | public function getUserDashboardElement() { |
112 | // no dashboard element for this component | |
113 | return NULL; | |
114 | } | |
115 | ||
30c4e065 EM |
116 | /** |
117 | * @return null | |
118 | */ | |
6a488035 TO |
119 | public function getUserDashboardObject() { |
120 | // no dashboard element for this component | |
121 | return NULL; | |
122 | } | |
123 | ||
30c4e065 | 124 | /** |
e7c15cb6 | 125 | * @inheritDoc |
30c4e065 EM |
126 | * @return null |
127 | */ | |
6a488035 TO |
128 | public function registerTab() { |
129 | // this component doesn't use contact record tabs | |
130 | return NULL; | |
131 | } | |
132 | ||
30c4e065 | 133 | /** |
e7c15cb6 | 134 | * @inheritDoc |
30c4e065 EM |
135 | * @return null |
136 | */ | |
6a488035 TO |
137 | public function registerAdvancedSearchPane() { |
138 | // this component doesn't use advanced search | |
139 | return NULL; | |
140 | } | |
141 | ||
30c4e065 | 142 | /** |
e7c15cb6 | 143 | * @inheritDoc |
30c4e065 | 144 | */ |
6a488035 TO |
145 | public function getActivityTypes() { |
146 | return NULL; | |
147 | } | |
148 | ||
30c4e065 | 149 | /** |
fe482240 | 150 | * add shortcut to Create New. |
30c4e065 EM |
151 | * @param $shortCuts |
152 | */ | |
6a488035 TO |
153 | public function creatNewShortcut(&$shortCuts) { |
154 | if (CRM_Core_Permission::check('manage campaign') || | |
155 | CRM_Core_Permission::check('administer CiviCampaign') | |
156 | ) { | |
157 | $shortCuts = array_merge($shortCuts, array( | |
94880218 | 158 | array( |
353ffa53 TO |
159 | 'path' => 'civicrm/campaign/add', |
160 | 'query' => "reset=1&action=add", | |
161 | 'ref' => 'new-campaign', | |
162 | 'title' => ts('Campaign'), | |
163 | ), | |
164 | array( | |
165 | 'path' => 'civicrm/survey/add', | |
166 | 'query' => "reset=1&action=add", | |
167 | 'ref' => 'new-survey', | |
168 | 'title' => ts('Survey'), | |
169 | ), | |
170 | )); | |
6a488035 TO |
171 | } |
172 | } | |
96025800 | 173 | |
6a488035 | 174 | } |