本文整理汇总了PHP中FRoute::apps方法的典型用法代码示例。如果您正苦于以下问题:PHP FRoute::apps方法的具体用法?PHP FRoute::apps怎么用?PHP FRoute::apps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FRoute
的用法示例。
在下文中一共展示了FRoute::apps方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($uid = null, $docType = null)
{
$event = FD::event($uid);
// Get the article item
$news = FD::table('EventNews');
$news->load($this->input->get('newsId', 0, 'int'));
// Check if the user is really allowed to view this item
if (!$event->canViewItem()) {
return $this->redirect($event->getPermalink(false));
}
// Get the author of the article
$author = FD::user($news->created_by);
// Get the url for the article
$url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $event->getAlias(), 'type' => SOCIAL_TYPE_EVENT, 'id' => $this->app->getAlias(), 'articleId' => $news->id), false);
// Apply comments for the article
$comments = FD::comments($news->id, 'news', 'create', SOCIAL_APPS_GROUP_EVENT, array('url' => $url));
// Apply likes for the article
$likes = FD::likes()->get($news->id, 'news', 'create', SOCIAL_APPS_GROUP_EVENT);
// Set the page title
FD::page()->title($news->get('title'));
// Retrieve the params
$params = $this->app->getParams();
$this->set('app', $this->app);
$this->set('params', $params);
$this->set('event', $event);
$this->set('likes', $likes);
$this->set('comments', $comments);
$this->set('author', $author);
$this->set('news', $news);
echo parent::display('canvas/item');
}
示例2: format
public function format(&$notes)
{
if (!$notes) {
return;
}
// Since this is the dashboard view, we may freely use the current user.
$my = FD::user();
$stream = FD::stream();
foreach ($notes as &$note) {
$comments = FD::comments($note->id, 'notes', 'create', SOCIAL_APPS_GROUP_USER, array('url' => FRoute::apps(array('layout' => 'canvas', 'userid' => $my->getAlias(), 'cid' => $note->id))));
$likes = FD::likes($note->id, 'notes', 'create', SOCIAL_APPS_GROUP_USER);
$options = array('comments' => $comments, 'likes' => $likes);
$note->actions = $stream->getActions($options);
}
}
示例3: display
/**
* Displays the application output in the canvas.
*
* @since 1.0
* @access public
* @param int The user id that is currently being viewed.
*/
public function display($uid = null, $docType = null)
{
FD::requireLogin();
$event = FD::event($uid);
if (!$event->canViewItem()) {
return $this->redirect($event->getPermalink(false));
}
// Load up the app params
$params = $this->app->getParams();
// Get the discussion item
$id = $this->input->get('discussionId', 0, 'int');
$discussion = FD::table('Discussion');
$discussion->load($id);
// Get the author of the article
$author = FD::user($discussion->created_by);
// Get the url for the article
$url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $event->getAlias(), 'type' => SOCIAL_TYPE_EVENT, 'id' => $this->app->getAlias(), 'discussionId' => $discussion->id), false);
// Set the page title
FD::page()->title($discussion->get('title'));
// Increment the hits for this discussion item
$discussion->addHit();
// Get a list of other news
$model = FD::model('Discussions');
$replies = $model->getReplies($discussion->id, array('ordering' => 'created'));
$participants = $model->getParticipants($discussion->id);
// Get the answer
$answer = false;
if ($discussion->answer_id) {
$answer = FD::table('Discussion');
$answer->load($discussion->answer_id);
$answer->author = FD::user($answer->created_by);
}
// Determines if we should allow file sharing
$access = $event->getAccess();
$files = $access->get('files.enabled', true);
$this->set('app', $this->app);
$this->set('files', $files);
$this->set('params', $params);
$this->set('answer', $answer);
$this->set('participants', $participants);
$this->set('discussion', $discussion);
$this->set('event', $event);
$this->set('replies', $replies);
$this->set('author', $author);
echo parent::display('canvas/item');
}
示例4: save
/**
* Retrieves the new article form
*
* @since 1.2
* @access public
* @return
*/
public function save()
{
// Check for request forgeriess
FD::checkToken();
// Ensure that the user is logged in.
FD::requireLogin();
// Determines if this is an edited news.
$id = $this->input->get('newsId', 0, 'int');
// Load up the news obj
$news = FD::table('EventNews');
$news->load($id);
// Determine the message to display
$message = !$news->id ? JText::_('APP_EVENT_NEWS_CREATED_SUCCESSFULLY') : JText::_('APP_EVENT_NEWS_UPDATED_SUCCESSFULLY');
// Load the event object
$event = FD::event($this->input->get('cluster_id', 0, 'int'));
if (!$event) {
return $this->redirect($event->getPermalink(false));
}
// Get the app id
$app = $this->getApp();
if (!$event->isAdmin()) {
$url = FRoute::events($event->getPermalink(false));
return $this->redirect($url);
}
$options = array();
$options['title'] = $this->input->get('title', '', 'default');
$options['content'] = $this->input->get('news_content', '', 'raw');
$options['comments'] = $this->input->get('comments', true, 'bool');
$options['state'] = SOCIAL_STATE_PUBLISHED;
// Only bind this if it's a new item
if (!$news->id) {
$options['cluster_id'] = $event->id;
$options['created_by'] = $this->my->id;
$options['hits'] = 0;
}
// Bind the data
$news->bind($options);
// Check if there are any errors
if (!$news->check()) {
FD::info()->set($news->getError(), SOCIAL_MSG_ERROR);
$url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'form', 'uid' => $event->getAlias(), 'type' => SOCIAL_TYPE_EVENT, 'id' => $app->getAlias()), false);
return $this->redirect($url);
}
// If everything is okay, bind the data.
$news->store();
// If it is a new item, we want to run some other stuffs here.
if (!$id) {
// @points: events.news.create
// Add points to the user that updated the event
$points = FD::points();
$points->assign('events.news.create', 'com_easysocial', $this->my->id);
}
// Redirect to the appropriate page now
$url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $event->getAlias(), 'type' => SOCIAL_TYPE_EVENT, 'id' => $app->getAlias(), 'newsId' => $news->id), false);
$app = $this->getApp();
$permalink = $app->getPermalink('canvas', array('customView' => 'item', 'eventId' => $event->id, 'newsId' => $news->id));
// Notify users about the news.
$options = array('userId' => $this->my->id, 'permalink' => $permalink, 'newsId' => $news->id, 'newsTitle' => $news->title, 'newsContent' => strip_tags($news->content));
$event->notifyMembers('news.create', $options);
FD::info()->set($message, SOCIAL_MSG_SUCCESS);
// Perform a redirection
$this->redirect($url);
}
示例5: submit
/**
* Submits a reply
*
* @since 1.2
* @access public
* @return
*/
public function submit()
{
// Check for request forgeriess
FD::checkToken();
// Ensure that the user is logged in.
FD::requireLogin();
// Load up ajax lib
$ajax = FD::ajax();
// Get the group
$groupId = JRequest::getInt('groupId');
$group = FD::group($groupId);
// Get the discussion
$id = JRequest::getInt('id');
$discussion = FD::table('Discussion');
$discussion->load($id);
// Get the current user
$my = FD::user();
// Check whether the viewer can really reply to the discussion
if (!$group->isMember()) {
return $this->reject();
}
// Test for locked discussion.
if ($discussion->lock && !$group->isAdmin()) {
$obj = new stdClass();
$obj->message = JText::_('APP_GROUP_DISCUSSIONS_DISCUSSION_IS_LOCKED');
$obj->type = SOCIAL_MSG_ERROR;
return $ajax->reject($obj);
}
// Get the content
// $content = JRequest::getVar( 'content' , '' );
$content = JRequest::getVar('content', '', 'post', 'none', JREQUEST_ALLOWRAW);
if (empty($content)) {
$obj = new stdClass();
$obj->message = JText::_('APP_GROUP_DISCUSSIONS_EMPTY_REPLY_ERROR');
$obj->type = SOCIAL_MSG_ERROR;
return $ajax->reject($obj);
}
$reply = FD::table('Discussion');
$reply->uid = $discussion->uid;
$reply->type = $discussion->type;
$reply->content = $content;
$reply->created_by = $my->id;
$reply->parent_id = $discussion->id;
$reply->state = SOCIAL_STATE_PUBLISHED;
// Save the reply.
$reply->store();
if (!$id) {
// @points: groups.discussion.reply
// Earn points when posting a reply
$points = FD::points();
$points->assign('groups.discussion.reply', 'com_easysocial', $reply->created_by);
}
// Create a new stream item for this discussion
$stream = FD::stream();
// Get the stream template
$tpl = $stream->getTemplate();
// Someone just joined the group
$tpl->setActor($my->id, SOCIAL_TYPE_USER);
// Set the context
$tpl->setContext($discussion->id, 'discussions');
// Set the cluster
$tpl->setCluster($group->id, SOCIAL_TYPE_GROUP, $group->type);
// Set the verb
$tpl->setVerb('reply');
// Set the params to cache the group data
$registry = FD::registry();
$registry->set('group', $group);
$registry->set('reply', $reply);
$registry->set('discussion', $discussion);
$tpl->setParams($registry);
$tpl->setAccess('core.view');
// Add the stream
$stream->add($tpl);
// Update the parent's reply counter.
$discussion->sync($reply);
// Before we populate the output, we need to format it according to the theme's specs.
$reply->author = $my;
// Load the contents
$theme = FD::themes();
// Since this reply is new, we don't have an answer for this item.
$answer = false;
$theme->set('question', $discussion);
$theme->set('group', $group);
$theme->set('answer', $answer);
$theme->set('reply', $reply);
$contents = $theme->output('apps/group/discussions/canvas/item.reply');
// Send notification to group members
$options = array();
$options['permalink'] = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $this->getApp()->getAlias(), 'discussionId' => $discussion->id, 'external' => true), false);
$options['title'] = $discussion->title;
$options['content'] = $reply->getContent();
$options['discussionId'] = $reply->id;
$options['userId'] = $reply->created_by;
//.........这里部分代码省略.........
示例6: save
/**
* Creates a new discussion
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function save()
{
// Check for request forgeriess
FD::checkToken();
// Ensure that the user is logged in.
FD::requireLogin();
// Load up ajax lib
$ajax = FD::ajax();
// Load the discussion
$id = JRequest::getInt('id');
$discussion = FD::table('Discussion');
$discussion->load($id);
// Get the current logged in user.
$my = FD::user();
// Get the group
$groupId = JRequest::getInt('cluster_id', 0);
$group = FD::group($groupId);
// Only allow owner and admin to modify the
if ($discussion->id) {
if ($discussion->created_by != $my->id && !$group->isAdmin() && !$my->isSiteAdmin()) {
return $this->redirect($group->getPermalink(false));
}
}
// Check if the user is allowed to create a discussion
if (!$group->isMember()) {
FD::info()->set(JText::_('APP_GROUP_DISCUSSIONS_NOT_ALLOWED_CREATE'), SOCIAL_MSG_ERROR);
// Perform a redirection
return JFactory::getApplication()->redirect(FRoute::dashboard());
}
// Assign discussion properties
$discussion->uid = $group->id;
$discussion->type = SOCIAL_TYPE_GROUP;
$discussion->title = JRequest::getVar('title', '');
$discussion->content = JRequest::getVar('content', '', 'POST', 'none', JREQUEST_ALLOWRAW);
// If discussion is edited, we don't want to modify the following items
if (!$discussion->id) {
$discussion->created_by = $my->id;
$discussion->parent_id = 0;
$discussion->hits = 0;
$discussion->state = SOCIAL_STATE_PUBLISHED;
$discussion->votes = 0;
$discussion->lock = false;
}
$app = $this->getApp();
// Ensure that the title is valid
if (!$discussion->title) {
Foundry::info()->set(JText::_('APP_GROUP_DISCUSSIONS_INVALID_TITLE'), SOCIAL_MSG_ERROR);
// Get the redirection url
$url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'create', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias()), false);
return $this->redirect($url);
}
// Lock the discussion
$state = $discussion->store();
if (!$state) {
FD::info()->set(JText::_('APP_GROUP_DISCUSSIONS_DISCUSSION_CREATED_FAILED'));
// Get the redirection url
$url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'form', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias()), false);
return $this->redirect($url);
}
// Process any files that needs to be created.
$discussion->mapFiles();
// Get the app
$app = $this->getApp();
// If it is a new discussion, we want to run some other stuffs here.
if (!$id) {
// @points: groups.discussion.create
// Add points to the user that updated the group
$points = FD::points();
$points->assign('groups.discussion.create', 'com_easysocial', $my->id);
// Create a new stream item for this discussion
$stream = FD::stream();
// Get the stream template
$tpl = $stream->getTemplate();
// Someone just joined the group
$tpl->setActor($my->id, SOCIAL_TYPE_USER);
// Set the context
$tpl->setContext($discussion->id, 'discussions');
// Set the cluster
$tpl->setCluster($group->id, SOCIAL_TYPE_GROUP, $group->type);
// Set the verb
$tpl->setVerb('create');
// Set the params to cache the group data
$registry = FD::registry();
$registry->set('group', $group);
$registry->set('discussion', $discussion);
$tpl->setParams($registry);
$tpl->setAccess('core.view');
// Add the stream
$stream->add($tpl);
// Set info message
FD::info()->set(false, JText::_('APP_GROUP_DISCUSSIONS_DISCUSSION_CREATED_SUCCESS'), SOCIAL_MSG_SUCCESS);
// Send notification to group members only if it is new discussion
//.........这里部分代码省略.........
示例7:
echo JText::_('APP_GROUP_DISCUSSIONS_REPLIES');
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
?>
<div class="media-body">
<h3>
<a href="<?php
echo FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias(), 'discussionId' => $discussion->id), false);
?>
">
<?php
echo $discussion->get('title');
?>
</a>
<span class="label label-success label-resolved"><?php
echo JText::_('APP_GROUP_DISCUSSIONS_RESOLVED');
?>
</span>
<span class="label label-warning label-locked"><i class="ies-locked locked-icon"></i> <?php
echo JText::_('APP_GROUP_DISCUSSIONS_LOCKED');
?>
</span>
<span class="label label-danger label-unanswered"><?php
示例8:
">
<?php
echo JText::_('COM_EASYSOCIAL_TOOLBAR_PROFILE_POINTS_HISTORY');
?>
</a>
</li>
<?php
}
?>
<li class="<?php
echo $view == 'apps' ? 'active' : '';
?>
">
<a href="<?php
echo FRoute::apps();
?>
">
<?php
echo JText::_('COM_EASYSOCIAL_TOOLBAR_APPS');
?>
</a>
</li>
<li class="<?php
echo $view == 'activities' ? 'active' : '';
?>
">
<a href="<?php
echo FRoute::activities();
?>
">
示例9:
data-original-title="<?php
echo JText::_('COM_EASYSOCIAL_APPS_SORT_RECENT_ADDED', true);
?>
"
>
<i class="ies-upload-2 ies-small"></i>
</a>
<a class="btn btn-es trending<?php
echo $sort == 'trending' ? ' active' : '';
?>
"
data-apps-sort
data-apps-sort-type="trending"
data-apps-sort-group="user"
data-apps-sort-url="<?php
echo FRoute::apps(array('sort' => 'trending'));
?>
"
data-es-provide="tooltip"
data-placement="bottom"
data-original-title="<?php
echo JText::_('COM_EASYSOCIAL_APPS_SORT_TRENDING_APPS', true);
?>
"
>
<i class="ies-fire ies-small"></i>
</a>
</div>
<?php
}
?>
示例10: defined
* EasySocial is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
defined('_JEXEC') or die('Unauthorized Access');
?>
<li class="note-item" data-apps-notes-item data-id="<?php
echo $note->id;
?>
">
<div class="row">
<div class="col-md-12">
<a href="<?php
echo FRoute::apps(array('layout' => 'canvas', 'id' => $appId, 'cid' => $note->id, 'userid' => $user->getAlias()));
?>
" class="note-title pull-left"><?php
echo $note->title;
?>
</a>
<div class="pull-right btn-group">
<a href="javascript:void(0);" data-bs-toggle="dropdown" class="dropdown-toggle_ loginLink btn btn-dropdown">
<i class="icon-es-dropdown"></i>
</a>
<ul class="dropdown-menu dropdown-menu-user messageDropDown">
<li>
<a href="javascript:void(0);" data-apps-notes-edit>
<?php
echo JText::_('APP_NOTES_EDIT_BUTTON');
示例11: foreach
foreach ($apps as $app) {
?>
<li class="app-item<?php
echo $appId == $app->id ? ' active' : '';
?>
"
data-id="<?php
echo $app->id;
?>
"
data-layout="<?php
echo $app->getViews('dashboard')->type;
?>
"
data-canvas-url="<?php
echo FRoute::apps(array('id' => $app->getAlias(), 'layout' => 'canvas'));
?>
"
data-embed-url="<?php
echo FRoute::dashboard(array('appId' => $app->getAlias()));
?>
"
data-title="<?php
echo $this->html('string.escape', $user->getName()) . ' - ' . $app->get('title');
?>
"
data-dashboardSidebar-menu
data-dashboardApps-item>
<a href="javascript:void(0);">
<img src="<?php
echo $app->getIcon();
示例12: getCanvasUrl
/**
* Retrieves the canvas url
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function getCanvasUrl($options = array(), $xhtml = true)
{
$default = array('layout' => 'canvas', 'id' => $this->getAlias());
$options = array_merge($default, $options);
$url = FRoute::apps($options, $xhtml);
return $url;
}
示例13:
}
?>
</div>
</div>
<div class="col-md-3 discussion-meta">
<?php
if ($group->isMember()) {
?>
<div class="mt-5">
<a href="<?php
echo FRoute::apps(array('layout' => 'canvas', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias(), 'customView' => 'create'));
?>
"
class="btn btn-es-primary btn-create"><i class="ies-pencil"></i> <?php
echo JText::_('APP_GROUP_DISCUSSIONS_CREATE_DISCUSSION');
?>
→</a>
</div>
<?php
}
?>
<?php
if ($params->get('stats_sidebar', true)) {
?>
<div class="stats">
示例14: createStream
public function createStream($discussion, $group, $reply, $log_user)
{
// Create a new stream item for this discussion
$stream = FD::stream();
$my = FD::user($log_user);
// Get the stream template
$tpl = $stream->getTemplate();
// Someone just joined the group
$tpl->setActor($log_user, SOCIAL_TYPE_USER);
// Set the context
$tpl->setContext($discussion->id, 'discussions');
// Set the cluster
$tpl->setCluster($group->id, SOCIAL_TYPE_GROUP, $group->type);
// Set the verb
$tpl->setVerb('reply');
// Set the params to cache the group data
$registry = FD::registry();
$registry->set('group', $group);
$registry->set('reply', $reply);
$registry->set('discussion', $discussion);
$tpl->setParams($registry);
$tpl->setAccess('core.view');
// Add the stream
$stream->add($tpl);
// Update the parent's reply counter.
$discussion->sync($reply);
// Before we populate the output, we need to format it according to the theme's specs.
$reply->author = $my;
// Load the contents
$theme = FD::themes();
// Since this reply is new, we don't have an answer for this item.
$answer = false;
$theme->set('question', $discussion);
$theme->set('group', $group);
$theme->set('answer', $answer);
$theme->set('reply', $reply);
// $contents = $theme->output( 'apps/group/discussions/canvas/item.reply' );
// Send notification to group members
$options = array();
//$options[ 'permalink' ] = FRoute::apps( array( 'layout' => 'canvas' , 'customView' => 'item' , 'uid' => $group->getAlias() , 'type' => SOCIAL_TYPE_GROUP , 'id' => $this->getApp()->getAlias() , 'discussionId' => $discussion->id , 'external' => true ) , false );
$options['permalink'] = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $group->id, 'discussionId' => $discussion->id, 'external' => true), false);
$options['title'] = $discussion->title;
$options['content'] = $reply->getContent();
$options['discussionId'] = $reply->id;
$options['userId'] = $reply->created_by;
$options['targets'] = $discussion->getParticipants(array($reply->created_by));
return $group->notifyMembers('discussion.reply', $options);
}
示例15:
<?php
echo $milestone->title;
?>
</h3>
<?php
if ($group->isAdmin()) {
?>
<span class="btn-group pull-right">
<a href="javascript:void(0);" data-bs-toggle="dropdown" class="dropdown-toggle_ btn btn-dropdown">
<i class="icon-es-dropdown"></i>
</a>
<ul class="dropdown-menu">
<li>
<a href="<?php
echo FRoute::apps(array('layout' => 'canvas', 'customView' => 'form', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias(), 'milestoneId' => $milestone->id), false);
?>
"><?php
echo JText::_('APP_GROUP_TASKS_MILESTONE_EDIT');
?>
</a>
</li>
<li class="mark-uncomplete">
<a href="javascript:void(0);" data-milestone-mark-uncomplete><?php
echo JText::_('APP_GROUP_TASKS_MILESTONE_MARK_UNCOMPLETED');
?>
</a>
</li>
<li class="mark-completed">
<a href="javascript:void(0);" data-milestone-mark-complete><?php