コード例 #1
0
 public function getActionableTimesheets($employeeList)
 {
     $timesheetList = null;
     $accessFlowStateMachinService = new AccessFlowStateMachineService();
     $action = array(PluginWorkflowStateMachine::TIMESHEET_ACTION_APPROVE, PluginWorkflowStateMachine::TIMESHEET_ACTION_REJECT);
     $actionableStatesList = $accessFlowStateMachinService->getActionableStates(PluginWorkflowStateMachine::FLOW_TIME_TIMESHEET, AdminUserRoleDecorator::ADMIN_USER, $action);
     $empNumbers = array();
     foreach ($employeeList as $employee) {
         $empNumbers[] = $employee['empNumber'];
     }
     if ($actionableStatesList != null) {
         $timesheetList = $this->getTimesheetService()->getTimesheetListByEmployeeIdAndState($empNumbers, $actionableStatesList, self::NUM_PENDING_TIMESHEETS);
     }
     return $timesheetList;
 }
コード例 #2
0
 public function getActionableAttendanceStates($actions)
 {
     $accessFlowStateMachinService = new AccessFlowStateMachineService();
     $actionableAttendanceStatesForAdminUser = $accessFlowStateMachinService->getActionableStates(PluginWorkflowStateMachine::FLOW_ATTENDANCE, AdminUserRoleDecorator::ADMIN_USER, $actions);
     $actionableAttendanceStates = $this->user->getActionableAttendanceStates($actions);
     if (is_null($actionableAttendanceStatesForAdminUser)) {
         return $actionableAttendanceStates;
     }
     $actionableAttendanceStatesList = array_unique(array_merge($actionableAttendanceStatesForAdminUser, $actionableAttendanceStates));
     return $actionableAttendanceStatesList;
 }
コード例 #3
0
 /**
  * Given an array of actions, returns the states for which those actions can be applied
  * by the current logged in user
  * 
  * @param string $workflow Workflow 
  * @param array $actions Array of Action names
  * @param array $rolesToExclude
  * @param array $rolesToInclude
  * @param array $entities
  * 
  * @return array Array of states
  */
 public function getActionableStates($workflow, $actions, $rolesToExclude = array(), $rolesToInclude = array(), $entities = array())
 {
     $accessFlowStateMachineService = new AccessFlowStateMachineService();
     $actionableStates = array();
     $filteredRoles = $this->filterRoles($this->userRoles, $rolesToExclude, $rolesToInclude, $entities);
     foreach ($filteredRoles as $role) {
         $roleName = $this->fixUserRoleNameForWorkflowStateMachine($role->getName(), $workflow);
         $states = $accessFlowStateMachineService->getActionableStates($workflow, $roleName, $actions);
         if (!empty($states)) {
             $actionableStates = array_unique(array_merge($actionableStates, $states));
         }
     }
     return $actionableStates;
 }