Пример #1
0
 private function getStates(DeliveryZone $zone, $country)
 {
     $localeInfo = $this->locale->info();
     $allCountries = $countries = $localeInfo->getAllCountries();
     $allStates = array();
     foreach (State::getStatesByCountry($country) as $stateID => $state) {
         $allStates[$stateID] = $localeInfo->getCountryName($country) . ": " . $state;
     }
     $selectedStates = array();
     foreach ($zone->getStates()->toArray() as $state) {
         $selectedStates[$state['State']['ID']] = $localeInfo->getCountryName($state['State']['countryID']) . ": " . $state['State']['name'];
         unset($allStates[$state['State']['ID']]);
     }
     return array('all' => $allStates, 'selected' => $selectedStates);
 }