本文整理汇总了PHP中FrontendNavigation::getURLForBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontendNavigation::getURLForBlock方法的具体用法?PHP FrontendNavigation::getURLForBlock怎么用?PHP FrontendNavigation::getURLForBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrontendNavigation
的用法示例。
在下文中一共展示了FrontendNavigation::getURLForBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadForm
/**
* Load the form
*
* @return void
*/
private function loadForm()
{
// create form
$this->frm = new FrontendForm('search', FrontendNavigation::getURLForBlock('search'), 'get', null, false);
// create elements
$this->frm->addText('q_widget', null, 255, 'inputText autoSuggest', 'inputTextError autoSuggest');
}
示例2: loadDataGrid
/**
* Load the datagrid
*/
private function loadDataGrid()
{
// create a new source-object
$source = new SpoonDataGridSourceDB(FrontendModel::getDB(), array(FrontendMailmotorModel::QRY_DATAGRID_BROWSE_SENT, array('sent', FRONTEND_LANGUAGE)));
// create datagrid
$this->dataGrid = new SpoonDataGrid($source);
$this->dataGrid->setCompileDirectory(FRONTEND_CACHE_PATH . '/compiled_templates');
// set hidden columns
$this->dataGrid->setColumnsHidden(array('id', 'status'));
// set headers values
$headers['name'] = SpoonFilter::ucfirst(FL::lbl('Name'));
$headers['send_on'] = SpoonFilter::ucfirst(FL::lbl('Sent'));
// set headers
$this->dataGrid->setHeaderLabels($headers);
// sorting columns
$this->dataGrid->setSortingColumns(array('name', 'send_on'), 'name');
$this->dataGrid->setSortParameter('desc');
// set colum URLs
$this->dataGrid->setColumnURL('name', FrontendNavigation::getURLForBlock('mailmotor', 'detail') . '/[id]');
// set column functions
$this->dataGrid->setColumnFunction(array('SpoonDate', 'getTimeAgo'), array('[send_on]'), 'send_on', true);
// add styles
$this->dataGrid->setColumnAttributes('name', array('class' => 'title'));
// set paging limit
$this->dataGrid->setPagingLimit(self::MAILINGS_PAGING_LIMIT);
}
示例3: parse
/**
* Parse the data into the template
*/
private function parse()
{
// get vars
$title = vsprintf(FL::msg('CommentsOn'), array($this->record['title']));
$link = SITE_URL . FrontendNavigation::getURLForBlock('blog', 'article_comments_rss') . '/' . $this->record['url'];
$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') . ' ' . $this->record['title'];
$link = $detailLink . '/' . $this->record['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();
}
示例4: validateForm
/**
* Validate the form
*/
private function validateForm()
{
if ($this->frm->isSubmitted()) {
$this->frm->cleanupFields();
// validate required fields
$this->frm->getField('name')->isFilled(FL::err('NameIsRequired'));
$this->frm->getField('email')->isEmail(FL::err('EmailIsInvalid'));
$this->frm->getField('message')->isFilled(FL::err('QuestionIsRequired'));
if ($this->frm->isCorrect()) {
$spamFilterEnabled = FrontendModel::getModuleSetting('faq', 'spamfilter');
$variables['sentOn'] = time();
$variables['name'] = $this->frm->getField('name')->getValue();
$variables['email'] = $this->frm->getField('email')->getValue();
$variables['message'] = $this->frm->getField('message')->getValue();
if ($spamFilterEnabled) {
// if the comment is spam alter the comment status so it will appear in the spam queue
if (FrontendModel::isSpam($variables['message'], SITE_URL . FrontendNavigation::getURLForBlock('faq'), $variables['name'], $variables['email'])) {
$this->status = 'errorSpam';
return;
}
}
$this->status = 'success';
FrontendMailer::addEmail(sprintf(FL::getMessage('FaqOwnQuestionSubject'), $variables['name']), FRONTEND_MODULES_PATH . '/faq/layout/templates/mails/own_question.tpl', $variables, $variables['email'], $variables['name']);
}
}
}
示例5: validateForm
/**
* Validate the form
*/
private function validateForm()
{
// is the form submitted
if ($this->frm->isSubmitted()) {
// validate required fields
$email = $this->frm->getField('email');
// validate required fields
if ($email->isEmail(FL::err('EmailIsInvalid'))) {
if (FrontendMailmotorModel::isSubscribed($email->getValue())) {
$email->addError(FL::err('AlreadySubscribed'));
}
}
// no errors
if ($this->frm->isCorrect()) {
try {
// subscribe the user to our default group
FrontendMailmotorCMHelper::subscribe($email->getValue());
// trigger event
FrontendModel::triggerEvent('mailmotor', 'after_subscribe', array('email' => $email->getValue()));
// redirect
$this->redirect(FrontendNavigation::getURLForBlock('mailmotor', 'subscribe') . '?sent=true#subscribeForm');
} catch (Exception $e) {
// when debugging we need to see the exceptions
if (SPOON_DEBUG) {
throw $e;
}
// show error
$this->tpl->assign('subscribeHasError', true);
}
} else {
$this->tpl->assign('subscribeHasFormError', true);
}
}
}
示例6: 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 = FrontendModel::getModuleSettings('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';
}
}
示例7: parse
/**
* Parse the data into the template
*
* @return void
*/
private function parse()
{
// get vars
$title = isset($this->settings['rss_title_' . FRONTEND_LANGUAGE]) ? $this->settings['rss_title_' . FRONTEND_LANGUAGE] : FrontendModel::getModuleSetting('blog', 'rss_title_' . FRONTEND_LANGUAGE, SITE_DEFAULT_TITLE);
$link = SITE_URL . FrontendNavigation::getURLForBlock('blog');
$description = isset($this->settings['rss_description_' . FRONTEND_LANGUAGE]) ? $this->settings['rss_description_' . FRONTEND_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 (FrontendModel::getModuleSetting('blog', 'rss_meta_' . FRONTEND_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>' . 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();
}
示例8: parse
/**
* Parse
*
* @return void
*/
private function parse()
{
// get RSS-link
$rssLink = FrontendModel::getModuleSetting('blog', 'feedburner_url_' . FRONTEND_LANGUAGE);
if ($rssLink == '') {
$rssLink = FrontendNavigation::getURLForBlock('blog', 'rss');
}
// add RSS-feed into the metaCustom
$this->header->addLink(array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => FrontendModel::getModuleSetting('blog', 'rss_title_' . FRONTEND_LANGUAGE), 'href' => $rssLink), true);
// assign comments
$this->tpl->assign('widgetBlogRecentArticlesList', FrontendBlogModel::getAll(FrontendModel::getModuleSetting('blog', 'recent_articles_list_num_items', 5)));
}
示例9: loadForm
/**
* Load the form
*/
private function loadForm()
{
// don't show the form if someone is logged in
if (FrontendProfilesAuthentication::isLoggedIn()) {
return;
}
$this->frm = new FrontendForm('login', FrontendNavigation::getURLForBlock('profiles', 'login'));
$this->frm->addText('email');
$this->frm->addPassword('password');
$this->frm->addCheckbox('remember', true);
// parse the form
$this->frm->parse($this->tpl);
}
示例10: parse
/**
* Parse the data into the template
*
* @return void
*/
private function parse()
{
// get RSS-link
$rssLink = FrontendModel::getModuleSetting('blog', 'feedburner_url_' . FRONTEND_LANGUAGE);
if ($rssLink == '') {
$rssLink = FrontendNavigation::getURLForBlock('blog', 'rss');
}
// add RSS-feed
$this->header->addLink(array('rel' => 'alternate', 'type' => 'application/rss+xml', 'title' => FrontendModel::getModuleSetting('blog', 'rss_title_' . FRONTEND_LANGUAGE), 'href' => $rssLink), true);
// assign articles
$this->tpl->assign('items', $this->items);
// parse the pagination
$this->parsePagination();
}
示例11: 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::getCategory($this->URL->getParameter(1));
// anything found?
if (empty($this->record)) {
$this->redirect(FrontendNavigation::getURL(404));
}
$this->record['full_url'] = FrontendNavigation::getURLForBlock('faq', 'category') . '/' . $this->record['url'];
$this->questions = FrontendFaqModel::getAllForCategory($this->record['id']);
}
示例12: parse
/**
* Parse
*
* @return void
*/
private function parse()
{
// get categories
$categories = FrontendBlogModel::getAllCategories();
// any categories?
if (!empty($categories)) {
// build link
$link = FrontendNavigation::getURLForBlock('blog', 'category');
// loop and reset url
foreach ($categories as &$row) {
$row['url'] = $link . '/' . $row['url'];
}
}
// assign comments
$this->tpl->assign('widgetBlogCategories', $categories);
}
示例13: validateForm
/**
* Validate the form.
*/
private function validateForm()
{
// is the form submitted
if ($this->frm->isSubmitted()) {
// get fields
$txtEmail = $this->frm->getField('email');
$txtPassword = $this->frm->getField('password');
$chkRemember = $this->frm->getField('remember');
// required fields
$txtEmail->isFilled(FL::getError('EmailIsRequired'));
$txtPassword->isFilled(FL::getError('PasswordIsRequired'));
// both fields filled in
if ($txtEmail->isFilled() && $txtPassword->isFilled()) {
// valid email?
if ($txtEmail->isEmail(FL::getError('EmailIsInvalid'))) {
// get the status for the given login
$loginStatus = FrontendProfilesAuthentication::getLoginStatus($txtEmail->getValue(), $txtPassword->getValue());
// valid login?
if ($loginStatus !== FrontendProfilesAuthentication::LOGIN_ACTIVE) {
// get the error string to use
$errorString = sprintf(FL::getError('Profiles' . SpoonFilter::toCamelCase($loginStatus) . 'Login'), FrontendNavigation::getURLForBlock('profiles', 'resend_activation'));
// add the error to stack
$this->frm->addError($errorString);
// add the error to the template variables
$this->tpl->assign('loginError', $errorString);
}
}
}
// valid login
if ($this->frm->isCorrect()) {
// get profile id
$profileId = FrontendProfilesModel::getIdByEmail($txtEmail->getValue());
// login
FrontendProfilesAuthentication::login($profileId, $chkRemember->getChecked());
// update salt and password for Dieter's security features
FrontendProfilesAuthentication::updatePassword($profileId, $txtPassword->getValue());
// trigger event
FrontendModel::triggerEvent('profiles', 'after_logged_in', array('id' => $profileId));
// querystring
$queryString = urldecode(SpoonFilter::getGetValue('queryString', null, SITE_URL));
// redirect
$this->redirect($queryString);
}
}
}
示例14: parse
/**
* Parse
*
* @return void
*/
private function parse()
{
// get categories
$tags = FrontendTagsModel::getAll();
// we just need the 10 first items
$tags = array_slice($tags, 0, 10);
// build link
$link = FrontendNavigation::getURLForBlock('tags', 'detail');
// any tags?
if (!empty($tags)) {
// loop and reset url
foreach ($tags as &$row) {
$row['url'] = $link . '/' . $row['url'];
}
}
// assign comments
$this->tpl->assign('widgetTagsTagCloud', $tags);
}
示例15: execute
/**
* Execute the action
*
* @return void
*/
public function execute()
{
// call parent, this will probably add some general CSS/JS or other required files
parent::execute();
// get parameters
$term = SpoonFilter::getGetValue('term', null, '');
$limit = (int) FrontendModel::getModuleSetting('search', 'autocomplete_num_items', 10);
// validate
if ($term == '') {
$this->output(self::BAD_REQUEST, null, 'term-parameter is missing.');
}
// 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);
}