Merged bugfixes since 2.0.6
[fa-stable.git] / includes / ui / db_pager_view.inc
index d0c50ad1bc2b6ab047746027778c3da5e8a30a91..573cae2897889b91b600abcf6f09e164cfe71155 100644 (file)
@@ -45,7 +45,7 @@ function display_db_pager(&$pager) {
 
        div_start("_{$pager->name}_span");
     $headers = array();
-//display_error(print_r($pager->columns,true));
+
        foreach($pager->columns as $num_col=>$col) {
        if (isset($col['head'])) {
                        if (!isset($col['ord'])) 
@@ -59,8 +59,8 @@ function display_db_pager(&$pager) {
                }
        }
     /* show a table of records returned by the sql */
-    start_table("$table_style width=95%");
-    table_header($headers);
+    start_table("$table_style width=$pager->width");
+    table_header($headers, 'nowrap');
 
        if($pager->header_fun) {        // if set header handler
                start_row("class='{$pager->header_class}'");
@@ -123,7 +123,7 @@ function display_db_pager(&$pager) {
                          else
                                qty_cell($cell, false, isset($col['dec']) ? $col['dec'] : null); break;
                    case 'rate':
-                         rate_cell($cell);  break;
+                               label_cell(number_format2($cell, user_exrate_dec()), "align=center"); break;
                    default:
 //                 case 'text':
                          if (isset( $col['align']))
@@ -153,18 +153,22 @@ function display_db_pager(&$pager) {
                end_row();
        }
 
-       end_table();
-       start_table("$table_style align='center' class='navibar' width=95%");
-       start_row();
+       //end_table();
+       //start_table("$table_style align='center' class='navibar' width=100%");
+       /*
+       start_row("class='navibar'");
+       $colspan = count($pager->columns);
         if($pager->rec_count) {
                $from = ($pager->curr_page-1)*$pager->page_len+1;
                $to = $from + $pager->page_len - 1;
                if ($to > $pager->rec_count)
                  $to = $pager->rec_count;
                $all = $pager->rec_count;
+               $lcols = ($colspan > 4 ? 3 : 2);
                label_cell(sprintf( _('Records %d-%d of %d'), $from, $to, $all),
-                       "style='border:none'");
-               echo "<td style='border:none'>";
+                       "colspan=$lcols class='navibar' style='border:none'");
+               //echo "<td colspan=".($pager->columns -.$lcols)." style='border:none'>";
+               echo "<td colspan=".($colspan-3)." style='border:none'>";
                $but_pref = $pager->name.'_page_';
            start_table("align='right'");
                start_row();
@@ -176,9 +180,37 @@ function display_db_pager(&$pager) {
                end_table();    
                echo "</td>";
        } else {
-         label_cell( _('No records'));
+         label_cell( _('No records'), "colspan=$colspan class='navibar'");
+       }
+       end_row();
+       */
+       start_row("class='navibar'");
+       $colspan = count($pager->columns);
+        if($pager->rec_count) {
+               echo "<td colspan=$colspan class='navibar' style='border:none;padding:3px;'>";
+               echo "<div style='float:right;'>";
+               $but_pref = $pager->name.'_page_';
+           start_table();
+               start_row();
+               echo navi_button_cell($but_pref.'first', _('First'), $pager->first_page, 'right');
+               echo navi_button_cell($but_pref.'prev', _('Prev'), $pager->prev_page,'right');
+               echo navi_button_cell($but_pref.'next', _('Next'), $pager->next_page,'right');
+               echo navi_button_cell($but_pref.'last', _('Last'), $pager->last_page, 'right');
+               end_row(); 
+               end_table();
+               echo "</div>";
+               $from = ($pager->curr_page-1)*$pager->page_len+1;
+               $to = $from + $pager->page_len - 1;
+               if ($to > $pager->rec_count)
+                 $to = $pager->rec_count;
+               $all = $pager->rec_count;
+               echo sprintf( _('Records %d-%d of %d'), $from, $to, $all);
+               echo "</td>";
+       } else {
+         label_cell( _('No records'), "colspan=$colspan class='navibar'");
        }
        end_row();
+
        end_table();
 
    if (isset($pager->marker_txt))