mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
* Calendar - new placeholders {{participant_emails}} for non-declined participants and {{participant_summary}} for a summary of participants by status
This commit is contained in:
parent
816db05496
commit
de17d9a2ea
@ -249,6 +249,12 @@ class calendar_merge extends Api\Storage\Merge
|
|||||||
$replacements['$$'.($prefix ? $prefix . '/' : '') . "calendar_participants/{$t_id}$$"] = implode(', ',$type);
|
$replacements['$$'.($prefix ? $prefix . '/' : '') . "calendar_participants/{$t_id}$$"] = implode(', ',$type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Participant email list (not declined)
|
||||||
|
$this->participant_emails($replacements, $record, $prefix, $content);
|
||||||
|
|
||||||
|
// Add participant summary
|
||||||
|
$this->participant_summary($replacements, $record, $prefix, $content);
|
||||||
|
|
||||||
if(!$replacements['$$'.($prefix ? $prefix . '/' : '') . 'calendar_recur_type$$'])
|
if(!$replacements['$$'.($prefix ? $prefix . '/' : '') . 'calendar_recur_type$$'])
|
||||||
{
|
{
|
||||||
// Need to set it to '' if not set or previous record may be used
|
// Need to set it to '' if not set or previous record may be used
|
||||||
@ -288,6 +294,88 @@ class calendar_merge extends Api\Storage\Merge
|
|||||||
return $replacements;
|
return $replacements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate placeholder(s) for email addresses of all participants who have
|
||||||
|
* them.
|
||||||
|
*
|
||||||
|
* @param Array $replacements Array of replacements
|
||||||
|
* @param calendar_egw_record $record Event record
|
||||||
|
* @param string $prefix Prefix of placeholder
|
||||||
|
* @param string $content Content with placeholders in it
|
||||||
|
*/
|
||||||
|
public function participant_emails(&$replacements, &$record, $prefix, &$content)
|
||||||
|
{
|
||||||
|
// Early exit if the placeholder is not used
|
||||||
|
if(strpos($content, '$$'.($prefix?$prefix.'/':'').'participant_emails$$') === FALSE)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$emails = array();
|
||||||
|
foreach($record->participants as $uid => $status)
|
||||||
|
{
|
||||||
|
// Skip rejected
|
||||||
|
if (in_array(substr($status, 0, 1), array('R')))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$info = $this->bo->resource_info($uid);
|
||||||
|
if($info['email'])
|
||||||
|
{
|
||||||
|
$emails[] = $info['email'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$replacements['$$'.($prefix?$prefix.'/':'').'participant_emails$$'] = implode(', ', $emails);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate placeholder for a summary of participant status:
|
||||||
|
* 3 Participants: 1 Accepted, 2 Unknown
|
||||||
|
*
|
||||||
|
* Blank if only one participant, matches what's shown in UI event hover
|
||||||
|
*
|
||||||
|
* @param Array $replacements Array of replacements
|
||||||
|
* @param calendar_egw_record $record Event record
|
||||||
|
* @param string $prefix Prefix of placeholder
|
||||||
|
* @param string $content Content with placeholders in it
|
||||||
|
*/
|
||||||
|
public function participant_summary(&$replacements, &$record, $prefix, &$content)
|
||||||
|
{
|
||||||
|
// Early exit if the placeholder is not used
|
||||||
|
if(strpos($content, '$$'.($prefix?$prefix.'/':'').'participant_summary$$') === FALSE)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$placeholder = '$$'.($prefix?$prefix.'/':'').'participant_summary$$';
|
||||||
|
|
||||||
|
// No summary for 1 participant
|
||||||
|
if(count($record->participants) < 2)
|
||||||
|
{
|
||||||
|
$replacements[$placeholder] = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$participant_status = array('A' => 0, 'R' => 0, 'T' => 0, 'U' => 0, 'D' => 0);
|
||||||
|
$status_label = array('A' => 'accepted', 'R' => 'rejected', 'T' => 'tentative', 'U' => 'unknown', 'D' => 'delegated');
|
||||||
|
$participant_summary = count($record->participants) . ' ' . lang('Participants').': ';
|
||||||
|
$status_totals = [];
|
||||||
|
|
||||||
|
foreach($record->participants as $uid => $status)
|
||||||
|
{
|
||||||
|
$participant_status[substr($status,0,1)]++;
|
||||||
|
}
|
||||||
|
foreach($participant_status as $status => $count)
|
||||||
|
{
|
||||||
|
if($count > 0)
|
||||||
|
{
|
||||||
|
$status_totals[] = $count . ' ' . lang($status_label[$status]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$summary = $participant_summary . join(', ',$status_totals);
|
||||||
|
$replacements[$placeholder] = $summary;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table plugin for event
|
* Table plugin for event
|
||||||
* Lists events for a certain day of the week. Only works for one week at a time, so for multiple weeks,
|
* Lists events for a certain day of the week. Only works for one week at a time, so for multiple weeks,
|
||||||
@ -795,6 +883,9 @@ class calendar_merge extends Api\Storage\Merge
|
|||||||
|
|
||||||
|
|
||||||
echo '<tr><td colspan="4"><h3>'.lang('Participants').":</h3></td></tr>";
|
echo '<tr><td colspan="4"><h3>'.lang('Participants').":</h3></td></tr>";
|
||||||
|
echo '<tr><td>{{participant_emails}}</td><td colspan="3">'.lang('A list of email addresses of all participants who have not declined')."</td></tr>\n";
|
||||||
|
echo '<tr><td>{{participant_summary}}</td><td colspan="3">'.lang('Summary of participant status: 3 Participants: 1 Accepted, 2 Unknown')."</td></tr>\n";
|
||||||
|
echo '<tr><td colspan="4">'.lang('Participant names by type').'</td></tr>';
|
||||||
echo '<tr><td>{{calendar_participants/account}}</td><td colspan="3">'.lang('Accounts')."</td></tr>\n";
|
echo '<tr><td>{{calendar_participants/account}}</td><td colspan="3">'.lang('Accounts')."</td></tr>\n";
|
||||||
echo '<tr><td>{{calendar_participants/group}}</td><td colspan="3">'.lang('Groups')."</td></tr>\n";
|
echo '<tr><td>{{calendar_participants/group}}</td><td colspan="3">'.lang('Groups')."</td></tr>\n";
|
||||||
foreach($this->bo->resources as $resource)
|
foreach($this->bo->resources as $resource)
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
(without a custom url we use nation of user preference to load holidays from %s) calendar en (Without a custom URL we use nation of user preference to load holidays from %s)
|
(without a custom url we use nation of user preference to load holidays from %s) calendar en (Without a custom URL we use nation of user preference to load holidays from %s)
|
||||||
, exceptions preserved calendar en , exceptions preserved
|
, exceptions preserved calendar en , exceptions preserved
|
||||||
, stati of participants reset calendar en , status of participants reset
|
, stati of participants reset calendar en , status of participants reset
|
||||||
|
a list of email addresses of all participants who have not declined calendar en A list of email addresses of all participants who have not declined
|
||||||
a non blocking event will not conflict with other events calendar en A non blocking event will not conflict with other events
|
a non blocking event will not conflict with other events calendar en A non blocking event will not conflict with other events
|
||||||
accept calendar en Accept
|
accept calendar en Accept
|
||||||
accept or reject an invitation calendar en Accept or reject an invitation
|
accept or reject an invitation calendar en Accept or reject an invitation
|
||||||
@ -401,6 +402,7 @@ open todo's: calendar en Open ToDo's:
|
|||||||
optional calendar en Optional
|
optional calendar en Optional
|
||||||
overlap holiday calendar en Overlap holiday
|
overlap holiday calendar en Overlap holiday
|
||||||
owner too calendar en Owner too
|
owner too calendar en Owner too
|
||||||
|
participant names by type calendar en Participant names by type
|
||||||
participant table calendar en Participant table
|
participant table calendar en Participant table
|
||||||
participants calendar en Participants
|
participants calendar en Participants
|
||||||
participants disinvited from an event calendar en Participants disinvited from an event
|
participants disinvited from an event calendar en Participants disinvited from an event
|
||||||
@ -524,6 +526,7 @@ status for all future scheduled days changed calendar en Status for all future s
|
|||||||
status for this particular day changed calendar en Status for this particular day changed.
|
status for this particular day changed calendar en Status for this particular day changed.
|
||||||
status of participants set to unknown because of missing category rights calendar en Status of participants set to unknown because of missing category rights.
|
status of participants set to unknown because of missing category rights calendar en Status of participants set to unknown because of missing category rights.
|
||||||
submit to repository calendar en Submit to repository
|
submit to repository calendar en Submit to repository
|
||||||
|
summary of participant status: 3 participants: 1 accepted, 2 unknown calendar en Summary of participant status: 3 Participants: 1 Accepted, 2 Unknown
|
||||||
sun calendar en Sun
|
sun calendar en Sun
|
||||||
tag to mark positions for address labels calendar en Tag to mark positions for address labels
|
tag to mark positions for address labels calendar en Tag to mark positions for address labels
|
||||||
tentative calendar en Tentative
|
tentative calendar en Tentative
|
||||||
|
Loading…
Reference in New Issue
Block a user