Example #1
0
 /**
  * Returns an instance of pager for a given configuration builder and a pager configuration
  *
  * @param Tx_PtExtlist_Domain_Configuration_Pager_PagerConfig $pagerConfiguration
  * @return Tx_PtExtlist_Domain_Model_Pager_PagerInterface
  */
 public function getInstance(Tx_PtExtlist_Domain_Configuration_Pager_PagerConfig $pagerConfiguration)
 {
     $pagerClassName = $pagerConfiguration->getPagerClassName();
     $pager = $this->objectManager->get($pagerClassName, $pagerConfiguration);
     Tx_PtExtbase_Assertions_Assert::isTrue(is_a($pager, 'Tx_PtExtlist_Domain_Model_Pager_PagerInterface'), array('message' => 'Given pager class does not implement pager interface! 1279541488'));
     return $pager;
 }
 /**
  * Constructor for criteria. Takes a collection of fields and a search string.
  *
  * @param Tx_PtExtlist_Domain_Configuration_Data_Fields_FieldConfigCollection $fields
  * @param string $searchString
  * @param array $searchParameter
  */
 public function __construct(Tx_PtExtlist_Domain_Configuration_Data_Fields_FieldConfigCollection $fields, $searchString, array $searchParameter = array())
 {
     Tx_PtExtbase_Assertions_Assert::isPositiveInteger($fields->count(), array('message' => 'No field given to search in! 1313532571'));
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($searchString, array('message' => 'SearchString must not be empty! 1313532596'));
     $this->fields = $fields;
     $this->searchString = $searchString;
     $this->searchParameter = $searchParameter;
 }
 /**
  * Constructor for criteria. Takes a field name a value and a operator.
  * Works like 'field' <operator> 'value'
  *
  * @param string $field
  * @param string $value
  * @param string $operator
  */
 public function __construct($field = '', $value, $operator)
 {
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($field, array('message' => 'Field must not be empty! 1282849697'));
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($operator, array('message' => 'Operator must not be empty! 1282849699'));
     $this->field = $field;
     $this->value = $value;
     $this->operator = $operator;
 }
 /**
  * Initialize the Controller
  *
  * @param array $settings Settings container of the current extension
  * @return void
  */
 public function initializeAction()
 {
     parent::initializeAction();
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($this->settings['filterboxIdentifier'], array('message' => 'No filterbox identifier has been set. Set filterbox identifier in flexform! 1277889418'));
     $this->filterboxIdentifier = $this->settings['filterboxIdentifier'];
     $this->filterboxCollection = $this->dataBackend->getFilterboxCollection();
     $this->filterbox = $this->filterboxCollection->getFilterboxByFilterboxIdentifier($this->filterboxIdentifier, true);
     $this->pagerCollection = $this->dataBackend->getPagerCollection();
 }
Example #5
0
 /**
  * @return void
  */
 public function initializeAction()
 {
     parent::initializeAction();
     $this->exportListIdentifier = $this->settings['exportListIdentifier'];
     if (!$this->exportListIdentifier) {
         $this->exportListIdentifier = $this->listIdentifier;
     }
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($this->exportListIdentifier, array('message' => 'No export list identifier set.', 1316446015));
 }
Example #6
0
 /**
  * Adds one item to the collection
  *
  * @param	object	object to add
  * @param	mixed	array key / label (use namespaces here to avoid conflicts!)
  * @param	bool	(optional) overwrite existing object, default is false
  * @return	void
  * @throws	Exception	if the given label already exists and overwrite if false
  */
 public function addItem($object, $label, $overwrite = false)
 {
     Tx_PtExtbase_Assertions_Assert::isNotEmpty($label, array('message' => 'Registry keys cannot be empty!'));
     if (!$this->hasItem($label) || $overwrite == true) {
         // add object to the collection
         parent::addItem($object, $label);
     } else {
         throw new Exception('There is already an element stored with the label "' . $label . '" (and overwriting not permitted)!');
     }
 }
 /**
  * Build and return the renderer
  *
  * @param Tx_PtExtlist_Domain_Configuration_Renderer_RendererConfig $rendererConfiguration
  * @return Tx_PtExtlist_Domain_Renderer_ConfigurableRendererInterface
  */
 public function getRenderer(Tx_PtExtlist_Domain_Configuration_Renderer_RendererConfig $rendererConfiguration)
 {
     $rendererClassName = $rendererConfiguration->getRendererClassName();
     Tx_PtExtbase_Assertions_Assert::classExists($rendererClassName, array('message' => 'Configured renderer class ' . $rendererClassName . ' does not exist! 1286986512'));
     $renderer = $this->objectManager->get($rendererClassName);
     /* @var $renderer Tx_PtExtlist_Domain_Renderer_ConfigurableRendererInterface */
     Tx_PtExtbase_Assertions_Assert::isTrue(is_a($renderer, 'Tx_PtExtlist_Domain_Renderer_ConfigurableRendererInterface'), array('message' => 'Configured renderer class ' . $rendererClassName . ' does not implement Tx_PtExtlist_Domain_Renderer_RendererInterface 1286986513'));
     $renderer->_injectConfiguration($rendererConfiguration);
     $renderer->initRenderer();
     return $renderer;
 }
 /**
  * @param Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder $configurationBuilder
  * @param $filterboxIdentifier
  * @param array $filterBoxSettings
  * @return Tx_PtExtlist_Domain_Configuration_Filters_FilterboxConfig
  */
 public static function createInstance(Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder $configurationBuilder, $filterboxIdentifier, array $filterBoxSettings)
 {
     $filterboxConfiguration = new Tx_PtExtlist_Domain_Configuration_Filters_FilterboxConfig($configurationBuilder, $filterboxIdentifier, $filterBoxSettings);
     $filterSettingsArray = is_array($filterBoxSettings['filterConfigs']) ? $filterBoxSettings['filterConfigs'] : array();
     ksort($filterSettingsArray);
     foreach ($filterSettingsArray as $arrayIndex => $filterSettings) {
         Tx_PtExtbase_Assertions_Assert::isArray($filterSettings, array('message' => 'No array given for filter settings. Perhaps misconfiguration of TS for filterbox? 1280772788'));
         $filterConfig = Tx_PtExtlist_Domain_Configuration_Filters_FilterConfigFactory::createInstance($configurationBuilder, $filterboxIdentifier, $filterSettings);
         $filterboxConfiguration->addFilterConfig($filterConfig, $arrayIndex);
     }
     return $filterboxConfiguration;
 }
 /**
  * Renders captions
  *
  * @param Tx_PtExtlist_Domain_Model_List_Header_ListHeader $listHeader
  * @return Tx_PtExtlist_Domain_Model_List_Header_ListHeader $listHeader
  */
 public function renderCaptions(Tx_PtExtlist_Domain_Model_List_Header_ListHeader $listHeader)
 {
     Tx_PtExtbase_Assertions_Assert::isNotNull($listHeader, array('message' => 'No header data available. 1280408235'));
     $renderedListHeader = new Tx_PtExtlist_Domain_Model_List_Header_ListHeader($listHeader->getListIdentifier());
     foreach ($listHeader as $headerColumn) {
         /* @var $headerColumn Tx_PtExtlist_Domain_Model_List_Header_HeaderColumn */
         if ($headerColumn->getColumnConfig()->isAccessable() && $headerColumn->getIsVisible()) {
             $label = $this->renderColumnLabel($headerColumn);
             $renderedListHeader->createAndAddCell($label, $headerColumn->getColumnIdentifier());
         }
     }
     return $renderedListHeader;
 }
Example #10
0
 /**
  * Set and validate the config values
  *
  * @return void
  */
 protected function initByTsConfig()
 {
     $this->dateIteratorStart = (int) Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($this->filterConfig->getSettings('dateIteratorStart'));
     Tx_PtExtbase_Assertions_Assert::isPositiveInteger($this->dateIteratorStart, false, array('message' => 'The Value dateIteratorStart is not given. 1314608757'));
     $this->dateIteratorEnd = (int) Tx_PtExtlist_Utility_RenderValue::stdWrapIfPlainArray($this->filterConfig->getSettings('dateIteratorEnd'));
     Tx_PtExtbase_Assertions_Assert::isPositiveInteger($this->dateIteratorEnd, false, array('message' => 'The Value dateIteratorEnd is not given. 1314608758'));
     $this->dateIteratorFormat = $this->filterConfig->getSettings('dateIteratorFormat');
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($this->dateIteratorFormat, array('message' => 'The Value dateIteratorFormat is not given. 1314608759'));
     $this->dateIteratorIncrement = strtolower(trim($this->filterConfig->getSettings('dateIteratorIncrement')));
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($this->dateIteratorIncrement, array('message' => 'The Value dateIteratorIncrement is not given. 1314608760'));
     Tx_PtExtbase_Assertions_Assert::isTrue(in_array($this->dateIteratorIncrement, array('s', 'i', 'h', 'd', 'm', 'y')), array('message' => "The parameter dateIteratorIncrement has to be out of 's', 'i', 'h', 'd', 'm', 'y'"));
     Tx_PtExtbase_Assertions_Assert::isTrue($this->dateIteratorStart < $this->dateIteratorEnd, array('message' => 'The Value dateIteratorStart (' . $this->dateIteratorStart . ') is higher than dateIteratorEnd (' . $this->dateIteratorEnd . ')'));
 }
 /**
  * Determine the dataProvider to use for filter options
  *
  * TODO: Test me!
  * @param Tx_PtExtlist_Domain_Configuration_Filters_FilterConfig $filterConfig
  * @return string dataProviderClass
  */
 protected function determineDataProviderClass(Tx_PtExtlist_Domain_Configuration_Filters_FilterConfig $filterConfig)
 {
     if ($filterConfig->getSettings('dataProviderClassName')) {
         $dataProviderClassName = $filterConfig->getSettings('dataProviderClassName');
     } else {
         if ($filterConfig->getSettings('options')) {
             $dataProviderClassName = 'Tx_PtExtlist_Domain_Model_Filter_DataProvider_ExplicitData';
         } else {
             $dataProviderClassName = 'Tx_PtExtlist_Domain_Model_Filter_DataProvider_GroupData';
         }
     }
     Tx_PtExtbase_Assertions_Assert::isTrue(class_exists($dataProviderClassName), array('message' => 'The defined DataProviderClass "' . $dataProviderClassName . '" does not exist! 1283535558'));
     return $dataProviderClassName;
 }
Example #12
0
 /**
  * Returns an instance of a data mapper for a given data mapper class name.
  *
  * @param Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder $configurationBuilder
  * @return mixed
  */
 public function createDataMapper(Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder $configurationBuilder)
 {
     $dataBackendConfiguration = $configurationBuilder->buildDataBackendConfiguration();
     $dataMapperClassName = $dataBackendConfiguration->getDataMapperClass();
     $dataMapper = $this->objectManager->get($dataMapperClassName, $configurationBuilder);
     /** @var Tx_PtExtlist_Domain_DataBackend_Mapper_AbstractMapper $dataMapper */
     $mapperConfiguration = $configurationBuilder->buildFieldsConfiguration();
     // Check whether mapper implements interface
     Tx_PtExtbase_Assertions_Assert::isTrue($dataMapper instanceof Tx_PtExtlist_Domain_DataBackend_Mapper_MapperInterface, array('message' => 'Data mapper must implement data mapper interface! 1280415471'));
     $dataMapper->_injectConfigurationBuilder($configurationBuilder);
     $dataMapper->_injectMapperConfiguration($mapperConfiguration);
     $dataMapper->init();
     return $dataMapper;
 }
    /**
     * @param $query
     * @return Tx_PtExtlist_Domain_DataBackend_DataSource_Typo3DataSource
     * @throws Exception
     */
    public function executeQuery($query)
    {
        try {
            $this->startTimeMeasure();
            $this->resource = $this->connection->sql_query($query);
            Tx_PtExtbase_Assertions_Assert::isMySQLRessource($this->resource, $this->dbObj);
            $this->stopTimeMeasure();
        } catch (Exception $e) {
            throw new Exception('Error while retrieving data from database using typo3 db object.<br> 
							     Error: ' . $e->getMessage() . ' sql_error says: ' . $this->connection->sql_error() . ' 1280400023<br><br>
							     SQL QUERY: <br>
							     </strong><hr>' . nl2br($query) . '<hr><strong>', 1280400023);
        }
        return $this;
    }
 /**
  * Factory method for filter boxes. Returns filterbox for a given filterbox configuration and list identifier
  *
  * @param Tx_PtExtlist_Domain_Configuration_Filters_FilterboxConfig $filterboxConfiguration
  * @return Tx_PtExtlist_Domain_Model_Filter_Filterbox
  */
 public function createInstance(Tx_PtExtlist_Domain_Configuration_Filters_FilterboxConfig $filterboxConfiguration)
 {
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($filterboxConfiguration->getListIdentifier(), array('message' => 'List identifier must not be empty 1277889458'));
     $filterbox = $this->objectManager->get('Tx_PtExtlist_Domain_Model_Filter_Filterbox');
     /* @var $filterbox Tx_PtExtlist_Domain_Model_Filter_Filterbox */
     $filterbox->_injectFilterboxConfiguration($filterboxConfiguration);
     $filterbox->_injectFilterboxFactory($this);
     foreach ($filterboxConfiguration as $filterConfiguration) {
         $filter = $this->filterFactory->createInstance($filterConfiguration);
         $filter->_injectFilterbox($filterbox);
         $filterbox->addFilter($filter, $filter->getFilterIdentifier());
     }
     $sessionPersistenceManager = $this->sessionPersistenceManagerBuilder->getInstance();
     $sessionPersistenceManager->registerObjectAndLoadFromSession($filterbox);
     return $filterbox;
 }
Example #15
0
 /**
  * Initialize additional class properties
  */
 public function initConfiguration()
 {
     parent::initConfiguration();
     //echo 's';
     $this->templatePath = $this->exportConfiguration->getSettings('templatePath');
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($this->templatePath, array('message' => 'No template path given for fluid export! 1284621481'));
     $this->setTemplatePathAndFilename(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->templatePath));
     $this->paperSize = strtolower($this->exportConfiguration->getSettings('paperSize'));
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($this->paperSize, array('message' => 'No PaperSize given for the PDF output! 1322585559'));
     $this->paperOrientation = $this->exportConfiguration->getSettings('paperOrientation');
     Tx_PtExtbase_Assertions_Assert::isInArray($this->paperOrientation, array('portrait', 'landscape'), array('message' => 'The Orientation must either be portrait or landscape! 1322585560'));
     $this->cssFilePath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->exportConfiguration->getSettings('cssFilePath'));
     Tx_PtExtbase_Assertions_Assert::isTrue(file_exists($this->cssFilePath), array('message' => 'The CSS File with the filename ' . $this->cssFilePath . ' can not be found. 1322587627'));
     $this->dompdfSourcePath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->exportConfiguration->getSettings('dompdfSourcePath'));
     Tx_PtExtbase_Assertions_Assert::isTrue(is_dir($this->dompdfSourcePath), array('message' => 'DomPdf source in path ' . $this->dompdfSourcePath . ' was not found. 1322753515'));
     $this->dompdfSourcePath = substr($this->dompdfSourcePath, -1, 1) == '/' ? $this->dompdfSourcePath : $this->dompdfSourcePath . '/';
 }
 /**
  * Returns list data structure for given domain objects.
  * Uses configuration currently set in mapper.
  *
  * @param mixed $domainObjects
  * @return Tx_PtExtlist_Domain_Model_List_ListData List data generated for given mapping configuration
  */
 public function getMappedListData($domainObjects)
 {
     Tx_PtExtbase_Assertions_Assert::isNotNull($this->fieldConfigurationCollection, array('message' => 'No mapper configuration has been set for domain object mapper! 1281635601'));
     $listData = new Tx_PtExtlist_Domain_Model_List_ListData();
     foreach ($domainObjects as $domainObject) {
         $listDataRow = new Tx_PtExtlist_Domain_Model_List_Row();
         foreach ($this->fieldConfigurationCollection as $fieldConfiguration) {
             /* @var $fieldConfiguration Tx_PtExtlist_Domain_Configuration_Data_Fields_FieldConfig */
             $property = $this->getPropertyNameByFieldConfig($fieldConfiguration);
             if ($property == '__object__') {
                 $value = $domainObject;
             } else {
                 $value = $this->getObjectPropertyValueByProperty($domainObject, $property);
             }
             $listDataRow->createAndAddCell($value, $fieldConfiguration->getIdentifier());
         }
         $listData->addRow($listDataRow);
     }
     return $listData;
 }
 /**
  * 
  * @param string $identifier aggregate identifier 
  * @param array $aggregateSettings
  * @param Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder $configurationBuilder
  * @throws Exception
  */
 public function __construct($identifier, $aggregateSettings, Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder $configurationBuilder)
 {
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($identifier, array('message' => 'No aggregate identifier specified. 1282891490'));
     $this->identifier = $identifier;
     if (!trim($aggregateSettings['fieldIdentifier'])) {
         throw new Exception('No fieldIdentifier for aggregate given! 1282891630');
     }
     $this->fieldIdentifier = $configurationBuilder->buildFieldsConfiguration()->getFieldConfigByIdentifier($aggregateSettings['fieldIdentifier']);
     if (!array_key_exists('method', $aggregateSettings) && !array_key_exists('special', $aggregateSettings)) {
         throw new Exception('No aggregate method or special sql given for aggregate ' . $this->identifier . '! 1282891831');
     }
     if (array_key_exists('method', $aggregateSettings)) {
         $this->method = trim($aggregateSettings['method']);
     }
     if (array_key_exists('scope', $aggregateSettings)) {
         $this->scope = $aggregateSettings['scope'];
     }
     if (array_key_exists('special', $aggregateSettings)) {
         $this->special = $aggregateSettings['special'];
         $this->scope = 'query';
     }
 }
 /**
  * Translates a query an manipulates given query object
  * 
  * TODO check, if there is already a constraint added to extbase query and use AND constraint then
  * TODO use AND to connect more than one constraint
  *
  * @param Tx_PtExtlist_Domain_QueryObject_Criteria $criteria Criteria to be translated
  * @param \TYPO3\CMS\Extbase\Persistence\Generic\Query $extbaseQuery Query to add criteria to
  * @param \TYPO3\CMS\Extbase\Persistence\Repository $extbaseRepository Associated repository
  *
  * @return \TYPO3\CMS\Extbase\Persistence\Generic\Query
  *
  * @throws \Exception
  */
 public static function translateCriteria(Tx_PtExtlist_Domain_QueryObject_Criteria $criteria, \TYPO3\CMS\Extbase\Persistence\Generic\Query $extbaseQuery, \TYPO3\CMS\Extbase\Persistence\Repository $extbaseRepository)
 {
     Tx_PtExtbase_Assertions_Assert::isTrue(is_a($criteria, 'Tx_PtExtlist_Domain_QueryObject_SimpleCriteria'), array('message' => 'Criteria is not a simple criteria! 1281724991'));
     /* @var $criteria Tx_PtExtlist_Domain_QueryObject_SimpleCriteria */
     $propertyName = self::getPropertyNameByCriteria($criteria);
     switch ($criteria->getOperator()) {
         case '.':
             self::addConstraint($extbaseQuery, $extbaseQuery->contains($propertyName, $criteria->getValue()));
             break;
         case '=':
             self::addConstraint($extbaseQuery, $extbaseQuery->equals($propertyName, $criteria->getValue()));
             break;
         case '<':
             self::addConstraint($extbaseQuery, $extbaseQuery->lessThan($propertyName, $criteria->getValue()));
             break;
         case '>':
             self::addConstraint($extbaseQuery, $extbaseQuery->greaterThan($propertyName, $criteria->getValue()));
             break;
         case '<=':
             self::addConstraint($extbaseQuery, $extbaseQuery->lessThanOrEqual($propertyName, $criteria->getValue()));
             break;
         case '>=':
             self::addConstraint($extbaseQuery, $extbaseQuery->greaterThanOrEqual($propertyName, $criteria->getValue()));
             break;
         case 'LIKE':
             self::addConstraint($extbaseQuery, $extbaseQuery->like($propertyName, $criteria->getValue()));
             break;
         case 'IN':
             self::addConstraint($extbaseQuery, $extbaseQuery->in($propertyName, $criteria->getValue()));
             break;
         default:
             throw new Exception('No translation implemented for ' . $criteria->getOperator() . ' operator! 1281727494');
             break;
     }
     return $extbaseQuery;
 }
Example #19
0
 /**
  * Renders list data
  *
  * @param Tx_PtExtlist_Domain_Model_List_ListData $listData
  * @return Tx_PtExtlist_Domain_Model_List_ListData
  */
 public function renderList(Tx_PtExtlist_Domain_Model_List_ListData $listData)
 {
     Tx_PtExtbase_Assertions_Assert::isNotNull($listData, array(message => 'No list data found in list. 1280405145'));
     // We could get another type of list data here, so we have to instantiate this class
     $listDataClassName = get_class($listData);
     $renderedList = new $listDataClassName();
     // We need some generic way to copy non-standard data from "old" list data to "new" list data
     if (method_exists($renderedList, 'copyListData')) {
         // TODO refactor this by using a getEmptyInstance method on the list data we want to copy.
         $renderedList->copyListData($listData);
     }
     foreach ($listData as $rowIndex => $row) {
         $renderedList->addRow($this->rowRenderer->renderRow($row, $rowIndex));
     }
     unset($listData);
     return $renderedList;
 }
Example #20
0
 private function initializeDbObj()
 {
     if (self::$dbObj === null) {
         self::$dbObj = $GLOBALS['TYPO3_DB'];
     }
 }
Example #21
0
 /**
  * Creates filter object for given filter class name
  *
  * @param string $filterClassName
  * @return Tx_PtExtlist_Domain_Model_Filter_FilterInterface
  */
 private function createFilterObject($filterClassName)
 {
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($filterClassName, array('message' => 'No filter class name given, check TS configuration! 1277889459'));
     Tx_PtExtbase_Assertions_Assert::isTrue(class_exists($filterClassName), array('message' => 'Given filter class ' . $filterClassName . ' does not exist or is not loaded! 1277889460'));
     $filter = $this->objectManager->get($filterClassName);
     /* @var $filter Tx_PtExtlist_Domain_Model_Filter_FilterInterface */
     Tx_PtExtbase_Assertions_Assert::isTrue(is_a($filter, 'Tx_PtExtlist_Domain_Model_Filter_FilterInterface'), array('message' => 'Given filter class does not implement filter interface! 1277889461'));
     $filter->_injectGpVarsAdapter($this->getPostVarsAdapterFactory->getInstance());
     return $filter;
 }
Example #22
0
 protected function init()
 {
     $this->setRequiredValue('fileName', 'No fileName given for export file! 1284563488');
     $this->setRequiredValue('fileExtension', 'No file extension given for export file! 1284620580');
     $this->setRequiredValue('viewClassName', 'No viewClassName given for export file ' . $this->fileName . '1284563489');
     Tx_PtExtbase_Assertions_Assert::isTrue(class_exists($this->viewClassName), array('message' => 'The class name "' . $this->viewClassName . '" for export view does not exist! 1284563683'));
     $this->setBooleanIfExistsAndNotNothing('addDateToFilename');
     $this->setValueIfExistsAndNotNothing('dateFormat');
     $this->setValueIfExistsAndNotNothing('contentType');
     if (array_key_exists('downloadtype', $this->settings)) {
         $this->downloadType = $this->settings['downloadtype'] == 'D' ? self::FORCE_DOWNLOAD : self::OPEN_IN_BROWSER;
     }
 }
 /**
  * Returns configuration object for filterbox identifier
  *
  * @param string $filterboxIdentifier
  * @return Tx_PtExtlist_Domain_Configuration_Filters_FilterboxConfig
  */
 public function getFilterboxConfigurationByFilterboxIdentifier($filterboxIdentifier)
 {
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($filterboxIdentifier, array('message' => 'Filterbox identifier must not be empty! 1277889453'));
     return $this->buildFilterConfiguration()->getItemById($filterboxIdentifier);
 }
Example #24
0
 /**
  * Init the dataProvider by TS-conifg
  * 
  * @param array $filterSettings
  */
 protected function initDataProviderByTsConfig($filterSettings)
 {
     $this->tsOptions = $this->filterConfig->getSettings('options');
     Tx_PtExtbase_Assertions_Assert::isArray($this->tsOptions, array('message' => 'Options configured by TS has to be an array, ' . gettype($this->tsOptions) . ' given! 1284142006'));
 }
 /**
  * Get the valueArray with the right objectNamespace
  * 
  * @param Tx_PtExtbase_State_IdentifiableInterface $object
  * @param string $key
  * @param string $value
  * @return array
  */
 public function buildObjectValueArray(Tx_PtExtbase_State_IdentifiableInterface $object, $key, $value)
 {
     $nameSpace = $object->getObjectNamespace();
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($nameSpace, array('message' => 'No ObjectNamespace returned from Obejct ' . get_class($object) . '! 1280771624'));
     return $this->buildNamespaceValueArray($nameSpace, $key, $value);
 }
Example #26
0
 /**
  * Build the SQL Query for an aggregate
  *
  * @param Tx_PtExtlist_Domain_Configuration_Data_Aggregates_AggregateConfig $aggregateConfig
  * @return string
  */
 protected function buildAggregateFieldSQLByConfig(Tx_PtExtlist_Domain_Configuration_Data_Aggregates_AggregateConfig $aggregateConfig)
 {
     $supportedMethods = array('sum', 'avg', 'min', 'max', 'count');
     if ($aggregateConfig->getSpecial()) {
         $aggregateFieldSQL = $aggregateConfig->getSpecial();
     } else {
         Tx_PtExtbase_Assertions_Assert::isInArray($aggregateConfig->getMethod(), $supportedMethods, array('info' => 'The given aggregate method "' . $aggregateConfig->getMethod() . '" is not supported by this DataBackend'));
         $aggregateFieldSQL = strtoupper($aggregateConfig->getMethod()) . '(' . $aggregateConfig->getFieldIdentifier() . ')';
     }
     $aggregateFieldSQL .= ' AS ' . $aggregateConfig->getIdentifier();
     return $aggregateFieldSQL;
 }
 /**
  * Deletes a session value from TYPO3 FE _browser_ session or a BE user session
  * *immediately* (does not wait for complete script execution)
  *
  * @param   string $key name of session key to delete (array key)
  * @throws  Exception   if no valid frontend user and no valid backend user found
  */
 public function delete($key)
 {
     // TYPO3 Frontend mode
     if (TYPO3_MODE == 'FE' && $GLOBALS['TSFE']->fe_user instanceof \TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication) {
         if (!empty($GLOBALS['TSFE']->fe_user->sesData[$key])) {
             unset($GLOBALS['TSFE']->fe_user->sesData[$key]);
             $GLOBALS['TSFE']->fe_user->sesData_change = 1;
             $GLOBALS['TSFE']->fe_user->storeSessionData();
             if (TYPO3_DLOG) {
                 GeneralUtility::devLog(sprintf('Deleting "%s" from FE browser session in "$GLOBALS[\'TSFE\']->fe_user"', $key), 'pt_extbase');
             }
         }
         // TYPO3 Backend mode
     } else {
         Tx_PtExtbase_Assertions_Assert::isInstanceOf($GLOBALS['BE_USER'], 't3lib_userAuth', array('message' => 'No valid backend user found!'));
         $sesDat = unserialize($GLOBALS['BE_USER']->user['ses_data']);
         if (!empty($sesDat[$key])) {
             unset($sesDat[$key]);
             $GLOBALS['BE_USER']->user['ses_data'] = !empty($sesDat) ? serialize($sesDat) : '';
             // this is adapted from t3lib_userAuth::setAndSaveSessionData()
             $GLOBALS['TYPO3_DB']->exec_UPDATEquery($GLOBALS['BE_USER']->session_table, 'ses_id=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($GLOBALS['BE_USER']->user['ses_id'], $GLOBALS['BE_USER']->session_table), array('ses_data' => $GLOBALS['BE_USER']->user['ses_data']));
             if (TYPO3_DLOG) {
                 GeneralUtility::devLog(sprintf('Deleting "%s" from BE user in "$GLOBALS[\'BE_USER\']"', $key), 'pt_extbase');
             }
         }
     }
 }
 /**
  * Deletes a session value from the TYPO3 FRONTEND user session *immediately* (does not wait for complete script execution)
  *
  * @param   string      name of session key to delete (array key)
  * @return  void
  * @global  object      $GLOBALS['TSFE']->fe_user: tslib_feUserAuth Object
  * @author  Rainer Kuhn <*****@*****.**>
  * @since   2005-09-23
  */
 public function delete($key)
 {
     Tx_PtExtbase_Assertions_Assert::isInstanceOf($GLOBALS['TSFE']->fe_user, 'tslib_feUserAuth', array('message' => 'No valid frontend user found!'));
     unset($GLOBALS['TSFE']->fe_user->uc[$key]);
     $GLOBALS['TSFE']->fe_user->userData_change = 1;
     $GLOBALS['TSFE']->fe_user->storeSessionData();
     if (TYPO3_DLOG) {
         \TYPO3\CMS\Core\Utility\GeneralUtility::devLog(sprintf('Deleting "%s" from FE user session in "$GLOBALS[\'TSFE\']->fe_user"', $key), 'pt_extbase');
     }
 }
Example #29
0
 private function restoreDbObjInAssertClass()
 {
     Tx_PtExtbase_Assertions_Assert::$dbObj = $this->dbObjTmp;
 }
 /**
  * Check existance of given class and set the property
  * @param string $queryInterpreterClassName
  */
 protected function checkAndSetQueryInterpreterClass($queryInterpreterClassName)
 {
     Tx_PtExtbase_Assertions_Assert::isNotEmptyString($queryInterpreterClassName, array('message' => 'queryInterpreterClass must not be empty! 1281178538'));
     Tx_PtExtbase_Assertions_Assert::isTrue(class_exists($queryInterpreterClassName), array('message' => ' QueryInterpreter class ' . $queryInterpreterClassName . ' does not exist! 1281178539'));
     $this->queryInterpreterClass = $queryInterpreterClassName;
 }