Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
fee14197 | 4 | | CiviCRM version 5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
8c9251b3 | 6 | | Copyright CiviCRM LLC (c) 2004-2018 | |
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 | * | |
30 | * @package CRM | |
8c9251b3 | 31 | * @copyright CiviCRM LLC (c) 2004-2018 |
6a488035 TO |
32 | * $Id$ |
33 | * | |
34 | */ | |
35 | ||
36 | /** | |
37 | * Create a page for displaying UF Groups. | |
38 | * | |
39 | * Heart of this class is the run method which checks | |
40 | * for action type and then displays the appropriate | |
41 | * page. | |
42 | * | |
43 | */ | |
44 | class CRM_UF_Page_Group extends CRM_Core_Page { | |
45 | ||
46 | /** | |
fe482240 | 47 | * The action links that we need to display for the browse screen. |
6a488035 TO |
48 | * |
49 | * @var array | |
50 | */ | |
51 | private static $_actionLinks = NULL; | |
52 | ||
53 | /** | |
54 | * Get the action links for this page. | |
55 | * | |
56 | * @param | |
57 | * | |
a6c01b45 | 58 | * @return array |
6a488035 | 59 | */ |
d1424f8f | 60 | public static function &actionLinks() { |
6a488035 TO |
61 | // check if variable _actionsLinks is populated |
62 | if (!self::$_actionLinks) { | |
63 | // helper variable for nicer formatting | |
64 | $copyExtra = ts('Are you sure you want to make a copy of this Profile?'); | |
65 | self::$_actionLinks = array( | |
66 | CRM_Core_Action::BROWSE => array( | |
67 | 'name' => ts('Fields'), | |
68 | 'url' => 'civicrm/admin/uf/group/field', | |
69 | 'qs' => 'reset=1&action=browse&gid=%%id%%', | |
70 | 'title' => ts('View and Edit Fields'), | |
71 | ), | |
72 | CRM_Core_Action::UPDATE => array( | |
73 | 'name' => ts('Settings'), | |
74 | 'url' => 'civicrm/admin/uf/group/update', | |
75 | 'qs' => 'action=update&id=%%id%%&context=group', | |
76 | 'title' => ts('Edit CiviCRM Profile Group'), | |
77 | ), | |
78 | CRM_Core_Action::PREVIEW => array( | |
79 | 'name' => ts('Preview'), | |
80 | 'url' => 'civicrm/admin/uf/group', | |
81 | 'qs' => 'action=preview&id=%%id%%&field=0&context=group', | |
82 | 'title' => ts('Edit CiviCRM Profile Group'), | |
83 | ), | |
84 | CRM_Core_Action::ADD => array( | |
3495d8d7 | 85 | 'name' => ts('Use - Create Mode'), |
6a488035 TO |
86 | 'url' => 'civicrm/profile/create', |
87 | 'qs' => 'gid=%%id%%&reset=1', | |
3495d8d7 J |
88 | 'title' => ts('Use - Create Mode'), |
89 | 'fe' => TRUE, | |
90 | ), | |
91 | CRM_Core_Action::ADVANCED => array( | |
92 | 'name' => ts('Use - Edit Mode'), | |
93 | 'url' => 'civicrm/profile/edit', | |
94 | 'qs' => 'gid=%%id%%&reset=1', | |
95 | 'title' => ts('Use - Edit Mode'), | |
9147c186 | 96 | 'fe' => TRUE, |
6a488035 | 97 | ), |
9865c956 | 98 | CRM_Core_Action::BASIC => array( |
3495d8d7 | 99 | 'name' => ts('Use - Listings Mode'), |
9865c956 DG |
100 | 'url' => 'civicrm/profile', |
101 | 'qs' => 'gid=%%id%%&reset=1', | |
3495d8d7 | 102 | 'title' => ts('Use - Listings Mode'), |
9147c186 | 103 | 'fe' => TRUE, |
9865c956 | 104 | ), |
6a488035 TO |
105 | CRM_Core_Action::DISABLE => array( |
106 | 'name' => ts('Disable'), | |
4d17a233 | 107 | 'ref' => 'crm-enable-disable', |
6a488035 TO |
108 | 'title' => ts('Disable CiviCRM Profile Group'), |
109 | ), | |
110 | CRM_Core_Action::ENABLE => array( | |
111 | 'name' => ts('Enable'), | |
4d17a233 | 112 | 'ref' => 'crm-enable-disable', |
6a488035 TO |
113 | 'title' => ts('Enable CiviCRM Profile Group'), |
114 | ), | |
115 | CRM_Core_Action::DELETE => array( | |
116 | 'name' => ts('Delete'), | |
117 | 'url' => 'civicrm/admin/uf/group', | |
118 | 'qs' => 'action=delete&id=%%id%%', | |
119 | 'title' => ts('Delete CiviCRM Profile Group'), | |
120 | ), | |
6a488035 | 121 | CRM_Core_Action::COPY => array( |
3495d8d7 | 122 | 'name' => ts('Copy'), |
6a488035 TO |
123 | 'url' => 'civicrm/admin/uf/group', |
124 | 'qs' => 'action=copy&gid=%%id%%', | |
125 | 'title' => ts('Make a Copy of CiviCRM Profile Group'), | |
126 | 'extra' => 'onclick = "return confirm(\'' . $copyExtra . '\');"', | |
127 | ), | |
128 | ); | |
e8a64b98 | 129 | $allowRemoteSubmit = Civi::settings()->get('remote_profile_submissions'); |
1bfe4abf | 130 | if ($allowRemoteSubmit) { |
61f53f0d PN |
131 | self::$_actionLinks[CRM_Core_Action::PROFILE] = array( |
132 | 'name' => ts('HTML Form Snippet'), | |
133 | 'url' => 'civicrm/admin/uf/group', | |
134 | 'qs' => 'action=profile&gid=%%id%%', | |
135 | 'title' => ts('HTML Form Snippet for this Profile'), | |
136 | ); | |
137 | } | |
6a488035 TO |
138 | } |
139 | return self::$_actionLinks; | |
140 | } | |
141 | ||
142 | /** | |
143 | * Run the page. | |
144 | * | |
145 | * This method is called after the page is created. It checks for the | |
146 | * type of action and executes that action. | |
147 | * Finally it calls the parent's run method. | |
6a488035 | 148 | */ |
00be9182 | 149 | public function run() { |
6a488035 TO |
150 | // get the requested action |
151 | $action = CRM_Utils_Request::retrieve('action', 'String', | |
152 | $this, FALSE, | |
153 | // default to 'browse' | |
154 | 'browse' | |
155 | ); | |
156 | ||
157 | // assign vars to templates | |
158 | $this->assign('action', $action); | |
c1bd8375 | 159 | $this->assign('selectedChild', CRM_Utils_Request::retrieve('selectedChild', 'Alphanumeric', $this)); |
6a488035 TO |
160 | $id = CRM_Utils_Request::retrieve('id', 'Positive', |
161 | $this, FALSE, 0 | |
162 | ); | |
163 | ||
164 | //set the context and then start w/ action. | |
165 | $this->setContext($id, $action); | |
166 | ||
167 | // what action to take ? | |
168 | if ($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::DELETE | CRM_Core_Action::DISABLE)) { | |
169 | $this->edit($id, $action); | |
170 | } | |
171 | else { | |
172 | // if action is enable or disable do the needful. | |
173 | if ($action & CRM_Core_Action::ENABLE) { | |
174 | CRM_Core_BAO_UFGroup::setIsActive($id, 1); | |
175 | ||
176 | // update cms integration with registration / my account | |
177 | CRM_Utils_System::updateCategories(); | |
178 | } | |
179 | elseif ($action & CRM_Core_Action::PROFILE) { | |
180 | $this->profile(); | |
181 | CRM_Utils_System::setTitle(ts('%1 - HTML Form Snippet', array(1 => $this->_title))); | |
182 | } | |
183 | elseif ($action & CRM_Core_Action::PREVIEW) { | |
184 | $this->preview($id, $action); | |
185 | } | |
186 | elseif ($action & CRM_Core_Action::COPY) { | |
187 | $this->copy(); | |
188 | } | |
189 | // finally browse the uf groups | |
190 | $this->browse(); | |
191 | } | |
192 | // parent run | |
193 | return parent::run(); | |
194 | } | |
195 | ||
196 | /** | |
dc195289 | 197 | * make a copy of a profile, including |
6a488035 TO |
198 | * all the fields in the profile |
199 | * | |
200 | * @return void | |
6a488035 | 201 | */ |
00be9182 | 202 | public function copy() { |
6a488035 TO |
203 | $gid = CRM_Utils_Request::retrieve('gid', 'Positive', |
204 | $this, TRUE, 0, 'GET' | |
205 | ); | |
206 | ||
207 | CRM_Core_BAO_UFGroup::copy($gid); | |
208 | CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/uf/group', 'reset=1')); | |
209 | } | |
210 | ||
211 | /** | |
dc195289 | 212 | * for profile mode (standalone html form ) for uf group |
6a488035 TO |
213 | * |
214 | * @return void | |
6a488035 | 215 | */ |
00be9182 | 216 | public function profile() { |
6a488035 TO |
217 | $config = CRM_Core_Config::singleton(); |
218 | ||
219 | // reassign resource base to be the full url, CRM-4660 | |
220 | $config->resourceBase = $config->userFrameworkResourceURL; | |
221 | $config->useFrameworkRelativeBase = $config->userFrameworkBaseURL; | |
222 | ||
223 | $gid = CRM_Utils_Request::retrieve('gid', 'Positive', | |
224 | $this, FALSE, 0, 'GET' | |
225 | ); | |
226 | $controller = new CRM_Core_Controller_Simple('CRM_Profile_Form_Edit', ts('Create'), CRM_Core_Action::ADD, | |
227 | FALSE, FALSE, TRUE | |
228 | ); | |
229 | $controller->reset(); | |
230 | $controller->process(); | |
231 | $controller->set('gid', $gid); | |
232 | $controller->setEmbedded(TRUE); | |
233 | $controller->run(); | |
234 | $template = CRM_Core_Smarty::singleton(); | |
235 | $template->assign('gid', $gid); | |
236 | $template->assign('tplFile', 'CRM/Profile/Form/Edit.tpl'); | |
880e33cd | 237 | $profile = trim($template->fetch('CRM/Form/default.tpl')); |
6a488035 TO |
238 | |
239 | // not sure how to circumvent our own navigation system to generate the right form url | |
240 | $urlReplaceWith = 'civicrm/profile/create&gid=' . $gid . '&reset=1'; | |
241 | if ($config->userSystem->is_drupal && $config->cleanURL) { | |
242 | $urlReplaceWith = 'civicrm/profile/create?gid=' . $gid . '&reset=1'; | |
243 | } | |
244 | $profile = str_replace('civicrm/admin/uf/group', $urlReplaceWith, $profile); | |
245 | ||
8c63e816 CW |
246 | // FIXME: (CRM-3587) hack to make standalone profile work |
247 | // in wordpress and joomla without administrator login | |
6a488035 TO |
248 | if ($config->userFramework == 'Joomla') { |
249 | $profile = str_replace('/administrator/', '/index.php', $profile); | |
250 | } | |
013e44b2 | 251 | elseif ($config->userFramework == 'WordPress') { |
c73b1c19 | 252 | //@todo remove this part when it is OK to deprecate CIVICRM_UF_WP_BASEPAGE-CRM-15933 |
253 | if (defined('CIVICRM_UF_WP_BASEPAGE')) { | |
254 | $wpbase = CIVICRM_UF_WP_BASEPAGE; | |
255 | } | |
256 | elseif (!empty($config->wpBasePage)) { | |
257 | $wpbase = $config->wpBasePage; | |
258 | } | |
259 | else { | |
260 | $wpbase = 'index.php'; | |
261 | } | |
81badc57 | 262 | $profile = str_replace('/wp-admin/admin.php', '/' . $wpbase . '/', $profile); |
6a488035 TO |
263 | } |
264 | ||
880e33cd CW |
265 | // add header files |
266 | CRM_Core_Resources::singleton()->addCoreResources('html-header'); | |
267 | $profile = CRM_Core_Region::instance('html-header')->render('', FALSE) . $profile; | |
6a488035 | 268 | |
6a488035 TO |
269 | $this->assign('profile', htmlentities($profile, ENT_NOQUOTES, 'UTF-8')); |
270 | //get the title of uf group | |
271 | if ($gid) { | |
272 | $title = CRM_Core_BAO_UFGroup::getTitle($gid); | |
273 | $this->_title = $title; | |
274 | } | |
275 | else { | |
276 | $title = 'Profile Form'; | |
277 | } | |
278 | ||
279 | $this->assign('title', $title); | |
280 | $this->assign('action', CRM_Core_Action::PROFILE); | |
281 | $this->assign('isForm', 0); | |
282 | } | |
283 | ||
284 | /** | |
fe482240 | 285 | * Edit uf group. |
6a488035 | 286 | * |
5ce1712d TO |
287 | * @param int $id |
288 | * Uf group id. | |
289 | * @param string $action | |
290 | * The action to be invoked. | |
6a488035 TO |
291 | * |
292 | * @return void | |
6a488035 | 293 | */ |
00be9182 | 294 | public function edit($id, $action) { |
6a488035 TO |
295 | // create a simple controller for editing uf data |
296 | $controller = new CRM_Core_Controller_Simple('CRM_UF_Form_Group', ts('CiviCRM Profile Group'), $action); | |
297 | $this->setContext($id, $action); | |
298 | $controller->set('id', $id); | |
299 | $controller->setEmbedded(TRUE); | |
300 | $controller->process(); | |
301 | $controller->run(); | |
302 | } | |
303 | ||
304 | /** | |
305 | * Browse all uf data groups. | |
306 | * | |
307 | * @param | |
308 | * | |
309 | * @return void | |
6a488035 | 310 | */ |
00be9182 | 311 | public function browse($action = NULL) { |
6a488035 | 312 | $ufGroup = array(); |
6a488035 TO |
313 | $allUFGroups = CRM_Core_BAO_UFGroup::getModuleUFGroup(); |
314 | if (empty($allUFGroups)) { | |
315 | return; | |
316 | } | |
317 | ||
ff4f7744 | 318 | $ufGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id'); |
6a488035 TO |
319 | CRM_Utils_Hook::aclGroup(CRM_Core_Permission::ADMIN, NULL, 'civicrm_uf_group', $ufGroups, $allUFGroups); |
320 | ||
321 | foreach ($allUFGroups as $id => $value) { | |
322 | $ufGroup[$id] = array(); | |
323 | $ufGroup[$id]['id'] = $id; | |
324 | $ufGroup[$id]['title'] = $value['title']; | |
ce1a9db4 | 325 | $ufGroup[$id]['frontend_title'] = $value['frontend_title']; |
bcbde5ca AW |
326 | $ufGroup[$id]['created_id'] = $value['created_id']; |
327 | $ufGroup[$id]['created_by'] = CRM_Contact_BAO_Contact::displayName($value['created_id']); | |
328 | $ufGroup[$id]['description'] = $value['description']; | |
6a488035 TO |
329 | $ufGroup[$id]['is_active'] = $value['is_active']; |
330 | $ufGroup[$id]['group_type'] = $value['group_type']; | |
331 | $ufGroup[$id]['is_reserved'] = $value['is_reserved']; | |
332 | ||
333 | // form all action links | |
d1424f8f | 334 | $action = array_sum(array_keys(self::actionLinks())); |
6a488035 TO |
335 | |
336 | // update enable/disable links depending on uf_group properties. | |
337 | if ($value['is_active']) { | |
338 | $action -= CRM_Core_Action::ENABLE; | |
339 | } | |
340 | else { | |
341 | $action -= CRM_Core_Action::DISABLE; | |
342 | } | |
343 | ||
344 | // drop certain actions if the profile is reserved | |
345 | if ($value['is_reserved']) { | |
346 | $action -= CRM_Core_Action::UPDATE; | |
347 | $action -= CRM_Core_Action::DISABLE; | |
348 | $action -= CRM_Core_Action::DELETE; | |
349 | } | |
350 | ||
351 | $groupTypes = self::extractGroupTypes($value['group_type']); | |
6a488035 | 352 | |
b233e1b4 | 353 | // drop Create, Edit and View mode links if profile group_type is one of the following: |
4d4daa2d | 354 | // Contribution, Membership, Activity, Participant, Case, Grant |
7e50650d PN |
355 | $isMixedProfile = CRM_Core_BAO_UFField::checkProfileType($id); |
356 | if ($isMixedProfile) { | |
6a488035 | 357 | $action -= CRM_Core_Action::ADD; |
caa0151f PN |
358 | $action -= CRM_Core_Action::ADVANCED; |
359 | $action -= CRM_Core_Action::BASIC; | |
9664eee1 BS |
360 | |
361 | //CRM-21004 | |
b841e03f | 362 | if (array_key_exists(CRM_Core_Action::PROFILE, self::$_actionLinks)) { |
9664eee1 BS |
363 | $action -= CRM_Core_Action::PROFILE; |
364 | } | |
6a488035 TO |
365 | } |
366 | ||
b233e1b4 | 367 | $ufGroup[$id]['group_type'] = self::formatGroupTypes($groupTypes); |
6a488035 TO |
368 | |
369 | $ufGroup[$id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, | |
87dab4a4 AH |
370 | array('id' => $id), |
371 | ts('more'), | |
372 | FALSE, | |
373 | 'ufGroup.row.actions', | |
374 | 'UFGroup', | |
375 | $id | |
6a488035 TO |
376 | ); |
377 | //get the "Used For" from uf_join | |
378 | $ufGroup[$id]['module'] = implode(', ', CRM_Core_BAO_UFGroup::getUFJoinRecord($id, TRUE)); | |
379 | } | |
380 | ||
381 | $this->assign('rows', $ufGroup); | |
382 | } | |
383 | ||
384 | /** | |
fe482240 | 385 | * for preview mode for ufoup. |
6a488035 | 386 | * |
5ce1712d TO |
387 | * @param int $id |
388 | * Uf group id. | |
6a488035 | 389 | * |
3bdf1f3a | 390 | * @param int $action |
6a488035 | 391 | */ |
00be9182 | 392 | public function preview($id, $action) { |
6a488035 TO |
393 | $controller = new CRM_Core_Controller_Simple('CRM_UF_Form_Preview', ts('CiviCRM Profile Group Preview'), NULL); |
394 | $controller->set('id', $id); | |
395 | $controller->setEmbedded(TRUE); | |
396 | $controller->process(); | |
397 | $controller->run(); | |
398 | } | |
399 | ||
624e56fa | 400 | /** |
100fef9d | 401 | * @param int $id |
624e56fa EM |
402 | * @param $action |
403 | */ | |
00be9182 | 404 | public function setContext($id, $action) { |
edc80cda | 405 | $context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this); |
6a488035 TO |
406 | |
407 | //we need to differentiate context for update and preview profile. | |
408 | if (!$context && !($action & (CRM_Core_Action::UPDATE | CRM_Core_Action::PREVIEW))) { | |
409 | $context = 'group'; | |
410 | } | |
411 | ||
412 | if ($context == 'field') { | |
413 | $url = CRM_Utils_System::url('civicrm/admin/uf/group/field', "reset=1&action=browse&gid={$id}"); | |
414 | } | |
415 | else { | |
416 | $url = CRM_Utils_System::url('civicrm/admin/uf/group', 'reset=1&action=browse'); | |
417 | } | |
418 | ||
419 | $session = CRM_Core_Session::singleton(); | |
420 | $session->pushUserContext($url); | |
421 | } | |
422 | ||
624e56fa EM |
423 | /** |
424 | * @param $groupType | |
425 | * | |
426 | * @return array | |
427 | */ | |
00be9182 | 428 | public static function extractGroupTypes($groupType) { |
6a488035 TO |
429 | $returnGroupTypes = array(); |
430 | if (!$groupType) { | |
431 | return $returnGroupTypes; | |
432 | } | |
433 | ||
434 | $groupTypeParts = explode(CRM_Core_DAO::VALUE_SEPARATOR, $groupType); | |
435 | foreach (explode(',', $groupTypeParts[0]) as $type) { | |
436 | $returnGroupTypes[$type] = $type; | |
437 | } | |
438 | ||
a7488080 | 439 | if (!empty($groupTypeParts[1])) { |
6a488035 TO |
440 | foreach (explode(',', $groupTypeParts[1]) as $typeValue) { |
441 | $groupTypeValues = $valueLabels = array(); | |
442 | $valueParts = explode(':', $typeValue); | |
443 | $typeName = NULL; | |
444 | switch ($valueParts[0]) { | |
445 | case 'ContributionType': | |
446 | $typeName = 'Contribution'; | |
447 | $valueLabels = CRM_Contribute_PseudoConstant::financialType(); | |
448 | break; | |
449 | ||
450 | case 'ParticipantRole': | |
451 | $typeName = 'Participant'; | |
452 | $valueLabels = CRM_Event_PseudoConstant::participantRole(); | |
453 | break; | |
454 | ||
455 | case 'ParticipantEventName': | |
456 | $typeName = 'Participant'; | |
457 | $valueLabels = CRM_Event_PseudoConstant::event(); | |
458 | break; | |
459 | ||
460 | case 'ParticipantEventType': | |
461 | $typeName = 'Participant'; | |
462 | $valueLabels = CRM_Event_PseudoConstant::eventType(); | |
463 | break; | |
464 | ||
465 | case 'MembershipType': | |
466 | $typeName = 'Membership'; | |
467 | $valueLabels = CRM_Member_PseudoConstant::membershipType(); | |
468 | break; | |
469 | ||
470 | case 'ActivityType': | |
471 | $typeName = 'Activity'; | |
472 | $valueLabels = CRM_Core_PseudoConstant::ActivityType(TRUE, TRUE, FALSE, 'label', TRUE); | |
473 | break; | |
9147c186 | 474 | |
1cb28d5d | 475 | case 'CaseType': |
476 | $typeName = 'Case'; | |
477 | $valueLabels = CRM_Case_PseudoConstant::caseType(); | |
478 | break; | |
6a488035 TO |
479 | } |
480 | ||
481 | foreach ($valueParts as $val) { | |
482 | if (CRM_Utils_Rule::integer($val)) { | |
483 | $groupTypeValues[$val] = CRM_Utils_Array::value($val, $valueLabels); | |
484 | } | |
485 | } | |
486 | ||
487 | if (!is_array($returnGroupTypes[$typeName])) { | |
488 | $returnGroupTypes[$typeName] = array(); | |
489 | } | |
490 | $returnGroupTypes[$typeName][$valueParts[0]] = $groupTypeValues; | |
491 | } | |
492 | } | |
493 | return $returnGroupTypes; | |
494 | } | |
96025800 | 495 | |
b233e1b4 CW |
496 | /** |
497 | * Format 'group_type' field for display | |
498 | * | |
499 | * @param array $groupTypes | |
500 | * output from self::extractGroupTypes | |
501 | * @return string | |
502 | */ | |
503 | public static function formatGroupTypes($groupTypes) { | |
504 | $groupTypesString = ''; | |
505 | if (!empty($groupTypes)) { | |
506 | $groupTypesStrings = array(); | |
507 | foreach ($groupTypes as $groupType => $typeValues) { | |
508 | if (is_array($typeValues)) { | |
509 | if ($groupType == 'Participant') { | |
510 | foreach ($typeValues as $subType => $subTypeValues) { | |
511 | $groupTypesStrings[] = $subType . '::' . implode(': ', $subTypeValues); | |
512 | } | |
513 | } | |
514 | else { | |
515 | $groupTypesStrings[] = $groupType . '::' . implode(': ', current($typeValues)); | |
516 | } | |
517 | } | |
518 | else { | |
519 | $groupTypesStrings[] = $groupType; | |
520 | } | |
521 | } | |
522 | $groupTypesString = implode(', ', $groupTypesStrings); | |
523 | } | |
524 | return $groupTypesString; | |
525 | } | |
526 | ||
6a488035 | 527 | } |