Exemplo n.º 1
0
 /**
  * @deprecated
  */
 protected static function expandTerritoryGroup($parentTerritory)
 {
     return Territory::getChildTerritoryCodes($parentTerritory, true);
 }
Exemplo n.º 2
0
 /**
  * Returns the list of countries that use a specific paper size by default.
  *
  * @param string $paperSize The paper size identifier ('A4' or 'US-Letter')
  *
  * @return array The list of country IDs that use the specified paper size (if $paperSize is invalid you'll get an empty array)
  */
 public static function getCountriesWithPaperSize($paperSize)
 {
     $result = array();
     if (is_string($paperSize) && isset($paperSize[0])) {
         $someGroup = false;
         $data = Data::getGeneric('measurementData');
         foreach ($data['paperSize'] as $territory => $ms) {
             if (strcasecmp($paperSize, $ms) === 0) {
                 $children = Territory::getChildTerritoryCodes($territory, true);
                 if (empty($children)) {
                     $result[] = $territory;
                 } else {
                     $someGroup = true;
                     $result = array_merge($result, $children);
                 }
             }
         }
         if ($someGroup) {
             $otherCountries = array();
             foreach ($data['paperSize'] as $territory => $ms) {
                 if ($territory !== '001' && strcasecmp($paperSize, $ms) !== 0) {
                     $children = Territory::getChildTerritoryCodes($territory, true);
                     if (empty($children)) {
                         $otherCountries[] = $territory;
                     } else {
                         $otherCountries = array_merge($otherCountries, $children);
                     }
                 }
             }
             $result = array_values(array_diff($result, $otherCountries));
         }
     }
     return $result;
 }