/**
  * Liefert die TCA-Definition der in der Tabelle definierten Spalten
  *
  * @return array
  */
 public function getTCAColumns()
 {
     $columns = tx_rnbase_util_TCA::getTcaColumns($this->getTableName());
     return empty($columns) ? 0 : $columns;
 }
Пример #2
0
 /**
  * Setzt eventuelle Sprachparameter,
  * damit nur valide Daten für die aktuelle Sprache ausgelesen werden.
  *
  * @param array &$fields
  * @param array &$options
  * @return void
  */
 protected function handleLanguageOptions(&$fields, &$options)
 {
     if (!isset($options['i18n']) && !isset($options['ignorei18n']) && !isset($options['enablefieldsoff'])) {
         $tableName = $this->getEmptyModel()->getTableName();
         $languageField = tx_rnbase_util_TCA::getLanguageFieldForTable($tableName);
         // Die Sprache prüfen wir nur, wenn ein Sprachfeld gesetzt ist.
         if (!empty($languageField)) {
             $tsfe = tx_rnbase_util_TYPO3::getTSFE();
             $languages = array();
             if (isset($options['additionali18n'])) {
                 $languages = tx_rnbase_util_Strings::trimExplode(',', $options['additionali18n'], TRUE);
             }
             // for all languages
             $languages[] = '-1';
             // Wenn eine bestimmte Sprache gesetzt ist,
             // laden wir diese ebenfalls.
             if (is_object($tsfe) && $tsfe->sys_language_content) {
                 $languages[] = $tsfe->sys_language_content;
             } else {
                 // default language
                 $languages[] = '0';
             }
             $options['i18n'] = implode(',', array_unique($languages, SORT_NUMERIC));
         }
     }
 }
 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;
 }
Пример #4
0
    /**
     * Erstellt eine Selectbox mit festen Werten in der TCA.
     * Die Labels werden in der richtigen Sprache angezeigt.
     */
    function createSelectSingle($name, $value, $table, $column, $options = 0)
    {
        global $TCA, $LANG;
        $options = is_array($options) ? $options : array();
        $out = '<select name="' . $name . '" class="select" ';
        if ($options['onchange']) {
            $out .= 'onChange="' . $options['onchange'] . '" ';
        }
        $out .= '>';
        // Die TCA laden
        tx_rnbase_util_TCA::loadTCA($table);
        // Die Options ermitteln
        foreach ($TCA[$table]['columns'][$column]['config']['items'] as $item) {
            $sel = '';
            if ($value === $item[1]) {
                $sel = 'selected="selected"';
            }
            $out .= '<option value="' . $item[1] . '" ' . $sel . '>' . $LANG->sL($item[0]) . '</option>';
        }
        $out .= '
			</select>
		';
        return $out;
    }
 /**
  * Adds the column 'sys_language_uid' to the be list.
  *
  * @param array $columns
  * @param tx_rnbase_mod_IDecorator $oDecorator
  * @return tx_mklib_mod1_searcher_abstractBase
  */
 protected function addDecoratorColumnLanguage(array &$columns, tx_rnbase_mod_IDecorator &$oDecorator = NULL)
 {
     if (!empty($this->options['baseTableName'])) {
         tx_rnbase::load('tx_rnbase_util_TCA');
         $sysLanguageUidField = tx_rnbase_util_TCA::getLanguageFieldForTable($this->options['baseTableName']);
         if (!empty($sysLanguageUidField)) {
             $columns['sys_language_uid'] = array('title' => 'label_tableheader_language', 'decorator' => &$oDecorator);
         }
     }
     return $this;
 }
 /**
  * returns all language overlays.
  *
  * @param Tx_Rnbase_Domain_Model_Base $entry
  * @return array[Tx_Rnbase_Domain_Model_Base]
  */
 private static function getLangOverlayEntries(Tx_Rnbase_Domain_Model_RecordInterface $entry)
 {
     tx_rnbase::load('tx_rnbase_util_TCA');
     $parentField = tx_rnbase_util_TCA::getTransOrigPointerFieldForTable($entry->getTableName());
     $overlays = tx_rnbase_util_DB::doSelect('*', $entry->getTableName(), array('where' => $parentField . '=' . $entry->getUid(), 'wrapperclass' => get_class($entry)));
     return $overlays;
 }
Пример #7
0
 /**
  * Liefert die TCA-Definition der in der Tabelle definierten Spalten
  *
  * @param string $tcaTableName
  * @return array or 0
  */
 public function getTCAColumns($tcaTableName)
 {
     global $TCA;
     tx_rnbase_util_TCA::loadTCA($tcaTableName);
     return isset($TCA[$tcaTableName]) ? $TCA[$tcaTableName]['columns'] : 0;
 }
 function getDAMColumns()
 {
     global $TCA;
     tx_rnbase_util_TCA::loadTCA('tx_dam');
     // Wird zur Initialisierung der Marker benötigt
     return isset($TCA['tx_dam']) ? array_keys($TCA['tx_dam']['columns']) : 0;
 }
 /**
  * is testing th following methods:
  *     tx_rnbase_util_TCA::validateModel();
  *     tx_rnbase_util_TCA::validateRecord();
  *     tx_rnbase_model_base::validateProperties();
  *
  * @return void
  *
  * @group unit
  * @test
  * @dataProvider getValidateModelData
  */
 public function testValidateModel(tx_rnbase_model_base $model, array $options, $valid)
 {
     /* @var $options tx_rnbase_model_data */
     $options = tx_rnbase::makeInstance('tx_rnbase_model_data', is_array($options) ? $options : array());
     // test the tx_rnbase_util_TCA::validateModel method
     $this->assertEquals($valid, tx_rnbase_util_TCA::validateModel($model, $options));
     // test the tx_rnbase_util_TCA::validateRecord method
     $this->assertEquals($valid, tx_rnbase_util_TCA::validateRecord($model->getProperty(), $model->getTableName(), $options));
     // test the tx_rnbase_model_base::validateProperties method
     $this->assertEquals($valid, $model->validateProperties($options));
     if ($valid) {
         $this->assertFalse($options->hasLastInvalidField(), 'last_invalid_field was set, why?');
         $this->assertFalse($options->hasLastInvalidValue(), 'last_invalid_value was set, why?');
     } else {
         $this->assertTrue($options->hasLastInvalidField(), 'last_invalid_field was not set, why?');
         // we has to check the property key,
         // hasLastInvalidValue returns false, if the value is NULL
         $this->assertTrue(array_key_exists('last_invalid_value', $options->getProperty()), 'last_invalid_value was not set, why?');
     }
 }