X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fui%2Fdb_pager_view.inc;h=8245d77b4cc2eb0df5fcc7c500def48b60bec68f;hb=274bad27be5e62c7cbed49b22d66270991044009;hp=dfd2ecc534f0130171726f446396dbbbd77415fc;hpb=bdfd43a6cecc75f0886ea8cf5c307fc1b4b9b1a3;p=fa-stable.git diff --git a/includes/ui/db_pager_view.inc b/includes/ui/db_pager_view.inc index dfd2ecc5..8245d77b 100644 --- a/includes/ui/db_pager_view.inc +++ b/includes/ui/db_pager_view.inc @@ -1,25 +1,24 @@ . + See the License here . ***********************************************************************/ //-------------------------------------------------------------------------------------------------- function pager_link($link_text, $url, $icon=false) { global $path_to_root; - $link = access_string($link_text); if (user_graphic_links() && $icon) - $link[0] = set_icon($icon, $link[0]); + $link_text = set_icon($icon, $link_text); $href = $path_to_root . $url; - return "" . $link[0] . ""; + return "" . $link_text . ""; } function navi_button($name, $value, $enabled=true, $icon = false) { @@ -34,12 +33,14 @@ function navi_button($name, $value, $enabled=true, $icon = false) { function navi_button_cell($name, $value, $enabled=true, $align='left') { label_cell(navi_button($name, $value, $enabled), "align='$align'"); } + + //----------------------------------------------------------------------------- // // Sql paged table view. Call this function inside form. // function display_db_pager(&$pager) { - global $table_style, $use_popup_windows, $use_date_picker, $path_to_root; + global $path_to_root; $pager->select_records(); @@ -47,8 +48,9 @@ function display_db_pager(&$pager) { $headers = array(); foreach($pager->columns as $num_col=>$col) { - if (isset($col['head'])) { - if (!isset($col['ord'])) + // record status control column is displayed only when control checkbox is on + if (isset($col['head']) && ($col['type']!='inactive' || get_post('show_inactive'))) { + if (!isset($col['ord'])) $headers[] = $col['head']; else { $icon = (($col['ord'] == 'desc') ? 'sort_desc.gif' : @@ -59,8 +61,8 @@ function display_db_pager(&$pager) { } } /* show a table of records returned by the sql */ - start_table("$table_style width=".$pager->width); - table_header($headers, 'nowrap'); + start_table(TABLESTYLE, "width='$pager->width'"); + table_header($headers); if($pager->header_fun) { // if set header handler start_row("class='{$pager->header_class}'"); @@ -81,6 +83,13 @@ function display_db_pager(&$pager) { $cc = 0; //row colour counter foreach($pager->data as $line_no => $row) { + if ($pager->row_fun) { + if (function_exists($pager->row_fun)) { + $fn = $pager->row_fun; + $row = $fn($row); + } + } + $marker = $pager->marker; if ($marker && $marker($row)) start_row("class='$pager->marker_class'"); @@ -99,14 +108,13 @@ function display_db_pager(&$pager) { } else $cell = ''; } - switch($coltype) { // format column case 'time': - label_cell($cell, "width=40"); break; + label_cell($cell, "width='40'"); break; case 'date': - label_cell(sql2date($cell), "align='center' width=50"); break; + label_cell(sql2date($cell), "align='center' nowrap"); break; case 'dstamp': // time stamp displayed as date - label_cell(sql2date(substr($cell, 0, 10)), "align='center'"); break; + label_cell(sql2date(substr($cell, 0, 10)), "align='center' nowrap"); break; case 'tstamp': // time stamp - FIX user format label_cell(sql2date(substr($cell, 0, 10)). ' '. substr($cell, 10), "align='center'"); break; @@ -122,10 +130,15 @@ function display_db_pager(&$pager) { label_cell(''); else qty_cell($cell, false, isset($col['dec']) ? $col['dec'] : null); break; + case 'email': + email_cell($cell,isset( $col['align']) ? "align='" . $col['align'] . "'" : null); + break; case 'rate': label_cell(number_format2($cell, user_exrate_dec()), "align=center"); break; + case 'inactive': + if(get_post('show_inactive')) + $pager->inactive_control_cell($row); break; default: -// case 'text': if (isset( $col['align'])) label_cell($cell, "align='" . $col['align'] . "'"); else @@ -153,32 +166,39 @@ function display_db_pager(&$pager) { end_row(); } - end_table(); - start_table("$table_style align='center' class='navibar' width=".$pager->width); - start_row(); + start_row("class='navibar'"); + $colspan = count($pager->columns); + $inact = @$pager->inactive_ctrl==true + ? ' '.checkbox(null, 'show_inactive', null, true). _("Show also Inactive") : ''; 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; - label_cell(sprintf( _('Records %d-%d of %d'), $from, $to, $all), - "style='border:none'"); - echo ""; + echo ""; + echo "
"; $but_pref = $pager->name.'_page_'; - start_table("align='right'"); + start_table(); start_row(); + if (@$pager->inactive_ctrl) + submit('Update', _('Update'), true, '', null); // inactive update 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(); + end_table(); + echo "
"; + $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 $inact; echo ""; } else { - label_cell( _('No records')); + label_cell( _('No records') . $inact, "colspan=$colspan class='navibar'"); } + end_row(); + end_table(); if (isset($pager->marker_txt)) @@ -189,4 +209,3 @@ function display_db_pager(&$pager) { } -?> \ No newline at end of file