本文整理汇总了PHP中Controller::generateFrontendUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::generateFrontendUrl方法的具体用法?PHP Controller::generateFrontendUrl怎么用?PHP Controller::generateFrontendUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::generateFrontendUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateAddActions
public function generateAddActions($arrData, $id, Watchlist $objWatchlist)
{
global $objPage;
if ($objPage === null) {
return;
}
if (\Validator::isUuid($id)) {
$objFile = \FilesModel::findByUuid($id);
} else {
$objFile = \FilesModel::findBy('path', $id);
}
$objItem = new WatchlistItemModel();
$objItem->pid = Watchlist::getInstance()->getId();
$objItem->uuid = $objFile->uuid;
$objItem->pageID = $objPage->id;
$objItem->cid = $arrData['id'];
$objItem->type = $arrData['type'];
$objT = new \FrontendTemplate('watchlist_add_actions');
$objT->addHref = ampersand(\Controller::generateFrontendUrl($objPage->row()) . '?act=' . WATCHLIST_ACT_ADD . '&cid=' . $objItem->cid . '&type=' . $objItem->type . '&id=' . $strUuid . '&title=' . urlencode($objItem->getTitle()));
$objT->addTitle = $GLOBALS['TL_LANG']['WATCHLIST']['addTitle'];
$objT->addLink = $GLOBALS['TL_LANG']['WATCHLIST']['addLink'];
$objT->active = $objWatchlist->isInList($strUuid);
$objT->id = $strUuid;
return $objT->parse();
}
示例2: runAction
protected function runAction()
{
global $objPage;
switch (\Input::get('act')) {
case WATCHLIST_ACT_DELETE:
Watchlist::getInstance()->deleteItem(\Input::get('id'));
break;
case WATCHLIST_ACT_ADD:
$objItem = new WatchlistItemModel();
$objItem->pid = Watchlist::getInstance()->getId();
$objItem->uuid = \Input::get('id');
$objItem->pageID = $objPage->id;
$objItem->cid = \Input::get('cid');
$objItem->type = \Input::get('type');
$objItem->title = \Input::get('title');
$objItem->tstamp = time();
Watchlist::getInstance()->addItem($objItem);
break;
case WATCHLIST_ACT_DELETE_ALL:
Watchlist::getInstance()->deleteAll();
break;
case WATCHLIST_ACT_DOWNLOAD_ALL:
Watchlist::getInstance()->downloadAll();
break;
}
// if ajax -> return the content of the watchlist
if (\Environment::get('isAjaxRequest')) {
die(json_encode(array('action' => \Input::get('act'), 'watchlist' => Watchlist::getInstance()->generate(), 'notification' => Watchlist::getInstance()->generateNotifications(), 'count' => Watchlist::getInstance()->count(), 'cssClass' => Watchlist::getInstance()->count() > 0 ? 'not-empty' : 'empty')));
}
// no js support -- redirect and remove GET parameters
\Controller::redirect(\Controller::generateFrontendUrl($objPage->row()));
}
示例3: loadStoreDetails
/**
* @deprecated
*/
public static function loadStoreDetails(array $arrStore, $jumpTo = null)
{
//load country names
//@todo load only once. not every time.
$arrCountryNames = \System::getCountries();
//full localized country name
//@todo rename country to countrycode in database
$arrStore['countrycode'] = $arrStore['country'];
$arrStore['country'] = $arrCountryNames[$arrStore['countrycode']];
// generate jump to
if ($jumpTo) {
if (($objLocation = \PageModel::findByPk($jumpTo)) !== null) {
//@todo language parameter
$strStoreKey = !$GLOBALS['TL_CONFIG']['useAutoItem'] ? '/store/' : '/';
$strStoreValue = $arrStore['alias'];
$arrStore['href'] = \Controller::generateFrontendUrl($objLocation->row(), $strStoreKey . $strStoreValue);
}
}
// opening times
$arrStore['opening_times'] = deserialize($arrStore['opening_times']);
// store logo
//@todo change size and properties in module
if ($arrStore['logo']) {
if (($objLogo = \FilesModel::findByUuid($arrStore['logo'])) !== null) {
$arrLogo = $objLogo->row();
$arrMeta = deserialize($arrLogo['meta']);
$arrLogo['meta'] = $arrMeta[$GLOBALS['TL_LANGUAGE']];
$arrStore['logo'] = $arrLogo;
} else {
$arrStore['logo'] = null;
}
}
return $arrStore;
}
示例4: compile
/**
* compile
*/
protected function compile()
{
if ($this->cssID[0] == '') {
$cssID = $this->cssID;
$cssID[0] = 'modal-' . $this->id;
$this->cssID = $cssID;
}
$modal = new Component();
$modal->setId($this->cssID[0])->setSize($this->bootstrap_modalSize);
if ($this->cssID[1]) {
$modal->addClass($this->cssID[1]);
}
// check if ajax is used
if ($this->bootstrap_modalAjax) {
$this->Template->hideFrame = $this->isAjax;
$this->Template->hideContent = !$this->Template->hideFrame;
}
if ($this->Template->hideContent) {
$url = \Controller::generateFrontendUrl($GLOBALS['objPage']->row()) . '?bootstrap_modal=' . $this->id;
//$url = sprintf(Bootstrap::getConfigVar('modal.remoteUrl'), $GLOBALS['objPage']->id, $this->id);
$modal->setAttribute('data-remote', $url)->render($this->Template);
return;
}
if ($this->headline) {
$headline = Element::create($this->hl)->addClass('modal-title')->addChild($this->headline);
$modal->setTitle($headline);
}
$modal->setContent($this->getContent())->setFooter($this->getButtons())->setCloseButton(Bootstrap::getConfigVar('modal.dismiss'), true)->render($this->Template);
}
示例5: checkPermissionForProtectedHomeDirs
public static function checkPermissionForProtectedHomeDirs($strFile)
{
$strUuid = \Config::get('protectedHomeDirRoot');
if (!$strFile) {
return;
}
if ($strUuid && ($strProtectedHomeDirRootPath = \HeimrichHannot\HastePlus\Files::getPathFromUuid($strUuid)) !== null) {
// check only if path inside the protected root dir
if (StringUtil::startsWith($strFile, $strProtectedHomeDirRootPath)) {
if (FE_USER_LOGGED_IN) {
if (($objFrontendUser = \FrontendUser::getInstance()) !== null) {
if (\Config::get('allowAccessByMemberId') && $objFrontendUser->assignProtectedDir && $objFrontendUser->protectedHomeDir) {
$strProtectedHomeDirMemberRootPath = Files::getPathFromUuid($objFrontendUser->protectedHomeDir);
// fe user id = dir owner member id
if (StringUtil::startsWith($strFile, $strProtectedHomeDirMemberRootPath)) {
return;
}
}
if (\Config::get('allowAccessByMemberGroups')) {
$arrAllowedGroups = deserialize(\Config::get('allowedMemberGroups'), true);
if (array_intersect(deserialize($objFrontendUser->groups, true), $arrAllowedGroups)) {
return;
}
}
}
}
$intNoAccessPage = \Config::get('jumpToNoAccess');
if ($intNoAccessPage && ($objPageJumpTo = \PageModel::findByPk($intNoAccessPage)) !== null) {
\Controller::redirect(\Controller::generateFrontendUrl($objPageJumpTo->row()));
} else {
die($GLOBALS['TL_LANG']['MSC']['noAccessDownload']);
}
}
}
}
示例6: addCurrentPage
protected static function addCurrentPage(FileCreditModel $objCredit)
{
global $objPage;
$strRequestRaw = preg_replace('/\\?.*/', '', \Environment::get('request'));
// strip get parameter from url
$strRequest = rtrim($strRequestRaw, "/");
$strAlias = \Controller::generateFrontendUrl($objPage->row());
// only accept pages or auto_item pages
if (!Validator::isRequestAlias($strRequest, $strAlias)) {
// cleanup pages that no longer exist
$objModel = FileCreditPageModel::findByPidAndPageAndUrl($objCredit->id, $objPage->id, $strRequestRaw);
if ($objModel !== null) {
while ($objModel->next()) {
$objModel->delete();
}
}
return false;
}
$objModel = FileCreditPageModel::findByPidAndPageAndUrl($objCredit->id, $objPage->id, $strRequest);
// do not index page again
if ($objModel !== null) {
return false;
}
$arrSet = array('pid' => $objCredit->id, 'tstamp' => time(), 'page' => $objPage->id, 'url' => $strRequest, 'protected' => $objPage->protected ? '1' : '', 'groups' => $objPage->groups, 'language' => $objPage->language, 'published' => 1, 'start' => '', 'stop' => '');
// create: add new page for the credit
$objModel = new FileCreditPageModel();
$objModel->setRow($arrSet);
$objModel->save();
return true;
}
示例7: generate
/**
* Display a wildcard in the back end
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newsreader'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
global $objPage;
if ($this->news_template_modal) {
$this->strTemplate = 'mod_news_modal';
$this->news_template = $this->news_template_modal;
// list config
$this->news_showInModal = true;
$this->news_readerModule = $this->id;
// set modal css ID for generateModal() and parent::generate()
$arrCss = deserialize($this->cssID, true);
$arrCss[0] = NewsPlusHelper::getCSSModalID($this->id);
$this->cssID = $arrCss;
$this->base = \Controller::generateFrontendUrl($objPage->row());
if ($this->Environment->isAjaxRequest && !$this->isSearchIndexer()) {
$this->strTemplate = 'mod_news_modal_ajax';
$this->generateAjax();
}
if (!$this->checkConditions()) {
return $this->generateModal();
}
}
return parent::generate();
}
示例8: compile
protected function compile()
{
global $objPage;
// Set the flags
$GLOBALS['NEWS_FILTER_SHOW_SEARCH'] = $this->news_filterShowSearch ? true : false;
// filter news by search
$GLOBALS['NEWS_FILTER_USE_SEARCH_INDEX'] = $this->news_filterUseSearchIndex ? true : false;
// filter news by search index or tl_news table
$GLOBALS['NEWS_FILTER_FUZZY_SEARCH'] = $this->news_filterFuzzySearch ? true : false;
// use fuzzy search
$GLOBALS['NEWS_FILTER_SEARCH_QUERY_TYPE'] = $this->news_filterSearchQueryType ? "and" : "or";
// query type 'and' or 'or'
$this->strCategoryTemplate = $this->news_filterCategoryTemplate ?: NULL;
// Show search form in template
$this->Template->showSearch = $this->news_filterShowSearch ?: NULL;
$this->Template->showCategories = $this->news_filterShowCategories ?: NULL;
// Set Fields
$this->Template->searchKeywords = trim(\Input::get('searchKeywords'));
$this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
// Return if there are no archives
if (!is_array($this->news_archives) || empty($this->news_archives)) {
return '';
}
// news archive, with newscategories (news_categories module)
$this->news_filterNewsCategoryArchives = deserialize($this->news_filterNewsCategoryArchives, true);
$sql = "SELECT * FROM tl_news_archive WHERE tl_news_archive.id IN(" . implode(',', array_map('intval', $this->news_archives)) . ") ORDER BY title";
/** @var \Contao\Database\Result $rs */
$rs = \Database::getInstance()->query($sql);
$arrResult = $rs->fetchAllAssoc();
if (empty($arrResult)) {
return '';
}
$objTemplate = new \FrontendTemplate($this->searchTpl ?: $this->strCategoryTemplate);
$objTemplate->filterName = $GLOBALS['TL_LANG']['news_plus']['filterLabel'];
$objTemplate->rootPageLink = \Controller::generateFrontendUrl($objPage->row());
if ($this->strCategoryTemplate == 'filter_cat_multilevel') {
$strNewsArchives = trim(\Input::get('newscategories'));
$strNewsCategories = trim(\Input::get('category'));
if ($strNewsArchives || $strNewsCategories) {
$filterName = ModuleNewsListPlus::findArchiveTitleByPid($strNewsArchives);
// overwrite title with news_category
if ($filterName && $strNewsCategories) {
$objNewsCategory = \NewsCategories\NewsCategoryModel::findPublishedByIdOrAlias($strNewsCategories);
if ($objNewsCategory !== null) {
$filterName = $objNewsCategory->frontendTitle ? $objNewsCategory->frontendTitle : $objNewsCategory->title;
}
}
$objTemplate->filterName = self::getShortCategoryTitle($filterName);
$objTemplate->filterResetName = $GLOBALS['TL_LANG']['news_plus']['resetFilterLabel'];
$objTemplate->pageLink = $objPage->alias;
$objTemplate->activeNewsArchive = $strNewsArchives;
$objTemplate->activeCategory = $strNewsCategories;
}
$objTemplate->categories = self::groupCategoriesByArchivesTitle($arrResult);
} else {
$objTemplate->optionValues = self::getCategoriesFromArchiveTitle($arrResult);
}
$this->Template->categories = $objTemplate->parse();
}
示例9: parseCredit
public static function parseCredit(FileCreditModel $objModel, array $arrPids = array(), $objModule)
{
global $objPage;
$objTemplate = new \FrontendTemplate(!$objModule->creditsGroupBy ? 'filecredit_default' : 'filecredit_grouped');
// skip if no files model exists
if (($objFilesModel = $objModel->getRelated('uuid')) === null) {
return null;
}
// cleanup: remove credits where copyright was deleted
if ($objFilesModel->copyright == '') {
FileCreditPageModel::deleteByPid($objModel->id);
$objModel->delete();
return null;
}
// skip if credit occurs on no page
if (($objCreditPages = FileCreditPageModel::findPublishedByPids(array($objModel->id))) === null) {
return null;
}
while ($objCreditPages->next()) {
$arrCredit = $objCreditPages->row();
// not a child of current root page
if (!empty($arrPids) && !in_array($arrCredit['page'], $arrPids)) {
continue;
}
if ($arrCredit['url'] == '' && ($objTarget = \PageModel::findByPk($arrCredit['page'])) !== null) {
$arrCredit['url'] = \Controller::generateFrontendUrl($objTarget->row());
}
$arrPages[] = $arrCredit;
}
if ($arrPages === null) {
return null;
}
$objTemplate->setData($objModel->row());
$objTemplate->fileData = $objFilesModel->row();
static::addCopyrightToTemplate($objTemplate, $objFilesModel, $objModule);
$objTemplate->link = $GLOBALS['TL_LANG']['MSC']['creditLinkText'];
$objTemplate->pagesLabel = $GLOBALS['TL_LANG']['MSC']['creditPagesLabel'];
$objTemplate->path = $objFilesModel->path;
$objTemplate->pages = $arrPages;
$objTemplate->pageCount = count($arrPages);
// colorbox support
if ($objPage->outputFormat == 'xhtml') {
$strLightboxId = 'lightbox';
} else {
$strLightboxId = 'lightbox[' . substr(md5($objTemplate->getName() . '_' . $objFilesModel->id), 0, 6) . ']';
}
$objTemplate->attribute = $strLightboxId ? ($objPage->outputFormat == 'html5' ? ' data-gallery="#gallery-' . $objModule->id . '" data-lightbox="' : ' rel="') . $strLightboxId . '"' : '';
$objTemplate->addImage = false;
// Add an image
if (!is_file(TL_ROOT . '/' . $objModel->path)) {
$arrData = array('singleSRC' => $objFilesModel->path, 'doNotIndex' => true);
$size = deserialize($objModule->imgSize);
if ($size[0] > 0 || $size[1] > 0 || is_numeric($size[2])) {
$arrData['size'] = $objModule->imgSize;
}
\Controller::addImageToTemplate($objTemplate, $arrData);
}
return array('pages' => $arrPages, 'order' => static::getSortValue($objModule->creditsSortBy, $objTemplate), 'group' => static::getGroupValue($objModule->creditsGroupBy, $objTemplate), 'output' => $objTemplate->parse());
}
示例10: compile
protected function compile()
{
global $objPage;
$this->Template->href = \Controller::generateFrontendUrl($this->objTarget->row());
if ($objPage->id == $this->jumpTo) {
$this->Template->active = true;
}
}
示例11: generateForumlayout
protected function generateForumlayout($activeRecord)
{
Message::addInfo("Generating Layout");
$row = $activeRecord->row();
$row['skipInternalHook'] = true;
$url = Controller::generateFrontendUrl($row, null, null, false);
$frontendRequest = new \Contao\Request();
$frontendRequest->send(Environment::get('url') . '/' . $url);
}
示例12: addSubscriptions
public static function addSubscriptions(Order $objOrder, $arrTokens)
{
$strEmail = $objOrder->getBillingAddress()->email;
$objAddress = $objOrder->getShippingAddress() ?: $objOrder->getBillingAddress();
$arrItems = $objOrder->getItems();
$objSession = \Session::getInstance();
if (!($intModule = $objSession->get('isotopeCheckoutModuleIdSubscriptions'))) {
return true;
}
$objSession->remove('isotopeCheckoutModuleIdSubscriptions');
$objModule = \ModuleModel::findByPk($intModule);
foreach ($arrItems as $item) {
switch ($objModule->iso_direct_checkout_product_mode) {
case 'product_type':
$objFieldpalette = FieldPaletteModel::findBy('iso_direct_checkout_product_type', Standard::findAvailableByIdOrAlias($item->product_id)->type);
break;
default:
$objFieldpalette = FieldPaletteModel::findBy('iso_direct_checkout_product', $item->product_id);
break;
}
if ($objFieldpalette !== null && $objFieldpalette->iso_addSubscription) {
if ($objFieldpalette->iso_subscriptionArchive && (!$objFieldpalette->iso_addSubscriptionCheckbox || \Input::post('subscribeToProduct_' . $item->product_id))) {
$objSubscription = Subscription::findOneBy(array('email=?', 'pid=?', 'activation!=?', 'disable=?'), array($strEmail, $objFieldpalette->iso_subscriptionArchive, '', 1));
if (!$objSubscription) {
$objSubscription = new Subscription();
}
if ($objFieldpalette->iso_addActivation) {
$strToken = md5(uniqid(mt_rand(), true));
$objSubscription->disable = true;
$objSubscription->activation = $strToken;
if (($objNotification = Notification::findByPk($objFieldpalette->iso_activationNotification)) !== null) {
if ($objFieldpalette->iso_activationJumpTo && ($objPageRedirect = \PageModel::findByPk($objFieldpalette->iso_activationJumpTo)) !== null) {
$arrTokens['link'] = \Environment::get('url') . '/' . \Controller::generateFrontendUrl($objPageRedirect->row()) . '?token=' . $strToken;
}
$objNotification->send($arrTokens, $GLOBALS['TL_LANGUAGE']);
}
}
$arrAddressFields = \Config::get('iso_addressFields');
if ($arrAddressFields === null) {
$arrAddressFields = serialize(array_keys(static::getIsotopeAddressFields()));
}
foreach (deserialize($arrAddressFields, true) as $strName) {
$objSubscription->{$strName} = $objAddress->{$strName};
}
$objSubscription->email = $strEmail;
$objSubscription->pid = $objFieldpalette->iso_subscriptionArchive;
$objSubscription->tstamp = $objSubscription->dateAdded = time();
$objSubscription->quantity = \Input::post('quantity');
$objSubscription->order_id = $objOrder->id;
$objSubscription->save();
}
}
}
return true;
}
示例13: show
public function show()
{
global $objPage;
$back = \Controller::generateFrontendUrl($objPage->row(), null, null, true);
$blnAjax = false;
$objModal = new Modal($this->objModal, $this->arrConfig);
$objModal->setBackLink($back);
$objResponse = new ResponseSuccess();
$objResponse->setResult(new ResponseData($objModal->generate(), array('id' => $this->objModal->id)));
$objResponse->setUrl(AjaxAction::removeAjaxParametersFromUrl(Request::getInstance()->getRequestUri()));
return $objResponse;
}
示例14: generate
/**
* Display a wildcard in the back end
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE') {
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['eventreader_plus'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
global $objPage;
// add registration before generating event details, otherwise formhybrid ajax requests wont get triggered
if (in_array('event_registration', \ModuleLoader::getActive()) && $this->addRegistration && $this->checkConditions() && $this->objEvent->addRegistration) {
if (!$this->objEvent->codes && !\Input::get('step') || \Input::get('step') == EventRegistration::STEP_REGISTRATION) {
if ($this->registrationFormModule > 0) {
$this->registration = \Controller::getFrontendModule($this->registrationFormModule);
}
} else {
if (\Input::get('step') == EventRegistration::STEP_SUMMARY) {
if ($this->summaryModule > 0) {
$this->registration = \Controller::getFrontendModule($this->summaryModule);
}
} else {
if ($this->codeCheckModule > 0) {
$this->registration = \Controller::getFrontendModule($this->codeCheckModule);
}
}
}
}
if ($this->cal_template_modal) {
$this->strTemplate = $this->customTpl ?: 'mod_event_modal';
$this->cal_template = $this->cal_template_modal;
// list config
$this->cal_showInModal = true;
$this->cal_readerModule = $this->id;
// set modal css ID for generateModal() and parent::generate()
$arrCss = deserialize($this->cssID, true);
$arrCss[0] = EventsPlusHelper::getCSSModalID($this->id);
$this->cssID = $arrCss;
$this->base = \Controller::generateFrontendUrl($objPage->row());
if ($this->Environment->isAjaxRequest && !$this->isSearchIndexer()) {
$this->strTemplate = 'mod_event_modal_ajax';
if (!$this->generateAjax()) {
return '';
}
}
if (!$this->checkConditions()) {
return $this->generateModal();
}
}
return parent::generate();
}
示例15: getRelationLink
/**
* Generate a link to the relation submission form page
*
* @param \PageModel $objPage
* @param \Model $objEntity
* @param array $arrRelation
*
* @return string The url to the relation submission page
*/
public function getRelationLink(\PageModel $objPage, \Model $objEntity, array $arrRelation)
{
$objPage = \PageModel::findWithDetails($objPage->id);
$strParam = $arrRelation['request_parameter'] ?: $arrRelation['submissionField'];
if (\Config::get('useAutoItem') && $arrRelation['useAutoItem']) {
$varPath = !\Config::get('disableAlias') ? '/' : '/' . $strParam . '/';
$varValue = !\Config::get('disableAlias') && $objEntity->alias ? $objEntity->alias : $objEntity->id;
return \Controller::generateFrontendUrl($objPage->row(), $varPath . $varValue, $objPage->language, true);
}
$strQuery = $strParam . '=' . (!\Config::get('disableAlias') && $objEntity->alias ? $objEntity->alias : $objEntity->id);
return Url::addQueryString($strQuery, \Controller::generateFrontendUrl($objPage->row(), null, $objPage->language, true));
}