phpBB Türkiye - phpBB3 Türkçe destek ve geliştirme

İçeriği atla

Sitemiz sadece phpBB 3.0 sürümüne destek vermektedir. Konu açmadan, ileti yazmadan önce lütfen site kuralları sayfamıza göz atınız.

pagination to NV BugTracker 0.1.1

pagination to NV BugTracker 0.1.1

İleti ALEXIS 28 Oca 2008 16:08

I add pagination function on viewbug.php page.

Kod: Tümünü seç
pagination to NV BugTracker 0.1.1


[ OPEN ]

bugtracker/viewcat.php

[ FIND ]

$status = request_var('st', 'all');

[ AFTER ADD ]

// + ALEXIS: pagination
$start = request_var('start', 0);
$on_viewcat = true; // this is pagination run only viewcat.php, because one function used for list last bugs
// - ALEXIS: pagination


[ OPEN ]

bugtracker/common.php

[ FIND ]

   global $db, $template, $phpbb_root_path, $phpEx, $user, $config;

[ AFTER ADD ]

   // + ALEXIS: pagination
   global $status_ask, $on_viewcat;
   // - ALEXIS: pagination

[ FIND ]

   $user_in_group = 0;

[ AFTER ADD ]

   // + ALEXIS: pagination
   // defauls is 10, if you change de-comment this line and change bugs per page
   // $config['posts_per_page'] = 20;
   if ($on_viewcat)
   {
      // count total pm for pagination
      $sql = 'SELECT COUNT(bug_track_id) AS total_bug
         FROM ' . BUG_TRACKING_TABLE . "
         WHERE bug_track_cat_id = $cat_id";
      $result = $db->sql_query($sql);
      $total_bug = (int) $db->sql_fetchfield('total_bug');
      $db->sql_freeresult($result);
   }
   // - // ALEXIS: pagination


[ FIND ]

   $sql = 'SELECT br.*, bc.*, bs.*, bp.bug_post_title, bp.bug_post_time, bp.bug_post_user_id, u1.user_id, u1.username, u1.user_colour, u2.user_id AS as_user_id, u2.username AS as_username, u2.user_colour AS as_user_colour, u3.user_id AS la_user_id, u3.username AS la_username, u3.user_colour AS la_user_colour
      FROM ' . BUG_REPORTS_TABLE . " br
      LEFT JOIN " . BUG_STATUS_TABLE . " bs
         ON bs.bug_status_id = br.bug_repo_status
      LEFT JOIN " . BUG_POSTS_TABLE . " bp
         ON bp.bug_post_id = br.bug_repo_post_id
      LEFT JOIN " . USERS_TABLE . " u1
         ON u1.user_id = bp.bug_post_user_id
      LEFT JOIN " . USERS_TABLE . " u2
         ON u2.user_id = br.bug_repo_assigned
      LEFT JOIN " . USERS_TABLE . " u3
         ON u3.user_id = br.bug_repo_lastuser_id
      LEFT JOIN " . BUG_CATS_TABLE . " bc
         ON bc.cat_id = br.bug_repo_cat_id
      WHERE br.bug_repo_cat_id = $cat_id
         AND bs.bug_status_name = $status
         $security
      ORDER BY br.bug_repo_lasttime DESC
      LIMIT $number";
   $result = $db->sql_query($sql);

[ REPLACE WITH ]

   // + ALEXIS: pagination
   /*
   $sql = 'SELECT br.*, bc.*, bs.*, bp.bug_post_title, bp.bug_post_time, bp.bug_post_user_id, u1.user_id, u1.username, u1.user_colour, u2.user_id AS as_user_id, u2.username AS as_username, u2.user_colour AS as_user_colour, u3.user_id AS la_user_id, u3.username AS la_username, u3.user_colour AS la_user_colour
      FROM ' . BUG_REPORTS_TABLE . " br
      LEFT JOIN " . BUG_STATUS_TABLE . " bs
         ON bs.bug_status_id = br.bug_repo_status
      LEFT JOIN " . BUG_POSTS_TABLE . " bp
         ON bp.bug_post_id = br.bug_repo_post_id
      LEFT JOIN " . USERS_TABLE . " u1
         ON u1.user_id = bp.bug_post_user_id
      LEFT JOIN " . USERS_TABLE . " u2
         ON u2.user_id = br.bug_repo_assigned
      LEFT JOIN " . USERS_TABLE . " u3
         ON u3.user_id = br.bug_repo_lastuser_id
      LEFT JOIN " . BUG_CATS_TABLE . " bc
         ON bc.cat_id = br.bug_repo_cat_id
      WHERE br.bug_repo_cat_id = $cat_id
         AND bs.bug_status_name = $status
         $security
      ORDER BY br.bug_repo_lasttime DESC
      LIMIT $number";
   $result = $db->sql_query($sql);
   */
   $sql = 'SELECT br.*, bc.*, bs.*, bp.bug_post_title, bp.bug_post_time, bp.bug_post_user_id, u1.user_id, u1.username, u1.user_colour, u2.user_id AS as_user_id, u2.username AS as_username, u2.user_colour AS as_user_colour, u3.user_id AS la_user_id, u3.username AS la_username, u3.user_colour AS la_user_colour
      FROM ' . BUG_REPORTS_TABLE . " br
      LEFT JOIN " . BUG_STATUS_TABLE . " bs
         ON bs.bug_status_id = br.bug_repo_status
      LEFT JOIN " . BUG_POSTS_TABLE . " bp
         ON bp.bug_post_id = br.bug_repo_post_id
      LEFT JOIN " . USERS_TABLE . " u1
         ON u1.user_id = bp.bug_post_user_id
      LEFT JOIN " . USERS_TABLE . " u2
         ON u2.user_id = br.bug_repo_assigned
      LEFT JOIN " . USERS_TABLE . " u3
         ON u3.user_id = br.bug_repo_lastuser_id
      LEFT JOIN " . BUG_CATS_TABLE . " bc
         ON bc.cat_id = br.bug_repo_cat_id
      WHERE br.bug_repo_cat_id = $cat_id
         AND bs.bug_status_name = $status
         $security
      ORDER BY br.bug_repo_lasttime DESC";
   $result = $db->sql_query_limit($sql, $config['posts_per_page'], $start);   
   // - ALEXIS: pagination

[ FIND ]


   $template->assign_vars(array(
      'NEWEST_POST_IMG'      => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),

[ BEFORE ADD ]

   // + ALEXIS: pagination
   // Make sure $start is set to the last page if it exceeds the amount
   if ($on_viewcat)
   {
      if ($start < 0 || $start > $total_bug)
      {
         $start = ($start < 0) ? 0 : floor(($total_bug - 1) / $config['posts_per_page']) * $config['posts_per_page'];
      }
      // If we've got a hightlight set pass it on to pagination.
      $pagination = generate_pagination(append_sid("{$phpbb_root_path}bugtracker/viewcat.$phpEx", "c=$cat_id&amp;st=$status_ask"), $total_bug, $config['posts_per_page'], $start);

      $template->assign_vars(array(
         'PAGINATION' => $pagination,
         'PAGE_NUMBER'    => on_page($total_bug, $config['posts_per_page'], $start),
         'TOTAL_BUGS'   => ($total_bug == 1) ? $user->lang['TOTAL_BUG'] : sprintf($user->lang['TOTAL_BUGS'], $total_bug),
      ));
   }
   // - ALEXIS: pagination

[ OPEN ]

language/en/mods/bugtracker.php

[ FIND ]

));

[ BEFORE ADD ]

// ALEXIS: pagination
   'TOTAL_BUG'      => '1 bug',
   'TOTAL_BUGS'   => '%d bugs',

[ OPEN ]

styles/prosilver/template/bugtracker/viewcat_body.html

[ FIND ]

<br />
<!-- INCLUDE bugtracker/bug_footer.html -->

[  BEFORE ADD]

<!-- IF PAGINATION or TOTAL_BUGS -->
   <div class="pagination">
      {TOTAL_BUGS}
      <!-- IF PAGE_NUMBER --><!-- IF PAGINATION --> &bull; <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> &bull; <span>{PAGINATION}</span><!-- ELSE --> &bull; {PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF -->
   </div>
   <br style="clear:both" />
<!-- ENDIF -->


[ END ]

phpBB3 Portal :: stabil sürüm 1.2.2 | phpBB3 Portal :: geliştirme sürümü 2.0.0
phpBB3 arama motoru optimizasyonu | phpBB3 Hızlandırma
ALEXIS


Kullanıcı avatarı

İleti: 2315
Kayıt: 03 Arl 2006 09:57
Konum: İstanbul
İsim: Sevdin Filiz
HTML: İyi
CSS: İyi
PHP: Orta
phpBB3: İyi
Sürüm: phpBB 3.0.2

  internet ve web yazılım hizmetleri

phpBB Türkiye Eklentileri


Kimler çevrimiçi

Bu forumu görüntüleyenler: Kayıtlı kullanıcı yok ve 1 misafir