Skocz do zawartości
"Idzie nowe..." - o zmianach i nie tylko ×
Przeniesienie zakupów z IPS Marketplace / Moving bought items from IPS Marketplace ×

ROZWIĄZANY: Jak zrobić funkcje dzielenia na strony?


Rekomendowane odpowiedzi

Korzystam z pewnej modyfikacji, która wyświetla listę użytkownikó według punktów reputacji. Wszystko pięknie wygląda dopóki nie chcemy by ta lista zawierała 25 pazycji. Przy większej wartości np.100 pozycji wszystko wyświetlane jest na jednej stronie.

W jaki sposób można podział na strony? Czy są jakieś gotowe rozwiązania łatwe do zaadoptowania pod moje potrzeby?

46279b204b.png

Rozwiążemy dla Ciebie każde zadanie z matematyki: http://matma4u.pl

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Gotowego nie ma, ale jak poszukasz w kodzie fragmentów z generatePagination to zrozumiesz. A jak nie to pokaż kod tego moda i się zobaczy.

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

Własnie przeglądam szablon generatePagination, nie mogę "wgryść się". Chodzi mi o mod Reputation Points 2.0.0 (Adriano Faria)

Mam ustawione by wyświetlało tylko użytkowników w systemie Reputacja tylko pozytywna. Ten fragment kodu odpowiada za to i w nim wymagane by były zmiany:

<if test="$this->settings['reputation_point_types'] == 'positive'">
<div class='category_block block_wrap left' style='width: 100%'>
<h3 id='top20' class='maintitle'>{$this->lang->words['title_pos']}</h3>
<table class='ipb_table ipsMemberList' summary="{$this->lang->words['title_pos']}">
 <tr class='header'>
  <th scope='col' class='col_c_forum' style='width: 5%;'>{$this->lang->words['rank']}</th>
  <th scope='col' class='col_c_forum' style='text-align:center;'>{$this->lang->words['pontos']}</th>
  <th scope='col' class='col_c_forum' style='width: 5%;'> </th>
  <th scope='col' class='col_c_forum' style='width: 35%;'>{$this->lang->words['usuario']}</th>
  <th scope='col' class='col_c_forum' style='width: 20%;'>{$this->lang->words['joined']}</th>
  <th scope='col' class='col_c_forum' style='width: 10%;'>{$this->lang->words['posts']}</th>
  <th scope='col' class='col_c_forum' style='width: 25%;'> </th>
 </tr>
 <if test=is_array($positive) OR count($positive)">
  <foreach loop="reppos:$positive as $pos">
   <tr class='row1'>
 <td class='altrow' style="text-align: center" style="padding: 0 0 0 0;">{$pos['rank']}</td>
 <td style="padding: 0 0 0 0;"><div class='reputation positive' style='float:none; text-align:center;'><span class="number">{$pos['pp_reputation_points']}</span></div></td>
 <td class='altrow short'>
  <a href='{parse url="showuser={$pos['member_id']}" seotitle="{$pos['members_seo_name']}" template="showuser" base="public"}' title='{$this->lang->words['view_profile']}' class='ipsUserPhotoLink left'><img src='{$pos['pp_mini_photo']}' alt="{$pos['members_display_name']}{$this->lang->words['users_photo']}" class='ipsUserPhoto ipsUserPhoto_mini' /></a>
 </td>
 <td style="padding: 0 0 0 10px;">
  <if test="!$this->settings['reputacao_format']">
   <a href='{parse url="showuser={$pos['member_id']}" seotitle="{$pos['members_seo_name']}" template="showuser" base="public"}' title='{$this->lang->words['view_profile']}'>{$pos['members_display_name']}</a> {parse template="user_popup" group="global" params="$pos['member_id'], $pos['members_seo_name']"}
  <else />
   {IPSMember::makeProfileLink(IPSMember::makeNameFormatted( $pos['members_display_name'], $pos['member_group_id']), $pos['member_id'])} {parse template="user_popup" group="global" params="$pos['member_id'],$pos['members_display_name']"}
  </if>
 </td>
 <td class='altrow' style="padding: 0 0 0 0;"><div style='float:none; text-align:center;'><span class="number">{parse date="$pos['joined']" format="short"}</span></div></td>
 <td style="padding: 0 0 0 0;"><div style='float:none; text-align:center;'><span class="number">{$pos['posts']}</span></div></td>
 <td class='altrow short'>
  <ul class='ipsList_inline ipsList_nowrap right'>
   <li><a href={parse url="app=core&module=search&do=user_activity&mid={$pos['member_id']}" base="public"}' title='{$this->lang->words['gbl_find_my_content']}' class='ipsButton_secondary'>{parse replacement="find_icon"}</a></li>
   <if test="tpIsFrindable:|:$this->memberData['member_id'] AND $this->memberData['member_id'] != $pos['member_id'] && $this->settings['friends_enabled'] AND $this->memberData['g_can_add_friends']">
    <if test="tpIsFriend:|:IPSMember::checkFriendStatus( $pos['member_id'] )">
	 <li class='mini_friend_toggle is_friend' id='friend_xxx_{$pos['member_id']}'><a href='{parse url="app=members&module=profile&section=friends&do=remove&member_id={$pos['member_id']}&secure_key={$this->member->form_hash}" base="public"}' title='{$this->lang->words['remove_friend']}' class='ipsButton_secondary'>{parse replacement="remove_friend"}</a></li>
    <else />
	 <li class='mini_friend_toggle is_not_friend' id='friend_xxx_{$pos['member_id']}'><a href='{parse url="app=members&module=profile&section=friends&do=add&member_id={$pos['member_id']}&secure_key={$this->member->form_hash}" base="public"}' title='{$this->lang->words['add_friend']}' class='ipsButton_secondary'>{parse replacement="add_friend"}</a></li>	   
    </if>
   </if>
   <if test="tpPm:|:$this->memberData['g_use_pm'] AND $this->memberData['member_id'] != $pos['member_id'] AND $this->memberData['members_disable_pm'] == 0 AND IPSLib::moduleIsEnabled( 'messaging', 'members' )">
    <li class='pm_button' id='pm_xxx_{$pos['member_id']}'><a href='{parse url="app=members&module=messaging&section=send&do=form&fromMemberID={$pos['member_id']}" base="public"}' title='{$this->lang->words['pm_member']}' class='ipsButton_secondary'>{parse replacement="send_msg"}</a></li>
   </if>
   <if test="tpBlog:|:$pos['has_blog'] AND IPSLib::appIsInstalled( 'blog' )">
    <li><a href='{parse url="app=blog&module=display&section=blog&mid={$pos['member_id']}" base="public"}' title='{$this->lang->words['view_blog']}' class='ipsButton_secondary'>{parse replacement="blog_link"}</a></li>
   </if>
   <if test="tpGallery:|:$pos['has_gallery'] AND IPSLib::appIsInstalled( 'gallery' )">
    <li><a href='{parse url="app=gallery&module=user&section=user&user={$pos['member_id']}" base="public"}' title='{$this->lang->words['view_gallery']}' class='ipsButton_secondary'>{parse replacement="gallery_link"}</a></li>
   </if>
  </ul>
 </td>
   </tr>
  </foreach>
 </if>
</table>
</div>
</if>

46279b204b.png

Rozwiążemy dla Ciebie każde zadanie z matematyki: http://matma4u.pl

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Paginacji w stylu tak łatwo nie zrobisz, bo i nie ma potrzeby.. Styl wyświetla, co trzeba, a 'ograniczanie' wyników dzieje się po stronie kodu. Daj kod z pliku, który wypluwa dane do tego bitu skina.

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

Myślę, że to ten plik:

<?php
/**
* Product Title:  (SOS32) Reputation Points
* Product Version:  2.0.0
* Author:    Adriano Faria
* Website:    SOS Invision
* Website URL:   http://forum.sosinvision.com.br/
* Email:    [email protected]
*/
if ( ! defined( 'IN_IPB' ) )
{
   print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
   exit();
}
class public_reputationpoints_display_list extends ipsCommand
{
   protected $output			   = '';
   protected $pageTitle		    = '';  
public function doExecute( ipsRegistry $registry )
{
    switch( $this->request['do'] )
    {
	 default:
	  $this->_showList();
	 break;
    }
 $this->registry->output->addContent( $this->output );
 $this->registry->getClass('output')->sendOutput();
}
   public function _showList()
   {
  if ( !$this->settings['reputacao_systemon'] )
  {
  $this->registry->output->showError( $this->lang->words['systemoff'] );
 }

 if ( !in_array( $this->memberData['member_group_id'], explode( ',', $this->settings['reputacao_grupos'] ) ) )
 {
  $this->registry->output->showError( $this->lang->words['erro_permissao'] );
 }

 /* Add some CSS */
 $this->registry->output->addToDocumentHead( 'importcss' , "{$this->settings['css_base_url']}style_css/{$this->registry->output->skin['_csscacheid']}/ipb_mlist.css" );
 /* Add some JS */
 $this->registry->output->addToDocumentHead( 'javascript', "{$this->settings['js_base_url']}js/ips.memberlist.js" );
 $this->registry->output->addNavigation( $this->lang->words['title'], '' );

 $positive = array();
 $negative = array();

 $where = "";
 $nr    = intval( $this->settings['reputacao_nr'] ) ? $this->settings['reputacao_nr'] : 30;

 /* Usuários banidos ? */
 if ( !$this->settings['reputacao_banned'] )
 {
  $where = " and member_banned = 0 AND member_group_id != {$this->settings['banned_group']}";
 }

 /* Top Users + */
    $this->DB->build(array( 'select'   => 'm.member_id, m.members_display_name, m.members_seo_name, m.member_group_id, m.has_blog, m.has_gallery, m.posts, m.joined',
						    'from'	 => array('members' => 'm'),
						    'add_join' => array(
						    0 => array( 'select' => 'pp.*',
		   'from'   => array( 'profile_portal' => 'pp' ),
		 'where'  => 'pp.pp_member_id=m.member_id',
		 'type'   => 'left' ),
						    ),
						    'where'  => "pp_reputation_points > 0".$where,
						    'order'  => "pp.pp_reputation_points DESC, m.member_id",
	   'limit'  => array( 0, $nr ),
    ) );

 $outer = $this->DB->execute();

 $rank = 0;
 while( $r = $this->DB->fetch( $outer ) )
 {
  $r = IPSMember::buildDisplayData( $r );
  $r['rank'] = ++$rank;
  $r['pp_reputation_points'] = $this->registry->getClass('class_localization')->formatNumber($r['pp_reputation_points']);
  $positive[] = $r;
 }
 /* Top Users - */
    $this->DB->build(array( 'select'   => 'm.member_id, m.members_display_name, m.members_seo_name, m.member_group_id, m.has_blog, m.has_gallery, m.posts, m.joined',
						    'from'	 => array('members' => 'm'),
						    'add_join' => array(
						    0 => array( 'select' => 'pp.*',
		   'from'   => array( 'profile_portal' => 'pp' ),
		 'where'  => 'pp.pp_member_id=m.member_id',
		 'type'   => 'left' ),
						    ),
						    'where'  => "pp_reputation_points < 0".$where,
						    'order'  => "pp.pp_reputation_points ASC, m.member_id",
	   'limit'  => array( 0, $nr ),
    ) );

 $outer2 = $this->DB->execute();

 $rank = 0;
 while( $r = $this->DB->fetch( $outer2 ) )
 {
  $r = IPSMember::buildDisplayData( $r );
  $r['rank'] = ++$rank;
  $r['pp_reputation_points'] = $this->registry->getClass('class_localization')->formatNumber($r['pp_reputation_points']);
  $negative[] = $r;
 }

 $this->output .= $this->registry->output->getTemplate( 'reputationpoints' )->listReps( $positive, $negative );
    $this->pageTitle = $this->settings['board_name']." - ".$this->lang->words['title'];
 $this->registry->output->setTitle( $this->pageTitle );
 $this->registry->output->addContent( $this->output );
 $this->registry->output->sendOutput();
   }
}
?>

46279b204b.png

Rozwiążemy dla Ciebie każde zadanie z matematyki: http://matma4u.pl

Odnośnik do komentarza
Udostępnij na innych stronach

Z tego co do tej chwili pojąłem to trzeba by gdzieś w tym kodzi wstawić:

				$pages = $this->registry->output->generatePagination( array(
				'totalItems'		=> $totalResults,
				'itemsPerPage'		=> $maxResults,
				'currentStartValue'	=> $first,
			) );

gdzie:

$maxResults - wcześniej zdefiniowana wartość np 25 użytkowników na stronę

$totalResults, - np.300 bo tyle ma być brane pod uwagę użytkowników pod uwagę przy tworzeniu listy

I dalej nie mogę tego rozgryść.

W tym kodzie zmienna $nr to moje $totalResults.

Czyli kod mógłby wyglądać tak:

				
$maxResults	= 25;

$pages = $this->registry->output->generatePagination( array(
				'totalItems'		=> $nr,
				'itemsPerPage'		=> $maxResults,
				'currentStartValue'	=> $first,
			) );

Ale co to jest 'currentStartValue' to już nie wiem.

A w szablonie mam wstawić:

<if test="$pages">
  <div class='topic_controls clearfix'>{$pages}</div>
 </if>

Resztę luk w mojej wiedzy (jeśli dobrze myślę) prosiłbym o uzupełnienie

Edytowane przez matma4u

46279b204b.png

Rozwiążemy dla Ciebie każde zadanie z matematyki: http://matma4u.pl

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Jezu jak ja nie trawię kodów Adriano.. Są tak pokaszanione, że masakra.. Analizuj, robione z palca, więc pewnie gdzieś coś mi się sypnie:

<?php
/**
* Product Title:  (SOS32) Reputation Points
* Product Version:  2.0.0
* Author:    Adriano Faria
* Website:    SOS Invision
* Website URL:   http://forum.sosinvision.com.br/
* Email:    [email protected]
*/
if ( ! defined( 'IN_IPB' ) )
{
   print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
   exit();
}
class public_reputationpoints_display_list extends ipsCommand
{
   protected $output					  = '';
   protected $pageTitle				    = '';  
public function doExecute( ipsRegistry $registry )
{
	    switch( $this->request['do'] )
	    {
			 default:
			  $this->_showList();
			 break;
	    }
 $this->registry->output->addContent( $this->output );
 $this->registry->getClass('output')->sendOutput();
}
   public function _showList()
   {
  if ( !$this->settings['reputacao_systemon'] )
  {
  $this->registry->output->showError( $this->lang->words['systemoff'] );
 }

 if ( !in_array( $this->memberData['member_group_id'], explode( ',', $this->settings['reputacao_grupos'] ) ) )
 {
  $this->registry->output->showError( $this->lang->words['erro_permissao'] );
 }

 /* Add some CSS */
 $this->registry->output->addToDocumentHead( 'importcss' , "{$this->settings['css_base_url']}style_css/{$this->registry->output->skin['_csscacheid']}/ipb_mlist.css" );
 /* Add some JS */
 $this->registry->output->addToDocumentHead( 'javascript', "{$this->settings['js_base_url']}js/ips.memberlist.js" );
 $this->registry->output->addNavigation( $this->lang->words['title'], '' );

 $positive = array();
 $negative = array();

 $st         = intval( $this->request['st'] ) > 0 ? intval( $this->request['st'] ) : 0; //DawPi

 $where = "";
 $nr    = intval( $this->settings['reputacao_nr'] ) ? $this->settings['reputacao_nr'] : 30;

 /* Usuários banidos ? */
 if ( !$this->settings['reputacao_banned'] )
 {
  $where = " and member_banned = 0 AND member_group_id != {$this->settings['banned_group']}";
 }

 /* Top Users + */

 $num1 = $this->DB->buildAndFetch( array( 'select'   => 'count(*) as num1',
													    'from'	   => array('members' => 'm'),
													    'add_join' => array(
													    0 => array( 'select' => 'pp.*',
					   'from'   => array( 'profile_portal' => 'pp' ),
					 'where'  => 'pp.pp_member_id=m.member_id',
					 'type'   => 'left' ),
													    ),
													    'where'  => "pp_reputation_points > 0".$where,
													    'order'  => "pp.pp_reputation_points DESC, m.member_id",
			   'limit'  => array( 0, $nr ),
	    ) );

$page_links1 = $this->registry->output->generatePagination( array(
                                                                   'totalItems'		 => $num1['num1'],
                                                                   'itemsPerPage'	   => 25,
                                                                   'currentStartValue'  => $st,
                                                                   'baseUrl'		    => "{$this->settings['base_url']}module=display&section=list",
                                                       )     );		   

	    $this->DB->build(array( 'select'   => 'm.member_id, m.members_display_name, m.members_seo_name, m.member_group_id, m.has_blog, m.has_gallery, m.posts, m.joined',
													    'from'	   => array('members' => 'm'),
													    'add_join' => array(
													    0 => array( 'select' => 'pp.*',
					   'from'   => array( 'profile_portal' => 'pp' ),
					 'where'  => 'pp.pp_member_id=m.member_id',
					 'type'   => 'left' ),
													    ),
													    'where'  => "pp_reputation_points > 0".$where,
													    'order'  => "pp.pp_reputation_points DESC, m.member_id",
			   'limit'  => array( 0, 25 ),
	    ) );

 $outer = $this->DB->execute();

 $rank = 0;
 while( $r = $this->DB->fetch( $outer ) )
 {
  $r = IPSMember::buildDisplayData( $r );
  $r['rank'] = ++$rank;
  $r['pp_reputation_points'] = $this->registry->getClass('class_localization')->formatNumber($r['pp_reputation_points']);
  $positive[] = $r;
 }
 /* Top Users - */
	    $this->DB->build(array( 'select'   => 'm.member_id, m.members_display_name, m.members_seo_name, m.member_group_id, m.has_blog, m.has_gallery, m.posts, m.joined',
													    'from'	   => array('members' => 'm'),
													    'add_join' => array(
													    0 => array( 'select' => 'pp.*',
					   'from'   => array( 'profile_portal' => 'pp' ),
					 'where'  => 'pp.pp_member_id=m.member_id',
					 'type'   => 'left' ),
													    ),
													    'where'  => "pp_reputation_points < 0".$where,
													    'order'  => "pp.pp_reputation_points ASC, m.member_id",
			   'limit'  => array( 0, $nr ),
	    ) );

 $outer2 = $this->DB->execute();

 $rank = 0;
 while( $r = $this->DB->fetch( $outer2 ) )
 {
  $r = IPSMember::buildDisplayData( $r );
  $r['rank'] = ++$rank;
  $r['pp_reputation_points'] = $this->registry->getClass('class_localization')->formatNumber($r['pp_reputation_points']);
  $negative[] = $r;
 }

 $this->output .= $this->registry->output->getTemplate( 'reputationpoints' )->listReps( $positive, $negative, $page_links1 );
	    $this->pageTitle = $this->settings['board_name']." - ".$this->lang->words['title'];
 $this->registry->output->setTitle( $this->pageTitle );
 $this->registry->output->addContent( $this->output );
 $this->registry->output->sendOutput();
   }
}
?>

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

wywala przy próbie zapisu "Błąd składni itd"

Przepraszam, zapisałem nie ten plik co trzeba. Nie ma błędu, teraz tylko muszę w bicie szablonu wstawić odpowiedni kod.

Edytowane przez matma4u

46279b204b.png

Rozwiążemy dla Ciebie każde zadanie z matematyki: http://matma4u.pl

Odnośnik do komentarza
Udostępnij na innych stronach

Wstawiłem to w (odpowiednich miejscach)bicie:

<if test="$page_links1">
  <div class='topic_controls clearfix'>{$page_links1}</div>
 </if>

A to nie powinno być tak:

'baseUrl' => "&app=reputationpoints",

Na końcu powinno "dolejać" parametr &st=

Choć przy tym też zero reakcji.

Edytowane przez matma4u

46279b204b.png

Rozwiążemy dla Ciebie każde zadanie z matematyki: http://matma4u.pl

Odnośnik do komentarza
Udostępnij na innych stronach

Teraz rozumiem o co chodzi. Wpisałem zmiany do szablonu, ale zapomniałem o dodaniu zmiennej $pages. Po dodaniu wyświetla pasek numerów stron, ale po kliknięciu na np nr 2 przerzuca na stronę główną

46279b204b.png

Rozwiążemy dla Ciebie każde zadanie z matematyki: http://matma4u.pl

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Zmień:

'baseUrl'               => "{$this->settings['base_url']}module=display&section=list",

Na:

'baseUrl'               => "{$this->settings['base_url']}app=reputationpoints&module=display&section=list",

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

Tak nie może być bo dokleja dwa razy nawę domeny 'baseUrl' => "{$this->settings['base_url']}app=reputationpoints&module=display&section=list",,

Zrobiłem tak

'baseUrl' => "app=reputationpoints&module=display&section=list",

teraz nie dokleja ale mimo wszystko nie działa. Mam ustawione 50 użytkowników po 25 na strone a w linku stron wyświetla strony od 1 do 15

46279b204b.png

Rozwiążemy dla Ciebie każde zadanie z matematyki: http://matma4u.pl

Odnośnik do komentarza
Udostępnij na innych stronach

Kod pliku nie działa. Wprowadziłem zmiany (prosze o sprawdzenie) i teraz działa, ale jest jedno ale..... Pierwsza strona użytkownicy są numerowani od 1 -25, więc druga powinna być numerowana od 26-50, a jest od 1-25. Odpowiada za to zmienna $rank

Taki wygląda plik:

<?php
/**
* Product Title:  (SOS32) Reputation Points
* Product Version:  2.0.0
* Author:	Adriano Faria
* Website:	SOS Invision
* Website URL:   http://forum.sosinvision.com.br/
* Email:	[email protected]
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_reputationpoints_display_list extends ipsCommand
{
protected $output									 = '';
protected $pageTitle									= '';
public function doExecute( ipsRegistry $registry )
{
				switch( $this->request['do'] )
				{
							 default:
							  $this->_showList();
							 break;
				}
 $this->registry->output->addContent( $this->output );
 $this->registry->getClass('output')->sendOutput();
}
public function _showList()
{
  if ( !$this->settings['reputacao_systemon'] )
  {
  $this->registry->output->showError( $this->lang->words['systemoff'] );
 }

 if ( !in_array( $this->memberData['member_group_id'], explode( ',', $this->settings['reputacao_grupos'] ) ) )
 {
  $this->registry->output->showError( $this->lang->words['erro_permissao'] );
 }

 /* Add some CSS */
 $this->registry->output->addToDocumentHead( 'importcss' , "{$this->settings['css_base_url']}style_css/{$this->registry->output->skin['_csscacheid']}/ipb_mlist.css" );
 /* Add some JS */
 $this->registry->output->addToDocumentHead( 'javascript', "{$this->settings['js_base_url']}js/ips.memberlist.js" );
 $this->registry->output->addNavigation( $this->lang->words['title'], '' );

 $positive = array();
 $negative = array();

 $first  = intval( $this->request['st'] ); //DawPi

 $where = "";
 $nr	= intval( $this->settings['reputacao_nr'] ) ? $this->settings['reputacao_nr'] : 30;

 /* Usuários banidos ? */
 if ( !$this->settings['reputacao_banned'] )
 {
  $where = " and member_banned = 0 AND member_group_id != {$this->settings['banned_group']}";
 }

 /* Top Users + */

				 $this->DB->build(array( 'select'   => 'm.member_id, m.members_display_name, m.members_seo_name, m.member_group_id, m.has_blog, m.has_gallery, m.posts, m.joined',
																												'from'		 => array('members' => 'm'),
																												'add_join' => array(
																												0 => array( 'select' => 'pp.*',
											   'from'   => array( 'profile_portal' => 'pp' ),
											 'where'  => 'pp.pp_member_id=m.member_id',
											 'type'   => 'left' ),
																												),
																												'where'  => "pp_reputation_points > 0".$where,
																												'order'  => "pp.pp_reputation_points DESC, m.member_id",
							   'limit'  => array( $first, 25 ),
				) );


$pages = $this->registry->output->generatePagination( array(
																'totalItems'				 => $nr,
																'itemsPerPage'		 => 25,
																'currentStartValue'  => $first,
																'baseUrl'			   => "app=reputationpoints&module=display&section=list",
													)	 );				  

 $outer = $this->DB->execute();

 $rank = 0;
 while( $r = $this->DB->fetch( $outer ) )
 {
  $r = IPSMember::buildDisplayData( $r );
  $r['rank'] = ++$rank;
  $r['pp_reputation_points'] = $this->registry->getClass('class_localization')->formatNumber($r['pp_reputation_points']);
  $positive[] = $r;
 }
 /* Top Users - */
				$this->DB->build(array( 'select'   => 'm.member_id, m.members_display_name, m.members_seo_name, m.member_group_id, m.has_blog, m.has_gallery, m.posts, m.joined',
																												'from'		 => array('members' => 'm'),
																												'add_join' => array(
																												0 => array( 'select' => 'pp.*',
											   'from'   => array( 'profile_portal' => 'pp' ),
											 'where'  => 'pp.pp_member_id=m.member_id',
											 'type'   => 'left' ),
																												),
																												'where'  => "pp_reputation_points < 0".$where,
																												'order'  => "pp.pp_reputation_points ASC, m.member_id",
							   'limit'  => array( 0, $nr ),
				) );

 $outer2 = $this->DB->execute();

 $rank = 0;
 while( $r = $this->DB->fetch( $outer2 ) )
 {
  $r = IPSMember::buildDisplayData( $r );
  $r['rank'] = ++$rank;
  $r['pp_reputation_points'] = $this->registry->getClass('class_localization')->formatNumber($r['pp_reputation_points']);
  $negative[] = $r;
 }

 $this->output .= $this->registry->output->getTemplate( 'reputationpoints' )->listReps( $positive, $negative, $pages );
				$this->pageTitle = $this->settings['board_name']." - ".$this->lang->words['title'];
 $this->registry->output->setTitle( $this->pageTitle );
 $this->registry->output->addContent( $this->output );
 $this->registry->output->sendOutput();
}
}
?>

Edytowane przez matma4u

46279b204b.png

Rozwiążemy dla Ciebie każde zadanie z matematyki: http://matma4u.pl

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Zmień oba:

$rank = 0;

Na:

$rank = $st;

[ + ]

No nie może to działać:

'totalItems'							 => $nr,

A zmienna $nr to jakieś ustawienie, a nie ilość użytkowników - na pewno to do zmiany.

  • Lubię to 1

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

Wczytałem się w kod i zmienna $nr właśnie jest liczbą ile użytkowników powinno być wyświetlanych (Specify how many reputations will show on list). Po instalacji jest standardowo 30 ustawione, stąd:

$nr   = intval( $this->settings['reputacao_nr'] ) ? $this->settings['reputacao_nr'] : 30;

Zmieniłem

$rank = $first;

bo tak pasuje to do kodu, który powyżej podałem i wszysko teraz ślicznie działa. Efekty można zobaczyć: http://matma4u.pl/index.php?app=reputationpoints

46279b204b.png

Rozwiążemy dla Ciebie każde zadanie z matematyki: http://matma4u.pl

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Problem ROZWIĄZANY. Jeśli są jakiekolwiek wątpliwości, pytania proszę o założenie nowego tematu.

Wszelkie uzasadnione reklamacje/pretensje/sugestie/rady przyjmuje ekipa forum.

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Problem ROZWIĄZANY. Jeśli są jakiekolwiek wątpliwości, pytania proszę o założenie nowego tematu.

Wszelkie uzasadnione reklamacje/pretensje/sugestie/rady przyjmuje ekipa forum.

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.