Exemplo n.º 1
0
 /**
  * Render a single option line by cObject or default
  *
  * @param array $optionData
  * @return string $option;
  */
 protected function renderOptionData($optionData)
 {
     foreach ($this->displayFields as $displayField) {
         $values[] = $optionData[$displayField->getIdentifier()];
     }
     $optionData['allDisplayFields'] = implode(' ', $values);
     $option = Tx_PtExtlist_Utility_RenderValue::renderByConfigObjectUncached($optionData, $this->filterConfig);
     return $option;
 }
Exemplo n.º 2
0
 /**
  * @param Tx_PtExtlist_Domain_Model_List_Header_HeaderColumn $headerColumn
  * @return string
  */
 public function renderColumnLabel(Tx_PtExtlist_Domain_Model_List_Header_HeaderColumn $headerColumn)
 {
     $label = $headerColumn->getLabel();
     $label = Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($label);
     if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($label, 'LLL:')) {
         $label = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($label, '');
     }
     return $label;
 }
Exemplo n.º 3
0
 /**
  * (non-PHPdoc)
  * @see Classes/Domain/Model/Filter/DataProvider/Tx_PtExtlist_Domain_Model_Filter_DataProvider_DataProviderInterface::getRenderedOptions()
  */
 public function getRenderedOptions()
 {
     $renderedOptions = array();
     foreach ($this->tsOptions as $key => $option) {
         if (is_array($option)) {
             if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($option['value'], 'LLL:')) {
                 $optionData['allDisplayFields'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($option['value'], '');
             } else {
                 $optionData['allDisplayFields'] = $option['value'];
             }
             $optionKey = $option['key'];
         } else {
             $optionKey = $key;
             if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($option, 'LLL:')) {
                 $optionData['allDisplayFields'] = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($option, '');
             } else {
                 $optionData['allDisplayFields'] = trim($option);
             }
         }
         $renderedOptions[$optionKey] = array('value' => Tx_PtExtlist_Utility_RenderValue::renderByConfigObjectUncached($optionData, $this->filterConfig), 'selected' => false);
     }
     return $renderedOptions;
 }
Exemplo n.º 4
0
 /**
  * @return string
  */
 public function getFileName()
 {
     $parameters = array();
     if ($this->itemListData->count() > 0) {
         $item = $this->itemListData->getFirstRow()->getCell('image')->getValue();
         /** @var Tx_Yag_Domain_Model_Item $item */
         $parameters = array('album' => $item->getAlbum()->getName(), 'gallery' => $item->getAlbum()->getGallery()->getName());
     }
     $formattedFileName = Tx_PtExtlist_Utility_RenderValue::renderDataByConfigArray($parameters, $this->fileNameFormat);
     if (substr(strtolower($formattedFileName), -4, 4) != '.zip') {
         $formattedFileName .= '.zip';
     }
     $formattedFileName = $this->fileSystemDiv->cleanFileName($formattedFileName);
     return $formattedFileName;
 }
Exemplo n.º 5
0
 /**
  * render the cells CSS Class
  * 
  * @param array $fieldSet
  * @param Tx_PtExtlist_Domain_Configuration_ColumnConfigInterface $columnConfig
  * @return string
  */
 protected function renderCellCSSClass($fieldSet, Tx_PtExtlist_Domain_Configuration_ColumnConfigInterface $columnConfig)
 {
     $cellCSSConfig = $columnConfig->getCellCSSClass();
     if (is_array($cellCSSConfig)) {
         $renderObj = array_key_exists('renderObj', $cellCSSConfig) ? GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService')->convertPlainArrayToTypoScriptArray(array('renderObj' => $cellCSSConfig['renderObj'])) : NULL;
         $renderUserFunction = array_key_exists('renderUserFunction', $cellCSSConfig) ? $cellCSSConfig['renderUserFunction'] : NULL;
         return Tx_PtExtlist_Utility_RenderValue::render($fieldSet, $renderObj, $renderUserFunction);
     } else {
         return $cellCSSConfig;
     }
 }
Exemplo n.º 6
0
 /**
  * Render defaultValue with stdWrap
  */
 protected function renderDefaultValue()
 {
     // no array - nothing to do
     if (!is_array($this->defaultValue)) {
         return;
     }
     // array but no cOBJ - defines multivalue default
     if (!$this->defaultValue['cObject']) {
         foreach ($this->defaultValue as $key => $defaultValue) {
             if (is_array($defaultValue)) {
                 $this->defaultValue[$key] = Tx_PtExtlist_Utility_RenderValue::renderCObjectWithPlainArray($defaultValue);
             }
         }
         if (array_key_exists('_typoScriptNodeValue', $this->defaultValue)) {
             unset($this->defaultValue['_typoScriptNodeValue']);
         }
         return;
     }
     // array and cObject - render
     $this->defaultValue = Tx_PtExtlist_Utility_RenderValue::renderCObjectWithPlainArray($this->defaultValue);
 }
Exemplo n.º 7
0
 /**
  * Replace the variables in the given format string with fileName or properties of the
  * itemMeta object.
  *
  * @param Tx_Yag_Domain_Model_Item $item
  * @param string $format
  * @param array $additionalVars
  * @return Tx_Yag_Domain_Model_Item $item;
  */
 protected function processStringFromMetaData(Tx_Yag_Domain_Model_Item $item, $format, $additionalVars = array())
 {
     if ($item->getItemMeta() instanceof Tx_Yag_Domain_Model_ItemMeta) {
         $vars = $item->getItemMeta()->getAttributeArray();
     } else {
         $vars = array();
     }
     $vars['origFileName'] = $item->getOriginalFilename();
     $vars['fileName'] = $this->processTitleFromFileName($item->getOriginalFilename());
     $vars = \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($vars, $additionalVars);
     $formattedString = Tx_PtExtlist_Utility_RenderValue::renderDataByConfigArray($vars, $format);
     return $formattedString;
 }
Exemplo n.º 8
0
 /**
  * Build a fluid renderer object
  *
  * @return TYPO3\CMS\Fluid\View\TemplateView
  */
 protected static function getFluidRenderer()
 {
     if (!self::$fluidRenderer) {
         $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
         self::$fluidRenderer = $objectManager->get('TYPO3\\CMS\\Fluid\\View\\TemplateView');
         $controllerContext = $objectManager->get('Tx_PtExtlist_Extbase_ExtbaseContext')->getControllerContext();
         self::$fluidRenderer->setControllerContext($controllerContext);
     }
     return self::$fluidRenderer;
 }
Exemplo n.º 9
0
 /**
  * (non-PHPdoc)
  * @see Classes/Domain/DataBackend/Tx_PtExtlist_Domain_DataBackend_AbstractDataBackend::initBackendByTsConfig()
  */
 protected function initBackendByTsConfig()
 {
     $this->tables = Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($this->backendConfiguration->getDataBackendSettings('tables'));
     $this->baseWhereClause = Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($this->backendConfiguration->getDataBackendSettings('baseWhereClause'));
     $this->baseFromClause = Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($this->backendConfiguration->getDataBackendSettings('baseFromClause'));
     $this->baseGroupByClause = Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($this->backendConfiguration->getDataBackendSettings('baseGroupByClause'));
 }
Exemplo n.º 10
0
 /**
  * Template method for initializing filter by TS configuration
  */
 protected function initFilterByTsConfig()
 {
     $filterValue = Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($this->filterConfig->getSettings('filterValue'));
     $this->filterValue = $filterValue;
 }
Exemplo n.º 11
0
 /**
  * Render a single option line by cObject or default
  *
  * @param array $optionData
  * @return string
  */
 protected function renderOptionData($optionData)
 {
     $option = Tx_PtExtlist_Utility_RenderValue::renderByConfigObjectUncached($optionData, $this->filterConfig);
     return $option;
 }
Exemplo n.º 12
0
 /**
  * @return void
  */
 protected function renderFreeText()
 {
     $activeSheet = $this->objPHPExcel->getActiveSheet();
     $freeText = Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($this->freeText);
     $activeSheet->getStyleByColumnAndRow(0, $this->rowNumber)->applyFromArray(array('font' => array('bold' => true)));
     $activeSheet->setCellValueByColumnAndRow(0, $this->rowNumber++, $freeText);
     $activeSheet->setCellValueByColumnAndRow(0, $this->rowNumber++, '');
 }
Exemplo n.º 13
0
 /**
  * (non-PHPdoc)
  * @see \PunktDe\PtExtbase\Configuration\AbstractConfiguration::init()
  */
 protected function init()
 {
     $this->setRequiredValue('identifier', 'No field identifier specified. 1277889450');
     $this->table = Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($this->settings['table']);
     $this->field = Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($this->settings['field']);
     $this->special = Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($this->settings['special']);
     if (!trim($this->special) && (!trim($this->table) || !trim($this->field))) {
         throw new Exception('Configuration error for field: "' . $this->identifier . '" Either a table and a field or a special string has to be given! 1281353522');
     }
     $this->setBooleanIfExistsAndNotNothing('isSortable');
     $this->setBooleanIfExistsAndNotNothing('expandGroupRows');
     $this->setBooleanIfExistsAndNotNothing('isRelation');
     $this->setValueIfExists('expandGroupRowsSeparator');
     if (array_key_exists('accessGroups', $this->settings)) {
         $this->accessGroups = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->settings['accessGroups']);
     }
 }
Exemplo n.º 14
0
 /**
  * Returns filter breadcrumb for this filter.
  * Most likely to be overwritten in concrete filter class.
  *
  * @return Tx_PtExtlist_Domain_Model_BreadCrumbs_BreadCrumb
  */
 public function getFilterBreadCrumb()
 {
     $breadCrumb = new Tx_PtExtlist_Domain_Model_BreadCrumbs_BreadCrumb($this);
     $breadCrumb->injectBreadCrumbsConfiguration($this->filterConfig->getConfigurationBuilder()->buildBreadCrumbsConfiguration());
     if ($this->getDisplayValue() != '') {
         $breadCrumbRenderArray = $this->filterConfig->getBreadCrumbString();
         $breadCrumbMessage = Tx_PtExtlist_Utility_RenderValue::renderDataByConfigArray($this->getFieldsForBreadcrumb(), $breadCrumbRenderArray);
         $breadCrumb->setMessage($breadCrumbMessage);
         $breadCrumb->setIsResettable(true);
     }
     return $breadCrumb;
 }
Exemplo n.º 15
0
 /**
  * (non-PHPdoc)
  * @see Classes/Domain/Model/Filter/DataProvider/Tx_PtExtlist_Domain_Model_Filter_DataProvider_DataProviderInterface::getRenderedOptions()
  */
 public function getRenderedOptions()
 {
     $renderedOptions = array();
     $timeSpanList = $this->buildTimeStampList();
     foreach ($timeSpanList as $key => $timestamp) {
         $optionData['allDisplayFields'] = strftime($this->dateIteratorFormat, $timestamp);
         $renderedOptions[$key] = array('value' => Tx_PtExtlist_Utility_RenderValue::renderByConfigObjectUncached($optionData, $this->filterConfig), 'selected' => false);
     }
     return $renderedOptions;
 }
Exemplo n.º 16
0
 public function testRenderDefaultMixed()
 {
     $testObject = new Tx_PtExtlist_Tests_Utility_RenderValueTest_testclass();
     $renderedOutput = Tx_PtExtlist_Utility_RenderValue::renderDefault(array('field1' => $testObject, 'field2' => array('x' => 'y'), 'field3' => 'field3Value'));
     $this->assertEquals($renderedOutput, 'Tx_PtExtlist_Tests_Utility_RenderValueTest_testclass, x : y, field3Value');
 }