/** * Gets all locations. * @return string[] $locationList */ private function _getLocationList() { $locationService = new LocationService(); $locationList = array('-1' => __('All')); $locations = $locationService->getLocationList(); foreach ($locations as $location) { $locationList[$location->id] = $location->name; } return $locationList; }
/** * Gets all locations. * @return string[] $locationList */ private function _getLocationList() { $locationService = new LocationService(); $showAll = $this->getOption('show_all_locations'); $locationList = array(); $locations = $locationService->getLocationList(); $accessibleLocations = UserRoleManagerFactory::getUserRoleManager()->getAccessibleEntityIds('Location'); foreach ($locations as $location) { if ($showAll || in_array($location->id, $accessibleLocations)) { $locationList[$location->id] = $location->name; } } return $locationList; }
/** * Gets all locations. * @return string[] $locationList */ private function _getLocationList() { $locationService = new LocationService(); $showAll = $this->getOption('show_all_locations'); $locationList = array(); $locations = $locationService->getLocationList(); $accessibleLocations = UserRoleManagerFactory::getUserRoleManager()->getAccessibleEntityIds('Location', BasicUserRoleManager::OPERATION_VIEW); foreach ($locations as $location) { if ($showAll || in_array($location->id, $accessibleLocations)) { $locationList[$location->getCountry()->getCouName()][] = $location; } } ksort($locationList); return $locationList; }
private function _getLocations(Employee $employee) { $locationList = array('' => '-- ' . __('Select') . ' --'); $locationService = new LocationService(); $locations = $locationService->getLocationList(); $accessibleLocations = UserRoleManagerFactory::getUserRoleManager()->getAccessibleEntityIds('Location'); $empLocations = $employee->getLocations(); foreach ($empLocations as $location) { $accessibleLocations[] = $location->getId(); } foreach ($locations as $location) { if (in_array($location->id, $accessibleLocations)) { $locationList[$location->id] = $location->name; } } return $locationList; }