/**
  * Translate selector items array
  *
  * @param string $itemFormElValue: value of the form element
  * @param string $tableName: name of static info tables
  * @return string value of the form element with translated labels
  */
 protected function translateSelectedItems($itemFormElValue, $tableName)
 {
     // Get the array with selected items:
     $itemArray = GeneralUtility::trimExplode(',', $itemFormElValue, 1);
     // Perform modification of the selected items array:
     foreach ($itemArray as $tk => $tv) {
         $tvP = explode('|', $tv, 2);
         if ($tvP[0]) {
             //Get isocode if present
             $code = strstr($tvP[1], '%28');
             $code2 = strstr(substr($code, 1), '%28');
             $code = $code2 ? $code2 : $code;
             // Translate
             $tvP[1] = LocalizationUtility::translate(array('uid' => $tvP[0]), $tableName);
             // Re-append isocode, if present
             $tvP[1] = $tvP[1] . ($code ? '%20' . $code : '');
         }
         $itemArray[$tk] = implode('|', $tvP);
     }
     return implode(',', $itemArray);
 }
 /**
  * Manipulate a record before using it to render the selector; may be used to replace a MM-relation etc.
  *
  * @param array $row
  */
 protected function manipulateRecord(&$row)
 {
     // Localize the record
     $row[$GLOBALS['TCA'][$this->table]['ctrl']['label']] = LocalizationUtility::translate(array('uid' => $row['uid']), $this->table);
 }
Exemple #3
0
 /**
  * Getting the name of a country, country subdivision, currency, language, tax
  *
  * @param	string		Defines the type of entry of the requested name: 'TERRIRORIES', 'COUNTRIES', 'SUBDIVISIONS', 'CURRENCIES', 'LANGUAGES'
  * @param	string		The ISO alpha-3 code of a territory, country or currency, or the ISO alpha-2 code of a language or the code of a country subdivision, can be a comma ',' separated string, then all the single items are looked up and returned
  * @param	string		The value of the country code (cn_iso_3) for which a name of type 'SUBDIVISIONS' is requested (meaningful only in this case)
  * @param	string		Not used
  * @param	boolean		local name only - if set local title is returned
  * @return	string		The name of the object in the current language
  */
 public function getStaticInfoName($type = 'COUNTRIES', $code, $country = '', $countrySubdivision = '', $local = FALSE)
 {
     $names = FALSE;
     if (in_array($type, $this->types) && trim($code)) {
         $codeArray = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $code);
         $tableName = $this->tables[$type];
         if (!$tableName) {
             return FALSE;
         }
         $nameArray = array();
         foreach ($codeArray as $item) {
             $isoCodeArray = array();
             $isoCodeArray[] = $item;
             switch ($type) {
                 case 'SUBDIVISIONS':
                     $isoCodeArray[] = trim($country) ? trim($country) : $this->defaultCountry;
                     break;
                 case 'LANGUAGES':
                     $isoCodeArray = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('_', $code, 1);
                     break;
             }
             $nameArray[] = LocalizationUtility::translate(array('iso' => $isoCodeArray), $tableName, $local);
         }
         $names = implode(',', $nameArray);
     }
     return $names;
 }
 public function getCountryzoneMarker(&$template, &$sims, &$rems)
 {
     // Initialise static info library
     $sims['###COUNTRYZONE###'] = '';
     $sims['###COUNTRYZONE_VALUE###'] = '';
     if ($this->isAllowed('countryzone')) {
         if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) {
             $staticInfo = \TYPO3\CMS\Cal\Utility\Functions::makeInstance('tx_staticinfotables_pi1');
             $staticInfo->init();
             $current = \SJBR\StaticInfoTables\Utility\LocalizationUtility::translate(array('uid' => $this->object->getCountryzone()), 'static_country_zones', FALSE);
             $sims['###COUNTRYZONE###'] = $this->applyStdWrap($current, 'countryzone_static_info_stdWrap');
             $sims['###COUNTRYZONE_VALUE###'] = $this->object->getCountryZone();
         } else {
             $sims['###COUNTRYZONE###'] = $this->applyStdWrap($this->object->getCountryZone(), 'countryzone_stdWrap');
             $sims['###COUNTRYZONE_VALUE###'] = $this->object->getCountryZone();
         }
     }
 }
 /**
  * Translate selector items array
  *
  * @param array $items: array of value/label pairs
  * @param string $tableName: name of static info tables
  * @return array array of value/translated label pairs
  */
 protected function translateSelectorItems($items, $tableName)
 {
     $translatedItems = $items;
     if (isset($translatedItems) && is_array($translatedItems)) {
         foreach ($translatedItems as $key => $item) {
             if ($translatedItems[$key][1]) {
                 //Get isocode if present
                 $code = strstr($item[0], '(');
                 $code2 = strstr(substr($code, 1), '(');
                 $code = $code2 ? $code2 : $code;
                 // Translate
                 $translatedItems[$key][0] = LocalizationUtility::translate(array('uid' => $item[1]), $tableName);
                 // Re-append isocode, if present
                 $translatedItems[$key][0] = $translatedItems[$key][0] . ($code ? ' ' . $code : '');
             }
         }
         $currentLocale = setlocale(LC_COLLATE, '0');
         $locale = LocalizationUtility::setCollatingLocale();
         if ($locale !== FALSE) {
             uasort($translatedItems, array($this, 'strcollOnLabels'));
         }
         setlocale(LC_COLLATE, $currentLocale);
     }
     $items = $translatedItems;
     return $items;
 }
Exemple #6
0
 function getCountryZoneMarker(&$template, &$sims, &$rems, &$wrapped, $view)
 {
     $this->initLocalCObject();
     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) {
         $staticInfo = \TYPO3\CMS\Cal\Utility\Functions::makeInstance('tx_staticinfotables_pi1');
         $staticInfo->init();
         $current = \SJBR\StaticInfoTables\Utility\LocalizationUtility::translate(array('uid' => $this->getCountryzone()), 'static_country_zones', FALSE);
         $this->local_cObj->setCurrentVal($current);
         $sims['###COUNTRYZONE###'] = $this->local_cObj->cObjGetSingle($this->conf['view.'][$this->conf['view'] . '.'][$this->getObjectType() . '.']['countryzoneStaticInfo'], $this->conf['view.'][$this->conf['view'] . '.'][$this->getObjectType() . '.']['countryzoneStaticInfo.']);
     } else {
         $current = $this->getCountryzone();
         $this->local_cObj->setCurrentVal($current);
         $sims['###COUNTRYZONE###'] = $this->local_cObj->cObjGetSingle($this->conf['view.'][$this->conf['view'] . '.'][$this->getObjectType() . '.']['countryzone'], $this->conf['view.'][$this->conf['view'] . '.'][$this->getObjectType() . '.']['countryzone.']);
     }
 }