本文整理汇总了PHP中DiscussRouter::getCategoryRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussRouter::getCategoryRoute方法的具体用法?PHP DiscussRouter::getCategoryRoute怎么用?PHP DiscussRouter::getCategoryRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussRouter
的用法示例。
在下文中一共展示了DiscussRouter::getCategoryRoute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
?>
<?php
if ($pagination) {
?>
<div class="discuss-pagination">
<?php
echo $pagination->getPagesLinks();
?>
</div>
<?php
} else {
?>
<div>
<a href="<?php
echo DiscussRouter::getCategoryRoute($category->id);
?>
"><?php
echo JText::_('COM_EASYDISCUSS_SHOW_MORE_POSTS');
?>
<i class="icon-chevron-right"></i> </a>
</div>
<?php
}
?>
</div>
<?php
if ($system->config->get('layout_board_stats')) {
echo DiscussHelper::getBoardStatistics();
}
示例2:
</span>
<div class="discuss-status">
<i class="edy-icon-locked edy-state" rel="ed-tooltip" data-placement="top" data-original-title="Locked"></i>
<i class="edy-icon-resolved edy-state" rel="ed-tooltip" data-placement="top" data-original-title="Resolved"></i>
<i class="edy-icon-featured edy-state" rel="ed-tooltip" data-placement="top" data-original-title="Featured"></i>
<i class="edy-icon-favorited edy-state" rel="ed-tooltip" data-placement="top" data-original-title="Favorited"></i>
</div>
</div>
</div>
<div class="dc-mod-bd">
<div class="discuss-category small">
<i class="edy-icon-category"></i> - <a href="<?php
echo DiscussRouter::getCategoryRoute($post->category_id);
?>
"> <?php
echo $post->category;
?>
</a>
</div>
<div class="discuss-date small">
<i class="edy-icon-clock"></i> <?php
echo $post->duration;
?>
</div>
</div><!-- bd -->
<div class="dc-mod-ft">
<div class="discuss-statistic small">
示例3: accessNestedCategories
public static function accessNestedCategories($arr, &$html, $deep = '0', $default = '0', $type = 'select', $linkDelimiter = '', $disableContainers = false)
{
$config = DiscussHelper::getConfig();
if (isset($arr->childs) && is_array($arr->childs)) {
$sup = '<sup>|_</sup>';
$space = '';
$ld = empty($linkDelimiter) ? '>' : $linkDelimiter;
if ($type == 'select' || $type == 'list') {
$deep++;
for ($d = 0; $d < $deep; $d++) {
$space .= ' ';
}
}
if ($type == 'list' && !empty($arr->childs)) {
$html .= '<ul>';
}
for ($j = 0; $j < count($arr->childs); $j++) {
$child = $arr->childs[$j];
switch ($type) {
case 'select':
$selected = $child->id == $default ? ' selected="selected"' : '';
if (!$default) {
$selected = $child->default ? ' selected="selected"' : '';
}
$disabled = '';
$style = '';
// @rule: Test if the category should just act as a container
if ($disableContainers) {
$disabled = $child->container ? ' disabled="disabled"' : '';
$style = $disabled ? ' style="font-weight:700;"' : '';
}
$html .= '<option value="' . $child->id . '" ' . $selected . $disabled . $style . '>' . $space . $sup . $child->title . '</option>';
break;
case 'list':
$expand = !empty($child->childs) ? '<span onclick="EasyDiscuss.$(this).parents(\'li:first\').toggleClass(\'expand\');">[+] </span>' : '';
$html .= '<li><div>' . $space . $sup . $expand . '<a href="' . DiscussRouter::getCategoryRoute($child->id) . '">' . $child->title . '</a> <b>(' . $child->count . ')</b></div>';
break;
case 'listlink':
$str = '<li><a href="' . DiscussRouter::getCategoryRoute($child->id) . '">';
$str .= empty($html) ? $child->title : $ld . ' ' . $child->title;
$str .= '</a></li>';
$html .= $str;
break;
default:
$str = '<a href="' . DiscussRouter::getCategoryRoute($child->id) . '">';
//str .= (empty($html)) ? $child->title : $ld . ' ' . $child->title;
$str .= empty($html) ? $child->title : $ld . ' ' . $child->title;
$str .= '</a></li>';
$html .= $str;
}
if (!$config->get('layout_category_one_level', 0)) {
DiscussHelper::accessNestedCategories($child, $html, $deep, $default, $type, $linkDelimiter, $disableContainers);
}
if ($type == 'list') {
$html .= '</li>';
}
}
if ($type == 'list' && !empty($arr->childs)) {
$html .= '</ul>';
}
} else {
return false;
}
}
示例4: subscribe
/**
* Processes user subscription.
*
* @since 3.0
* @access public
* @param null
*/
public function subscribe()
{
JRequest::checkToken('request') or jexit('Invalid Token');
$app = JFactory::getApplication();
$my = JFactory::getUser();
$config = DiscussHelper::getConfig();
// Get variables from post.
$type = JRequest::getVar('type', null);
$name = JRequest::getVar('subscribe_name', '');
$email = JRequest::getVar('subscribe_email', '');
$interval = JRequest::getVar('subscription_interval', '');
$cid = JRequest::getInt('cid', 0);
$redirect = JRequest::getVar('redirect', '');
if (empty($redirect)) {
$redirect = DiscussRouter::_('index.php?option=com_easydiscuss', false);
if ($type == 'category' && $cid) {
$redirect = DiscussRouter::getCategoryRoute($cid, false);
}
} else {
$redirect = base64_decode($url);
}
// Apply filtering on the name.
$filter = JFilterInput::getInstance();
$name = $filter->clean($name, 'STRING');
$email = JString::trim($email);
$name = JString::trim($name);
if (!JMailHelper::isEmailAddress($email)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_EMAIL'), 'error');
$app->redirect($redirect);
$app->close();
}
// Check for empty email
if (empty($email)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_EMAIL_IS_EMPTY'), 'error');
$app->redirect($redirect);
$app->close();
}
// Check for empty name
if (empty($name)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_NAME_IS_EMPTY'), 'error');
$app->redirect($redirect);
$app->close();
}
$model = DiscussHelper::getModel('Subscribe');
$subscription = $model->isSiteSubscribed($type, $email, $cid);
$data = array();
$data['type'] = $type;
$data['userid'] = $my->id;
$data['email'] = $email;
$data['cid'] = $cid;
$data['member'] = $my->id ? '1' : '0';
$data['name'] = $my->id ? $my->name : $name;
$data['interval'] = $interval;
if ($subscription) {
// Perhaps the user tried to change the subscription interval.
if ($subscription->interval == $interval) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_UPDATED_SUCCESSFULLY'), 'success');
$app->redirect($redirect);
return $app->close();
}
// User changed their subscription interval.
if (!$model->updateSiteSubscription($subscription->id, $data)) {
//if($model->updateSiteSubscription($subRecord['id'], $subscription_info))
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_FAILED'), 'error');
$app->redirect($redirect);
return $app->close();
}
// If the user already has an existing subscription, just let them know that their subscription is already updated.
$intervalMessage = JText::_('COM_EASYDISCUSS_SUBSCRIPTION_INTERVAL_' . strtoupper($interval));
DiscussHelper::setMessageQueue(JText::sprintf('COM_EASYDISCUSS_SUBSCRIPTION_UPDATED', $intervalMessage), 'success');
$app->redirect($redirect);
return $app->close();
}
// Only new records are added here.
if (!$model->addSubscription($data)) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_FAILED'), 'error');
$app->redirect($redirect);
return $app->close();
}
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SUBSCRIPTION_UPDATED_SUCCESSFULLY'), 'success');
$app->redirect($redirect);
return $app->close();
}
示例5: tab
//.........这里部分代码省略.........
break;
case 'tabEasyBlog':
$helperFile = JPATH_ROOT . '/components/com_easyblog/helpers/helper.php';
if (!JFile::exists($helperFile)) {
$html = JText::_('COM_EASYDISCUSS_EASYBLOG_DOES_NOT_EXIST');
} else {
require_once $helperFile;
require_once JPATH_ROOT . '/components/com_easyblog/router.php';
$blogModel = EasyBlogHelper::getModel('Blog');
$blogs = $blogModel->getBlogsBy('blogger', $profileId);
$blogs = EasyBlogHelper::formatBlog($blogs);
$ebConfig = EasyBlogHelper::getConfig();
$user = JFactory::getUser($profileId);
$template->set('user', $user);
$template->set('ebConfig', $ebConfig);
$template->set('blogs', $blogs);
// Load EasyBlog's language file
JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
$html = $template->fetch('profile.blogs.php');
}
break;
case 'tabKomento':
$helperFile = JPATH_ROOT . '/components/com_komento/helpers/helper.php';
if (!JFile::exists($helperFile)) {
$html = JText::_('COM_EASYDISCUSS_KOMENTO_DOES_NOT_EXIST');
} else {
require_once $helperFile;
$commentsModel = Komento::getModel('comments');
$commentHelper = Komento::getHelper('comment');
$options = array('sort' => 'latest', 'userid' => $profileId, 'threaded' => 0);
$comments = $commentsModel->getComments('all', 'all', $options);
foreach ($comments as &$comment) {
$comment = $commentHelper->process($comment);
}
$feedUrl = Komento::getHelper('router')->getFeedUrl('all', 'all', $profileId);
JFactory::getLanguage()->load('com_komento', JPATH_ROOT);
$template->set('feedUrl', $feedUrl);
$template->set('comments', $comments);
$html = $template->fetch('profile.comments.php');
}
break;
case 'subscriptions':
$subModel = DiscussHelper::getModel('subscribe');
$rows = $subModel->getSubscriptions();
$subs = array();
if ($rows) {
foreach ($rows as $row) {
$obj = new stdClass();
$obj->id = $row->id;
$obj->type = $row->type;
$obj->unsublink = Discusshelper::getUnsubscribeLink($row, false);
switch ($row->type) {
case 'site':
$obj->title = '';
$obj->link = '';
break;
case 'post':
$post = DiscussHelper::getTable('Post');
$post->load($row->cid);
$obj->title = $post->title;
$obj->link = DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $post->id);
break;
case 'category':
$category = DiscussHelper::getTable('Category');
$category->load($row->cid);
$obj->title = $category->title;
$obj->link = DiscussRouter::getCategoryRoute($category->id);
break;
case 'user':
$profile = DiscussHelper::getTable('Profile');
$profile->load($row->cid);
$obj->title = $profile->getName();
$obj->link = $profile->getLink();
break;
default:
unset($obj);
break;
}
if (!empty($obj)) {
$obj->title = DiscussStringHelper::escape($obj->title);
$subs[$row->type][] = $obj;
unset($obj);
}
}
}
$template->set('subscriptions', $subs);
$html = $template->fetch('profile.subscriptions.php');
break;
default:
break;
}
if ($pagination) {
$filterArr = array();
$filterArr['viewtype'] = $type;
$filterArr['id'] = $profileId;
$pagination = $pagination->getPagesLinks('profile', $filterArr, true);
}
$ajax->success($html, $pagination);
$ajax->send();
}
示例6: submit
//.........这里部分代码省略.........
// the content is bbcode. we need to parse it.
$emailContent = EasyDiscussParser::bbcode($emailContent);
$emailContent = EasyDiscussParser::removeBrTag($emailContent);
}
// If post is html type we need to strip off html codes.
if ($post->content_type == 'html') {
$emailContent = strip_tags($post->content);
}
$emailContent = $post->trimEmail($emailContent);
$attachments = $post->getAttachments();
$emailData['attachments'] = $attachments;
$emailData['postContent'] = $emailContent;
$emailData['post_id'] = $post->id;
$emailData['cat_id'] = $post->category_id;
$emailData['emailTemplate'] = 'email.subscription.site.new.php';
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_QUESTION_ASKED', $post->id, $post->title);
if ($isModerate) {
// Generate hashkeys to map this current request
$hashkey = DiscussHelper::getTable('HashKeys');
$hashkey->uid = $post->id;
$hashkey->type = DISCUSS_QUESTION_TYPE;
$hashkey->store();
require_once DISCUSS_HELPERS . '/router.php';
$approveURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=approvePost&key=' . $hashkey->key);
$rejectURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=rejectPost&key=' . $hashkey->key);
$emailData['moderation'] = '<div style="display:inline-block;width:100%;padding:20px;border-top:1px solid #ccc;padding:20px 0 10px;margin-top:20px;line-height:19px;color:#555;font-family:\'Lucida Grande\',Tahoma,Arial;font-size:12px;text-align:left">';
$emailData['moderation'] .= '<a href="' . $approveURL . '" style="display:inline-block;padding:5px 15px;background:#fc0;border:1px solid #caa200;border-bottom-color:#977900;color:#534200;text-shadow:0 1px 0 #ffe684;font-weight:bold;box-shadow:inset 0 1px 0 #ffe064;-moz-box-shadow:inset 0 1px 0 #ffe064;-webkit-box-shadow:inset 0 1px 0 #ffe064;border-radius:2px;moz-border-radius:2px;-webkit-border-radius:2px;text-decoration:none!important">' . JText::_('COM_EASYDISCUSS_EMAIL_APPROVE_POST') . '</a>';
$emailData['moderation'] .= ' ' . JText::_('COM_EASYDISCUSS_OR') . ' <a href="' . $rejectURL . '" style="color:#477fda">' . JText::_('COM_EASYDISCUSS_REJECT') . '</a>';
$emailData['moderation'] .= '</div>';
$emailData['emailTemplate'] = 'email.subscription.site.moderate.php';
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_QUESTION_MODERATE', $post->id, $post->title);
} else {
// If this is a private post, do not notify anyone
if (!$post->private && $category->canPublicAccess()) {
// Notify site subscribers
if ($config->get('main_sitesubscription') && ($isNew || $prevPostStatus == DISCUSS_ID_PENDING) && $post->published == DISCUSS_ID_PUBLISHED && !$config->get('notify_all')) {
DiscussHelper::getHelper('Mailer')->notifySubscribers($emailData, array($my->email));
}
// Notify category subscribers
if ($config->get('main_ed_categorysubscription') && ($isNew || $prevPostStatus == DISCUSS_ID_PENDING) && $post->published == DISCUSS_ID_PUBLISHED && !$config->get('notify_all')) {
DiscussHelper::getHelper('Mailer')->notifySubscribers($emailData, array($my->email));
}
// Notify EVERYBODY
if ($config->get('notify_all') && !$isModerate) {
DiscussHelper::getHelper('Mailer')->notifyAllMembers($emailData, array($my->email));
}
}
}
// Notify admins and category moderators
if ($isNew || $prevPostStatus == DISCUSS_ID_PENDING) {
DiscussHelper::getHelper('Mailer')->notifyAdministrators($emailData, array($my->email), $config->get('notify_admin'), $config->get('notify_moderator'));
}
// @rule: Jomsocial activity integrations & points & ranking
if (($isNew || $prevPostStatus == DISCUSS_ID_PENDING) && $post->published == DISCUSS_ID_PUBLISHED && !$post->private) {
DiscussHelper::getHelper('jomsocial')->addActivityQuestion($post);
DiscussHelper::getHelper('easysocial')->createDiscussionStream($post);
// Add notification to subscribers
DiscussHelper::getHelper('easysocial')->notify('new.discussion', $post);
// Add logging for user.
DiscussHelper::getHelper('History')->log('easydiscuss.new.discussion', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_NEW_POST', $post->title), $post->id);
DiscussHelper::getHelper('Badges')->assign('easydiscuss.new.discussion', $my->id);
DiscussHelper::getHelper('Points')->assign('easydiscuss.new.discussion', $my->id);
// Assign badge for EasySocial
DiscussHelper::getHelper('EasySocial')->assignBadge('create.question', $my->id, JText::sprintf('COM_EASYDISCUSS_BADGES_HISTORY_NEW_POST', $post->title));
// assign new ranks.
DiscussHelper::getHelper('ranks')->assignRank($my->id, $config->get('main_ranking_calc_type'));
// aup
DiscussHelper::getHelper('Aup')->assign(DISCUSS_POINTS_NEW_DISCUSSION, $my->id, $post->title);
}
$message = $isNew ? JText::_('COM_EASYDISCUSS_POST_STORED') : JText::_('COM_EASYDISCUSS_EDIT_SUCCESS');
$state = 'success';
// Let's set our custom message here.
if (!$post->isPending()) {
DiscussHelper::setMessageQueue($message, $state);
}
$redirect = JRequest::getVar('redirect', '');
if (!empty($redirect)) {
$redirect = base64_decode($redirect);
return $this->setRedirect($redirect);
}
$redirectionOption = $config->get('main_post_redirection');
switch ($redirectionOption) {
case 'default':
$redirect = DiscussRouter::getPostRoute($post->id, false);
break;
case 'home':
$redirect = DiscussRouter::_('index.php?option=com_easydiscuss&view=index', false);
break;
case 'mainCategory':
$redirect = DiscussRouter::_('index.php?option=com_easydiscuss&view=categories', false);
break;
case 'currentCategory':
$redirect = DiscussRouter::getCategoryRoute($post->category_id, false);
break;
default:
$redirect = DiscussRouter::getPostRoute($post->id, false);
break;
}
$this->setRedirect($redirect);
}