"implemented new status filter for planner by user (wasnt implemented when status filter were added)"

This commit is contained in:
Ralf Becker 2010-04-03 13:21:40 +00:00
parent 17e5f174b0
commit eef0fdedb6

View File

@ -1504,14 +1504,37 @@ class calendar_uiviews extends calendar_ui
} }
if (!is_array($events)) $events = array(); if (!is_array($events)) $events = array();
if ($by_cat === 'user') // planner by user
{
// convert filter to allowed status
switch($this->filter)
{
case 'unknown':
$status_to_show = array('U','G'); break;
case 'accepted':
$status_to_show = array('A'); break;
case 'tentative':
$status_to_show = array('T'); break;
case 'rejected':
$status_to_show = array('R'); break;
case 'delegated':
$status_to_show = array('D'); break;
case 'all':
$status_to_show = array('U','A','T','D','G','R'); break;
default:
$status_to_show = array('U','A','T','D','G'); break;
}
}
foreach($events as $key => $event) foreach($events as $key => $event)
{ {
if ($by_cat === false) // planner by user if ($by_cat === false) // planner by user
{ {
foreach($event['participants'] as $sort => $status) foreach($event['participants'] as $sort => $status)
{ {
// only show if participant has not rejected or user wants to see rejections calendar_so::split_status($status,$nul,$nul);
if (isset($sort2label[$sort]) && ($status != 'R' || $this->bo->cal_prefs['show_rejected'])) // only show if participant with status visible with current filter
if (isset($sort2label[$sort]) && (in_array($status,$status_to_show) ||
$this->filter == 'owner' && $event['owner'] == $sort)) // owner too additionally uses owner
{ {
$rows[$sort][] =& $events[$key]; $rows[$sort][] =& $events[$key];
} }