Exemplo n.º 1
0
 /**
  * This method shows the highest scoring discussions/comments a user has ever posted
  *
  * @param ProfileController $Sender
  * @param int $UserReference
  * @param string $Username
  * @param int $Page
  */
 public function ProfileController_Best_Create($Sender, $UserReference = '', $Username = '', $Page = 0)
 {
     if (!C('Yaga.Reactions.Enabled')) {
         return;
     }
     list($Offset, $Limit) = OffsetLimit($Page, C('Yaga.BestContent.PerPage', 10));
     if (!is_numeric($Offset) || $Offset < 0) {
         $Offset = 0;
     }
     $Sender->EditMode(FALSE);
     // Tell the ProfileController what tab to load
     $Sender->GetUserInfo($UserReference, $Username);
     $Sender->_SetBreadcrumbs(T('Yaga.BestContent'), UserUrl($Sender->User, '', 'best'));
     $Sender->SetTabView(T('Yaga.BestContent'), 'best', 'profile', 'Yaga');
     $Sender->AddJsFile('jquery.expander.js');
     $Sender->AddJsFile('reactions.js', 'yaga');
     $Sender->AddDefinition('ExpandText', T('(more)'));
     $Sender->AddDefinition('CollapseText', T('(less)'));
     $Model = new ActedModel();
     $Data = $Model->GetBest($Sender->User->UserID, $Limit, $Offset);
     $Sender->SetData('Content', $Data);
     // 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) {
         $Sender->Head->AddTag('meta', array('name' => 'robots', 'content' => 'noindex,noarchive'));
     }
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $Sender->Pager = $PagerFactory->GetPager('Pager', $Sender);
     $Sender->Pager->ClientID = 'Pager';
     $Sender->Pager->Configure($Offset, $Limit, FALSE, 'profile/best/' . $Sender->User->UserID . '/' . Gdn_Format::Url($Sender->User->Name) . '/%1$s/');
     // Render the ProfileController
     $Sender->Render();
 }