Ejemplo n.º 1
0
 /**
  * @param string $action Target action
  * @param array $arguments Arguments
  * @param string $controller Target controller. If NULL current controllerName is used
  * @param string $extensionName Target Extension Name (without "tx_" prefix and no underscores). If NULL the current extension name is used
  * @param string $pluginName Target plugin. If empty, the current plugin name is used
  * @param integer $pageUid target page. See TypoLink destination
  * @param integer $pageType type of the target page. See typolink.parameter
  * @param boolean $noCache set this to disable caching for the target page. You should not need this.
  * @param boolean $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this.
  * @param string $section the anchor to be added to the URI
  * @param string $format The requested format, e.g. ".html"
  * @param boolean $linkAccessRestrictedPages If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.
  * @param array $additionalParams additional query parameters that won't be prefixed like $arguments (overrule $arguments)
  * @param boolean $absolute If set, an absolute URI is rendered
  * @param boolean $addQueryString If set, the current query parameters will be kept in the URI
  * @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE
  * @return string Rendered link
  * @author Sebastian Kurfürst <*****@*****.**>
  * @author Bastian Waidelich <*****@*****.**>
  */
 public function render($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $pageUid = NULL, $pageType = 0, $noCache = FALSE, $noCacheHash = FALSE, $section = '', $format = '', $linkAccessRestrictedPages = FALSE, array $additionalParams = array(), $absolute = FALSE, $addQueryString = FALSE, array $argumentsToBeExcludedFromQueryString = array())
 {
     $this->sessionPersistenceManagerBuilder->getInstance()->addSessionRelatedArguments($argumentArray);
     $uriBuilder = $this->controllerContext->getUriBuilder();
     $uri = $uriBuilder->reset()->setTargetPageUid($pageUid)->setTargetPageType($pageType)->setNoCache($noCache)->setUseCacheHash(!$noCacheHash)->setSection($section)->setFormat($format)->setLinkAccessRestrictedPages($linkAccessRestrictedPages)->setArguments($additionalParams)->setCreateAbsoluteUri($absolute)->setAddQueryString($addQueryString)->setArgumentsToBeExcludedFromQueryString($argumentsToBeExcludedFromQueryString)->uriFor($action, $arguments, $controller, $extensionName, $pluginName);
     return $uri;
 }
Ejemplo n.º 2
0
 /**
  * Renders a link for given header and sortingFields
  *
  * @param Tx_PtExtlist_Domain_Model_List_Header_HeaderColumn $header
  * @param array $fieldAndDirection List of fields and direction for which we want to generate sorting link {field: fieldName, direction: sortingDirection}
  * @param string $action Rendered link for sorting action
  * @param int $pageUid target page. See TypoLink destination
  * @param int $pageType type of the target page. See typolink.parameter
  * @param bool $noCache set this to disable caching for the target page. You should not need this.
  * @param bool $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this.
  * @param string $section the anchor to be added to the URI
  * @param string $format The requested format, e.g. ".html
  * @param bool $linkAccessRestrictedPages If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.
  * @param array $additionalParams additional query parameters that won't be prefixed like $arguments (overrule $arguments)
  * @param bool $absolute If set, the URI of the rendered link is absolute
  * @param bool $addQueryString If set, the current query parameters will be kept in the URI
  * @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE
  * @param string $addQueryStringMethod Set which parameters will be kept. Only active if $addQueryString = TRUE
  * @return string Rendered link
  */
 public function render(Tx_PtExtlist_Domain_Model_List_Header_HeaderColumn $header, array $fieldAndDirection, $action = 'sort', $pageUid = null, $pageType = 0, $noCache = false, $noCacheHash = false, $section = '', $format = '', $linkAccessRestrictedPages = false, array $additionalParams = array(), $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = array(), $addQueryStringMethod = null)
 {
     $sortingFieldParams = array();
     $sortingDirection = Tx_PtExtlist_Domain_QueryObject_Query::invertSortingState($fieldAndDirection['currentDirection']);
     $sortingFieldParams[] = $fieldAndDirection['field'] . ':' . $sortingDirection;
     # echo "current direction for field " . $fieldAndDirection['field'] . " = " . $fieldAndDirection['currentDirection'] . " link direction = " . $sortingDirection;
     $sortingFieldParam = implode(';', $sortingFieldParams);
     $gpArrayViewHelper = new Tx_PtExtlist_ViewHelpers_Namespace_GPArrayViewHelper();
     $argumentArray = $gpArrayViewHelper->buildObjectValueArray($header, 'sortingFields', $sortingFieldParam);
     $this->sessionPersistenceManagerBuilder->getInstance()->addSessionRelatedArguments($argumentArray);
     return parent::render($action, $argumentArray, null, null, null, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format, $linkAccessRestrictedPages, $additionalParams, $absolute, $addQueryString, $argumentsToBeExcludedFromQueryString, $addQueryStringMethod);
 }
Ejemplo n.º 3
0
 /**
  * Renders hidden form fields for referrer information about
  * the current controller and action.
  *
  * @return string Hidden fields with referrer information
  * @todo filter out referrer information that is equal to the target (e.g. same packageKey)
  */
 protected function renderHiddenReferrerFields()
 {
     $request = $this->controllerContext->getRequest();
     $extensionName = $request->getControllerExtensionName();
     $controllerName = $request->getControllerName();
     $actionName = $request->getControllerActionName();
     $result = chr(10);
     // quick ugly hack
     if (strtolower($this->arguments['method']) === 'get') {
         $uriTemp = explode('?', $this->formActionUri);
         $uriTemp = explode('&', $uriTemp[1]);
         foreach ($uriTemp as $parameter) {
             $paramTemp = explode('=', $parameter);
             $result .= '<input type="hidden" name="' . $paramTemp[0] . '" value="' . $paramTemp[1] . '" />' . chr(10);
         }
     }
     $extBaseContext = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('Tx_PtExtlist_Extbase_ExtbaseContext');
     if ($extBaseContext->isInCachedMode()) {
         $listIdentifier = $extBaseContext->getCurrentListIdentifier();
         $stateHash = $this->sessionPersistenceManagerBuilder->getInstance()->getSessionDataHash();
         $result .= '<input type="hidden" name="' . $this->prefixFieldName($listIdentifier . '[state]') . '" value="' . $stateHash . '" />' . chr(10);
     }
     $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[extensionName]') . '" value="' . $extensionName . '" />' . chr(10);
     $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[controllerName]') . '" value="' . $controllerName . '" />' . chr(10);
     $result .= '<input type="hidden" name="' . $this->prefixFieldName('__referrer[actionName]') . '" value="' . $actionName . '" />' . chr(10);
     return $result;
 }
Ejemplo n.º 4
0
 /**
  * @return Tx_PtExtbase_State_Session_SessionPersistenceManager
  */
 protected function buildSessionPersistenceManager()
 {
     // Determine class name of session storage class to use for session persistence
     if (TYPO3_MODE === 'FE') {
         $sessionPersistenceStorageAdapterClassName = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('Tx_PtExtlist_Extbase_ExtbaseContext')->isInCachedMode() ? $this->configurationBuilder->buildBaseConfiguration()->getCachedSessionStorageAdapter() : $this->configurationBuilder->buildBaseConfiguration()->getUncachedSessionStorageAdapter();
         // We are in uncached mode
     } else {
         $sessionPersistenceStorageAdapterClassName = Tx_PtExtbase_State_Session_SessionPersistenceManager::STORAGE_ADAPTER_BROWSER_SESSION;
     }
     // Instantiate session storage for determined class name
     $sessionStorageAdapter = call_user_func($sessionPersistenceStorageAdapterClassName . '::getInstance');
     $this->sessionPersistenceManager = $this->sessionPersistenceManagerBuilder->getInstance($sessionStorageAdapter);
 }
Ejemplo n.º 5
0
 /**
  * render build key/value GET/POST-array within the namespace of the given object
  * 
  * @param string $arguments : list of arguments
  * @param Tx_PtExtbase_State_IdentifiableInterface $object
  * 	either as list of 'key : value' pairs 
  *  or as list of properties wich are then recieved from the object
  * @param string $nameSpace
  * @return array GPArray of objects namespace
  */
 public function render($arguments, $object = NULL, $nameSpace = '')
 {
     $argumentStringArray = $this->getArgumentArray($arguments);
     $argumentArray = array();
     foreach ($argumentStringArray as $key => $value) {
         if ($object !== NULL && $value === false) {
             $value = $this->getObjectValue($object, $key);
         }
         if (!$nameSpace) {
             $argumentArray = array_merge_recursive($argumentArray, $this->buildObjectValueArray($object, $key, $value));
         } else {
             $argumentArray = array_merge_recursive($argumentArray, $this->buildNamespaceValueArray($nameSpace, $key, $value));
         }
     }
     $this->sessionPersistenceManagerBuilder->getInstance()->addSessionRelatedArguments($argumentArray);
     return $argumentArray;
 }
Ejemplo n.º 6
0
 /**
  * Renders a link for given header
  *
  * @param Tx_PtExtlist_Domain_Model_List_Header_HeaderColumn $header
  * @param string $action Rendered link for sorting action
  * @param int $pageUid
  * @param int $pageType
  * @param bool $noCache
  * @param bool $noCacheHash
  * @param string $section
  * @param string $format
  * @param bool $linkAccessRestrictedPages
  * @param array $additionalParams
  * @param bool $absolute
  * @param bool $addQueryString
  * @param array $argumentsToBeExcludedFromQueryString
  * @param string $addQueryStringMethod Set which parameters will be kept. Only active if $addQueryString = TRUE
  * @return string
  */
 public function render(Tx_PtExtlist_Domain_Model_List_Header_HeaderColumn $header, $action = 'sort', $pageUid = NULL, $pageType = 0, $noCache = FALSE, $noCacheHash = FALSE, $section = '', $format = '', $linkAccessRestrictedPages = FALSE, array $additionalParams = array(), $absolute = FALSE, $addQueryString = FALSE, array $argumentsToBeExcludedFromQueryString = array(), $addQueryStringMethod = NULL)
 {
     $sortingFieldParams = array();
     // We generate sorting parameters for every sorting field configured for this column
     foreach ($header->getColumnConfig()->getSortingConfig() as $sortingFieldConfig) {
         /* @var $sortingFieldConfig Tx_PtExtlist_Domain_Configuration_Columns_SortingConfig */
         $newSortingDirection = $header->getSortingDirectionForField($sortingFieldConfig->getField()) != 0 ? Tx_PtExtlist_Domain_QueryObject_Query::invertSortingState($header->getSortingDirectionForField($sortingFieldConfig->getField())) : $sortingFieldConfig->getDirection();
         $sortingFieldParams[] = $sortingFieldConfig->getField() . ':' . $newSortingDirection;
     }
     $sortingFieldParam = implode(';', $sortingFieldParams);
     // We set sortingDirectionParameter for children of this viewHelper
     $this->templateVariableContainer->add('sortingDirection', $this->getSortingDirectionForHeader($header));
     #echo "Sorting field param for " . $header->getColumnConfig()->getColumnIdentifier() . " = " . $sortingFieldParam . "<br>";
     #echo "Sorting direction for " . $header->getColumnConfig()->getColumnIdentifier() . " = ". $this->getSortingDirectionForHeader($header) . "<br>";
     $gpArrayViewHelper = new Tx_PtExtlist_ViewHelpers_Namespace_GPArrayViewHelper();
     $argumentArray = $gpArrayViewHelper->buildObjectValueArray($header, 'sortingFields', $sortingFieldParam);
     $this->sessionPersistenceManagerBuilder->getInstance()->addSessionRelatedArguments($argumentArray);
     $output = parent::render($action, $argumentArray, NULL, NULL, NULL, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format, $linkAccessRestrictedPages, $additionalParams, $absolute, $addQueryString, $argumentsToBeExcludedFromQueryString, $addQueryStringMethod);
     $this->templateVariableContainer->remove('sortingDirection');
     return $output;
 }
Ejemplo n.º 7
0
 /**
  * Hook in Configuration set Process
  *
  * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
  */
 public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
 {
     parent::injectConfigurationManager($configurationManager);
     $this->overwriteFlexFormWithTyposcriptSettings();
     $contextIdentifier = $this->getContextIdentifier();
     if ($this->settings != null) {
         $this->emSettings = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['yag']);
         $resetContext = isset($this->settings['contextReset']) && (int) $this->settings['contextReset'] == 1 ? true : false;
         Tx_Yag_Domain_Configuration_ConfigurationBuilderFactory::injectSettings($this->settings);
         $this->configurationBuilder = Tx_Yag_Domain_Configuration_ConfigurationBuilderFactory::getInstance($contextIdentifier, $this->settings['theme'], $resetContext);
         if (TYPO3_MODE === 'FE') {
             GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('Tx_PtExtlist_Extbase_ExtbaseContext')->setInCachedMode(true);
             $storageAdapter = Tx_PtExtbase_State_Session_Storage_NullStorageAdapter::getInstance();
             $this->lifecycleManager->registerAndUpdateStateOnRegisteredObject($this->sessionPersistenceManagerBuilder->getInstance($storageAdapter));
         } else {
             $this->lifecycleManager->registerAndUpdateStateOnRegisteredObject($this->sessionPersistenceManagerBuilder->getInstance());
         }
         $this->yagContext = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('Tx_Yag_Domain_Context_YagContextFactory')->createInstance($contextIdentifier, $resetContext);
     }
 }
Ejemplo n.º 8
0
 /**
  * @param string $action Target action
  * @param array $arguments Arguments
  * @param string $controller Target controller. If NULL current controllerName is used
  * @param string $extensionName Target Extension Name (without "tx_" prefix and no underscores). If NULL the current extension name is used
  * @param string $pluginName Target plugin. If empty, the current plugin name is used
  * @param integer $pageUid target page. See TypoLink destination
  * @param integer $pageType type of the target page. See typolink.parameter
  * @param boolean $noCache set this to disable caching for the target page. You should not need this.
  * @param boolean $noCacheHash set this to supress the cHash query parameter created by TypoLink. You should not need this.
  * @param string $section the anchor to be added to the URI
  * @param string $format The requested format, e.g. ".html"
  * @param boolean $linkAccessRestrictedPages If set, links pointing to access restricted pages will still link to the page even though the page cannot be accessed.
  * @param array $additionalParams additional query parameters that won't be prefixed like $arguments (overrule $arguments)
  * @param boolean $absolute If set, the URI of the rendered link is absolute
  * @param boolean $addQueryString If set, the current query parameters will be kept in the URI
  * @param array $argumentsToBeExcludedFromQueryString arguments to be removed from the URI. Only active if $addQueryString = TRUE
  * @return string Rendered link
  */
 public function render($action = null, array $arguments = array(), $controller = null, $extensionName = null, $pluginName = null, $pageUid = null, $pageType = 0, $noCache = false, $noCacheHash = false, $section = '', $format = '', $linkAccessRestrictedPages = false, array $additionalParams = array(), $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = array())
 {
     $this->sessionPersistenceManagerBuilder->getInstance()->addSessionRelatedArguments($arguments);
     return parent::render($action, $arguments, $controller, $extensionName, $pluginName, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format, $linkAccessRestrictedPages, $additionalParams, $absolute, $addQueryString, $argumentsToBeExcludedFromQueryString);
 }