/** * 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')); }
/** * Display a building in a location * * @param int $location_id * @param int $building_id * @return \Symfony\Component\HttpFoundation\Response * @access public */ public function showLocationBuildingAction($location_id, $building_id) { //must be an integer $location_id = (int) $location_id; $building_id = (int) $building_id; if ($location_id === 0 || $building_id === 0) { redirect($this->helper->route('consim_core_location', array('location_id' => $location_id))); } $location = $this->locationService->getLocation($location_id); $building = $this->buildingService->getBuilding($building_id); //add location to navbar $this->add_navlinks($location->getName(), $this->helper->route('consim_core_location', array('location_id' => $location->getId()))); //Show all Works $this->workService->allWorksToTemplate($building->getTypeId()); add_form_key('working'); // Set output vars for display in the template $this->template->assign_vars(array('BUILDING_NAME' => $building->getName() != '' ? '"' . $building->getName() . '"' : '', 'BUILDING_DESCRIPTION' => $building->getDescription() != '' ? '' . $building->getDescription() . '' : '', 'BUILDING_TYP' => $building->getTypeName(), 'LOCATION' => $location->getName(), 'BACK_TO_LOCATION' => $this->helper->route('consim_core_location', array('location_id' => $location_id)), 'S_WORK_ACTION' => $this->helper->route('consim_core_work_start'))); // Send all data to the template file return $this->helper->render('consim_building.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')); }