/** * * @param <type> $candidates * @param <type> $noOfRecords * @param CandidateSearchParameters $searchParam */ private function _setListComponent($usrObj, $candidates, $noOfRecords, CandidateSearchParameters $searchParam, $pageNumber) { $configurationFactory = new CandidateHeaderFactory(); if (!($usrObj->isAdmin() || $usrObj->isHiringManager())) { $configurationFactory->setRuntimeDefinitions(array('hasSelectableRows' => false, 'buttons' => array())); } ohrmListComponent::setPageNumber($pageNumber); ohrmListComponent::setConfigurationFactory($configurationFactory); ohrmListComponent::setListData($candidates); ohrmListComponent::setItemsPerPage($noOfRecords); ohrmListComponent::setNumberOfRecords($this->getCandidateService()->getCandidateRecordsCount($searchParam)); }
/** * * @param <type> $candidates * @param <type> $noOfRecords * @param CandidateSearchParameters $searchParam */ private function _setListComponent($usrObj, $candidates, $noOfRecords, CandidateSearchParameters $searchParam, $pageNumber, $permissions) { $runtimeDefinitions = array(); $buttons = array(); if ($permissions->canCreate()) { $buttons['Add'] = array('label' => 'Add'); } if (!$permissions->canDelete()) { $runtimeDefinitions['hasSelectableRows'] = false; } else { if ($permissions->canDelete()) { $buttons['Delete'] = array('label' => 'Delete', 'type' => 'submit', 'data-toggle' => 'modal', 'data-target' => '#deleteConfirmation', 'class' => 'delete'); } } $runtimeDefinitions['buttons'] = $buttons; $configurationFactory = new CandidateHeaderFactory(); // if (!($usrObj->isAdmin() || $usrObj->isHiringManager())) { // $configurationFactory->setRuntimeDefinitions(array( // 'hasSelectableRows' => false, // 'buttons' => array(), // )); // } $configurationFactory->setRuntimeDefinitions($runtimeDefinitions); ohrmListComponent::setPageNumber($pageNumber); ohrmListComponent::setConfigurationFactory($configurationFactory); ohrmListComponent::setListData($candidates); ohrmListComponent::setItemsPerPage($noOfRecords); ohrmListComponent::setNumberOfRecords($this->getCandidateService()->getCandidateRecordsCount($searchParam)); }
/** * * @param string $sortField * @param string $sortOrder * @return string */ private function _buildSortQueryClause($sortField, $sortOrder) { $sortQuery = ''; $sortOrder = strcasecmp($sortOrder, 'DESC') === 0 ? 'DESC' : 'ASC'; if ($sortField == 'jc.first_name') { $sortQuery = 'jc.last_name ' . $sortOrder . ', ' . 'jc.first_name ' . $sortOrder; } elseif ($sortField == 'e.emp_firstname') { $sortQuery = 'e.emp_lastname ' . $sortOrder . ', ' . 'e.emp_firstname ' . $sortOrder; } elseif ($sortField == 'jc.date_of_application') { $sortQuery = 'jc.date_of_application ' . $sortOrder . ', ' . 'jc.last_name ASC, jc.first_name ASC'; } else { if (in_array($sortField, array_column(CandidateHeaderFactory::getSortableFields(), 'sortField'))) { $sortQuery = $sortField . " " . $sortOrder; } else { // default sorting $sortQuery = "jc.date_of_application DESC"; } } return $sortQuery; }