本文整理汇总了PHP中Frontend\Core\Engine\Navigation::getURLForBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::getURLForBlock方法的具体用法?PHP Navigation::getURLForBlock怎么用?PHP Navigation::getURLForBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frontend\Core\Engine\Navigation
的用法示例。
在下文中一共展示了Navigation::getURLForBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAlbumsForOverview
public static function getAlbumsForOverview()
{
$return = (array) FrontendModel::getContainer()->get('database')->getRecords(' SELECT i.*, m.url, m.data AS meta_data
FROM gallery_albums AS i
INNER JOIN meta AS m ON m.id = i.meta_id
WHERE i.language = ? AND show_in_overview = ?
ORDER BY sequence ASC', array(FRONTEND_LANGUAGE, 'Y'));
if (!empty($return)) {
//--Get link for the categories
$albumLink = FrontendNavigation::getURLForBlock('Gallery', 'Detail');
foreach ($return as &$row) {
//--Create url
$row['full_url'] = $albumLink . '/' . $row['url'];
//-- Unserialize
if (isset($row['meta_data'])) {
$row['meta_data'] = @unserialize($row['meta_data']);
}
$image = self::getImagesForAlbum($row['id'], 1);
if (!empty($image)) {
foreach ($image as $rowImage) {
$row['image'] = $rowImage;
}
}
}
}
return $return;
}
示例2: parse
/**
* Parse the data into the template
*/
private function parse()
{
// get vars
$title = \SpoonFilter::ucfirst(FL::msg('BlogAllComments'));
$link = SITE_URL . FrontendNavigation::getURLForBlock('Blog');
$detailLink = SITE_URL . FrontendNavigation::getURLForBlock('Blog', 'Detail');
$description = null;
// create new rss instance
$rss = new FrontendRSS($title, $link, $description);
// loop articles
foreach ($this->items as $item) {
// init vars
$title = $item['author'] . ' ' . FL::lbl('On') . ' ' . $item['post_title'];
$link = $detailLink . '/' . $item['post_url'] . '/#comment-' . $item['id'];
$description = $item['text'];
// create new instance
$rssItem = new FrontendRSSItem($title, $link, $description);
// set item properties
$rssItem->setPublicationDate($item['created_on']);
$rssItem->setAuthor($item['author']);
// add item
$rss->addItem($rssItem);
}
$rss->parse();
}
示例3: execute
/**
* Execute the action
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// get parameters
$charset = $this->getContainer()->getParameter('kernel.charset');
$searchTerm = \SpoonFilter::getPostValue('term', null, '');
$term = $charset == 'utf-8' ? \SpoonFilter::htmlspecialchars($searchTerm) : \SpoonFilter::htmlentities($searchTerm);
$limit = (int) $this->get('fork.settings')->get('Search', 'autocomplete_num_items', 10);
// validate
if ($term == '') {
$this->output(self::BAD_REQUEST, null, 'term-parameter is missing.');
} else {
// get matches
$matches = FrontendSearchModel::getStartsWith($term, FRONTEND_LANGUAGE, $limit);
// get search url
$url = FrontendNavigation::getURLForBlock('Search');
// loop items and set search url
foreach ($matches as &$match) {
$match['url'] = $url . '?form=search&q=' . $match['term'];
}
// output
$this->output(self::OK, $matches);
}
}
示例4: validateForm
/**
* Validate the form
*/
protected function validateForm()
{
if ($this->frm->isSubmitted()) {
$fields = $this->frm->getFields();
if ($fields['email']->isEmail(FL::err('EmailIsInvalid'))) {
}
if (FrontendMailengineModel::isSubscribed($fields['email']->getValue())) {
$fields['email']->addError(FL::err('AlreadySubscribed'));
}
if ($this->frm->isCorrect()) {
//--Subscribe
$id = FrontendMailengineModel::subscribe($fields['email']->getValue());
//--Get the default group
$defaultGroup = FrontendModel::getModuleSetting($this->module, 'default_group');
if ($defaultGroup > 0) {
$data = array();
$data['user_id'] = $id;
$data['group_id'] = $defaultGroup;
//--Add user to group
FrontendMailengineModel::insertUserToGroup($data);
}
// redirect
$this->redirect(FrontendNavigation::getURLForBlock('Mailengine', 'MailengineSubscribe') . '?sent=true#subscribe');
}
}
$this->frm->parse($this->tpl);
}
示例5: getData
/**
* Load the data, don't forget to validate the incoming data
*/
private function getData()
{
// requested page
$requestedPage = $this->URL->getParameter('page', 'int', 1);
// set URL and limit
$this->pagination['url'] = FrontendNavigation::getURLForBlock('catalog');
$this->pagination['limit'] = FrontendModel::getModuleSetting('catalog', 'overview_num_items', 10);
// populate count fields in pagination
$this->pagination['num_items'] = FrontendCatalogModel::getAllCount();
$this->pagination['num_pages'] = (int) ceil($this->pagination['num_items'] / $this->pagination['limit']);
// num pages is always equal to at least 1
if ($this->pagination['num_pages'] == 0) {
$this->pagination['num_pages'] = 1;
}
// redirect if the request page doesn't exist
if ($requestedPage > $this->pagination['num_pages'] || $requestedPage < 1) {
$this->redirect(FrontendNavigation::getURL(404));
}
// populate calculated fields in pagination
$this->pagination['requested_page'] = $requestedPage;
$this->pagination['offset'] = $this->pagination['requested_page'] * $this->pagination['limit'] - $this->pagination['limit'];
// get all categories
$this->categories = FrontendCatalogModel::getAllCategories();
// get tree of all categories
$this->categoriesTree = FrontendCatalogModel::getCategoriesTree();
// get all products
$this->products = FrontendCatalogModel::getAll($this->pagination['limit'], $this->pagination['offset']);
}
示例6: getData
/**
* Load the data, don't forget to validate the incoming data
*/
private function getData()
{
// requested page
$requestedPage = $this->URL->getParameter('page', 'int', 1);
$this->firstName = Cookie::get('fname');
$this->catalogUrl = FrontendNavigation::getURLForBlock('Catalog');
}
示例7: parse
/**
* Parse
*/
private function parse()
{
// get categories
$categories = FrontendCatalogModel::getAllCategories();
$count = 0;
// any categories?
if (!empty($categories)) {
// build link
$link = FrontendNavigation::getURLForBlock('Catalog', 'Category');
// loop and reset url
foreach ($categories as $key => &$row) {
if ($row['parent_id'] > 0 || $count >= 4) {
unset($categories[$key]);
continue;
}
//--Create url
$row['url'] = $link . '/' . $row['url'];
//--Get image
$row['image'] = FrontendMediaHelper::getFromModule('Catalog', $row['id'], 0, 1, 'category');
//--add count
$count++;
}
}
// assign comments
$this->tpl->assign('categories', $categories);
}
示例8: execute
/**
* Execute the extra
*
* @return void
*/
public function execute()
{
parent::execute();
// Define email from the subscribe widget
$email = $this->getEmail();
// Create the form
$form = $this->createForm($this->get('mailmotor.form.subscription'), new Subscription($email, FRONTEND_LANGUAGE));
$form->handleRequest($this->get('request'));
if (!$form->isValid()) {
$this->tpl->assign('form', $form->createView());
if ($form->isSubmitted()) {
$this->tpl->assign('mailmotorSubscribeHasFormError', true);
}
$this->loadTemplate();
$this->parse();
return;
}
$redirectLink = FrontendNavigation::getURLForBlock('Mailmotor', 'Subscribe') . '?subscribed=true';
/** @var Subscription $subscription */
$subscription = $form->getData();
try {
// The command bus will handle the unsubscription
$this->get('command_bus')->handle($subscription);
} catch (NotImplementedException $e) {
// fallback for when no mail-engine is chosen in the Backend
$this->get('event_dispatcher')->dispatch(NotImplementedSubscribedEvent::EVENT_NAME, new NotImplementedSubscribedEvent($subscription));
$redirectLink .= '&double-opt-in=false';
}
$redirectLink .= '#mailmotorSubscribeForm';
return $this->redirect($redirectLink);
}
示例9: getData
/**
* Load the data, don't forget to validate the incoming data
*/
private function getData()
{
// validate incoming parameters
if ($this->URL->getParameter(1) === null) {
$this->redirect(FrontendNavigation::getURL(404));
}
// get by URL
$this->record = FrontendFaqModel::get($this->URL->getParameter(1));
// anything found?
if (empty($this->record)) {
$this->redirect(FrontendNavigation::getURL(404));
}
// overwrite URLs
$this->record['category_full_url'] = FrontendNavigation::getURLForBlock('Faq', 'Category') . '/' . $this->record['category_url'];
$this->record['full_url'] = FrontendNavigation::getURLForBlock('Faq', 'Detail') . '/' . $this->record['url'];
// get tags
$this->record['tags'] = FrontendTagsModel::getForItem('Faq', $this->record['id']);
// get settings
$this->settings = $this->get('fork.settings')->getForModule('Faq');
// reset allow comments
if (!$this->settings['allow_feedback']) {
$this->record['allow_feedback'] = false;
}
// ge status
$this->status = $this->URL->getParameter(2);
if ($this->status == FL::getAction('Success')) {
$this->status = 'success';
}
if ($this->status == FL::getAction('Spam')) {
$this->status = 'spam';
}
}
示例10: getData
/**
* Get the data
*
* @return void
*/
private function getData()
{
// get all galleries
$this->items = FrontendSlideshowModel::getGalleries();
// full url assets
$this->full_url = FrontendNavigation::getURLForBlock('Slideshow', 'Detail');
$this->full_url_category = FrontendNavigation::getURLForBlock('Slideshow', 'Category');
}
示例11: loadForm
/**
* Load the form
*/
private function loadForm()
{
$this->frm = new FrontendForm('subscribe', null, null, 'subscribeForm');
$this->frm->setAction(FrontendNavigation::getURLForBlock('Mailmotor', 'Subscribe'));
$this->frm->addText('email')->setAttributes(array('required' => null, 'type' => 'email'));
$this->frm->parse($this->tpl);
$this->tpl->assign('formToken', $this->frm->getToken());
}
示例12: loadData
/**
* Load the data
*/
protected function loadData()
{
//--Get the send mailing
$this->record = FrontendMailengineModel::getSend($this->id);
//--Create iframe
$iframe = FrontendNavigation::getURLForBlock('Mailengine', 'MailenginePreview') . "?id=" . $this->id;
$this->tpl->assign('iframe', $iframe);
}
示例13: execute
/**
* Execute the extra
*/
public function execute()
{
parent::execute();
$this->loadTemplate();
// Check if we're logged in, else redirect to the login form.
if (!FrontendProfilesAuthentication::isLoggedIn()) {
$queryString = $this->URL->getQueryString();
throw new RedirectException('Redirect', new RedirectResponse(Navigation::getURLForBlock('Profiles', 'Login') . '?queryString=' . $queryString));
}
}
示例14: parse
/**
* Parse the data into the template
*/
private function parse()
{
// get vars
$title = isset($this->settings['rss_title_' . LANGUAGE]) ? $this->settings['rss_title_' . LANGUAGE] : $this->get('fork.settings')->get('Blog', 'rss_title_' . LANGUAGE, SITE_DEFAULT_TITLE);
$link = SITE_URL . FrontendNavigation::getURLForBlock('Blog');
$description = isset($this->settings['rss_description_' . LANGUAGE]) ? $this->settings['rss_description_' . LANGUAGE] : null;
// create new rss instance
$rss = new FrontendRSS($title, $link, $description);
// loop articles
foreach ($this->items as $item) {
// init vars
$title = $item['title'];
$link = $item['full_url'];
$description = $item['introduction'] != '' ? $item['introduction'] : $item['text'];
// meta is wanted
if ($this->get('fork.settings')->get('Blog', 'rss_meta_' . LANGUAGE, true)) {
// append meta
$description .= '<div class="meta">' . "\n";
$description .= ' <p><a href="' . $link . '" title="' . $title . '">' . $title . '</a> ' . sprintf(FL::msg('WrittenBy'), FrontendUser::getBackendUser($item['user_id'])->getSetting('nickname'));
$description .= ' ' . FL::lbl('In') . ' <a href="' . $item['category_full_url'] . '" title="' . $item['category_title'] . '">' . $item['category_title'] . '</a>.</p>' . "\n";
// any tags
if (isset($item['tags'])) {
// append tags-paragraph
$description .= ' <p>' . \SpoonFilter::ucfirst(FL::lbl('Tags')) . ': ';
$first = true;
// loop tags
foreach ($item['tags'] as $tag) {
// prepend separator
if (!$first) {
$description .= ', ';
}
// add
$description .= '<a href="' . $tag['full_url'] . '" rel="tag" title="' . $tag['name'] . '">' . $tag['name'] . '</a>';
// reset
$first = false;
}
// end
$description .= '.</p>' . "\n";
}
// end HTML
$description .= '</div>' . "\n";
}
// create new instance
$rssItem = new FrontendRSSItem($title, $link, $description);
// set item properties
$rssItem->setPublicationDate($item['publish_on']);
$rssItem->addCategory($item['category_title']);
$rssItem->setAuthor(FrontendUser::getBackendUser($item['user_id'])->getSetting('nickname'));
// add item
$rss->addItem($rssItem);
}
// output
$rss->parse();
}
示例15: parse
/**
* Parse the data into the template
*/
private function parse()
{
// get RSS-link
$rssLink = FrontendNavigation::getURLForBlock('Blog', 'Rss');
// add RSS-feed
$this->header->addLink(array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => $this->get('fork.settings')->get('Blog', 'rss_title_' . FRONTEND_LANGUAGE), 'href' => $rssLink), true);
// assign articles
$this->tpl->assign('items', $this->items);
// parse the pagination
$this->parsePagination();
}