+// Determine user for whom we display this page.
+if ($request->isPost() && $userChanged) {
+ $user_id = $request->getParameter('user');
+ $user->setOnBehalfUser($user_id);
+} else {
+ $user_id = $user->getUser();
+}
+
+$group_id = $user->getGroup();
+
+$showFiles = $user->isPluginEnabled('at');
+
+// Elements of timesheetsForm.
+$form = new Form('timesheetsForm');
+
+if ($user->can('track_time')) {
+ $rank = $user->getMaxRankForGroup($group_id);
+ if ($user->can('track_own_time'))
+ $options = array('status'=>ACTIVE,'max_rank'=>$rank,'include_self'=>true,'self_first'=>true);
+ else
+ $options = array('status'=>ACTIVE,'max_rank'=>$rank);
+ $user_list = $user->getUsers($options);
+ if (count($user_list) >= 1) {
+ $form->addInput(array('type'=>'combobox',
+ 'onchange'=>'document.timesheetsForm.user_changed.value=1;document.timesheetsForm.submit();',
+ 'name'=>'user',
+ 'style'=>'width: 250px;',
+ 'value'=>$user_id,
+ 'data'=>$user_list,
+ 'datakeys'=>array('id','name')));
+ $form->addInput(array('type'=>'hidden','name'=>'user_changed'));
+ $smarty->assign('user_dropdown', 1);
+ }
+}
+
+$active_timesheets = ttTimesheetHelper::getActiveTimesheets();
+$inactive_timesheets = ttTimesheetHelper::getInactiveTimesheets();
+
+$showClient = $user->isPluginEnabled('cl');