/**
  * Liefert eine Instanz von tx_rnbase_configurations. Da wir uns im BE bewegen, wird diese mit einem
  * Config-Array aus der TSConfig gefüttert. Dabei wird die Konfiguration unterhalb von mod.extkey. genommen.
  * Für "extkey" wird der Wert der Methode getExtensionKey() verwendet.
  * Zusätzlich wird auch die Konfiguration von "lib." bereitgestellt.
  * Wenn Daten für BE-Nutzer oder Gruppen überschrieben werden sollen, dann darauf achten, daß die
  * Konfiguration mit "page." beginnen muss. Also bspw. "page.lib.test = 42".
  *
  * Ein eigenes TS-Template für das BE wird in der ext_localconf.php mit dieser Anweisung eingebunden:
  * tx_rnbase_util_Extensions::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:myext/mod1/pageTSconfig.txt">');
  * @return tx_rnbase_configurations
  */
 public function getConfigurations()
 {
     if (!$this->configurations) {
         tx_rnbase::load('tx_rnbase_configurations');
         tx_rnbase::load('tx_rnbase_util_Misc');
         tx_rnbase::load('tx_rnbase_util_Typo3Classes');
         tx_rnbase_util_Misc::prepareTSFE();
         // Ist bei Aufruf aus BE notwendig!
         $cObj = tx_rnbase::makeInstance(tx_rnbase_util_Typo3Classes::getContentObjectRendererClass());
         $pageTSconfigFull = Tx_Rnbase_Backend_Utility::getPagesTSconfig($this->getPid());
         $pageTSconfig = $pageTSconfigFull['mod.'][$this->getExtensionKey() . '.'];
         $pageTSconfig['lib.'] = $pageTSconfigFull['lib.'];
         $userTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.' . $this->getExtensionKey() . '.');
         if (!empty($userTSconfig['properties'])) {
             tx_rnbase::load('tx_rnbase_util_Arrays');
             $pageTSconfig = tx_rnbase_util_Arrays::mergeRecursiveWithOverrule($pageTSconfig, $userTSconfig['properties']);
         }
         $qualifier = $pageTSconfig['qualifier'] ? $pageTSconfig['qualifier'] : $this->getExtensionKey();
         $this->configurations = new tx_rnbase_configurations();
         $this->configurations->init($pageTSconfig, $cObj, $this->getExtensionKey(), $qualifier);
     }
     return $this->configurations;
 }
Ejemplo n.º 2
0
 /**
  * Creates the wizard config for the tca
  *
  * usage:
  * ... 'wizards' => Tx_Rnbase_Utility_TcaTool::getWizards(
  *     'mytable',
  *     array(
  *         ### overwriting the default label
  *         ### or anything else
  *         'add' => array('title'  => 'my new title'),
  *         'edit' => TRUE,
  *         'suggest' => TRUE
  *     )
  * ),
  *
  * @param 	string 	$table
  * @param 	array 	$options
  * @return 	array
  */
 public static function getWizards($table, array $options = array())
 {
     $globalPid = isset($options['globalPid']) ? $options['globalPid'] : false;
     $wizards = array('_PADDING' => 2, '_VERTICAL' => 1);
     if (isset($options['edit'])) {
         $wizards['edit'] = array('type' => 'popup', 'title' => 'Edit entry', 'icon' => tx_rnbase_util_TYPO3::isTYPO60OrHigher() ? 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_edit.gif' : 'edit2.gif', 'popup_onlyOpenIfSelected' => 1, 'JSopenParams' => 'height=576,width=720,status=0,menubar=0,scrollbars=1');
         $wizards['edit'] = self::addWizardScriptForTypo3Version('edit', $wizards['edit']);
         if (is_array($options['edit'])) {
             $wizards['edit'] = tx_rnbase_util_Arrays::mergeRecursiveWithOverrule($wizards['edit'], $options['edit']);
         }
     }
     if (isset($options['add'])) {
         $wizards['add'] = array('type' => 'script', 'title' => 'Create new entry', 'icon' => tx_rnbase_util_TYPO3::isTYPO60OrHigher() ? 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_add.gif' : 'add.gif', 'params' => array('table' => $table, 'pid' => $globalPid ? '###STORAGE_PID###' : '###CURRENT_PID###', 'setValue' => 'prepend'));
         $wizards['add'] = self::addWizardScriptForTypo3Version('add', $wizards['add']);
         if (is_array($options['add'])) {
             $wizards['add'] = tx_rnbase_util_Arrays::mergeRecursiveWithOverrule($wizards['add'], $options['add']);
         }
     }
     if (isset($options['list'])) {
         $wizards['list'] = array('type' => 'popup', 'title' => 'List entries', 'icon' => tx_rnbase_util_TYPO3::isTYPO60OrHigher() ? 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_list.gif' : 'list.gif', 'params' => array('table' => $table, 'pid' => $globalPid ? '###STORAGE_PID###' : '###CURRENT_PID###'), 'JSopenParams' => 'height=576,width=720,status=0,menubar=0,scrollbars=1');
         $wizards['list'] = self::addWizardScriptForTypo3Version('list', $wizards['list']);
         if (is_array($options['list'])) {
             $wizards['list'] = tx_rnbase_util_Arrays::mergeRecursiveWithOverrule($wizards['list'], $options['list']);
         }
     }
     if (isset($options['suggest'])) {
         $wizards['suggest'] = array('type' => 'suggest', 'default' => array('maxItemsInResultList' => 8, 'searchWholePhrase' => true));
         if (is_array($options['suggest'])) {
             $wizards['suggest'] = tx_rnbase_util_Arrays::mergeRecursiveWithOverrule($wizards['suggest'], $options['suggest']);
         }
     }
     if (isset($options['RTE'])) {
         $wizards['RTE'] = array('notNewRecords' => 1, 'RTEonly' => 1, 'type' => 'script', 'title' => 'Full screen Rich Text Editing', 'icon' => tx_rnbase_util_TYPO3::isTYPO60OrHigher() ? 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_rte.gif' : 'wizard_rte2.gif');
         $wizards['RTE'] = self::addWizardScriptForTypo3Version('rte', $wizards['RTE']);
     }
     if (isset($options['link'])) {
         $wizards['link'] = array('type' => 'popup', 'title' => 'LLL:EXT:cms/locallang_ttc.xml:header_link_formlabel', 'icon' => tx_rnbase_util_TYPO3::isTYPO60OrHigher() ? 'EXT:backend/Resources/Public/Images/FormFieldWizard/wizard_link.gif' : 'link_popup.gif', 'script' => 'browse_links.php?mode=wizard', 'JSopenParams' => 'height=300,width=500,status=0,menubar=0,scrollbars=1', 'params' => array('blindLinkOptions' => ''));
         if (is_array($options['link'])) {
             $wizards['link'] = tx_rnbase_util_Arrays::mergeRecursiveWithOverrule($wizards['link'], $options['link']);
         }
         $wizards['link'] = self::addWizardScriptForTypo3Version('link', $wizards['link']);
     }
     return $wizards;
 }
 /**
  * Search database
  *
  * @param array $fields
  * @param array $options
  * @return array[tx_rnbase_model_base]
  */
 public function search(array $fields, array $options)
 {
     if (empty($options['searchdef']) || !is_array($options['searchdef'])) {
         $options['searchdef'] = array();
     }
     $options['searchdef'] = tx_rnbase_util_Arrays::mergeRecursiveWithOverrule($this->getSearchdef(), $options['searchdef']);
     return parent::search($fields, $options);
 }
 /**
  * Add a new local lang array from Typoscript _LOCAL_LANG. Merged with existing local lang
  *
  * @param array $langArr
  *
  * @return void
  */
 protected function addLang($langArr)
 {
     if (!is_array($langArr)) {
         return;
     }
     //new values from the given array are added to the existing local lang.
     //existing values in the local lang are overruled with those of the given array.
     tx_rnbase::load('tx_rnbase_util_Arrays');
     $this->LOCAL_LANG = tx_rnbase_util_Arrays::mergeRecursiveWithOverrule(is_array($this->LOCAL_LANG) ? $this->LOCAL_LANG : array(), $langArr);
 }
 /**
  *
  * @param string $tableName
  * @param array $options
  *     only_record_fields: validates only fields included in the record
  * @return array
  */
 public static function getTcaColumns($tableName, $options = NULL)
 {
     self::loadTCA($tableName);
     $options = tx_rnbase_model_data::getInstance($options);
     $columns = empty($GLOBALS['TCA'][$tableName]['columns']) ? array() : $GLOBALS['TCA'][$tableName]['columns'];
     $tcaOverrides = $options->getTcaOverrides();
     if (!empty($tcaOverrides['columns'])) {
         tx_rnbase::load('tx_rnbase_util_Arrays');
         $columns = tx_rnbase_util_Arrays::mergeRecursiveWithOverrule($columns, $tcaOverrides['columns']);
     }
     return $columns;
 }
 /**
  * Make the full configuration for the typolink function
  *
  * @param	string		$type: tag oder url
  * @return	array		the configuration
  * @access	private
  */
 function _makeConfig($type)
 {
     $conf = array();
     $this->parameters = is_array($this->parameters) ? $this->parameters : array();
     $this->overruledParameters = is_array($this->overruledParameters) ? $this->overruledParameters : array();
     unset($this->overruledParameters['DATA']);
     tx_rnbase::load('tx_rnbase_util_Arrays');
     $parameters = tx_rnbase_util_Arrays::mergeRecursiveWithOverrule($this->overruledParameters, $this->parameters);
     foreach ((array) $parameters as $key => $value) {
         // Ggf. hier auf die Parameter der eigenen Extension prüfen
         if ($this->getUniqueParameterId() !== NULL) {
             $value = array($key => $value);
             $key = $this->getUniqueParameterId();
         }
         $conf['additionalParams'] .= $this->makeUrlParam($key, $value);
     }
     if ($this->noHashBoolean) {
         $conf['useCacheHash'] = 0;
     } else {
         $conf['useCacheHash'] = 1;
     }
     if ($this->noCacheBoolean) {
         $conf['no_cache'] = 1;
         $conf['useCacheHash'] = 0;
     } else {
         $conf['no_cache'] = 0;
     }
     if ($this->destination !== '') {
         $conf['parameter'] = $this->destination;
     }
     if ($type == 'url') {
         $conf['returnLast'] = 'url';
     }
     if ($this->anchorString) {
         $conf['section'] = $this->anchorString;
     }
     if ($this->targetString) {
         $conf['target'] = $this->targetString;
     }
     $conf['extTarget'] = $this->externalTargetString != '-1' ? $this->externalTargetString : '_blank';
     if ($this->classString) {
         $conf['ATagParams'] .= 'class="' . $this->classString . '" ';
     }
     if ($this->idString) {
         $conf['ATagParams'] .= 'id="' . $this->idString . '" ';
     }
     if ($this->titleString) {
         $title = $this->titleHasAlreadyHtmlSpecialChars ? $this->titleString : htmlspecialchars($this->titleString);
         $conf['ATagParams'] .= 'title="' . $title . '" ';
     }
     if (is_array($this->tagAttributes) && count($this->tagAttributes) > 0) {
         foreach ($this->tagAttributes as $key => $value) {
             $conf['ATagParams'] .= ' ' . $key . '="' . htmlspecialchars($value) . '" ';
         }
     }
     // Weiter generische Attribute setzen
     if (count($this->typolinkParams)) {
         $conf = array_merge($conf, $this->typolinkParams);
     }
     return $conf;
 }
 /**
  * Prepares the simple generic searcher
  *
  * @param array $options
  *
  * @return void
  */
 protected function prepareGenericSearcher(array &$options)
 {
     if (empty($options['searchdef']) || !is_array($options['searchdef'])) {
         $options['searchdef'] = array();
     }
     $model = $this->getEmptyModel();
     \tx_rnbase::load('tx_rnbase_util_Arrays');
     $options['searchdef'] = \tx_rnbase_util_Arrays::mergeRecursiveWithOverrule(array('usealias' => 1, 'basetable' => $model->getTableName(), 'basetablealias' => 'DEVLOGENTRY', 'wrapperclass' => get_class($model), 'alias' => array('DEVLOGENTRY' => array('table' => $model->getTableName()))), $options['searchdef']);
 }
 /**
  * @return array
  */
 protected function getCacheKeyParts()
 {
     $keys = array();
     // TSFE hash, contains page id, domain, etc.
     $keys[] = tx_rnbase_util_TYPO3::getTSFE()->getHash();
     // the plugin ID (tt_content:uid or random md3, whenn rendered as USER in TS)
     $keys[] = $this->getConfigurations()->getPluginId();
     // the conf id of the current action (without trailing dot)
     $keys[] = trim($this->getConfId(), '.');
     // aditionaly a optional key set by ts
     $keys[] = $this->getSalt();
     // include params to the cache key usage = qualifier|uid,tt_news|tt_news
     $params = $this->getIcludeParams();
     if (!empty($params)) {
         // all get and post vars
         tx_rnbase::load('tx_rnbase_util_Arrays');
         $gp = tx_rnbase_util_Arrays::mergeRecursiveWithOverrule(tx_rnbase_parameters::getGetParameters(), tx_rnbase_parameters::getPostParameters());
         // the cobj to get the parameter value
         $cObj = $this->getConfigurations()->getCObj();
         foreach ($params as $param) {
             $keys[] = 'P-' . $param . '-' . $cObj->getGlobal($param, $gp);
         }
     }
     return $keys;
 }