- if ($user->can('view_own_reports'))
- $options = array('max_rank'=>$max_rank,'include_self'=>true);
- else
- $options = array('max_rank'=>$max_rank);
- $users = $user->getUsers($options); // Active and inactive users.
+ if ($user->can('view_own_reports')) {
+ $options_active = array('max_rank'=>$max_rank,'include_self'=>true,'status'=>ACTIVE);
+ $options_inactive = array('max_rank'=>$max_rank,'include_self'=>true,'status'=>INACTIVE);
+ } else {
+ $options_active = array('max_rank'=>$max_rank,'status'=>ACTIVE);
+ $options_inactive = array('max_rank'=>$max_rank,'status'=>INACTIVE);
+ }
+ $active_users = $user->getUsers($options_active);
+ $inactive_users = $user->getUsers($options_inactive);
+ }
+ elseif ($user->isClient()) {
+ $options_active = array('status'=>ACTIVE);
+ $options_inactive = array('status'=>INACTIVE);
+ $active_users = ttGroupHelper::getUsersForClient($options_active);
+ $inactive_users = ttGroupHelper::getUsersForClient($options_inactive);
+ }
+
+ foreach ($active_users as $single_user) {
+ $user_list_active[$single_user['id']] = $single_user['name'];
+ $projects = ttProjectHelper::getAssignedProjects($single_user['id']);
+ if ($projects) {
+ foreach ($projects as $single_project) {
+ $assigned_projects[$single_user['id']][] = $single_project['id'];
+ }
+ }