Esempio n. 1
0
 /**
  * Create a dataprovider for options filter data
  * 
  * @param Tx_PtExtlist_Domain_Configuration_Filters_FilterConfig $filterConfig
  * @return Tx_PtExtlist_Domain_Model_Filter_DataProvider_DataProviderInterface
  */
 public function createInstance(Tx_PtExtlist_Domain_Configuration_Filters_FilterConfig $filterConfig)
 {
     $dataProviderClassName = $this->determineDataProviderClass($filterConfig);
     $dataProvider = $this->objectManager->get($dataProviderClassName);
     Tx_PtExtbase_Assertions_Assert::isInstanceOf($dataProvider, 'Tx_PtExtlist_Domain_Model_Filter_DataProvider_DataProviderInterface', array('message' => 'The Dataprovider "' . $dataProviderClassName . ' does not implement the required interface! 1283536125'));
     /* @var $dataProvider Tx_PtExtlist_Domain_Model_Filter_DataProvider_DataProviderInterface */
     $dataProvider->_injectFilterConfig($filterConfig);
     $dataProvider->_injectDataBackend($this->dataBackendFactory->getDataBackendInstanceByListIdentifier($filterConfig->getListIdentifier()));
     $dataProvider->init();
     return $dataProvider;
 }
 /**
  * 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');
     }
 }
 /**
  * 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');
             }
         }
     }
 }
Esempio n. 4
0
 /**
  * Injector for data source. Expects \TYPO3\CMS\Extbase\Persistence\Repository to be given as datasource
  *
  * @param mixed $dataSource
  */
 public function _injectDataSource($dataSource)
 {
     Tx_PtExtbase_Assertions_Assert::isInstanceOf($dataSource, '\\TYPO3\\CMS\\Extbase\\Persistence\\Repository', array('message' => 'Given data source must implement \\TYPO3\\CMS\\Extbase\\Persistence\\Repository but did not! 1281545172'));
     $this->repository = $dataSource;
 }
Esempio n. 5
0
 /**
  * Overwrites the conf array with parameters from the flexform with the same keys
  *
  * @param   mixed    plugin object, e.g. "tslib_pibase" or any other object (needs a "tslib_cObj" at ->cObj, an array at ->conf and callable methods "pi_getFFvalue()" and "pi_initPIflexForm()")
  * @param   bool     (optional) if true the method won't throw an exception if no flexform data is found, default: false
  * @return  void
  * @throws  \PunktDe\PtExtbase\Exception\Exception    if no flexform data was found
  */
 public static function mergeConfAndFlexform($pObj, $noExceptionIfNoFlexform = false)
 {
     Tx_PtExtbase_Assertions_Assert::isObject($pObj, array('message' => '"$pObj" is no object.'));
     Tx_PtExtbase_Assertions_Assert::isInstanceOf($pObj->cObj, 'tslib_cObj', array('message' => '"$pObj->cObj" is no instance of "tslib_cObj".'));
     Tx_PtExtbase_Assertions_Assert::isArray($pObj->conf, array('message' => '"$pObj->conf" is no array.'));
     if (!is_callable(array($pObj, 'pi_initPIflexForm'))) {
         throw new \PunktDe\PtExtbase\Exception\Exception('"$pObj needs a callable method "pi_initPIflexForm()"');
     }
     if (!is_callable(array($pObj, 'pi_getFFvalue'))) {
         throw new \PunktDe\PtExtbase\Exception\Exception('"$pObj needs a callable method "pi_getFFvalue()"');
     }
     $pObj->pi_initPIflexForm();
     $piFlexForm = $pObj->cObj->data['pi_flexform'];
     if (is_array($piFlexForm['data'])) {
         foreach ($piFlexForm['data'] as $sheet => $data) {
             foreach ($data as $lang => $value) {
                 foreach ($value as $key => $val) {
                     $ff_value = trim($pObj->pi_getFFvalue($piFlexForm, $key, $sheet));
                     if ($ff_value != '') {
                         // do not overwrite conf settings with ''
                         $pObj->conf[$key] = $ff_value;
                         unset($pObj->conf[$key . '.']);
                         // unset stdWrap settings if available
                     }
                 }
             }
         }
     } elseif (!$noExceptionIfNoFlexform) {
         throw new \PunktDe\PtExtbase\Exception\Exception('No plugin configuration found!', 0, 'No flexform data found. Please update your plugin configuration!');
     }
 }