当前位置: 首页>>代码示例>>PHP>>正文


PHP FRoute类代码示例

本文整理汇总了PHP中FRoute的典型用法代码示例。如果您正苦于以下问题:PHP FRoute类的具体用法?PHP FRoute怎么用?PHP FRoute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FRoute类的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');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:38,代码来源:view.html.php

示例2: revoke

 /**
  * Post processing once a user's access has been revoked
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function revoke()
 {
     FD::info()->set($this->getMessage());
     $url = FRoute::profile(array('layout' => 'edit'), false);
     $this->redirect($url);
     $this->close();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:15,代码来源:view.html.php

示例3: 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;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:39,代码来源:toolbar.php

示例4: 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');
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:41,代码来源:view.html.php

示例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();
     // 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();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:35,代码来源:view.html.php

示例6: 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);
         }
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:34,代码来源:view.feed.php

示例7: 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();
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:34,代码来源:view.html.php

示例8: create_report

 public function create_report()
 {
     $app = JFactory::getApplication();
     $msg = $app->input->get('message', '', 'STRING');
     $title = $app->input->get('user_title', '', 'STRING');
     $item_id = $app->input->get('itemId', 0, 'INT');
     $log_user = $this->plugin->get('user')->id;
     $data = array();
     $data['message'] = $msg;
     $data['uid'] = $item_id;
     $data['type'] = 'stream';
     $data['title'] = $title;
     $data['extension'] = 'com_easysocial';
     //build share url use for share post through app
     $sharing = FD::get('Sharing', array('url' => FRoute::stream(array('layout' => 'item', 'id' => $item_id, 'external' => true, 'xhtml' => true)), 'display' => 'dialog', 'text' => JText::_('COM_EASYSOCIAL_STREAM_SOCIAL'), 'css' => 'fd-small'));
     $url = $sharing->url;
     $data['url'] = $url;
     // Get the reports model
     $model = FD::model('Reports');
     // Determine if this user has the permissions to submit reports.
     $access = FD::access();
     // Determine if this user has exceeded the number of reports that they can submit
     $total = $model->getCount(array('created_by' => $log_user));
     if ($access->exceeded('reports.limit', $total)) {
         $final_result['message'] = "Limit exceeds";
         $final_result['status'] = true;
         return $final_result;
     }
     // Create the report
     $report = FD::table('Report');
     $report->bind($data);
     // Set the creator id.
     $report->created_by = $log_user;
     // Set the default state of the report to new
     $report->state = 0;
     // Try to store the report.
     $state = $report->store();
     // If there's an error, throw it
     if (!$state) {
         $final_result['message'] = "Can't save report";
         $final_result['status'] = true;
         return $final_result;
     }
     // @badge: reports.create
     // Add badge for the author when a report is created.
     $badge = FD::badges();
     $badge->log('com_easysocial', 'reports.create', $log_user, JText::_('COM_EASYSOCIAL_REPORTS_BADGE_CREATED_REPORT'));
     // @points: reports.create
     // Add points for the author when a report is created.
     $points = FD::points();
     $points->assign('reports.create', 'com_easysocial', $log_user);
     // Determine if we should send an email
     $config = FD::config();
     if ($config->get('reports.notifications.moderators')) {
         $report->notify();
     }
     $final_result['message'] = "Report logged successfully!";
     $final_result['status'] = true;
     return $final_result;
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:60,代码来源:report.php

示例9: onDisplay

 /**
  * Responsible to output the html codes that is displayed to
  * a user when their profile is viewed.
  *
  * @since	1.0
  * @access	public
  */
 public function onDisplay($user)
 {
     $value = $this->value;
     if (!$value) {
         return;
     }
     if (!$this->allowedPrivacy($user)) {
         return;
     }
     // If there's no http:// or https:// , automatically append http://
     if (stristr($value, 'http://') === false && stristr($value, 'https://') === false) {
         $value = 'http://' . $value;
     }
     // Push vars to the theme
     $this->set('value', $this->escape($value));
     // linkage to advanced search page.
     $field = $this->field;
     if ($field->searchable) {
         $params = array('layout' => 'advanced');
         $params['criterias[]'] = $field->unique_key . '|' . $field->element;
         $params['operators[]'] = 'contain';
         $params['conditions[]'] = $this->escape($this->value);
         $advsearchLink = FRoute::search($params);
         $this->set('advancedsearchlink', $advsearchLink);
     }
     return $this->display();
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:34,代码来源:url.php

示例10: getTitle

 /**
  * Retrieve the title of the stream
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function getTitle()
 {
     // Get the actors
     $actors = $this->item->actors;
     // Get the source id
     $sourceId = $this->share->uid;
     // Load the stream
     $stream = FD::table('Stream');
     $stream->load($sourceId);
     // If stream cannot be loaded, skip this altogether
     if (!$stream->id) {
         return;
     }
     // Build the permalink to the stream item
     $link = FRoute::stream(array('layout' => 'item', 'id' => $sourceId));
     // Get the target user.
     $target = FD::user($stream->actor_id);
     $actor = $actors[0];
     $theme = FD::get('Themes');
     $theme->set('actor', $actor);
     $theme->set('link', $link);
     $theme->set('target', $target);
     $title = $theme->output('apps/group/shares/streams/stream/title');
     return $title;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:33,代码来源:stream.php

示例11: getRegistrationURL

 public function getRegistrationURL()
 {
     $usersConfig = JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration')) {
         return FRoute::registration();
     }
     return null;
 }
开发者ID:Ruud68,项目名称:Kunena-Forum,代码行数:8,代码来源:login.php

示例12: afterCategory

 /**
  * Display user photos on the side bar
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function afterCategory($group)
 {
     $app = $this->getApp();
     $permalink = FRoute::groups(array('layout' => 'item', 'id' => $group->getAlias(), 'appId' => $app->getAlias()));
     $theme = FD::themes();
     $theme->set('permalink', $permalink);
     $theme->set('group', $group);
     echo $theme->output('themes:/apps/group/members/widgets/header');
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:17,代码来源:view.html.php

示例13: 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);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:55,代码来源:view.ajax.php

示例14: 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();
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:15,代码来源:file.php

示例15: 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);
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:15,代码来源:view.html.php


注:本文中的FRoute类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。