From 859f9b7126657148e94ad959ab1f1262d2917acf Mon Sep 17 00:00:00 2001
From: nathangray
Date: Wed, 27 Jul 2016 17:04:02 -0600
Subject: [PATCH] Group event participants by type in event tooltip
---
calendar/inc/class.calendar_ui.inc.php | 12 +++++++++++-
calendar/js/et2_widget_event.js | 11 ++++++++++-
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php
index 9614dffca4..9c6843a669 100644
--- a/calendar/inc/class.calendar_ui.inc.php
+++ b/calendar/inc/class.calendar_ui.inc.php
@@ -753,7 +753,17 @@ class calendar_ui
// set id for grid
$event['row_id'] = $event['id'].($event['recur_type'] ? ':'.Api\DateTime::to($event['recur_date'] ? $event['recur_date'] : $event['start'],'ts') : '');
- $event['parts'] = implode(",\n",$this->bo->participants($event,false));
+ // Set up participant section of tooltip
+ $participants = $this->bo->participants($event,false);
+ $event['parts'] = implode("\n",$participants);
+ $event['participant_types'] = array();
+ foreach($participants as $uid => $text)
+ {
+ $user_type = $user_id = null;
+ calendar_so::split_user($uid, $user_type, $user_id);
+ $type_name = lang($this->bo->resources[$user_type]['app']);
+ $event['participant_types'][$type_name ? $type_name : ''][] = $text;
+ }
$event['date'] = $this->bo->date2string($event['start']);
// Change dates
diff --git a/calendar/js/et2_widget_event.js b/calendar/js/et2_widget_event.js
index 5ab70902a4..e34072da89 100644
--- a/calendar/js/et2_widget_event.js
+++ b/calendar/js/et2_widget_event.js
@@ -493,6 +493,15 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten
}
cat.destroy();
}
+ var participants = '';
+ for(var type_name in this.options.value.participant_types)
+ {
+ if(type_name)
+ {
+ participants += '
'+type_name+':
';
+ }
+ participants += this.options.value.participant_types[type_name].join("
");
+ }
return '
'+
'';
},