Example #1
0
 /**
  * Parses a flexForm node recursively and takes care of sections etc
  *
  * @param array|string $flexForm
  * @return array
  */
 protected function sanitize($flexForm)
 {
     if (is_string($flexForm)) {
         $flexForm = GeneralUtility::xml2array($flexForm);
     }
     return $flexForm;
 }
 /**
  * @param array $params
  *
  * @return string
  */
 public function getExtensionSummary(array $params)
 {
     $LL = $this->includeLocalLang();
     $result = '<strong><cite>&rarr; ' . $this->getLanguage()->getLLL('list_title_' . $params['row']['list_type'], $LL) . ' </cite></strong>';
     $this->flexformData = GeneralUtility::xml2array($params['row']['pi_flexform']);
     if ($this->getFieldFromFlexform('settings.videoWidth')) {
         $result .= '<br /><strong>Width:</strong>: ' . $this->getFieldFromFlexform('settings.videoWidth');
     }
     if ($this->getFieldFromFlexform('settings.videoHeight')) {
         $result .= '<br /><strong>Height</strong>: ' . $this->getFieldFromFlexform('settings.videoHeight');
     }
     if ($this->getFieldFromFlexform('settings.templateFile')) {
         $result .= '<br /><strong>Template</strong>: ' . $this->getFieldFromFlexform('settings.templateFile');
     }
     if ($this->getFieldFromFlexform('settings.addMediaElementJsInitializationFile')) {
         $result .= '<br /><strong>MediaelementInit</strong>: ' . basename($this->getFieldFromFlexform('settings.addMediaElementJsInitializationFile'));
     }
     if ($this->getFieldFromFlexform('settings.skin')) {
         $result .= '<br /><strong>Skin</strong>: ' . $this->getFieldFromFlexform('settings.skin');
     }
     if ($this->getFieldFromFlexform('settings.videoSelection')) {
         $this->addItemsToResult($this->getItemsByTableAndUids($this->getFieldFromFlexform('settings.videoSelection')), $result);
     }
     if ($this->getFieldFromFlexform('settings.audioSelection')) {
         $this->addItemsToResult($this->getItemsByTableAndUids($this->getFieldFromFlexform('settings.audioSelection'), 'tx_sschhtml5videoplayer_domain_model_audio'), $result);
     }
     return $result;
 }
Example #3
0
 /**
  * Adds onchange listener on the drop down menu "predefined".
  * If the event is fired and old value was ".default", then empty some fields.
  *
  * @param array $config
  * @return string the javascript
  * @author Fabien Udriot
  */
 function addFields_predefinedJS($config)
 {
     $newRecord = 'true';
     if ($config['row']['pi_flexform'] != '') {
         $flexData = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($config['row']['pi_flexform']);
         if (isset($flexData['data']['sDEF']['lDEF']['predefined'])) {
             $newRecord = 'false';
         }
     }
     $uid = NULL;
     if (is_array($GLOBALS['SOBE']->editconf['tt_content'])) {
         $uid = key($GLOBALS['SOBE']->editconf['tt_content']);
     }
     if ($uid < 0 || empty($uid) || !strstr($uid, 'NEW')) {
         $uid = $GLOBALS['SOBE']->elementsData[0]['uid'];
     }
     //print_r($GLOBALS['SOBE']->elementsData[0]);
     $js = "<script>\n";
     $js .= "/*<![CDATA[*/\n";
     $divId = $GLOBALS['SOBE']->tceforms->dynNestedStack[0][1];
     if (!$divId) {
         //$divId = 'DTM-' . $uid;
         $divId = "DIV.c-tablayer";
     } else {
         $divId .= "-DIV";
     }
     $js .= "var uid = '" . $uid . "'\n";
     $js .= "var flexformBoxId = '" . $divId . "'\n";
     //$js .= "var flexformBoxId = 'DIV.c-tablayer'\n";
     $js .= "var newRecord = " . $newRecord . "\n";
     $js .= file_get_contents(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('formhandler') . 'Resources/JS/addFields_predefinedJS.js');
     $js .= "/*]]>*/\n";
     $js .= "</script>\n";
     return $js;
 }
Example #4
0
 /**
  * Parses the flexForm content and converts it to an array
  * The resulting array will be multi-dimensional, as a value "bla.blubb"
  * results in two levels, and a value "bla.blubb.bla" results in three levels.
  *
  * Note: multi-language flexForms are not supported yet
  *
  * @param string $flexFormContent flexForm xml string
  * @param string $languagePointer language pointer used in the flexForm
  * @param string $valuePointer value pointer used in the flexForm
  * @return array the processed array
  */
 public function convertFlexFormContentToArray($flexFormContent, $languagePointer = 'lDEF', $valuePointer = 'vDEF')
 {
     $settings = array();
     $flexFormArray = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($flexFormContent);
     $flexFormArray = isset($flexFormArray['data']) ? $flexFormArray['data'] : array();
     foreach (array_values($flexFormArray) as $languages) {
         if (!is_array($languages[$languagePointer])) {
             continue;
         }
         foreach ($languages[$languagePointer] as $valueKey => $valueDefinition) {
             if (strpos($valueKey, '.') === FALSE) {
                 $settings[$valueKey] = $this->walkFlexFormNode($valueDefinition, $valuePointer);
             } else {
                 $valueKeyParts = explode('.', $valueKey);
                 $currentNode =& $settings;
                 foreach ($valueKeyParts as $valueKeyPart) {
                     $currentNode =& $currentNode[$valueKeyPart];
                 }
                 if (is_array($valueDefinition)) {
                     if (array_key_exists($valuePointer, $valueDefinition)) {
                         $currentNode = $valueDefinition[$valuePointer];
                     } else {
                         $currentNode = $this->walkFlexFormNode($valueDefinition, $valuePointer);
                     }
                 } else {
                     $currentNode = $valueDefinition;
                 }
             }
         }
     }
     return $settings;
 }
Example #5
0
 /**
  * @param array $params
  *
  * @return string
  */
 public function getExtensionSummary(array $params)
 {
     $result = '<strong><cite>&rarr; HTML5 Video Player</cite></strong>';
     $this->flexformData = GeneralUtility::xml2array($params['row']['pi_flexform']);
     if ($this->getFieldFromFlexform('settings.ff.videowidth')) {
         $result .= '<br /><strong>Width:</strong>: ' . $this->getFieldFromFlexform('settings.ff.videowidth');
     }
     if ($this->getFieldFromFlexform('settings.ff.videoheight')) {
         $result .= '<br /><strong>Height</strong>: ' . $this->getFieldFromFlexform('settings.ff.videoheight');
     }
     if ($this->getFieldFromFlexform('switchableControllerActions')) {
         $result .= '<br /><strong>Mode</strong>:';
         if ($this->getFieldFromFlexform('switchableControllerActions') == 'Videoplayer->list') {
             $result .= 'Movies';
         } else {
             $result .= 'Gallery';
         }
     }
     $result .= '<br /><ul style="margin-bottom: 0;">';
     $videos = $this->getVideosByContentUid($params['row']['uid']);
     foreach ($videos as $video) {
         $result .= '<li>' . $video['title'] . '</li>';
     }
     $result .= '</ul>';
     return $result;
 }
 /**
  * Render the Plugin Info
  * 
  * @param unknown_type $params
  * @param unknown_type $pObj
  */
 public function getExtensionSummary($params, &$pObj)
 {
     $data = GeneralUtility::xml2array($params['row']['pi_flexform']);
     $this->init($data);
     if (is_array($data)) {
         // PluginMode
         $firstControllerAction = array_shift(explode(';', $data['data']['sDefault']['lDEF']['switchableControllerActions']['vDEF']));
         $this->pluginMode = str_replace('->', '_', $firstControllerAction);
         // List
         $listIdentifier = $data['data']['sDefault']['lDEF']['settings.listIdentifier']['vDEF'];
         // Filter
         $filterBoxIdentifier = $data['data']['sDefault']['lDEF']['settings.filterboxIdentifier']['vDEF'];
         // Export
         $exportType = array_pop(explode('.', $data['data']['sDefault']['lDEF']['settings.controller.List.export.view']['vDEF']));
         $exportFileName = $data['data']['sDefault']['lDEF']['settings.prototype.export.fileName']['vDEF'];
         $exportFileName .= $data['data']['sDefault']['lDEF']['settings.prototype.export.addDateToFilename']['vDEF'] ? '[DATE]' : '';
         $exportFileName .= '.' . $data['data']['sDefault']['lDEF']['settings.prototype.export.fileExtension']['vDEF'];
         $exportDownloadType = 'tx_ptextlist_flexform_export.downloadtype.' . $data['data']['sDefault']['lDEF']['settings.prototype.export.downloadType']['vDEF'];
         $exportListIdentifier = $data['data']['sDefault']['lDEF']['settings.exportListIdentifier']['vDEF'];
     }
     $this->fluidRenderer->assign($this->pluginMode, true);
     $this->fluidRenderer->assign('listIdentifier', $listIdentifier);
     $this->fluidRenderer->assign('filterBoxIdentifier', $filterBoxIdentifier);
     $this->fluidRenderer->assign('exportType', $exportType);
     $this->fluidRenderer->assign('exportFileName', $exportFileName);
     $this->fluidRenderer->assign('exportDownloadType', $exportDownloadType);
     $this->fluidRenderer->assign('exportListIdentifier', $exportListIdentifier);
     $this->fluidRenderer->assign('caLabel', 'LLL:EXT:pt_extlist/Resources/Private/Language/locallang.xml:tx_ptextlist_flexform_controllerAction.' . $this->pluginMode);
     return $this->fluidRenderer->render();
 }
 /**
  * Returns information about this extension's pi1 plugin
  *
  * @param    array $params Parameters to the hook
  * @param    object $pObj A reference to calling object
  * @return    string        Information about pi1 plugin
  */
 function getExtensionSummary($params, &$pObj)
 {
     $languageService = $this->getLanguageService();
     $result = '';
     if ($params['row']['list_type'] == 'irfaq_pi1') {
         $data = GeneralUtility::xml2array($params['row']['pi_flexform']);
         if (is_array($data)) {
             $modes = array();
             foreach (GeneralUtility::trimExplode(',', $data['data']['sDEF']['lDEF']['what_to_display']['vDEF'], true) as $mode) {
                 switch ($mode) {
                     case 'DYNAMIC':
                         $modes[] = $languageService->sL('LLL:EXT:irfaq/lang/locallang_db.xml:tx_irfaq.pi_flexform.view_dynamic');
                         break;
                     case 'STATIC':
                         $modes[] = $languageService->sL('LLL:EXT:irfaq/lang/locallang_db.xml:tx_irfaq.pi_flexform.view_static');
                         break;
                     case 'STATIC_SEPARATE':
                         $modes[] = $languageService->sL('LLL:EXT:irfaq/lang/locallang_db.xml:tx_irfaq.pi_flexform.view_static_separate');
                         break;
                     case 'SEARCH':
                         $modes[] = $languageService->sL('LLL:EXT:irfaq/lang/locallang_db.xml:tx_irfaq.pi_flexform.view_search');
                         break;
                 }
             }
             $result = implode(', ', $modes);
         }
         if (!$result) {
             $result = $languageService->sL('LLL:EXT:irfaq/lang/locallang_db.xml:tx_irfaq.pi_flexform.no_view');
         }
     }
     return $result;
 }
 /**
  * Overwrites the data structure of a given tt_content::pi_flexform by
  * by the one matching the gridelements layout.
  *
  * @param array  $dataStructArray The incoming data structure. This might be the default one.
  * @param array  $conf
  * @param array  $row
  * @param string $table
  * @param string $fieldName
  *
  * @return void
  *
  */
 public function getFlexFormDS_postProcessDS(&$dataStructArray, $conf, $row, $table, $fieldName)
 {
     if ($table === 'tt_content' && $fieldName === 'pi_flexform' && $row['CType'] === 'gridelements_pi1' && $row['tx_gridelements_backend_layout']) {
         $this->init($row['pid']);
         $dataStructArray = GeneralUtility::xml2array($this->layoutSetup->getFlexformConfiguration($row['tx_gridelements_backend_layout']));
     }
 }
 /**
  * Init the extbase Context and the configurationBuilder
  *
  * @throws \Exception
  */
 protected function init(&$PA)
 {
     $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     if (is_array($PA['row']['pi_flexform'])) {
         // TYPO3 7.5 and newer delivers an array
         $this->apiServerToken = $PA['row']['pi_flexform']['data']['sDefault']['lDEF']['settings.apiServerToken']['vDEF'];
         $this->ytChannelId = $PA['row']['pi_flexform']['data']['sDefault']['lDEF']['settings.channelId']['vDEF'];
     } else {
         // TYPO3 7.4 or older delivers a string
         $flexForm = GeneralUtility::xml2array($PA['row']['pi_flexform']);
         if (is_array($flexForm) && isset($flexForm['data']['sDefault']['lDEF']['settings.apiServerToken']['vDEF'])) {
             $this->apiServerToken = $flexForm['data']['sDefault']['lDEF']['settings.apiServerToken']['vDEF'];
         }
         if (is_array($flexForm) && isset($flexForm['data']['sDefault']['lDEF']['settings.channelId']['vDEF'])) {
             $this->ytChannelId = $flexForm['data']['sDefault']['lDEF']['settings.channelId']['vDEF'];
         }
     }
     if (!isset($this->apiServerToken)) {
         error_log("YouTube Playlist - PlaylistSelector: API Server Token could not be accessed.");
     }
     if (!isset($this->ytChannelId)) {
         error_log("YouTube Playlist - PlaylistSelector: YouTube Channel ID could not be accessed.");
     }
     $this->youTubeApi = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Powrup\\YoutubePlaylist\\Utility\\YouTubeApi', $this->apiServerToken);
     // Set Channel ID
     $this->youTubeApi->setChannelId($this->ytChannelId);
 }
 /**
  * renders the templavoila preview
  *
  * @param	pointer		$row: affected record
  * @param	pointer		$table: affected table
  * @param	pointer		$alreadyRendered: is the preview already rendered by another extension?
  * @param	pointer		$reference: pointer to the parent class
  * @return	string		preview content
  */
 function renderPreviewContent_preProcess($row, $table, &$alreadyRendered, &$reference)
 {
     if ($row['CType'] == 'list' && $row['list_type'] == 'piwikintegration_pi1') {
         $content = '<strong>Piwik in FE</strong>';
         $content = $reference->link_edit($content, $table, $row['uid']);
         $piFlexForm = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($row['pi_flexform']);
         foreach ($piFlexForm['data'] as $sheet => $data) {
             foreach ($data as $lang => $value) {
                 foreach ($value as $key => $val) {
                     $conf[$key] = $piFlexForm['data'][$sheet]['lDEF'][$key]['vDEF'];
                 }
             }
         }
         $this->extConf = array('widget' => json_decode(base64_decode($conf['widget']), true), 'height' => $conf['div_height']);
         $this->extConf['widget']['idSite'] = $conf['idsite'];
         $this->extConf['widget']['period'] = $conf['period'];
         $this->extConf['widget']['date'] = 'yesterday';
         $this->extConf['widget']['viewDataTable'] = $conf['viewDataTable'];
         $this->extConf['widget']['moduleToWidgetize'] = $this->extConf['widget']['module'];
         $this->extConf['widget']['actionToWidgetize'] = $this->extConf['widget']['action'];
         unset($this->extConf['widget']['module']);
         unset($this->extConf['widget']['action']);
         #$helper = new tx_piwikintegration_helper();
         $obj .= '<div style="width:' . $this->extConf['height'] . 'px;"><object width="100%" type="text/html" height="' . intval($this->extConf['height']) . '" data="';
         $obj .= '../../../../typo3conf/piwik/piwik/index.php?module=Widgetize&action=iframe' . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $this->extConf['widget']);
         $obj .= '&disableLink=1"></object></div>';
         $content .= $obj;
         $alreadyRendered = true;
         return $content;
     }
 }
 /**
  * User function for to render a dropdown for selecting a folder
  * of a selected storage
  * todo: https://review.typo3.org/#/c/27119/2
  *
  * @param array $PA the array with additional configuration options.
  * @param \TYPO3\CMS\Backend\Form\FormEngine $tceformsObj Parent object
  * @return string The HTML code for the TCEform field
  */
 public function renderFlexFormSelectDropdown(&$PA, &$tceformsObj)
 {
     $storageUid = 0;
     // get storageUid from flexform
     $flexform_data = GeneralUtility::xml2array($PA['row']['pi_flexform']);
     if (is_array($flexform_data) && isset($flexform_data['data']['sDEF']['lDEF']['settings.storage']['vDEF'])) {
         $storageUid = (int) $flexform_data['data']['sDEF']['lDEF']['settings.storage']['vDEF'];
     }
     // if storageUid found get folders
     if ($storageUid > 0) {
         // reset items
         $PA['items'] = array();
         /** @var $storageRepository \TYPO3\CMS\Core\Resource\StorageRepository */
         $storageRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
         /** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */
         $storage = $storageRepository->findByUid($storageUid);
         if ($storage->isBrowsable()) {
             $rootLevelFolder = $storage->getRootLevelFolder();
             $folderItems = $this->getSubfoldersForOptionList($rootLevelFolder);
             foreach ($folderItems as $item) {
                 $PA['items'][] = array($item->getIdentifier(), $item->getIdentifier());
             }
         } else {
             /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
             $flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
             $queue = $flashMessageService->getMessageQueueByIdentifier();
             $queue->enqueue(new FlashMessage('Storage "' . $storage->getName() . '" is not browsable. No folder is currently selectable.', '', FlashMessage::WARNING));
             if (!count($PA['items'])) {
                 $PA['items'][] = array('', '');
             }
         }
     }
 }
 /**
  * Renders the slider value wizard
  *
  * @param array $params
  * @return string
  */
 public function renderWizard($params)
 {
     $field = $params['field'];
     if (is_array($params['row'][$field])) {
         $value = $params['row'][$field][0];
     } else {
         $value = $params['row'][$field];
     }
     // If Slider is used in a flexform
     if (!empty($params['flexFormPath'])) {
         $flexFormTools = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools::class);
         $flexFormValue = $flexFormTools->getArrayValueByPath($params['flexFormPath'], GeneralUtility::xml2array($value));
         if ($flexFormValue !== null) {
             $value = $flexFormValue;
         }
     }
     $itemName = $params['itemName'];
     // Set default values (which correspond to those of the JS component)
     $min = 0;
     $max = 10000;
     // Use the range property, if defined, to set min and max values
     if (isset($params['fieldConfig']['range'])) {
         $min = isset($params['fieldConfig']['range']['lower']) ? (int) $params['fieldConfig']['range']['lower'] : 0;
         $max = isset($params['fieldConfig']['range']['upper']) ? (int) $params['fieldConfig']['range']['upper'] : 10000;
     }
     $elementType = $params['fieldConfig']['type'];
     $step = $params['wConf']['step'] ?: 1;
     $width = (int) $params['wConf']['width'] ?: 400;
     $type = 'null';
     if (isset($params['fieldConfig']['eval'])) {
         $eval = GeneralUtility::trimExplode(',', $params['fieldConfig']['eval'], true);
         if (in_array('int', $eval, true)) {
             $type = 'int';
             $value = (int) $value;
         } elseif (in_array('double2', $eval, true)) {
             $type = 'double';
             $value = (double) $value;
         }
     }
     if (isset($params['fieldConfig']['items'])) {
         $type = 'array';
         $index = 0;
         $itemAmount = count($params['fieldConfig']['items']);
         for (; $index < $itemAmount; ++$index) {
             $item = $params['fieldConfig']['items'][$index];
             if ((string) $item[1] === $value) {
                 break;
             }
         }
         $min = 0;
         $max = $itemAmount - 1;
         $step = 1;
         $value = $index;
     }
     $callbackParams = [$params['table'], $params['row']['uid'], $params['field'], $params['itemName']];
     $id = 'slider-' . $params['md5ID'];
     $content = '<div' . ' id="' . $id . '"' . ' data-slider-id="' . $id . '"' . ' data-slider-min="' . $min . '"' . ' data-slider-max="' . $max . '"' . ' data-slider-step="' . htmlspecialchars($step) . '"' . ' data-slider-value="' . htmlspecialchars($value) . '"' . ' data-slider-value-type="' . htmlspecialchars($type) . '"' . ' data-slider-item-name="' . htmlspecialchars($itemName) . '"' . ' data-slider-element-type="' . htmlspecialchars($elementType) . '"' . ' data-slider-callback-params="' . htmlspecialchars(json_encode($callbackParams)) . '"' . ' style="width: ' . $width . 'px;"' . '></div>';
     return $content;
 }
 /**
  * Return Form Uid from content element
  *
  * @param int $ttContentUid
  * @return int
  */
 protected function getFormUidFromTtContentUid($ttContentUid)
 {
     $row = $this->databaseConnection->exec_SELECTgetSingleRow('pi_flexform', 'tt_content', 'uid=' . (int) $ttContentUid);
     $flexform = GeneralUtility::xml2array($row['pi_flexform']);
     if (is_array($flexform) && isset($flexform['data']['main']['lDEF']['settings.flexform.main.form']['vDEF'])) {
         return (int) $flexform['data']['main']['lDEF']['settings.flexform.main.form']['vDEF'];
     }
     return 0;
 }
Example #14
0
 /**
  * @param Form $form
  * @return string
  */
 public function render(Form $form)
 {
     $record = $form->getOption(Form::OPTION_RECORD);
     $table = $form->getOption(Form::OPTION_RECORD_TABLE);
     $field = $form->getOption(Form::OPTION_RECORD_FIELD);
     $node = $this->getNodeFactory()->create(array('type' => 'flex', 'renderType' => 'flex', 'flexFormDataStructureArray' => $form->build(), 'tableName' => $table, 'fieldName' => $field, 'databaseRow' => $record, 'inlineStructure' => array(), 'parameterArray' => array('itemFormElName' => sprintf('data[%s][%d][%s]', $table, (int) $record['uid'], $field), 'itemFormElValue' => GeneralUtility::xml2array($record[$field]), 'fieldChangeFunc' => array(), 'fieldConf' => array('config' => array('ds' => $form->build())))));
     $output = $node->render();
     return $output['html'];
 }
Example #15
0
 /**
  * Return Form Uid from Flexform settings
  * 
  * @param array $params
  * @return int
  */
 protected function getFormFromFlexform($params)
 {
     $xml = $params['row']['pi_flexform'];
     $flexform = GeneralUtility::xml2array($xml);
     if (is_array($flexform) && isset($flexform['data']['main']['lDEF']['settings.flexform.main.form']['vDEF'])) {
         return $flexform['data']['main']['lDEF']['settings.flexform.main.form']['vDEF'];
     }
     return 0;
 }
 /**
  * @param int $contentElementIdentifier
  * @return array
  */
 public function getSettings($contentElementIdentifier)
 {
     if (is_null($this->settings)) {
         $content = $this->get($contentElementIdentifier);
         $flexform = GeneralUtility::xml2array($content['pi_flexform']);
         $this->settings = $this->normalizeFlexForm($flexform)['settings'];
     }
     return $this->settings;
 }
Example #17
0
 /**
  * Returns information about this extension's pi1 plugin
  *
  * @param array $params Parameters to the hook
  * @return string Information about pi1 plugin
  */
 public function getExtensionSummary(array $params)
 {
     $result = $actionTranslationKey = '';
     if ($params['row']['list_type'] == self::KEY . '_pi1') {
         $this->flexformData = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
         // if flexform data is found
         $actions = $this->getFieldFromFlexform('switchableControllerActions');
         if (!empty($actions)) {
             $actionList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(';', $actions);
             // translate the first action into its translation
             $actionTranslationKey = strtolower(str_replace('->', '_', $actionList[0]));
             $actionTranslation = $GLOBALS['LANG']->sL(self::LLPATH_NEWSEVENT . 'flexforms_general.mode.' . $actionTranslationKey);
             $result .= '<pre>' . $actionTranslation . '</pre>';
         } else {
             $result = $GLOBALS['LANG']->sL(self::LLPATH . 'flexforms_general.mode.not_configured');
         }
         if (is_array($this->flexformData)) {
             switch ($actionTranslationKey) {
                 case 'news_list':
                 case 'news_detail':
                 case 'news_datemenu':
                 case 'category_list':
                 case 'tag_list':
                     return '';
                 case 'news_eventlist':
                     $this->getStartingPoint();
                     $this->getTimeRestrictionSetting();
                     $this->getTopNewsRestrictionSetting();
                     $this->getOrderSettings();
                     $this->getCategorySettings();
                     $this->getArchiveSettings();
                     $this->getOffsetLimitSettings();
                     $this->getDetailPidSetting();
                     $this->getListPidSetting();
                     break;
                 case 'news_eventdetail':
                     $this->getSingleNewsSettings();
                     $this->getDetailPidSetting();
                     break;
                 case 'news_eventdatemenu':
                     $this->getStartingPoint();
                     $this->getTimeRestrictionSetting();
                     $this->getTopNewsRestrictionSetting();
                     $this->getDateMenuSettings();
                     $this->getCategorySettings();
                     break;
                 default:
             }
             // for all views
             $this->getOverrideDemandSettings();
             $this->getTemplateLayoutSettings($params['row']['pid']);
             $result .= $this->renderSettingsAsTable();
         }
     }
     return $result;
 }
Example #18
0
 /**
  * @param array|string $params
  * @param array $reference
  */
 public function updateFlexforms(&$params, &$reference)
 {
     if ($params['selectedView'] === 'News->month') {
         $removedFields = $this->removedFieldsInListView;
         $removedFields['sDEF'] .= ',timeRestriction,timeRestrictionHigh';
         $this->deleteFromStructure($params['dataStructure'], $removedFields);
     }
     if ($params['selectedView'] === 'News->month' || $params['selectedView'] === 'News->list') {
         $eventRestrictionXml = GeneralUtility::xml2array($this->eventRestrictionField);
         $params['dataStructure']['sheets']['sDEF']['ROOT']['el'] = $params['dataStructure']['sheets']['sDEF']['ROOT']['el'] + array('settings.eventRestriction' => $eventRestrictionXml);
     }
 }
 /**
  * @param array $row
  * @return array
  */
 protected function getOptionsFromFlexFormData(array $row)
 {
     $options = [];
     $flexFormAsArray = GeneralUtility::xml2array($row['pi_flexform']);
     if (!empty($flexFormAsArray['data']['sDEF']['lDEF']) && is_array($flexFormAsArray['data']['sDEF']['lDEF'])) {
         foreach ($flexFormAsArray['data']['sDEF']['lDEF'] as $optionKey => $optionValue) {
             $optionParts = explode('.', $optionKey);
             $options[array_pop($optionParts)] = $optionValue['vDEF'] === '1' ? true : $optionValue['vDEF'];
         }
     }
     return $options;
 }
Example #20
0
 /**
  * Modifies the select box of orderBy-options as a category menu
  * needs different ones then a news action
  *
  * @param array &$config configuration array
  * @return void
  */
 public function user_orderBy(array &$config)
 {
     $newItems = '';
     // check if the record has been saved once
     if (is_array($config['row']) && !empty($config['row']['pi_flexform'])) {
         $flexformConfig = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($config['row']['pi_flexform']);
         // check if there is a flexform configuration
         if (isset($flexformConfig['data']['sDEF']['lDEF']['switchableControllerActions']['vDEF'])) {
             $selectedActionList = $flexformConfig['data']['sDEF']['lDEF']['switchableControllerActions']['vDEF'];
             // check for selected action
             if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($selectedActionList, 'Category')) {
                 $newItems = $GLOBALS['TYPO3_CONF_VARS']['EXT']['moox_news']['orderByCategory'];
             } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($selectedActionList, 'Tag')) {
                 $this->removeNonValidOrderFields($config, 'tx_mooxnews_domain_model_tag');
                 $newItems = $GLOBALS['TYPO3_CONF_VARS']['EXT']['moox_news']['orderByTag'];
             } elseif (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($selectedActionList, 'Target')) {
                 $this->removeNonValidOrderFields($config, 'tx_mooxnews_domain_model_target');
                 $newItems = $GLOBALS['TYPO3_CONF_VARS']['EXT']['moox_news']['orderByTarget'];
             } else {
                 $newItems = $GLOBALS['TYPO3_CONF_VARS']['EXT']['moox_news']['orderByNews'];
                 $orderByNews = true;
             }
         }
     }
     // if a override configuration is found
     if (!empty($newItems)) {
         // remove default configuration
         $config['items'] = array();
         // empty default line
         array_push($config['items'], array('', ''));
         $newItemArray = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $newItems, TRUE);
         $languageKey = 'LLL:EXT:moox_news/Resources/Private/Language/locallang_be.xlf:flexforms_general.orderBy.';
         foreach ($newItemArray as $item) {
             // label: if empty, key (=field) is used
             $label = $GLOBALS['LANG']->sL($languageKey . $item, TRUE);
             if (empty($label)) {
                 $label = htmlspecialchars($item);
             }
             array_push($config['items'], array($label, $item));
         }
     }
     if ($orderByNews) {
         foreach ($GLOBALS['TCA']['tx_mooxnews_domain_model_news']['columns'] as $fieldname => $field) {
             $ll = 'LLL:EXT:' . $field['extkey'] . '/Resources/Private/Language/locallang_db.xml:';
             if ($field['addToMooxNewsFrontendSorting']) {
                 $prefix = $ll . 'tx_' . str_replace("_", "", $field['extkey']) . '_domain_model_news';
                 $prefix = $GLOBALS['LANG']->sL($prefix, TRUE) . ": ";
                 $label = $GLOBALS['LANG']->sL($field['label'], TRUE);
                 array_push($config['items'], array($prefix . $label, \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToLowerCamelCase($fieldname)));
             }
         }
     }
 }
 /**
  * @todo Define visibility
  */
 public function main()
 {
     $content = '<html><body>';
     $conf = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('P');
     $conf['md5ID'];
     if ($conf['table'] == 'tx_datasources_datasource') {
         $dsRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($conf['table'], intval($conf['uid']));
         if (is_array($dsRecord)) {
             $dsArr = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($dsRecord['configuration']);
             $dsConf = $dsArr['data']['sDEF']['lDEF'];
             $content .= '<p>Trying to connect with Host / DSN <strong>' . htmlspecialchars($dsConf['field_host']['vDEF']) . '</strong> with user <strong>' . htmlspecialchars($dsConf['field_username']['vDEF']) . '</strong> ... ';
             $dbConn =& ADONewConnection($dsConf['field_dbtype']['vDEF']);
             $dbConn->PConnect($dsConf['field_host']['vDEF'], $dsConf['field_username']['vDEF'], $dsConf['field_password']['vDEF'], $dsConf['field_dbname']['vDEF']);
             $dbConn->SetFetchMode(ADODB_FETCH_ASSOC);
             $content .= $dbConn->ErrorMsg();
             if ($dbConn->_connectionID) {
                 $content .= '</p>';
                 $query = 'SELECT * FROM ' . $dsConf['field_table']['vDEF'];
                 $recordSet =& $dbConn->SelectLimit($query, 150);
                 if (!$recordSet) {
                     $content .= '<p>Query failed (' . htmlspecialchars($query) . '):<br />';
                     $content .= $dbConn->ErrorMsg() . '</p>';
                 } else {
                     $content .= '<span style="color:green">successful!</span></p>';
                     $counter = 0;
                     $content .= '<p>Showing the first 150 entries from the result recordset:</p>';
                     $content .= '<table border="1">';
                     while (!$recordSet->EOF) {
                         $content .= '<tr>';
                         if ($counter == 0) {
                             foreach (array_keys($recordSet->fields) as $key) {
                                 $content .= '<th>' . htmlspecialchars($key) . '</th>';
                             }
                             $content .= '</tr><tr>';
                         }
                         foreach (array_values($recordSet->fields) as $value) {
                             $content .= '<td>' . htmlspecialchars($value) . '&nbsp;</td>';
                         }
                         $recordSet->MoveNext();
                         $counter++;
                         $content .= '</tr>';
                     }
                     $content .= '<table>';
                 }
             }
         } else {
             $content .= '<span style="color:red">failed!</span></p><p><strong>Error Message:</strong>' . $dbConn->ErrorMsg() . '</p>';
         }
     }
     $content .= '</body></html>';
     echo $content;
 }
 /**
  * Returns information about this extension's pi1 plugin
  *
  * @param  array  $params Parameters to the hook
  * @param  object $pObj   A reference to calling object
  * @return string Information about pi1 plugin
  */
 function getExtensionSummary($params, &$pObj)
 {
     if ($params['row']['list_type'] == 'jfmulticontent_pi1') {
         $data = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
         if (is_array($data) && $data['data']['general']['lDEF']['style']['vDEF']) {
             $result = sprintf($GLOBALS['LANG']->sL('LLL:EXT:jfmulticontent/locallang.xml:cms_layout.style'), '<strong>' . $data['data']['general']['lDEF']['style']['vDEF'] . '</strong><br/>');
         }
         if (!$result) {
             $result = $GLOBALS['LANG']->sL('LLL:EXT:jfmulticontent/locallang.xml:cms_layout.not_configured') . '<br/>';
         }
     }
     return $result;
 }
Example #23
0
 /**
  * Return the powermail rows
  *
  * @param $row
  * @param $headers
  * @return array
  */
 public function getRow($row, $headers)
 {
     $currentRow = array();
     $piVars = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($row['piVars'], 'piVars');
     foreach ($headers as $header => $label) {
         if (is_array($piVars[$header])) {
             $currentRow[$header] = implode(', ', array_filter($piVars[$header]));
         } else {
             $currentRow[$header] = $piVars[$header];
         }
     }
     return $currentRow;
 }
 /**
  * Updates the FlexForm data in the given outdated content element.
  *
  * @param array $outdatedContent
  * @param array &$dbQueries Queries done in this update
  */
 protected function updateOutdatedContentFlexForm($outdatedContent, array &$dbQueries)
 {
     $flexFormArray = GeneralUtility::xml2array($outdatedContent['pi_flexform']);
     if (isset($flexFormArray['data']['rss']['lDEF']['settings.list.rss.channel'])) {
         $title = $flexFormArray['data']['rss']['lDEF']['settings.list.rss.channel'];
         unset($flexFormArray['data']['rss']['lDEF']['settings.list.rss.channel']);
         $flexFormArray['data']['rss']['lDEF']['settings.list.rss.channel.title'] = $title;
     }
     $flexFormData = $this->flexObj->flexArray2Xml($flexFormArray);
     $query = $this->db->UPDATEquery('tt_content', 'uid=' . (int) $outdatedContent['uid'], array('pi_flexform' => $flexFormData));
     $this->db->sql_query($query);
     $dbQueries[] = $query;
 }
Example #25
0
 /**
  * Check if password fields are added with flexform
  *
  * @return bool
  */
 protected function passwordFieldsAdded()
 {
     $flexFormValues = GeneralUtility::xml2array($this->cObj->data['pi_flexform']);
     if (is_array($flexFormValues)) {
         $fields = $flexFormValues['data'][$this->actionName]['lDEF']['settings.' . $this->actionName . '.fields']['vDEF'];
         if (empty($fields) || GeneralUtility::inList($fields, 'password')) {
             // password fields are added to form
             return TRUE;
         }
     }
     // password fields are not added to form
     return FALSE;
 }
 /**
  * Returns information about this extension's pi1 plugin
  *
  * @param	array		$params	Parameters to the hook
  * @param	object		$pObj	A reference to calling object
  * @return	string		Information about pi1 plugin
  */
 function getExtensionSummary($params, &$pObj)
 {
     if ($params['row']['list_type'] == 9) {
         $data = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
         if (is_array($data) && $data['data']['sDEF']['lDEF']['what_to_display']['vDEF']) {
             $result = sprintf($GLOBALS['LANG']->sL('LLL:EXT:tt_news/Resources/Private/Language/locallang.xml:cms_layout.mode'), $data['data']['sDEF']['lDEF']['what_to_display']['vDEF']);
         }
         if (!$result) {
             $result = $GLOBALS['LANG']->sL('LLL:EXT:tt_news/Resources/Private/Language/locallang.xml:cms_layout.not_configured');
         }
     }
     return $result;
 }
 /**
  * @param $parameters
  * @return string
  */
 protected function getDataTypeFromFlexform($parameters)
 {
     $configuredDataType = '';
     if (!empty($parameters['row']['settings.dataType'][0])) {
         $configuredDataType = $parameters['row']['settings.dataType'][0];
     }
     if (!empty($parameters['row']['pi_flexform'])) {
         $flexform = GeneralUtility::xml2array($parameters['row']['pi_flexform']);
         if (!empty($flexform['data']['general']['lDEF']['settings.dataType'])) {
             $configuredDataType = $flexform['data']['general']['lDEF']['settings.dataType']['vDEF'];
         }
     }
     return $configuredDataType;
 }
Example #28
0
	/**
	 * Entry method
	 *
	 * @return array As defined in initializeResultArray() of AbstractNode
	 */
	public function render() {
		$languageService = $this->getLanguageService();

		$table = $this->globalOptions['table'];
		$row = $this->globalOptions['databaseRow'];
		$field = $this->globalOptions['fieldName'];
		$parameterArray = $this->globalOptions['parameterArray'];

		// Data Structure
		$flexFormDataStructureArray = BackendUtility::getFlexFormDS($parameterArray['fieldConf']['config'], $row, $table, $field);

		// Early return if no data structure was found at all
		if (!is_array($flexFormDataStructureArray)) {
			$resultArray = $this->initializeResultArray();
			$resultArray['html'] = 'Data Structure ERROR: ' . $flexFormDataStructureArray;
			return $resultArray;
		}

		// Manipulate Flex form DS via TSConfig and group access lists
		if (is_array($flexFormDataStructureArray)) {
			$flexFormHelper = GeneralUtility::makeInstance(FlexFormsHelper::class);
			$flexFormDataStructureArray = $flexFormHelper->modifyFlexFormDS($flexFormDataStructureArray, $table, $field, $row, $parameterArray['fieldConf']);
		}

		// Get data
		$xmlData = $parameterArray['itemFormElValue'];
		$xmlHeaderAttributes = GeneralUtility::xmlGetHeaderAttribs($xmlData);
		$storeInCharset = strtolower($xmlHeaderAttributes['encoding']);
		if ($storeInCharset) {
			$currentCharset = $languageService->charSet;
			$xmlData = $languageService->csConvObj->conv($xmlData, $storeInCharset, $currentCharset, 1);
		}
		$flexFormRowData = GeneralUtility::xml2array($xmlData);

		// Must be XML parsing error...
		if (!is_array($flexFormRowData)) {
			$flexFormRowData = array();
		} elseif (!isset($flexFormRowData['meta']) || !is_array($flexFormRowData['meta'])) {
			$flexFormRowData['meta'] = array();
		}

		$options = $this->globalOptions;
		$options['flexFormDataStructureArray'] = $flexFormDataStructureArray;
		$options['flexFormRowData'] = $flexFormRowData;
		$options['renderType'] = 'flexFormLanguageContainer';
		/** @var NodeFactory $nodeFactory */
		$nodeFactory = $this->globalOptions['nodeFactory'];
		return $nodeFactory->create($options)->render();
	}
Example #29
0
 /**
  * Render the Plugin Info
  *
  * @param array $params
  * @param object $pObj
  * @return string
  */
 public function getExtensionSummary($params, &$pObj)
 {
     $data = GeneralUtility::xml2array($params['row']['pi_flexform']);
     $this->init($data);
     $this->getSelectedObjects($data);
     $this->fluidRenderer->assign($this->pluginMode, true);
     $this->fluidRenderer->assign('storageFolder', $this->getStorageFolder($data));
     $this->fluidRenderer->assign('gallery', $this->selectedGallery);
     $this->fluidRenderer->assign('album', $this->selectedAlbum);
     $this->fluidRenderer->assign('item', $this->selectedItem);
     $this->fluidRenderer->assign('caLabel', 'LLL:EXT:yag/Resources/Private/Language/locallang.xlf:tx_yag_flexform_controllerAction.' . $this->pluginMode);
     $this->fluidRenderer->assign('theme', $this->theme);
     $this->fluidRenderer->assign('context', $this->getDataValue($data, 'settings.contextIdentifier'));
     return $this->fluidRenderer->render();
 }
 /**
  * Preprocesses the preview rendering of a content element.
  *
  * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject Calling parent object
  * @param boolean $drawItem Whether to draw the item using the default functionalities
  * @param string $headerContent Header content
  * @param string $itemContent Item content
  * @param array $row Record row of tt_content
  * @return void
  */
 public function preProcess(\TYPO3\CMS\Backend\View\PageLayoutView &$parentObject, &$drawItem, &$headerContent, &$itemContent, array &$row)
 {
     if ($row['CType'] !== 'px_hybrid_auth_login') {
         return;
     }
     $drawItem = FALSE;
     $data = GeneralUtility::xml2array($row['pi_flexform']);
     $headerContent = '<strong>' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:px_hybrid_auth/Resources/Private/Language/locallang_db.xlf:CType.I.px_hybrid_auth_login')) . '</strong><br />';
     if (is_array($data) && isset($data['data']['sDEF']['lDEF']['switchableControllerActions']['vDEF'])) {
         $provider = strtolower(str_replace('User->newLogin;', '', $data['data']['sDEF']['lDEF']['switchableControllerActions']['vDEF']));
         if ($provider) {
             $headerContent .= htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:px_hybrid_auth/Resources/Private/Language/locallang_db.xlf:' . $provider . '_user.new_login')) . '<br />';
         }
     }
 }