本文整理汇总了PHP中DiscussRouter::getAskRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussRouter::getAskRoute方法的具体用法?PHP DiscussRouter::getAskRoute怎么用?PHP DiscussRouter::getAskRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussRouter
的用法示例。
在下文中一共展示了DiscussRouter::getAskRoute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
: </span>
<ul class="unstyled nav-bar discuss-category-sublist">
<?php
echo $category->nestedLink;
?>
</ul>
</div>
<?php
}
?>
<?php
if ($category->canPost() && !$category->container && $acl->allowed('add_question', 0)) {
?>
<a class="btn btn-primary btn-new-post btn-small" href="<?php
echo DiscussRouter::getAskRoute($category->id);
?>
"><i class="icon-plus-sign"></i> <?php
echo JText::_('COM_EASYDISCUSS_NEW_POST');
?>
</a>
<?php
}
?>
</div>
</div>
<div class="tab-content">
<div class="tab-pane active discussPostsList" data-id="<?php
echo $category->id;
示例2: submit
/**
* Handles POST request for new discussions
*
* @since 3.0
* @access public
*/
public function submit()
{
JRequest::checkToken('request') or jexit('Invalid Token');
$config = DiscussHelper::getConfig();
$my = JFactory::getUser();
$app = JFactory::getApplication();
$acl = DiscussHelper::getHelper('ACL');
// If guest posting is disallowed in the settings, they shouldn't be able to create a discussion at all.
if (!$my->id && !$acl->allowed('add_question', '0')) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_POST_PLEASE_LOGIN'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
return $app->close();
}
// If user is disallowed in the acl, they shouldn't be able to create a discussion at all.
if ($my->id && !$acl->allowed('add_question', '0')) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_SYSTEM_INSUFFICIENT_PERMISSIONS'), DISCUSS_QUEUE_ERROR);
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss', false));
return $app->close();
}
// Get values from the posted form.
$data = JRequest::get('post');
if (isset($data['mod_post_topic_category_id'])) {
$data['category_id'] = $data['mod_post_topic_category_id'];
unset($data['mod_post_topic_category_id']);
}
// Run validation on the posted data.
if (!$this->_fieldValidate($data)) {
$files = JRequest::getVar('filedata', array(), 'FILES');
$data['attachments'] = $files;
DiscussHelper::storeSession($data, 'NEW_POST_TOKEN');
$app->redirect(DiscussRouter::getAskRoute(null, false));
}
// get id if available
$id = JRequest::getInt('id', 0);
// bind the table
$post = DiscussHelper::getTable('Post');
$post->load($id);
// set is new value
$isNew = !$post->id ? true : false;
// If the post is edited and it doesn't have private the user might be switching from private -> non private
if (!$isNew && !isset($data['private'])) {
$post->private = false;
}
// Perform captcha validation
$state = EDC::validateCaptcha($data);
if (!$state) {
// Store the data into the session
EDC::storeSession($data, 'NEW_POST_TOKEN');
// Set error message
EDC::setMessageQueue(JText::_('COM_EASYDISCUSS_INVALID_CAPTCHA'), DISCUSS_QUEUE_ERROR);
if ($isNew) {
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=ask', false));
} else {
$app->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=ask&id=' . $post->id, false));
}
}
$previousTags = array();
if (!$isNew) {
//check if admin or is owner before allowing edit.
$isMine = DiscussHelper::isMine($post->user_id);
$isAdmin = DiscussHelper::isSiteAdmin();
$isEditor = $acl->allowed('edit_question');
if (!$my->id && !$isMine && !$isAdmin && !$isEditor) {
DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_NO_PERMISSION_TO_PERFORM_THE_REQUESTED_ACTION'), DISCUSS_QUEUE_ERROR);
$this->setRedirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=post&id=' . $id, false));
return;
}
// If this is an edited post, we need to remove existing tags and add them back again.
$postsTagsModel = $this->getModel('PostsTags');
$tmppreviousTags = $postsTagsModel->getPostTags($id);
if (!empty($tmppreviousTags)) {
foreach ($tmppreviousTags as $previoustag) {
$previousTags[] = $previoustag->id;
}
}
if ($acl->allowed('add_tag', '0')) {
$postsTagsModel->deletePostTag($id);
}
}
// Get raw content from request as we may need to respect the html codes.
$content = JRequest::getVar('dc_reply_content', '', 'post', 'none', JREQUEST_ALLOWRAW);
if (empty($content)) {
// if there is no content from component, get from module quick question
$content = JRequest::getVar('quick_question_reply_content', '', 'post', 'none', JREQUEST_ALLOWRAW);
}
// some joomla editor htmlentity the content before it send to server. so we need
// to do the god job to fix the content.
$content = DiscussHelper::getHelper('String ')->unhtmlentities($content);
// Ensure that the posted content is respecting the correct values.
$data['dc_reply_content'] = $content;
// Cleanup alias.
$alias = DiscussHelper::wordFilter($data['title']);
$data['alias'] = DiscussHelper::getAlias($alias, 'post', $post->id);
// Detect the poster type.
//.........这里部分代码省略.........