コード例 #1
0
 /**
  * @inheritdoc
  *
  * @throws \InvalidArgumentException
  */
 protected function doSwitchView($id)
 {
     list($table, $id) = explode('.', $id);
     $url = Url::removeQueryString(['switchLanguage']);
     switch ($table) {
         case 'tl_article':
             $url = Url::addQueryString('id=' . $id, $url);
             break;
         case 'tl_page':
             Session::getInstance()->set('tl_page_node', (int) $id);
             break;
         default:
             throw new \InvalidArgumentException(sprintf('Table "%s" is not supported', $table));
     }
     Controller::redirect($url);
 }
コード例 #2
0
 public static function generateUnlockForm($strTable, $objEntity, $objLock, $objModule, $arrTokens = array())
 {
     $objTemplate = new \FrontendTemplate('entity_lock_unlock_form');
     $objTemplate->action = Url::addQueryString('act=unlock', \Environment::get('uri'));
     $objTemplate->formId = 'entity_lock_unlock_' . $objModule->id;
     $objTemplate->lock = $objLock->id;
     // delete if preconditions are given - allow only for the current lock
     $blnIsSubmitted = \Input::post('FORM_SUBMIT') == $objTemplate->formId;
     if ($blnIsSubmitted && \Input::get('act') == EntityLock::ACT_UNLOCK && $objLock->id == \Input::post('lock')) {
         $objFormerEditor = EntityLockModel::getEditor($objLock->id);
         if ($objLock->delete() && $objModule->lockDeletionNotification) {
             static::sendLockDeletionNotification($objModule->lockDeletionNotification, $strTable, $objEntity, $objFormerEditor, $arrTokens);
         }
         \Controller::redirect(Url::removeQueryString(array('act')), $objTemplate->action);
     }
     return $objTemplate->parse();
 }
コード例 #3
0
ファイル: CumulativeFilter.php プロジェクト: rpquadrat/core
 /**
  * Compile the module
  */
 protected function compile()
 {
     $arrFilter = explode(';', base64_decode(\Input::get('cumulativefilter', true)), 4);
     if ($arrFilter[0] == $this->id && in_array($arrFilter[2], $this->iso_filterFields)) {
         // Unique filter key is necessary to unset the filter
         $strFilterKey = $arrFilter[2] . '=' . $arrFilter[3];
         if ($arrFilter[1] == 'add') {
             Isotope::getRequestCache()->setFilterForModule($strFilterKey, Filter::attribute($arrFilter[2])->isEqualTo($arrFilter[3]), $this->id);
         } else {
             Isotope::getRequestCache()->removeFilterForModule($strFilterKey, $this->id);
         }
         $objCache = Isotope::getRequestCache()->saveNewConfiguration();
         // Include \Environment::base or the URL would not work on the index page
         \Controller::redirect(\Environment::get('base') . Url::addQueryString('isorc=' . $objCache->id, Url::removeQueryString(array('cumulativefilter'))));
     } else {
         $this->generateFilter();
         $this->Template->linkClearAll = ampersand(preg_replace('/\\?.*/', '', \Environment::get('request')));
         $this->Template->labelClearAll = $GLOBALS['TL_LANG']['MSC']['clearFiltersLabel'];
     }
 }
コード例 #4
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     $this->blnUpdateCache = \Input::post('FORM_SUBMIT') == 'iso_filter_' . $this->id ? true : false;
     $this->generateFilters();
     $this->generateSorting();
     $this->generateLimit();
     if (!$this->blnUpdateCache) {
         // Search does not affect request cache
         $this->generateSearch();
         $arrParams = array_filter(array_keys($_GET), function ($key) {
             return strpos($key, 'page_iso') === 0;
         });
         $this->Template->id = $this->id;
         $this->Template->formId = 'iso_filter_' . $this->id;
         $this->Template->action = ampersand(Url::removeQueryString($arrParams));
         $this->Template->actionClear = ampersand(strtok(\Environment::get('request'), '?')) . "?keywords=" . \Input::get('keywords');
         $this->Template->clearLabel = $GLOBALS['TL_LANG']['MSC']['clearFiltersLabel'];
         $this->Template->slabel = $GLOBALS['TL_LANG']['MSC']['submitLabel'];
     }
 }
コード例 #5
0
 /**
  * @param string $action
  * @param string $attribute
  * @param string $value
  */
 private function saveFilter($action, $attribute, $value)
 {
     if ($action == 'add') {
         Isotope::getRequestCache()->setFiltersForModule($this->addFilter($this->activeFilters, $attribute, $value), $this->id);
     } else {
         Isotope::getRequestCache()->removeFilterForModule($this->generateFilterKey($attribute, $value), $this->id);
     }
     $objCache = Isotope::getRequestCache()->saveNewConfiguration();
     // Include \Environment::base or the URL would not work on the index page
     \Controller::redirect(\Environment::get('base') . Url::addQueryString('isorc=' . $objCache->id, Url::removeQueryString(array('cumulativefilter'), $this->jumpTo ?: null)));
 }
コード例 #6
0
 public static function removeAjaxParametersFromUrl($strUrl)
 {
     return Url::removeQueryString(Classes::getConstantsByPrefixes('HeimrichHannot\\Ajax\\Ajax', array('AJAX_ATTR')), $strUrl);
 }
コード例 #7
0
 /**
  * @inheritdoc
  */
 protected function doSwitchView($id)
 {
     Session::getInstance()->set('tl_page_node', (int) $id);
     Controller::redirect(Url::removeQueryString(['switchLanguage']));
 }
コード例 #8
0
ファイル: UrlTest.php プロジェクト: codefog/contao-haste
 /**
  * @dataProvider removeQueryStringProvider
  */
 public function testRemoveQueryString($request, $paramsToRemove, $expectedResult)
 {
     $this->assertSame($expectedResult, Url::removeQueryString($paramsToRemove, $request));
 }
コード例 #9
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     $this->blnUpdateCache = \Input::post('FORM_SUBMIT') == 'iso_filter_' . $this->id;
     $this->generateFilters();
     $this->generateSorting();
     $this->generateLimit();
     // If we update the cache and reload the page, we don't need to build the template
     if ($this->blnUpdateCache) {
         return;
     }
     // Search does not affect request cache
     $this->generateSearch();
     $arrParams = array_filter(array_keys($_GET), function ($key) {
         return strpos($key, 'page_iso') === 0;
     });
     $this->Template->id = $this->id;
     $this->Template->formId = 'iso_filter_' . $this->id;
     $this->Template->action = ampersand(Url::removeQueryString($arrParams));
     $this->Template->actionClear = ampersand(strtok(\Environment::get('request'), '?'));
     $this->Template->clearLabel = $GLOBALS['TL_LANG']['MSC']['clearFiltersLabel'];
     $this->Template->slabel = $GLOBALS['TL_LANG']['MSC']['submitLabel'];
 }
コード例 #10
0
 /**
  * @inheritdoc
  *
  * @throws \InvalidArgumentException
  */
 protected function doSwitchView($id)
 {
     $url = Url::removeQueryString(['switchLanguage']);
     $url = Url::addQueryString('id=' . $id, $url);
     Controller::redirect($url);
 }
コード例 #11
0
 /**
  * Generates an url for the step.
  *
  * @param int $step
  *
  * @return mixed
  */
 public function getUrlForStep($step)
 {
     if (0 === $step) {
         $url = \Haste\Util\Url::removeQueryString([$this->getGetParam()]);
     } else {
         $url = \Haste\Util\Url::addQueryString($this->getGetParam() . '=' . $step);
     }
     return $url;
 }