/**
  * Render method
  *
  * @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.
  * @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
  * @param string $addQueryStringMethod Set which parameters will be kept. Only active if $addQueryString = TRUE
  *
  * @return string Rendered link
  */
 public function render($action = null, array $arguments = [], $controller = null, $extensionName = null, $pluginName = null, $pageUid = null, $pageType = 0, $noCache = false, $noCacheHash = false, $section = '', $format = '', $linkAccessRestrictedPages = false, array $additionalParams = [], $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = [], $addQueryStringMethod = null)
 {
     if ($action !== null && $arguments !== null && isset($arguments['user'])) {
         $arguments['hash'] = GeneralUtility::hmac($action . '::' . $arguments['user']);
     }
     return parent::render($action, $arguments, $controller, $extensionName, $pluginName, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format, $linkAccessRestrictedPages, $additionalParams, $absolute, $addQueryString, $argumentsToBeExcludedFromQueryString, $addQueryStringMethod);
 }
Пример #2
0
 public function initialize()
 {
     parent::initialize();
     $class = 'btn';
     if ($this->arguments['primary'] === TRUE) {
         $class .= ' btn-primary';
     }
     $this->tag->addAttribute('class', $class);
 }
 /**
  * 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);
 }
Пример #4
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
  * @param string $addQueryStringMethod Set which parameters will be kept. Only active if $addQueryString = true
  * @return string Rendered link
  */
 public function render($action = null, array $arguments = [], $controller = null, $extensionName = null, $pluginName = null, $pageUid = null, $pageType = 0, $noCache = false, $noCacheHash = false, $section = '', $format = '', $linkAccessRestrictedPages = false, array $additionalParams = [], $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = [], $addQueryStringMethod = null)
 {
     $fieldName = '';
     if ($this->arguments['product']) {
         $product = $this->arguments['product'];
         $fieldName = '[' . $product->getId() . ']';
     }
     if ($this->arguments['beVariant']) {
         $variant = $this->arguments['beVariant'];
         $fieldName = $this->getVariantFieldName($variant);
     }
     $additionalParams['tx_cart_cart[product]' . $fieldName] = 1;
     return parent::render($action, $arguments, $controller, $extensionName, $pluginName, $pageUid, $pageType, $noCache, $noCacheHash, $section, $format, $linkAccessRestrictedPages, $additionalParams, $absolute, $addQueryString, $argumentsToBeExcludedFromQueryString, $addQueryStringMethod);
 }
 public function renderChildren()
 {
     $content = parent::renderChildren();
     $iconClass = NULL;
     if ($this->arguments['iconClass']) {
         $iconClass = $this->arguments['iconClass'];
     } elseif ($this->arguments['icon']) {
         $iconClass = $this->iconBaseClass . $this->arguments['icon'];
     } elseif ($this->arguments['iconAction']) {
         $iconClass = $this->iconBaseClass . $this->arguments['iconAction'];
     } elseif ($this->arguments['action']) {
         $iconClass = $this->iconBaseClass . $this->arguments['action'];
     }
     $this->tag->addAttribute('title', $content);
     if ($iconClass) {
         $content = '<div class="' . $iconClass . '"></div><div class="tx-typo3forum-button-text">' . $content . '</div>';
     }
     return $content;
 }
 /**
  * Arguments initialization
  *
  * @return void
  */
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerTagAttribute('data-toggle', 'string', '');
     $this->registerTagAttribute('data-placement', 'string', '');
 }
Пример #7
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;
 }
Пример #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);
 }
 /**
  * @param string $action
  * @param array $arguments
  * @param string $controller
  * @param string $extensionName
  * @param string $pluginName
  * @param string $format
  * @param int $pageUid
  * @param boolean $cachedAjaxIfPossible TRUE if the URI should be cached (with respect to non-cacheable actions)
  * @param boolean $forceContext TRUE if the controller/action/... should be passed
  * @param boolean $noAjax
  *
  * @return string
  */
 public function render($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $format = '', $pageUid = NULL, $cachedAjaxIfPossible = TRUE, $forceContext = TRUE, $noAjax = FALSE)
 {
     $request = $this->mvcDispatcher->getCurrentRequest();
     if ($forceContext) {
         $requestArguments = $this->controllerContext->getRequest()->getArguments();
         $requestArguments = array_merge($requestArguments, $this->hijaxEventDispatcher->getContextArguments());
         $requestArguments = array_merge($requestArguments, $arguments);
         $arguments = $requestArguments;
     }
     if ($noAjax) {
         return parent::render($action, $arguments, $controller, $extensionName, $pluginName, $pageUid);
     } else {
         /* @var $listener \EssentialDots\ExtbaseHijax\Event\Listener */
         $listener = $this->mvcDispatcher->getCurrentListener();
         if ($request) {
             if ($action === NULL) {
                 $action = $request->getControllerActionName();
             }
             if ($controller === NULL) {
                 $controller = $request->getControllerName();
             }
             if ($extensionName === NULL) {
                 $extensionName = $request->getControllerExtensionName();
             }
             if ($pluginName === NULL && TYPO3_MODE === 'FE') {
                 $pluginName = $this->extensionService->getPluginNameByAction($extensionName, $controller, $action);
             }
             if ($pluginName === NULL) {
                 $pluginName = $request->getPluginName();
             }
             $cachedAjaxIfPossible = $cachedAjaxIfPossible ? $this->configurationManager->getContentObject()->getUserObjectType() != ContentObjectRenderer::OBJECTTYPE_USER_INT : false;
             if ($cachedAjaxIfPossible) {
                 /* @var $cacheHash \TYPO3\CMS\Frontend\Page\CacheHashCalculator */
                 $cacheHash = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\CacheHashCalculator');
                 $chash = $cacheHash->calculateCacheHash(array('encryptionKey' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], 'action' => $action, 'controller' => $controller, 'extension' => $extensionName, 'plugin' => $pluginName, 'arguments' => $this->array_map_recursive('strval', $arguments), 'settingsHash' => $listener->getId()));
             }
         }
         $additionalArguments = array();
         $this->hA('r[0][arguments]', $arguments, $additionalArguments);
         $language = intval($GLOBALS['TSFE'] ? $GLOBALS['TSFE']->sys_language_content : 0);
         $additionalParams = "&r[0][extension]={$extensionName}&r[0][plugin]={$pluginName}&r[0][controller]={$controller}&r[0][action]={$action}&r[0][format]={$format}&r[0][settingsHash]={$listener->getId()}&eID=extbase_hijax_dispatcher&L={$language}";
         if ($additionalArguments) {
             $additionalParams .= '&' . implode('&', $additionalArguments);
         }
         if ($chash) {
             $additionalParams .= '&r[0][chash]=' . $chash;
         }
         /* @var $cObj \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */
         $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
         $uri = $cObj->typoLink('', array('returnLast' => 'url', 'additionalParams' => $additionalParams, 'parameter' => $pageUid ? $pageUid : ($GLOBALS['TSFE'] ? $GLOBALS['TSFE']->id : 0)));
         $this->tag->addAttribute('href', $uri);
         $this->tag->setContent($this->renderChildren());
         $this->tag->forceClosingTag(TRUE);
         return $this->tag->render();
     }
 }
 public function initializeArguments()
 {
     parent::initializeArguments();
     $this->registerArgument('array', 'array', 'Array to be reverted', TRUE, array());
 }