Location: PHPKode > projects > SENAYAN Library Automation > senayan3-stable5/admin/modules/reporting/report_dbgrid.inc.php
<?php
/**
 * report_datagrid class
 * SQL Report datagrid creator extended from simbio_datagrid class
 *
 * Copyright (C) 2008 Arie Nugraha (hide@address.com)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

class report_datagrid extends simbio_datagrid
{
    public $paging_set = null;
    public $using_AJAX = false;


    /**
     * Modified method to make HTML output more friendly to printer
     *
     * @param   object  $obj_db
     * @param   string  $str_db_table
     * @param   integer $int_num2show
     * @return  string
     */
    protected function makeOutput($obj_db, $str_db_table = '', $int_num2show = 30)
    {
        // disable row highlight
        $this->highlight_row = false;
        // get fields array and set the table header
        $this->setHeader($this->grid_result_fields);

        // field count
        $_field_cnt = count($this->grid_result_fields);

        $_record_row = 1;
        // data loop
        foreach ($this->grid_result_rows as $_data) {
            // alternate the row color
            $_row_class = ($_record_row%2 == 0)?'alterCellPrinted':'alterCellPrinted2';

            // append array to table
            $this->appendTableRow($_data);

            // field style modification
            for ($f = 0; $f < $_field_cnt; $f++) {
                // checking for special field width value set by column_width property array
                $_row_attr = 'valign="top"';
                $_classes = $_row_class;
                if (isset($this->column_width[$f])) {
                    $_row_attr .= ' style="width: '.$this->column_width[$f].';"';
                }
                $this->setCellAttr($_record_row, $f, $_row_attr.' class="'.$_classes.'"');
            }
            $_record_row++;
        }

        // init buffer return var
        $_buffer = '';

        // create paging
        if ($this->num_rows > $int_num2show) {
            $this->paging_set = simbio_paging::paging($this->num_rows, $int_num2show, 5, '', 'reportView');
        } else {
            $this->paging_set =  '&nbsp;';
        }
        $_buffer .= $this->printTable();
        $_buffer .= '<div class="printPageInfo">Currently on page '.$this->current_page.'</div>';

        return $_buffer;
    }
}

?>
Return current item: SENAYAN Library Automation