private function _setListComponent($records, $noOfRecords, $pageNumber, $count = null, $showEdit = null, $allowedActions = null)
 {
     $configurationFactory = new AttendanceRecordHeaderFactory();
     $userRoleManager = $this->getContext()->getUserRoleManager();
     $loggedInEmpNumber = $this->getUser()->getEmployeeNumber();
     $notSelectable = array();
     foreach ($records as $record) {
         if (!$userRoleManager->isActionAllowed(WorkflowStateMachine::FLOW_ATTENDANCE, $record->getState(), WorkflowStateMachine::ATTENDANCE_ACTION_DELETE, array(), array(), array('Employee' => $this->employeeId))) {
             $notSelectable[] = $record->getId();
         }
     }
     $buttons = array();
     $canSelect = false;
     if (isset($allowedActions)) {
         if (isset($showEdit) && $showEdit) {
             if ($allowedActions['Edit']) {
                 $buttons['Edit'] = array('label' => __('Edit'), 'type' => 'button');
             }
             if ($allowedActions['PunchIn']) {
                 $buttons['PunchIn'] = array('label' => __('Add Attendance Records'), 'type' => 'button', 'class' => 'punch');
             }
             if ($allowedActions['PunchOut']) {
                 $buttons['PunchOut'] = array('label' => __('Add Attendance Records'), 'type' => 'button', 'class' => 'punch');
             }
         }
         if ($allowedActions['Delete']) {
             $canSelect = true;
             $buttons['Delete'] = array('label' => __('Delete'), 'type' => 'submit', 'data-toggle' => 'modal', 'data-target' => '#dialogBox', 'class' => 'delete');
         }
     }
     $configurationFactory->setRuntimeDefinitions(array('buttons' => $buttons, 'unselectableRowIds' => $notSelectable, 'hasSelectableRows' => $canSelect));
     ohrmListComponent::setActivePlugin('orangehrmAttendancePlugin');
     ohrmListComponent::setConfigurationFactory($configurationFactory);
     ohrmListComponent::setListData($records);
     ohrmListComponent::setPageNumber($pageNumber);
     ohrmListComponent::setItemsPerPage($noOfRecords);
     ohrmListComponent::setNumberOfRecords($count);
 }
 private function _setListComponent($records, $noOfRecords, $pageNumber, $count = null, $showEdit = null, $allowedActions = null)
 {
     $configurationFactory = new AttendanceRecordHeaderFactory();
     $notSelectable = array();
     foreach ($records as $record) {
         if (!$this->allowedToPerformAction(WorkflowStateMachine::FLOW_ATTENDANCE, PluginWorkflowStateMachine::ATTENDANCE_ACTION_DELETE, $record->getState(), $this->decoratedUser)) {
             $notSelectable[] = $record->getId();
         }
     }
     //        print_r($allowedActions);
     $buttons = array();
     if (isset($allowedActions)) {
         if (isset($showEdit) && $showEdit) {
             if ($allowedActions['Edit']) {
                 $buttons['Edit'] = array('label' => __('Edit'), 'type' => 'button');
             }
             if ($allowedActions['PunchIn']) {
                 $buttons['PunchIn'] = array('label' => __('Add Attendance Records'), 'type' => 'button', 'class' => 'punch');
             }
             if ($allowedActions['PunchOut']) {
                 $buttons['PunchOut'] = array('label' => __('Add Attendance Records'), 'type' => 'button', 'class' => 'punch');
             }
         }
         if ($allowedActions['Delete']) {
             $buttons['Delete'] = array('label' => __('Delete'), 'type' => 'submit', 'data-toggle' => 'modal', 'data-target' => '#dialogBox', 'class' => 'delete');
         }
     }
     $configurationFactory->setRuntimeDefinitions(array('buttons' => $buttons, 'unselectableRowIds' => $notSelectable));
     ohrmListComponent::setActivePlugin('orangehrmAttendancePlugin');
     ohrmListComponent::setConfigurationFactory($configurationFactory);
     ohrmListComponent::setListData($records);
     ohrmListComponent::setPageNumber($pageNumber);
     ohrmListComponent::setItemsPerPage($noOfRecords);
     ohrmListComponent::setNumberOfRecords($count);
 }
 private function _setListComponent($records, $noOfRecords, $pageNumber, $count)
 {
     $configurationFactory = new AttendanceRecordHeaderFactory();
     $notSelectable = array();
     foreach ($records as $record) {
         if (!$this->allowedToPerformAction(WorkflowStateMachine::FLOW_ATTENDANCE, PluginWorkflowStateMachine::ATTENDANCE_ACTION_DELETE, $record->getState(), $this->decoratedUser)) {
             $notSelectable[] = $record->getId();
         }
     }
     $configurationFactory->setRuntimeDefinitions(array('unselectableRowIds' => $notSelectable));
     ohrmListComponent::setActivePlugin('orangehrmAttendancePlugin');
     ohrmListComponent::setConfigurationFactory($configurationFactory);
     ohrmListComponent::setListData($records);
     ohrmListComponent::setPageNumber($pageNumber);
     ohrmListComponent::setItemsPerPage($noOfRecords);
     ohrmListComponent::setNumberOfRecords($count);
 }