/** * Display page to list all action of current user * * @param int $page * @return \Symfony\Component\HttpFoundation\Response */ public function showActionListAction($page = 0) { $actions = $this->actionService->getActions($this->userService->getCurrentUser()->getUserId()); foreach ($actions as $action) { if ($action->getWorkId() > 0) { $this->template->assign_block_vars('actionlist', array('ACTION_NAME' => $this->workService->getWork($action->getId())->getName(), 'ACTION_URL' => $this->helper->route('consim_core_work', array('action_id' => $action->getId())), 'LOCATION_NAME' => $this->locationService->getLocation($action->getLocationId())->getName(), 'LOCATION_URL' => $this->helper->route('consim_core_location', array('location_id' => $action->getLocationId())), 'STARTTIME' => $this->user->format_date($action->getStartTime()), 'ENDTIME' => $this->user->format_date($action->getEndTime()), 'STATUS' => $action->getStatus())); } else { $this->template->assign_block_vars('actionlist', array('ACTION_NAME' => 'blubb', 'ACTION_URL' => $this->helper->route('consim_core_travel', array('action_id' => $action->getId())), 'LOCATION_NAME' => $this->locationService->getLocation($action->getLocationId())->getName(), 'LOCATION_URL' => $this->helper->route('consim_core_location', array('location_id' => $action->getLocationId())), 'STARTTIME' => $this->user->format_date($action->getStartTime()), 'ENDTIME' => $this->user->format_date($action->getEndTime()), 'STATUS' => $action->getStatus())); } } return $this->helper->render('consim_action_list.html', $this->user->lang('CONSIM')); }
/** * Start work * * return void */ public function startWorkAction() { $work_id = $this->request->variable('work_id', 0); //Check the request if (!$this->is_valid($work_id) || !check_form_key('working')) { 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 work $work = $this->workService->getWork($work_id); $user_skills = $this->userSkillService->getCurrentUserSkills(); //Check condition if (!$work->canUserWork($user_skills)) { throw new \phpbb\exception\http_exception(403, 'NO_AUTH_OPERATION'); } $now = time(); $this->container->get('consim.core.entity.action')->setUserId($consim_user->getUserId())->setLocationId($consim_user->getLocationId())->setStartTime($now)->setEndTime($now + $work->getDuration())->setWorkId($work->getId())->setResult('')->insert(); redirect($this->helper->route('consim_core_index')); }