/** * Display travel action * * @param $action_id * @return \Symfony\Component\HttpFoundation\Response */ public function showTravelAction($action_id) { $action = $this->actionService->getAction($action_id); //check if the user is owner of action if ($action->getUserId() != $this->userService->getCurrentUser()->getUserId() || $action->getRouteId() == 0) { throw new \phpbb\exception\http_exception(403, 'NO_AUTH_OPERATION'); } $now = time(); $time = $action->getEndTime() - $now; $route = $this->routeService->getRoute($action->getRouteId()); $location = $this->locationService->getLocationFromRoute($action->getLocationId(), $route); // Set output vars for display in the template $this->template->assign_vars(array('IS_TRAVELING' => TRUE, 'START_LOCATION_NAME' => $location['start']->getName(), 'START_LOCATION_IMAGE' => $location['start']->getImage(), 'START_LOCATION_TYPE' => $location['start']->getType(), 'START_LOCATION_PROVINCE' => $location['start']->getProvince(), 'START_LOCATION_COUNTRY' => $location['start']->getCountry(), 'START_TIME' => date("d.m.Y - H:i:s", $action->getStartTime()), 'END_LOCATION_NAME' => $location['end']->getName(), 'END_LOCATION_IMAGE' => $location['end']->getImage(), 'END_LOCATION_TYPE' => $location['end']->getType(), 'END_LOCATION_PROVINCE' => $location['end']->getProvince(), 'END_LOCATION_COUNTRY' => $location['end']->getCountry(), 'END_TIME' => date("d.m.Y - H:i:s", $action->getEndTime()), 'COUNTDOWN' => date("i:s", $time))); // Send all data to the template file return $this->helper->render('consim_traveling.html', $this->user->lang('CONSIM')); }