Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- public function ProfileController_Stars_Create($Sender, $UserReference = '', $Username = '', $Page = '', $UserID = '')
- {
- $Sender->EditMode(FALSE);
- // Tell the ProfileController what tab to load
- $Sender->GetUserInfo($UserReference, $Username, $UserID);
- $Sender->_SetBreadcrumbs(T('Stars'), '/profile/stars');
- $MyView = $this->GetView('profile.php');
- $Sender->SetTabView(T('Stars'), $MyView); //$Sender->SetTabView('Stars', 'Profile', $MyView, 'Vanilla');
- $Sender->CountCommentsPerPage = C('Vanilla.Comments.PerPage', 30);
- list($Offset, $Limit) = OffsetLimit($Page, Gdn::Config('Vanilla.Discussions.PerPage', 30));
- $Trans = Gdn::SQL()
- ->Select('st.InsertUserID,st.Amount,st.Date,st.DiscussionID,st.CommentID')
- ->From('StarsTrans st')
- ->Where('ReceiveUserID',$Sender->User->UserID)
- ->OrderBy('st.Date', 'dsc')
- ->Limit($Limit, $Offset)
- ->Get();
- $Transcount = Gdn::SQL()
- ->Where('ReceiveUserID',$Sender->User->UserID)
- ->GetCount('StarsTrans', $Trans);
- $Transcount = $Transcount; //+ $Offset + 1;
- $Sender->SetData('Transactions', $Trans);
- $Sender->SetData('TransCount',$Transcount);
- // Build a pager
- /* $PagerFactory = new Gdn_PagerFactory();
- $Sender->Pager = $PagerFactory->GetPager('MorePager', $Sender);
- $Sender->Pager->MoreCode = T('More Ratings');
- $Sender->Pager->LessCode = T('Newer Ratings');
- $Sender->Pager->ClientID = 'Pager';
- $Sender->Pager->Configure(
- $Offset,
- $Limit,
- $Transcount,
- UserUrl($Sender->User, '', 'stars').'/{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 = $MyView;
- }
- */
- // 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'));
- }
- $ProfileView = $Sender->FetchViewLocation('index', 'ProfileController', 'dashboard');
- // Render the ProfileController
- $Sender->Render($ProfileView);
- }
- ?>
- Profile.php :
- <?php
- echo '<h2 class="H">'.T('Ratings').'</h2>';
- $PagerOptions = array('Wrapper' => '<span class="PagerNub"> </span><div %1$s>%2$s</div>', 'RecordCount' => $this->Data('TransCount'), 'CurrentRecords' => $this->Data('Transactions')->NumRows());
- //if ($this->Data('_PagerUrl'))
- // $PagerOptions['Url'] = $this->Data('_PagerUrl');
- echo '<div class="PageControls Top">';
- PagerModule::Write($PagerOptions);
- echo '</div>';
- $Trans = $this->Data('Transactions');
- if ($this->Data('TransCount') <= 0) {
- echo Wrap(T("This user has not made any discussions yet."), 'div', array('Class' => 'Empty'));
- }
- else {
- $List = array();
- foreach($Trans as $Tran)
- $List[] = $Tran->InsertUserID;
- $UserModel = new UserModel();
- $Names = $UserModel->GetIDs($List);
- Anchor()
- ?>
- <table class="RatingTable">
- <thead>
- <tr>
- <td class="RateHeading"><? echo T('User') ?> </td>
- <td class="RateHeading"><? echo T('Amount') ?> </td>
- <td class="RateHeading"><? echo T('Date') ?> </td>
- </tr>
- <tr>
- </thead>
- <tbody>
- <? foreach($Trans as $Tran): ?>
- <tr>
- <td class="RateTD"> <? echo Anchor($Names[$Tran->InsertUserID][Name],"/profile/".$Tran->InsertUserID.'/'.$Names[$Tran->InsertUserID][Name],"RateLink"); ?> </td>
- <td class="RateTD"> <? echo $Tran->Amount; ?> </td>
- <td class="RateTD"> <? if ($Tran->CommentID != NULL)
- echo Anchor($Tran->Date,'/discussion/comment/'.$Tran->CommentID.'/#Comment_'.$Tran->CommentID);
- else
- echo Anchor($Tran->Date,'/discussion/'.$Tran->DiscussionID); ?> </td>
- </tr>
- <? endforeach ?>
- </tbody>
- </table>
- <?php
- }
- /*foreach ($Trans as $Tran)
- {
- decho($Tran);
- }*/
- //echo($this->Pager);
- //decho($this->Data('TransCount'));this->Data('TransCount'), 'CurrentRecords' => $this->Data('Transactions')->NumRows());
- //if ($this->Data('_PagerUrl'))
- // $PagerOptions['Url'] = $this->Data('_PagerUrl');
- echo '<div class="PageControls Top">';
- PagerModule::Write($PagerOptions);
- echo '</div>';
- $Trans = $this->Data('Transactions');
- if ($this->Data('TransCount') <= 0) {
- echo Wrap(T("This user has not made any discussions yet."), 'div', array('Class' => 'Empty'));
- }
- else {
- $List = array();
- foreach($Trans as $Tran)
- $List[] = $Tran->InsertUserID;
- $UserModel = new UserModel();
- $Names = $UserModel->GetIDs($List);
- Anchor()
- ?>
- <table class="RatingTable">
- <thead>
- <tr>
- <td class="RateHeading"><? echo T('User') ?> </td>
- <td class="RateHeading"><? echo T('Amount') ?> </td>
- <td class="RateHeading"><? echo T('Date') ?> </td>
- </tr>
- <tr>
- </thead>
- <tbody>
- <? foreach($Trans as $Tran): ?>
- <tr>
- <td class="RateTD"> <? echo Anchor($Names[$Tran->InsertUserID][Name],"/profile/".$Tran->InsertUserID.'/'.$Names[$Tran->InsertUserID][Name],"RateLink"); ?> </td>
- <td class="RateTD"> <? echo $Tran->Amount; ?> </td>
- <td class="RateTD"> <? if ($Tran->CommentID != NULL)
- echo Anchor($Tran->Date,'/discussion/comment/'.$Tran->CommentID.'/#Comment_'.$Tran->CommentID);
- else
- echo Anchor($Tran->Date,'/discussion/'.$Tran->DiscussionID); ?> </td>
- </tr>
- <? endforeach ?>
- </tbody>
- </table>
- <?php
- }
- /*foreach ($Trans as $Tran)
- {
- decho($Tran);
- }*/
- //echo($this->Pager);
- //decho($this->Data('TransCount'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement