+if ($request->isPost()) {
+ $userChanged = $request->getParameter('user_changed'); // Reused in multiple places below.
+ if ($userChanged && !($user->can('track_time') && $user->isUserValid($request->getParameter('user')))) {
+ header('Location: access_denied.php'); // Group changed, but no rght or wrong user id.
+ exit();
+ }
+}
+// End of access checks.
+
+// 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();
+
+$showClient = $user->isPluginEnabled('cl');
+$trackingMode = $user->getTrackingMode();
+$showProject = MODE_PROJECTS == $trackingMode || MODE_PROJECTS_AND_TASKS == $trackingMode;
+$showTask = MODE_PROJECTS_AND_TASKS == $trackingMode;
+$recordType = $user->getRecordType();
+$showStart = TYPE_START_FINISH == $recordType || TYPE_ALL == $recordType;
+$showFinish = $showStart;
+$showDuration = TYPE_DURATION == $recordType || TYPE_ALL == $recordType;
+$showFiles = $user->isPluginEnabled('at');