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. |
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. |
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. |
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 +--------------------------------------------------------------------+
24 require_once 'wci.civix.php';
27 * Implementation of hook_civicrm_config
29 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_config
31 function wci_civicrm_config(&$config) {
32 _wci_civix_civicrm_config($config);
36 * Implementation of hook_civicrm_xmlMenu
38 * @param $files array(string)
40 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_xmlMenu
42 function wci_civicrm_xmlMenu(&$files) {
43 _wci_civix_civicrm_xmlMenu($files);
47 * Implementation of hook_civicrm_install
49 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
51 function wci_civicrm_install() {
52 return _wci_civix_civicrm_install();
56 * Implementation of hook_civicrm_uninstall
58 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_uninstall
60 function wci_civicrm_uninstall() {
61 return _wci_civix_civicrm_uninstall();
65 * Implementation of hook_civicrm_enable
67 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable
69 function wci_civicrm_enable() {
70 return _wci_civix_civicrm_enable();
74 * Implementation of hook_civicrm_disable
76 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_disable
78 function wci_civicrm_disable() {
79 return _wci_civix_civicrm_disable();
83 * Implementation of hook_civicrm_upgrade
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
88 * @return mixed based on op. for 'check', returns array(boolean) (TRUE if upgrades are pending)
89 * for 'enqueue', returns void
91 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_upgrade
93 function wci_civicrm_upgrade($op, CRM_Queue_Queue
$queue = NULL) {
94 return _wci_civix_civicrm_upgrade($op, $queue);
98 * Implementation of hook_civicrm_managed
100 * Generate a list of entities to create/deactivate/delete when this module
101 * is installed, disabled, uninstalled.
103 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_managed
105 function wci_civicrm_managed(&$entities) {
106 return _wci_civix_civicrm_managed($entities);
110 * Implementation of hook_civicrm_caseTypes
112 * Generate a list of case-types
114 * Note: This hook only runs in CiviCRM 4.4+.
116 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_caseTypes
118 function wci_civicrm_caseTypes(&$caseTypes) {
119 _wci_civix_civicrm_caseTypes($caseTypes);
123 * Implementation of hook_civicrm_alterSettingsFolders
125 * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_alterSettingsFolders
127 function wci_civicrm_alterSettingsFolders(&$metaDataFolders = NULL) {
128 _wci_civix_civicrm_alterSettingsFolders($metaDataFolders);
131 function _getMenuKeyMax($menuArray) {
132 $max = array(max(array_keys($menuArray)));
133 foreach($menuArray as $v) {
134 if (!empty($v['child'])) {
135 $max[] = _getMenuKeyMax($v['child']);
141 function wci_civicrm_permission(&$permissions) {
142 $prefix = ts('CiviWCI') . ': '; // name of extension or module
143 $permissions +
= array(
144 'access CiviWCI Widget' => $prefix . ts('Access CiviWCI Widget'),
145 'administer CiviWCI' => $prefix . ts('Administer CiviWCI'),
149 function wci_civicrm_navigationMenu( &$params ) {
151 $maxKey = _getMenuKeyMax($params);
152 // Find the Help menu
153 $helpID = CRM_Core_DAO
::getFieldValue('CRM_Core_DAO_Navigation', 'Help', 'id', 'name');
154 $params[$maxKey] = $params[$helpID];
155 // inserting WCI menu at the place of old help location
156 $params[$helpID] = array (
157 'attributes' => array (
158 'label' => ts('Widgets and Progress Bars'),
161 'permission' => 'access CiviReport,access CiviContribute',
169 'attributes' => array (
170 'label' => ts('New Widget'),
171 'name' => 'new_widget',
172 'url' => 'civicrm/wci/widget/add',
173 'permission' => 'administer CiviWCI',
176 'parentID' => $maxKey,
177 'navID' => $maxKey+
1,
181 'attributes' => array (
182 'label' => ts('Manage Widgets'),
183 'name' => 'manage_widget',
184 'url' => 'civicrm/wci/widget?reset=1',
185 'permission' => 'administer CiviWCI',
188 'parentID' => $maxKey,
189 'navID' => $maxKey+
2,
193 'attributes' => array (
194 'label' => ts('New Progress Bar'),
195 'name' => 'new_progress_bar',
196 'url' => 'civicrm/wci/progress-bar/add',
197 'permission' => 'administer CiviWCI',
200 'parentID' => $maxKey,
201 'navID' => $maxKey+
3,
205 'attributes' => array (
206 'label' => ts('Manage Progress Bars'),
207 'name' => 'manage_progress_bar',
208 'url' => 'civicrm/wci/progress-bar?reset=1',
209 'permission' => 'administer CiviWCI',
212 'parentID' => $maxKey,
213 'navID' => $maxKey+
4,
217 'attributes' => array (
218 'label' => ts('New Embed Code'),
219 'name' => 'new_embed-code',
220 'url' => 'civicrm/wci/embed-code/add',
221 'permission' => 'administer CiviWCI',
224 'parentID' => $maxKey,
225 'navID' => $maxKey+
5,
229 'attributes' => array (
230 'label' => ts('Manage Embed Code'),
231 'name' => 'manage-emebed-code',
232 'url' => 'civicrm/wci/embed-code?reset=1',
233 'permission' => 'administer CiviWCI',
236 'parentID' => $maxKey,
237 'navID' => $maxKey+
6,
241 'attributes' => array (
242 'label' => ts('Widget Settings'),
243 'name' => 'widget-settings',
244 'url' => 'civicrm/wci/settings?reset=1',
245 'permission' => 'administer CiviWCI',
248 'parentID' => $maxKey,
249 'navID' => $maxKey+
7,