예제 #1
0
 /**
  * Start travel
  *
  * @param $travel_id
  * @return void
  */
 public function startTravelAction($travel_id)
 {
     //Check the request
     if (!$this->is_valid($travel_id) || !check_link_hash($this->request->variable('hash', ''), 'travel_' . $travel_id)) {
         throw new \phpbb\exception\http_exception(403, 'NO_AUTH_OPERATION');
     }
     //Load ConsimUser
     $consim_user = $this->userService->getCurrentUser();
     //Check, if user not active
     if ($consim_user->getActive()) {
         throw new \phpbb\exception\http_exception(403, 'NO_AUTH_OPERATION');
     }
     //Get Infos about the Route
     $route = $this->routeService->findRoute($consim_user->getLocationId(), $travel_id);
     $now = time();
     $this->container->get('consim.core.entity.action')->setUserId($consim_user->getUserId())->setLocationId($consim_user->getLocationId())->setStartTime($now)->setEndTime($now + $route->getTime() / 10)->setRouteId($route->getId())->setResult('')->insert();
     //$consim_user->setLocation($travel_id);
     //$consim_user->save();
     //Reload the Consim Index
     redirect($this->helper->route('consim_core_index'));
 }