本文整理汇总了PHP中Frontend\Core\Engine\Navigation类的典型用法代码示例。如果您正苦于以下问题:PHP Navigation类的具体用法?PHP Navigation怎么用?PHP Navigation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Navigation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute the extra.
*/
public function execute()
{
// get activation key
$key = $this->URL->getParameter(0);
// load template
$this->loadTemplate();
// do we have an activation key?
if (isset($key)) {
// get profile id
$profileId = FrontendProfilesModel::getIdBySetting('activation_key', $key);
// have id?
if ($profileId != null) {
// update status
FrontendProfilesModel::update($profileId, array('status' => 'active'));
// delete activation key
FrontendProfilesModel::deleteSetting($profileId, 'activation_key');
// login profile
FrontendProfilesAuthentication::login($profileId);
// trigger event
FrontendModel::triggerEvent('Profiles', 'after_activate', array('id' => $profileId));
// show success message
$this->tpl->assign('activationSuccess', true);
} else {
// failure
$this->redirect(FrontendNavigation::getURL(404));
}
} else {
$this->redirect(FrontendNavigation::getURL(404));
}
}
示例2: execute
/**
* Execute the action
*/
public function execute()
{
parent::execute();
//--Get the id
$id = $this->URL->getParameter(1);
//--check if the id is not empty
if (empty($id)) {
$this->redirect(FrontendNavigation::getURL(404));
}
//--Explode the id
$ids = explode("-", $id);
//--check if the id contains 2 elements
if (count($ids) != 2) {
$this->redirect(FrontendNavigation::getURL(404));
}
//--Get the ids and decrypt
$send_id = (int) FrontendMailengineModel::decryptId($ids[0]);
$user_id = (int) FrontendMailengineModel::decryptId($ids[1]);
//--check if the ids are integers
if ($send_id <= 0) {
$this->redirect(FrontendNavigation::getURL(404));
}
if ($user_id > 0) {
$data = array();
$data["send_id"] = $send_id;
$data["user_id"] = $user_id;
//--Add open-mail to the database
FrontendMailengineModel::insertMailOpen($data);
}
//--Create an empty image
$this->createImage();
//--Stop the script
die;
}
示例3: 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');
}
示例4: loadData
/**
* Load the data
*/
private function loadData()
{
// get the current page id
$pageId = $this->getContainer()->get('page')->getId();
$navigation = FrontendNavigation::getNavigation();
$pageInfo = FrontendNavigation::getPageInfo($pageId);
$this->navigation = array();
if (isset($navigation['page'][$pageInfo['parent_id']])) {
$pages = $navigation['page'][$pageInfo['parent_id']];
// store
$pagesPrev = $pages;
$pagesNext = $pages;
// check for current id
foreach ($pagesNext as $key => $value) {
if ((int) $key != (int) $pageId) {
// go to next pointer in array
next($pagesNext);
next($pagesPrev);
} else {
break;
}
}
// get previous page
$this->navigation['previous'] = prev($pagesPrev);
// get next page
$this->navigation['next'] = next($pagesNext);
// get parent page
$this->navigation['parent'] = FrontendNavigation::getPageInfo($pageInfo['parent_id']);
}
}
示例5: 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';
}
}
示例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));
}
// fetch record
$this->record = FrontendTagsModel::get($this->URL->getParameter(1));
// validate record
if (empty($this->record)) {
$this->redirect(FrontendNavigation::getURL(404));
}
// fetch modules
$this->modules = FrontendTagsModel::getModulesForTag($this->record['id']);
// loop modules
foreach ($this->modules as $module) {
// get the ids of the items linked to the tag
$otherIds = (array) $this->get('database')->getColumn('SELECT other_id
FROM modules_tags
WHERE module = ? AND tag_id = ?', array($module, $this->record['id']));
// set module class
$class = 'Frontend\\Modules\\' . $module . '\\Engine\\Model';
// get the items that are linked to the tags
$items = (array) FrontendTagsModel::callFromInterface($module, $class, 'getForTags', $otherIds);
// add into results array
if (!empty($items)) {
$this->results[] = array('name' => $module, 'label' => FL::lbl(\SpoonFilter::ucfirst($module)), 'items' => $items);
}
}
}
示例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 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);
}
}
示例9: 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;
}
示例10: 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']);
}
示例11: 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);
}
示例12: 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);
}
示例13: 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();
}
示例14: 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');
}
示例15: 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());
}