public function execute($request) { $this->form = new viewEmployeeTimesheetForm(); if ($request->isMethod("post")) { $this->form->bind($request->getParameter('time')); if ($this->form->isValid()) { $this->employeeId = $this->form->getValue('employeeId'); $startDaysListForm = new startDaysListForm(array(), array('employeeId' => $this->employeeId)); $dateOptions = $startDaysListForm->getDateOptions(); if ($dateOptions == null) { $this->getContext()->getUser()->setFlash('errorMessage', __("No Timesheets Found")); $this->redirect('time/createTimesheetForSubourdinate?' . http_build_query(array('employeeId' => $this->employeeId))); } $this->redirect('time/viewTimesheet?' . http_build_query(array('employeeId' => $this->employeeId))); } } $userObj = $this->getContext()->getUser()->getAttribute("user"); $this->form->employeeList = $userObj->getEmployeeNameList(); $this->pendingApprovelTimesheets = $userObj->getActionableTimesheets(); }
public function execute($request) { $this->timesheetPermissions = $this->getDataGroupPermissions('time_employee_timesheets'); $this->form = new viewEmployeeTimesheetForm(); if ($request->isMethod("post")) { $this->form->bind($request->getParameter('time')); if ($this->form->isValid()) { $this->employeeId = $this->form->getValue('employeeId'); $startDaysListForm = new startDaysListForm(array(), array('employeeId' => $this->employeeId)); $dateOptions = $startDaysListForm->getDateOptions(); if ($dateOptions == null) { $this->getContext()->getUser()->setFlash('warning.nofade', __('No Timesheets Found')); $this->redirect('time/createTimesheetForSubourdinate?' . http_build_query(array('employeeId' => $this->employeeId))); } $this->redirect('time/viewTimesheet?' . http_build_query(array('employeeId' => $this->employeeId))); } } $userRoleManager = $this->getContext()->getUserRoleManager(); $properties = array("empNumber", "firstName", "middleName", "lastName", "termination_id"); $employeeList = UserRoleManagerFactory::getUserRoleManager()->getAccessibleEntityProperties('Employee', $properties); $this->form->employeeList = $employeeList; $this->pendingApprovelTimesheets = $this->getActionableTimesheets($employeeList); }