Commit | Line | Data |
---|---|---|
60488185 | 1 | <?php |
bccdda02 J |
2 | /* |
3 | +--------------------------------------------------------------------+ | |
4 | | CiviCRM Widget Creation Interface (WCI) Version 1.0 | | |
5 | +--------------------------------------------------------------------+ | |
6 | | Copyright Zyxware Technologies (c) 2014 | | |
7 | +--------------------------------------------------------------------+ | |
8 | | This file is a part of CiviCRM WCI. | | |
9 | | | | |
10 | | CiviCRM WCI is free software; you can copy, modify, and distribute | | |
11 | | it under the terms of the GNU Affero General Public License | | |
12 | | Version 3, 19 November 2007. | | |
13 | | | | |
14 | | CiviCRM WCI is distributed in the hope that it will be useful, | | |
15 | | but 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 along with this program; if not, contact Zyxware | | |
21 | | Technologies at info[AT]zyxware[DOT]com. | | |
22 | +--------------------------------------------------------------------+ | |
23 | */ | |
60488185 M |
24 | require_once 'wci.civix.php'; |
25 | ||
26 | /** | |
27 | * Implementation of hook_civicrm_config | |
28 | * | |
29 | * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_config | |
30 | */ | |
31 | function wci_civicrm_config(&$config) { | |
32 | _wci_civix_civicrm_config($config); | |
33 | } | |
34 | ||
35 | /** | |
36 | * Implementation of hook_civicrm_xmlMenu | |
37 | * | |
38 | * @param $files array(string) | |
39 | * | |
40 | * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_xmlMenu | |
41 | */ | |
42 | function wci_civicrm_xmlMenu(&$files) { | |
43 | _wci_civix_civicrm_xmlMenu($files); | |
44 | } | |
45 | ||
46 | /** | |
47 | * Implementation of hook_civicrm_install | |
48 | * | |
49 | * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install | |
50 | */ | |
51 | function wci_civicrm_install() { | |
52 | return _wci_civix_civicrm_install(); | |
53 | } | |
54 | ||
55 | /** | |
56 | * Implementation of hook_civicrm_uninstall | |
57 | * | |
58 | * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_uninstall | |
59 | */ | |
60 | function wci_civicrm_uninstall() { | |
61 | return _wci_civix_civicrm_uninstall(); | |
62 | } | |
63 | ||
64 | /** | |
65 | * Implementation of hook_civicrm_enable | |
66 | * | |
67 | * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable | |
68 | */ | |
69 | function wci_civicrm_enable() { | |
70 | return _wci_civix_civicrm_enable(); | |
71 | } | |
72 | ||
73 | /** | |
74 | * Implementation of hook_civicrm_disable | |
75 | * | |
76 | * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_disable | |
77 | */ | |
78 | function wci_civicrm_disable() { | |
79 | return _wci_civix_civicrm_disable(); | |
80 | } | |
81 | ||
82 | /** | |
83 | * Implementation of hook_civicrm_upgrade | |
84 | * | |
85 | * @param $op string, the type of operation being performed; 'check' or 'enqueue' | |
86 | * @param $queue CRM_Queue_Queue, (for 'enqueue') the modifiable list of pending up upgrade tasks | |
87 | * | |
88 | * @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending) | |
89 | * for 'enqueue', returns void | |
90 | * | |
91 | * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_upgrade | |
92 | */ | |
93 | function wci_civicrm_upgrade($op, CRM_Queue_Queue $queue = NULL) { | |
94 | return _wci_civix_civicrm_upgrade($op, $queue); | |
95 | } | |
96 | ||
97 | /** | |
98 | * Implementation of hook_civicrm_managed | |
99 | * | |
100 | * Generate a list of entities to create/deactivate/delete when this module | |
101 | * is installed, disabled, uninstalled. | |
102 | * | |
103 | * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_managed | |
104 | */ | |
105 | function wci_civicrm_managed(&$entities) { | |
106 | return _wci_civix_civicrm_managed($entities); | |
107 | } | |
108 | ||
109 | /** | |
110 | * Implementation of hook_civicrm_caseTypes | |
111 | * | |
112 | * Generate a list of case-types | |
113 | * | |
114 | * Note: This hook only runs in CiviCRM 4.4+. | |
115 | * | |
116 | * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_caseTypes | |
117 | */ | |
118 | function wci_civicrm_caseTypes(&$caseTypes) { | |
119 | _wci_civix_civicrm_caseTypes($caseTypes); | |
120 | } | |
121 | ||
122 | /** | |
123 | * Implementation of hook_civicrm_alterSettingsFolders | |
124 | * | |
125 | * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_alterSettingsFolders | |
126 | */ | |
127 | function wci_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) { | |
128 | _wci_civix_civicrm_alterSettingsFolders($metaDataFolders); | |
129 | } | |
51fa85d7 J |
130 | |
131 | function wci_civicrm_navigationMenu( &$params ) { | |
bccdda02 | 132 | |
51fa85d7 J |
133 | $navId = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_navigation"); |
134 | if (is_integer($navId)) { | |
135 | $navId++; | |
136 | } | |
137 | // Find the Help menu | |
138 | $helpID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Navigation', 'Help', 'id', 'name'); | |
bccdda02 | 139 | $params[$navId] = $params[$helpID]; |
51fa85d7 J |
140 | // inserting WCI menu at the place of old help location |
141 | $params[$helpID] = array ( | |
cde51233 | 142 | 'attributes' => array ( |
09e2ab5d | 143 | 'label' => ts('Widgets and Progress Bars'), |
cde51233 J |
144 | 'name' => 'WCI', |
145 | 'url' => null, | |
146 | 'permission' => 'access CiviReport,access CiviContribute', | |
147 | 'operator' => 'OR', | |
148 | 'separator' => 0, | |
bccdda02 | 149 | 'parentID' => 0, |
cde51233 J |
150 | 'navID' => $navId, |
151 | 'active' => 1), | |
152 | 'child' => array ( | |
153 | '1' => array ( | |
154 | 'attributes' => array ( | |
540f6530 | 155 | 'label' => ts('New Widget'), |
cde51233 J |
156 | 'name' => 'new_widget', |
157 | 'url' => 'civicrm/wci/widget/add', | |
158 | 'permission' => 'access CiviReport,access CiviContribute', | |
159 | 'operator' => 'OR', | |
160 | 'separator' => 1, | |
bccdda02 | 161 | 'parentID' => $navId, |
cde51233 J |
162 | 'navID' => $navId+1, |
163 | 'active' => 1)), | |
bccdda02 | 164 | |
cde51233 J |
165 | '2' => array ( |
166 | 'attributes' => array ( | |
bccdda02 | 167 | 'label' => ts('Manage Widgets'), |
cde51233 | 168 | 'name' => 'manage_widget', |
ca0dca6f | 169 | 'url' => 'civicrm/wci/widget?reset=1', |
cde51233 J |
170 | 'permission' => 'access CiviReport,access CiviContribute', |
171 | 'operator' => 'OR', | |
172 | 'separator' => 1, | |
bccdda02 | 173 | 'parentID' => $navId, |
cde51233 J |
174 | 'navID' => $navId+2, |
175 | 'active' => 1)), | |
bccdda02 | 176 | |
cde51233 J |
177 | '3' => array ( |
178 | 'attributes' => array ( | |
540f6530 | 179 | 'label' => ts('New Progress Bar'), |
cde51233 J |
180 | 'name' => 'new_progress_bar', |
181 | 'url' => 'civicrm/wci/progress-bar/add', | |
182 | 'permission' => 'access CiviReport,access CiviContribute', | |
183 | 'operator' => 'OR', | |
184 | 'separator' => 1, | |
bccdda02 | 185 | 'parentID' => $navId, |
cde51233 J |
186 | 'navID' => $navId+3, |
187 | 'active' => 1)), | |
bccdda02 | 188 | |
cde51233 J |
189 | '4' => array ( |
190 | 'attributes' => array ( | |
bccdda02 | 191 | 'label' => ts('Manage Progress Bars'), |
cde51233 | 192 | 'name' => 'manage_progress_bar', |
10119db1 | 193 | 'url' => 'civicrm/wci/progress-bar?reset=1', |
cde51233 J |
194 | 'permission' => 'access CiviReport,access CiviContribute', |
195 | 'operator' => 'OR', | |
196 | 'separator' => 1, | |
bccdda02 | 197 | 'parentID' => $navId, |
cde51233 | 198 | 'navID' => $navId+4, |
4f895956 | 199 | 'active' => 1)), |
bccdda02 | 200 | |
4f895956 J |
201 | '5' => array ( |
202 | 'attributes' => array ( | |
13e70378 J |
203 | 'label' => ts('New Embed Code'), |
204 | 'name' => 'new_embed-code', | |
205 | 'url' => 'civicrm/wci/embed-code/add', | |
206 | 'permission' => 'access CiviReport,access CiviContribute', | |
207 | 'operator' => 'OR', | |
208 | 'separator' => 1, | |
bccdda02 | 209 | 'parentID' => $navId, |
13e70378 J |
210 | 'navID' => $navId+5, |
211 | 'active' => 1)), | |
212 | ||
213 | '6' => array ( | |
214 | 'attributes' => array ( | |
215 | 'label' => ts('Manage Embed Code'), | |
216 | 'name' => 'manage-emebed-code', | |
217 | 'url' => 'civicrm/wci/embed-code?reset=1', | |
218 | 'permission' => 'access CiviReport,access CiviContribute', | |
219 | 'operator' => 'OR', | |
220 | 'separator' => 1, | |
bccdda02 | 221 | 'parentID' => $navId, |
13e70378 J |
222 | 'navID' => $navId+6, |
223 | 'active' => 1)), | |
bccdda02 | 224 | |
13e70378 J |
225 | '7' => array ( |
226 | 'attributes' => array ( | |
68f8aff6 | 227 | 'label' => ts('Widget Settings'), |
13e70378 | 228 | 'name' => 'widget-settings', |
4f895956 J |
229 | 'url' => 'civicrm/wci/settings?reset=1', |
230 | 'permission' => 'access CiviReport,access CiviContribute', | |
231 | 'operator' => 'OR', | |
232 | 'separator' => 1, | |
bccdda02 | 233 | 'parentID' => $navId, |
13e70378 | 234 | 'navID' => $navId+7, |
4f895956 | 235 | 'active' => 1)), |
cde51233 | 236 | ), |
51fa85d7 J |
237 | ); |
238 | } |