_setBreadcrumbs() публичный Метод

public _setBreadcrumbs ( $Name = null, $Url = null )
Пример #1
0
 /**
  *
  *
  * @param ProfileController $Sender
  * @param type $UserReference
  * @param type $Username
  * @param type $Code
  */
 public function profileController_FacebookConnect_create($Sender, $UserReference, $Username, $Code = false)
 {
     $Sender->permission('Garden.SignIn.Allow');
     $Sender->getUserInfo($UserReference, $Username, '', true);
     $Sender->_setBreadcrumbs(t('Connections'), '/profile/connections');
     // Get the access token.
     $AccessToken = $this->getAccessToken($Code, self::profileConnecUrl());
     // Get the profile.
     $Profile = $this->getProfile($AccessToken);
     // Save the authentication.
     Gdn::userModel()->saveAuthentication(array('UserID' => $Sender->User->UserID, 'Provider' => self::ProviderKey, 'UniqueID' => $Profile['id']));
     // Save the information as attributes.
     $Attributes = array('AccessToken' => $AccessToken, 'Profile' => $Profile);
     Gdn::userModel()->saveAttribute($Sender->User->UserID, self::ProviderKey, $Attributes);
     $this->EventArguments['Provider'] = self::ProviderKey;
     $this->EventArguments['User'] = $Sender->User;
     $this->fireEvent('AfterConnection');
     redirect(userUrl($Sender->User, '', 'connections'));
 }
Пример #2
0
 /**
  * Creates virtual 'Discussions' method in ProfileController.
  *
  * @since 2.0.0
  * @package Vanilla
  *
  * @param ProfileController $Sender ProfileController.
  */
 public function profileController_discussions_create($Sender, $UserReference = '', $Username = '', $Page = '', $UserID = '')
 {
     $Sender->editMode(false);
     // Tell the ProfileController what tab to load
     $Sender->getUserInfo($UserReference, $Username, $UserID);
     $Sender->_setBreadcrumbs(t('Discussions'), userUrl($Sender->User, '', 'discussions'));
     $Sender->setTabView('Discussions', 'Profile', 'Discussions', 'Vanilla');
     $Sender->CountCommentsPerPage = c('Vanilla.Comments.PerPage', 30);
     list($Offset, $Limit) = offsetLimit($Page, c('Vanilla.Discussions.PerPage', 30));
     $DiscussionModel = new DiscussionModel();
     $Discussions = $DiscussionModel->getByUser($Sender->User->UserID, $Limit, $Offset, false, Gdn::session()->UserID);
     $CountDiscussions = $Offset + $DiscussionModel->LastDiscussionCount + 1;
     $Sender->DiscussionData = $Sender->setData('Discussions', $Discussions);
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $Sender->Pager = $PagerFactory->getPager('MorePager', $Sender);
     $Sender->Pager->MoreCode = 'More Discussions';
     $Sender->Pager->LessCode = 'Newer Discussions';
     $Sender->Pager->ClientID = 'Pager';
     $Sender->Pager->configure($Offset, $Limit, $CountDiscussions, userUrl($Sender->User, '', 'discussions') . '?page={Page}');
     // Deliver JSON data if necessary
     if ($Sender->deliveryType() != DELIVERY_TYPE_ALL && $Offset > 0) {
         $Sender->setJson('LessRow', $Sender->Pager->toString('less'));
         $Sender->setJson('MoreRow', $Sender->Pager->toString('more'));
         $Sender->View = 'discussions';
     }
     // Set the HandlerType back to normal on the profilecontroller so that it fetches it's own views
     $Sender->HandlerType = HANDLER_TYPE_NORMAL;
     // Do not show discussion options
     $Sender->ShowOptions = false;
     if ($Sender->Head) {
         // These pages offer only duplicate content to search engines and are a bit slow.
         $Sender->Head->addTag('meta', array('name' => 'robots', 'content' => 'noindex,noarchive'));
     }
     // Render the ProfileController
     $Sender->render();
 }