本文整理汇总了PHP中FRoute::dashboard方法的典型用法代码示例。如果您正苦于以下问题:PHP FRoute::dashboard方法的具体用法?PHP FRoute::dashboard怎么用?PHP FRoute::dashboard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FRoute
的用法示例。
在下文中一共展示了FRoute::dashboard方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRedirectionUrl
/**
* Retrieves the redirection url for sign in / sign out.
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function getRedirectionUrl($menuId)
{
$menu = JFactory::getApplication()->getMenu();
$menuItem = $menu->getItem($menuId);
// Set the default return URL.
$return = FRoute::dashboard(array(), false);
if ($menuItem) {
if ($menuItem->component != 'com_easysocial') {
if (strpos($menuItem->link, '?') > 0) {
$return = JRoute::_($menuItem->link . '&Itemid=' . $menuItem->id, false);
} else {
$return = JRoute::_($menuItem->link . '?Itemid=' . $menuItem->id, false);
}
// If the logout return is null, it means the menu item is on the home page.
if (!$return || isset($menuItem->home) && $menuItem->home) {
$return = JURI::root();
}
}
if ($menuItem->component == 'com_easysocial') {
$view = isset($menuItem->query['view']) ? $menuItem->query['view'] : '';
if ($view) {
$queries = $menuItem->query;
unset($queries['option']);
unset($queries['view']);
$arguments = array($queries, false);
$return = call_user_func_array(array('FRoute', $view), $arguments);
}
}
}
return $return;
}
示例2: route
/**
* Redirects a notification item to the intended location
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function route()
{
// The user needs to be logged in to access notifications
FD::requireLogin();
// Get the notification id
$id = $this->input->get('id', 0, 'int');
$table = FD::table('Notification');
$table->load($id);
// Default redirection URL
$redirect = FRoute::dashboard(array(), false);
if (!$id || !$table->id) {
$this->info->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
return $this->redirect($redirect);
}
// Ensure that the viewer really owns this item
if ($table->target_id != $this->my->id) {
$this->info->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_NOT_ALLOWED'), SOCIAL_MSG_ERROR);
return $this->redirect($redirect);
}
// Mark the notification item as read
$table->markAsRead();
// Ensure that all & are replaced with &
$url = str_ireplace('&', '&', $table->url);
$redirect = FRoute::_($url, false);
$this->redirect($redirect);
$this->close();
}
示例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($userId = null, $docType = null)
{
// Require user to be logged in
FD::requireLogin();
$id = JRequest::getVar('schedule_id');
// Get the user that's being accessed.
$user = FD::user($userId);
$calendar = FD::table('Calendar');
$calendar->load($id);
if (!$calendar->id || !$id) {
FD::info()->set(false, JText::_('APP_CALENDAR_CANVAS_INVALID_SCHEDULE_ID'), SOCIAL_MSG_ERROR);
return $this->redirect(FD::profile(array('id' => $user->getAlias()), false));
}
$my = FD::user();
$privacy = FD::privacy($my->id);
$result = $privacy->validate('apps.calendar', $calendar->id, 'view', $user->id);
if (!$result) {
FD::info()->set(false, JText::_('APP_CALENDAR_NO_ACCESS'), SOCIAL_MSG_ERROR);
JFactory::getApplication()->redirect(FRoute::dashboard());
}
FD::page()->title($calendar->title);
// Render the comments and likes
$likes = FD::likes();
$likes->get($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER);
// Apply comments on the stream
$comments = FD::comments($id, 'calendar', 'create', SOCIAL_APPS_GROUP_USER, array('url' => FRoute::albums(array('layout' => 'item', 'id' => $id))));
$params = $this->app->getParams();
$this->set('params', $params);
$this->set('likes', $likes);
$this->set('comments', $comments);
$this->set('calendar', $calendar);
$this->set('user', $user);
echo parent::display('canvas/item/default');
}
示例4: display
public function display()
{
// Get the configuration objects
$config = FD::config();
$jConfig = FD::config('joomla');
// Get the stream library
$stream = FD::stream();
$stream->get();
// Get the result in an array form
$result = $stream->toArray();
// Set the document properties
$doc = JFactory::getDocument();
$doc->link = FRoute::dashboard();
FD::page()->title(JText::_('COM_EASYSOCIAL_STREAM_FEED_TITLE'));
$doc->setDescription(JText::sprintf('COM_EASYSOCIAL_STREAM_FEED_DESC', $jConfig->getValue('sitename')));
if ($result) {
$useEmail = $jConfig->getValue('feed_email');
foreach ($result as $row) {
$item = new JFeedItem();
$item->title = $row->title;
$item->link = FRoute::stream(array('id' => $row->uid));
$item->description = $row->content;
$item->date = $row->created->toMySQL();
$item->author = $row->actor->getName();
if ($useEmail != 'none') {
$item->authorEmail = $jConfig->getValue('mailfrom');
if ($useEmail == 'author') {
$item->authorEmail = $row->actor->email;
}
}
$doc->addItem($item);
}
}
}
示例5: route
/**
* Redirects a notification item to the intended location
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function route()
{
// The user needs to be logged in to access notifications
FD::requireLogin();
// Check for user profile completeness
FD::checkCompleteProfile();
$id = JRequest::getInt('id');
$table = FD::table('Notification');
$table->load($id);
if (!$id || !$table->id) {
FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
return $this->redirect(FRoute::dashboard(array(), false));
}
// Check if the user is allowed to view this notification item.
$my = FD::user();
if ($table->target_id != $my->id) {
FD::info()->set(JText::_('COM_EASYSOCIAL_NOTIFICATIONS_NOT_ALLOWED'), SOCIAL_MSG_ERROR);
return $this->redirect(FRoute::dashboard(array(), false));
}
// Mark the notification item as read
$table->markAsRead();
// Ensure that all & are replaced with &
$url = str_ireplace('&', '&', $table->url);
$this->redirect(FRoute::_($url, false));
$this->close();
}
示例6: display
/**
* Responsible to display the generic login form.
*
* @since 1.0
* @access public
*/
public function display($tpl = null)
{
$my = FD::user();
// If user is already logged in, they should not see this page.
if ($my->id > 0) {
return $this->redirect(FRoute::dashboard(array(), false));
}
// Add page title
FD::page()->title(JText::_('COM_EASYSOCIAL_LOGIN_PAGE_TITLE'));
// Add breadcrumb
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_LOGIN_PAGE_BREADCRUMB'));
// Facebook codes.
$facebook = FD::oauth('Facebook');
$config = FD::config();
$loginMenu = $config->get('general.site.login');
// Get any callback urls.
$return = FD::getCallback();
// If return value is empty, always redirect back to the dashboard
if (!$return) {
// Determine if there's a login redirection
$urlFromCaller = FD::input()->getVar('return', '');
if ($urlFromCaller) {
$return = $urlFromCaller;
} else {
if ($loginMenu != 'null') {
$return = FRoute::getMenuLink($loginMenu);
} else {
$return = FRoute::dashboard(array(), false);
}
$return = base64_encode($return);
}
} else {
$return = base64_encode($return);
}
if ($config->get('registrations.enabled')) {
$profileId = $config->get('registrations.mini.profile', 'default');
if ($profileId === 'default') {
$profileId = Foundry::model('profiles')->getDefaultProfile()->id;
}
$options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
$fieldsModel = Foundry::model('fields');
$fields = $fieldsModel->getCustomFields($options);
if (!empty($fields)) {
FD::language()->loadAdmin();
$fieldsLib = FD::fields();
$session = JFactory::getSession();
$registration = FD::table('Registration');
$registration->load($session->getId());
$data = $registration->getValues();
$args = array(&$data, &$registration);
$fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
$this->set('fields', $fields);
}
}
$this->set('return', $return);
$this->set('facebook', $facebook);
return parent::display('site/login/default');
}
示例7: checkFeature
private function checkFeature()
{
$config = FD::config();
// Do not allow user to access photos if it's not enabled
if (!$config->get('photos.enabled')) {
$this->setMessage(JText::_('COM_EASYSOCIAL_ALBUMS_PHOTOS_DISABLED'), SOCIAL_MSG_ERROR);
FD::info()->set($this->getMessage());
$this->redirect(FRoute::dashboard(array(), false));
$this->close();
}
}
示例8: form
/**
* Responsible to display the generic login form via ajax
*
* @since 1.0
* @access public
*/
public function form($tpl = null)
{
$ajax = FD::ajax();
$my = FD::user();
// If user is already logged in, they should not see this page.
if ($my->id > 0) {
$this->setMessage(JText::_('COM_EASYSOCIAL_LOGIN_ALREADY_LOGGED_IN'), SOCIAL_MSG_ERROR);
return $ajax->reject($this->getMessage());
}
// Facebook codes.
$facebook = FD::oauth('Facebook');
// Get any callback urls.
$return = FD::getCallback();
// If return value is empty, always redirect back to the dashboard
if (!$return) {
$return = FRoute::dashboard(array(), false);
}
// Determine if there's a login redirection
$config = FD::config();
$loginMenu = $config->get('general.site.login');
if ($loginMenu != 'null') {
$return = FD::get('toolbar')->getRedirectionUrl($loginMenu);
}
$return = base64_encode($return);
$this->set('return', $return);
$this->set('facebook', $facebook);
if ($config->get('registrations.enabled')) {
$profileId = $config->get('registrations.mini.profile', 'default');
if ($profileId === 'default') {
$profileId = Foundry::model('profiles')->getDefaultProfile()->id;
}
$options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
$fieldsModel = FD::model('Fields');
$fields = $fieldsModel->getCustomFields($options);
if (!empty($fields)) {
FD::language()->loadAdmin();
$fieldsLib = FD::fields();
$session = JFactory::getSession();
$registration = FD::table('Registration');
$registration->load($session->getId());
$data = $registration->getValues();
$args = array(&$data, &$registration);
$fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
$this->set('fields', $fields);
}
}
$contents = parent::display('site/login/dialog.login');
return $ajax->resolve($contents);
}
示例9: preview
public function preview()
{
$fileid = JRequest::getInt('uid');
if (empty($fileid)) {
FD::info()->set((object) array('message' => JText::_('PLG_FIELDS_FILE_ERROR_INVALID_FILE_ID'), 'type' => SOCIAL_MSG_ERROR));
$this->redirect(FRoute::dashboard(array(), false));
}
$file = FD::table('file');
$state = $file->load($fileid);
if (!$state || !$file->hasPreview() || !$this->params->get('allow_preview')) {
FD::info()->set((object) array('message' => JText::_('PLG_FIELDS_FILE_ERROR_PREVIEW_NOT_ALLOWED'), 'type' => SOCIAL_MSG_ERROR));
$this->redirect(FRoute::dashboard(array(), false));
}
$file->preview();
}
示例10: preview
/**
* Allows viewer to download a conversation file
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function preview()
{
// Check if this feature is enabled.
$this->checkFeature();
// Currently only registered users are allowed to view a file.
FD::requireLogin();
// Get the file id from the request
$fileId = JRequest::getInt('fileid', null);
$file = FD::table('File');
$file->load($fileId);
if (!$file->id || !$fileId) {
// Throw error message here.
$this->redirect(FRoute::dashboard(array(), false));
$this->close();
}
// Load up the group
$group = FD::group($file->uid);
// Ensure that the user can really view this group
if (!$group->canViewItem()) {
// Throw error message here.
$this->redirect(FRoute::dashboard(array(), false));
$this->close();
}
$file->preview();
exit;
}
示例11: getDiscussions
/**
* Retrieves the list of discussions
*
* @since 1.2
* @access public
*/
public function getDiscussions()
{
// Check for request forgeriess
FD::checkToken();
// Ensure that the user is logged in.
FD::requireLogin();
// Load the discussion
$id = $this->input->get('id', 0, 'int');
$event = FD::event($id);
// Check if the viewer can really browse discussions from this group.
if (!$event->isOpen() && !$event->getGuest()->isGuest()) {
FD::info()->set(JText::_('APP_EVENT_DISCUSSIONS_NOT_ALLOWED_VIEWING'), SOCIAL_MSG_ERROR);
// Perform a redirection
return $this->redirect(FRoute::dashboard());
}
// Get the current filter type
$filter = $this->input->get('filter', 'all', 'word');
$options = array();
if ($filter == 'unanswered') {
$options['unanswered'] = true;
}
if ($filter == 'locked') {
$options['locked'] = true;
}
if ($filter == 'resolved') {
$options['resolved'] = true;
}
// Get the current group app
$app = $this->getApp();
$params = $app->getParams();
// Get total number of discussions to display
$options['limit'] = $params->get('total', 10);
$model = FD::model('Discussions');
$discussions = $model->getDiscussions($event->id, SOCIAL_TYPE_EVENT, $options);
$pagination = $model->getPagination();
$pagination->setVar('view', 'events');
$pagination->setVar('layout', 'item');
$pagination->setVar('id', $event->getAlias());
$pagination->setVar('appId', $this->getApp()->id);
$pagination->setVar('filter', $filter);
$theme = FD::themes();
$theme->set('params', $params);
$theme->set('pagination', $pagination);
$theme->set('app', $app);
$theme->set('event', $event);
$theme->set('discussions', $discussions);
$contents = $theme->output('apps/event/discussions/events/default.list');
$empty = empty($discussions);
return $this->ajax->resolve($contents, $empty);
}
示例12: canvas
/**
* Displays the application in a main canvas layout which is the full width of the component.
* Example:
* index.php?option=com_easysocial&view=apps&layout=canvas&id=[id]&appView=[appView]
*
* @since 1.0
* @access public
* @param null
* @return null
*
*/
public function canvas()
{
// Check for user profile completeness
FD::checkCompleteProfile();
// Get the unique id of the item that is being viewed
$uid = $this->input->get('uid', null, 'int');
$type = $this->input->get('type', SOCIAL_TYPE_USER, 'word');
// Determines if the type is accessible
if (!$this->allowed($uid, $type)) {
return;
}
// Get the current app id.
$id = $this->input->get('id', 0, 'int');
// Get the current app.
$app = FD::table('App');
$state = $app->load($id);
// Default redirection url
$redirect = FRoute::dashboard(array(), false);
// Check if the user has access to this app
if (!$app->accessible($uid, $type) && $type == SOCIAL_TYPE_USER) {
$this->info->set(null, JText::_('COM_EASYSOCIAL_APPS_CANVAS_APP_IS_NOT_INSTALLED'), SOCIAL_MSG_ERROR);
return $this->redirect($redirect);
}
// If id is not provided, we need to throw some errors here.
if (!$id || !$state) {
$this->setMessage(JText::_('COM_EASYSOCIAL_APPS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
$info->set($this->getMessage());
return $this->redirect($redirect);
}
// Try to load the app's css.
$app->loadCss();
// Check if the app provides any custom view
$appView = $this->input->get('customView', 'canvas', 'default');
// We need to set the breadcrumb for the cluster type
if ($type == 'group') {
$group = FD::group($uid);
$this->page->breadcrumb($group->getName());
}
// Set the breadcrumbs with the app's title
$this->page->breadcrumb($app->get('title'));
// Load the library.
$lib = FD::apps();
$contents = $lib->renderView(SOCIAL_APPS_VIEW_TYPE_CANVAS, $appView, $app, array('uid' => $uid));
$this->set('uid', $uid);
$this->set('contents', $contents);
$template = 'site/apps/default.canvas.' . strtolower($type);
echo parent::display($template);
}
示例13: achievements
/**
* Displays a list of badges the user has achieved
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function achievements()
{
// Check for user profile completeness
FD::checkCompleteProfile();
$config = FD::config();
if (!$config->get('badges.enabled')) {
return $this->redirect(FRoute::dashboard(array(), false));
}
// Get the current user id that should be displayed
$userId = JRequest::getInt('userid', null);
$user = FD::user($userId);
// If user is not found, we need to redirect back to the dashboard page
if (!$user->id) {
return $this->redirect(FRoute::dashboard(array(), false));
}
$title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS');
if (!$user->isViewer()) {
$title = JText::sprintf('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS_USER', $user->getName());
// Let's test if the current viewer is allowed to view this user's achievements.
$my = FD::user();
$privacy = $my->getPrivacy();
$allowed = $privacy->validate('achievements.view', $user->id, SOCIAL_TYPE_USER);
if (!$allowed) {
$this->set('user', $user);
parent::display('site/badges/restricted');
return;
}
}
// Set the page title
FD::page()->title($title);
// Set the page breadcrumb
FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS'), FRoute::badges(array('userid' => $userId, 'layout' => 'achievements')));
// Load admin translations
FD::language()->loadAdmin();
// @TODO: Check for privacy
$model = FD::model('badges');
$badges = $model->getBadges($user->id);
$totalBadges = count($badges);
$this->set('totalBadges', $totalBadges);
$this->set('badges', $badges);
$this->set('user', $user);
parent::display('site/badges/achievements');
}
示例14:
<div class="row">
<div class="col-md-12">
<h3 class="pull-left">
<a href="<?php
echo FRoute::dashboard(array('layout' => 'hashtag', 'tag' => $hashtagAlias));
?>
">#<?php
echo $hashtag;
?>
</a>
</h3>
</div>
</div>
<p class="fd-small">
<?php
echo JText::sprintf('COM_EASYSOCIAL_STREAM_HASHTAG_CURRENTLY_FILTERING', '<a href="' . FRoute::dashboard(array('layout' => 'hashtag', 'tag' => $hashtagAlias)) . '">#' . $hashtag . '</a>');
?>
</p>
</div>
<hr />
<?php
}
?>
<div data-unity-real-content>
<?php
echo $stream->html(false, JText::_('COM_EASYSOCIAL_UNITY_STREAM_LOGIN_TO_VIEW'));
?>
<?php
echo $this->includeTemplate('site/dashboard/default.stream.login');
?>
示例15: oauthSignup
/**
* This is when user clicks on Create account which we will automatically register them on the site.
*
* @since 1.0
* @access public
* @param string
* @return
*/
public function oauthSignup()
{
// Load our own configuration.
$config = FD::config();
// Retrieve current view.
$view = $this->getCurrentView();
// Get the current client
$client = JRequest::getWord('client');
// Get allowed clients
$allowedClients = array_keys((array) $config->get('oauth'));
// Check for allowed clients.
if (!in_array($client, $allowedClients)) {
$view->setMessage(JText::sprintf('COM_EASYSOCIAL_OAUTH_INVALID_OAUTH_CLIENT_PROVIDED', $client), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
// Load up oauth library
$oauthClient = FD::oauth($client);
// Get the external user id.
$oauthUserId = $oauthClient->getUser();
// Determines if the oauth id is already registered on the site.
$isRegistered = $oauthClient->isRegistered();
// If user has already registered previously, just log them in.
if ($isRegistered) {
$state = $oauthClient->login();
if ($state) {
$view->setMessage('COM_EASYSOCIAL_OAUTH_AUTHENTICATED_ACCOUNT_SUCCESS', SOCIAL_MSG_SUCCESS);
}
return $view->call(__FUNCTION__);
}
// Get the access tokens.
$accessToken = $oauthClient->getAccess();
// Retrieve user's information
try {
$meta = $oauthClient->getUserMeta();
} catch (Exception $e) {
$app = JFactory::getApplication();
// Use dashboard here instead of login because api error calls might come from after user have successfully logged in
$url = FRoute::dashboard(array(), false);
$message = (object) array('message' => JText::sprintf('COM_EASYSOCIAL_OAUTH_FACEBOOK_ERROR_MESSAGE', $e->getMessage()), 'type' => SOCIAL_MSG_ERROR);
FD::info()->set($message);
$app->redirect($url);
$app->close();
}
// Get the registration type.
$registrationType = $config->get('oauth.' . $client . '.registration.type');
// Load up registration model
$model = FD::model('Registration');
// If this is a simplified registration, check if the user name exists.
if ($registrationType == 'simplified') {
// If the username or email exists
if ($model->isEmailExists($meta['email']) || $model->isUsernameExists($meta['username'])) {
return $view->call('oauthPreferences', $meta['profileId'], $meta['username'], $meta['email'], $client);
}
}
// Create user account
$user = $model->createOauthUser($accessToken, $meta, $oauthClient);
// @badge: registration.create
// Assign badge for the person that initiated the friend request.
$badge = FD::badges();
$badge->log('com_easysocial', 'registration.create', $user->id, JText::_('COM_EASYSOCIAL_REGISTRATION_BADGE_REGISTERED'));
if (!$user) {
$view->setMessage($model->getError(), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
// If the profile type is auto login, we need to log the user in
$profile = FD::table('Profile');
$profile->load($meta['profileId']);
// Check if the profile type requires activation. Only log the user in when user is supposed to automatically login.
$type = $profile->getRegistrationType(false, true);
// Send notification to admin if necessary.
$model->notifyAdmins($meta, $user, $profile, true);
JFactory::getSession()->clear('user');
// Only log the user in if the profile allows this.
if ($type == 'auto') {
// Log the user in
$oauthClient->login();
// Once the user is logged in, get the new user object.
$my = FD::user();
// @points: user.register
// Assign points when user registers on the site.
$points = FD::points();
$points->assign('user.registration', 'com_easysocial', $my->id);
// Add activity logging when a uer registers on the site.
if ($config->get('registrations.stream.create')) {
$stream = FD::stream();
$streamTemplate = $stream->getTemplate();
// Set the actor
$streamTemplate->setActor($my->id, SOCIAL_TYPE_USER);
// Set the context
$streamTemplate->setContext($my->id, SOCIAL_TYPE_PROFILES);
// Set the verb
$streamTemplate->setVerb('register');
//.........这里部分代码省略.........