show resources always behind the users in planner-, day- or week-view

This commit is contained in:
Ralf Becker 2006-03-09 12:32:41 +00:00
parent 5c70ddf676
commit 6bdaedcd38

View File

@ -353,20 +353,21 @@ class uiviews extends uical
$users = $this->search_params['users']; $users = $this->search_params['users'];
if (!is_array($users)) $users = array($users); if (!is_array($users)) $users = array($users);
// for more then 3 users, show all in one row if (count($users) == 1 || count($users) > 3) // for more then 3 users, show all in one row
if (count($users) > 3) $users = array($users);
$content = '';
foreach($users as $user)
{ {
$search_params['users'] = $user; $content =& $this->timeGridWidget($this->bo->search($search_params),$this->cal_prefs['interval']);
if (count($users) > 1)
{
$content .= '<b>'.$this->bo->participant_name($user)."</b>\n";
}
$content .= $this->timeGridWidget($this->bo->search($search_params),
count($users) * $this->cal_prefs['interval'],400 / count($users),'','',count($users) > 1 ? $user : 0);
} }
else
{
$content = '';
foreach($this->_get_planner_users(false) as $uid => $label)
{
$search_params['users'] = $uid;
$content .= '<b>'.$label."</b>\n";
$content .= $this->timeGridWidget($this->bo->search($search_params),
count($users) * $this->cal_prefs['interval'],400 / count($users),'','',$uid);
}
}
if (!$home) if (!$home)
{ {
$this->do_header(); $this->do_header();
@ -407,11 +408,10 @@ class uiviews extends uical
{ {
$dayEvents = array(); $dayEvents = array();
$search_params = $this->search_params; $search_params = $this->search_params;
foreach($users as $user) foreach($this->_get_planner_users(false) as $uid => $label)
{ {
$title = '<b>'.$this->bo->participant_name($user).'</b>'; $search_params['users'] = $uid;
$search_params['users'] = $user; list(,$dayEvents['<b>'.$label.'</b>']) = each($this->bo->search($search_params));
list(,$dayEvents[$title]) = each($this->bo->search($search_params));
} }
$owner = $users; $owner = $users;
} }
@ -1127,14 +1127,19 @@ class uiviews extends uical
/** /**
* get all users to display in the planner_by_user * get all users to display in the planner_by_user
* *
* @return array with uid => label pairs * @param boolean $enum_groups=true should groups be returned as there members (eg. planner) or not (day & week)
* @return array with uid => label pairs, first all users alphabetically sorted, then all resources
*/ */
function _get_planner_users() function _get_planner_users($enum_groups=true)
{ {
$users = array(); $users = $resources = array();
foreach(explode(',',$this->owner) as $user) foreach(explode(',',$this->owner) as $user)
{ {
if (is_numeric($user) && $GLOBALS['egw']->accounts->get_type($user) == 'g') if (!is_numeric($user)) // resources
{
$resources[$user] = $this->bo->participant_name($user);
}
elseif ($enum_groups && $GLOBALS['egw']->accounts->get_type($user) == 'g') // groups
{ {
foreach((array) $GLOBALS['egw']->accounts->member($user) as $data) foreach((array) $GLOBALS['egw']->accounts->member($user) as $data)
{ {
@ -1145,13 +1150,15 @@ class uiviews extends uical
} }
} }
} }
else else // users
{ {
$users[$user] = $this->bo->participant_name($user); $users[$user] = $this->bo->participant_name($user);
} }
asort($users);
} }
return $users; asort($users);
asort($resources);
return $users+$resources;
} }
/** /**