コード例 #1
0
 public static function getAddLocalizationLinks(tx_rnbase_model_base $item, tx_rnbase_mod_BaseModule $mod = NULL)
 {
     if ($item->getUid() != $item->getProperty('uid') || $item->getSysLanguageUid() !== 0) {
         return '';
     }
     $out = '';
     foreach (self::getLangRecords($item->getPid()) as $lang) {
         // skip, if the be user hase no access to for the language!
         if (!$GLOBALS['BE_USER']->checkLanguageAccess($lang['uid'])) {
             continue;
         }
         // skip, if a overlay for this language allready exists
         tx_rnbase::load('tx_rnbase_util_TCA');
         $parentField = tx_rnbase_util_TCA::getTransOrigPointerFieldForTable($item->getTableName());
         $sysLanguageUidField = tx_rnbase_util_TCA::getLanguageFieldForTable($item->getTableName());
         $overlays = tx_rnbase_util_DB::doSelect('uid', $item->getTableName(), array('where' => implode(' AND ', array($parentField . '=' . $item->getUid(), $sysLanguageUidField . '=' . (int) $lang['uid'])), 'limit' => 1));
         if (!empty($overlays)) {
             continue;
         }
         /* @var $mod tx_rnbase_mod_BaseModule */
         if (!$mod instanceof tx_rnbase_mod_BaseModule) {
             $mod = $GLOBALS['SOBE'];
         }
         $onclick = $mod->getDoc()->issueCommand('&cmd[' . $item->getTableName() . '][' . $item->getUid() . '][localize]=' . $lang['uid']);
         $onclick = 'window.location.href=\'' . $onclick . '\'; return false;';
         $out .= sprintf('<a href="#" onclick="%1$s">%2$s</a>', htmlspecialchars($onclick), self::getLangSpriteIcon($lang, array('show_title' => FALSE)));
     }
     return $out;
 }
コード例 #2
0
 /**
  * Renders the language column.
  * Renders the flag and the title of the sys language record.
  * Renders some links to create the overlay too.
  *
  * @param tx_rnbase_model_base $item
  * @return string
  */
 protected function getSysLanguageColumn(tx_rnbase_model_base $item)
 {
     if ($item->getTableName()) {
         tx_rnbase::load('tx_mklib_mod1_util_Language');
         $ret = tx_mklib_mod1_util_Language::getLangSpriteIcon($item->getSysLanguageUid(), array('show_title' => TRUE));
         $new = tx_mklib_mod1_util_Language::getAddLocalizationLinks($item, $this->getModule());
         /** 
          * @TODO: compatibility with Typo3 4.x? xml files instead of xlf files
          */
         if (!empty($new)) {
             $ret .= ' (' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:Localize') . ' ' . $new . ')';
         }
     }
     return empty($ret) ? FALSE : $ret;
 }