/**
  * returns the country name for an ISO code
  *
  * @param string $countryCode The ISO code of a country
  * @return string the country name
  * @throws \TYPO3\Fluid\Core\ViewHelper\Exception
  * @api
  */
 public function render($countryCode = NULL)
 {
     if ($countryCode === NULL) {
         $countryCode = $this->renderChildren();
     }
     $countryName = $this->cldrService->getTerritoryNameForIsoCode($countryCode);
     if ($countryName !== $countryCode) {
         return $countryName;
     } elseif ($countryCode === 'XK') {
         // workaround because Kosovo isn't formally a country and therefore not in the CLDR repository
         return 'Kosovo';
     } else {
         return $countryCode;
     }
 }
 /**
  * @param array $demand
  */
 public function listAction($demand = NULL)
 {
     if (is_array($demand)) {
         $demand = Arrays::removeEmptyElementsRecursively($demand);
         $projects = $this->projectRepository->findByDemand($demand);
         //\TYPO3\Flow\var_dump($demand, 'demand');
         // return not only the country code, but also the country name for filter display
         if (isset($demand['filter']['country'])) {
             $isoCode = $demand['filter']['country'];
             unset($demand['filter']['country']);
             $demand['filter']['country']['name'] = $this->cldrService->getTerritoryNameForIsoCode($isoCode);
             $demand['filter']['country']['isoCode'] = $isoCode;
         }
         // return not only the regions requested, but also their names
         if (isset($demand['filter']['regions']) && is_array($demand['filter']['regions'])) {
             $regionsRequested = $demand['filter']['regions'];
             unset($demand['filter']['regions']);
             foreach ($regionsRequested as $region) {
                 $demand['filter']['regions'][$region]['key'] = $region;
                 $demand['filter']['regions'][$region]['name'] = $this->cldrService->getTerritoryNameForIsoCode($region);
             }
         }
         // return not only the stages requested, but also their names
         if (isset($demand['filter']['stages']) && is_array($demand['filter']['stages'])) {
             $stagesRequested = $demand['filter']['stages'];
             unset($demand['filter']['stages']);
             $stagesSettings = $this->settings['projectDatabase']['filters']['stage'];
             foreach ($stagesRequested as $stage) {
                 $demand['filter']['stages'][$stage]['key'] = $stage;
                 $demand['filter']['stages'][$stage]['name'] = $stagesSettings[$stage]['_value'];
             }
         }
         // return not only the budget bracket keys, but also the minimum and maximum value
         if (isset($demand['filter']['budgetBrackets']) && is_array($demand['filter']['budgetBrackets'])) {
             $bracketsRequested = $demand['filter']['budgetBrackets'];
             unset($demand['filter']['budgetBrackets']);
             $bracketSettings = $this->settings['projectDatabase']['filters']['budget']['brackets'];
             foreach ($bracketsRequested as $bracket) {
                 $demand['filter']['budgetBrackets'][$bracket]['key'] = $bracket;
                 $demand['filter']['budgetBrackets'][$bracket]['minimum'] = $bracketSettings[$bracket]['minimum'];
                 $demand['filter']['budgetBrackets'][$bracket]['maximum'] = $bracketSettings[$bracket]['maximum'];
             }
         }
         // return not only the required investment bracket keys, but also the minimum and maximum value
         if (isset($demand['filter']['requiredInvestmentBrackets']) && is_array($demand['filter']['requiredInvestmentBrackets'])) {
             $bracketsRequested = $demand['filter']['requiredInvestmentBrackets'];
             unset($demand['filter']['requiredInvestmentBrackets']);
             $bracketSettings = $this->settings['projectDatabase']['filters']['budget']['brackets'];
             foreach ($bracketsRequested as $bracket) {
                 $demand['filter']['requiredInvestmentBrackets'][$bracket]['key'] = $bracket;
                 $demand['filter']['requiredInvestmentBrackets'][$bracket]['minimum'] = $bracketSettings[$bracket]['minimum'];
                 $demand['filter']['requiredInvestmentBrackets'][$bracket]['maximum'] = $bracketSettings[$bracket]['maximum'];
             }
         }
     } else {
         $projects = $this->projectRepository->findVisible();
     }
     $this->view->assignMultiple(array('projects' => $projects, 'demand' => $demand));
 }
 /**
  * The textual representation of a country
  *
  * @return string
  */
 public function getCountry()
 {
     $countryName = $this->cldrService->getTerritoryNameForIsoCode($this->getCountryCode());
     if ($countryName !== $this->getCountryCode()) {
         return $countryName;
     } elseif ($this->getCountryCode() === 'XK') {
         // workaround because Kosovo isn't formally a country and therefore not in the CLDR repository
         return 'Kosovo';
     } else {
         return $this->getCountryCode();
     }
 }