Login   Register  
PHP Classes
elePHPant
Icontem

File: QP_Gray_White.mod

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Daniel Kushner  >  QueryPrint  >  QP_Gray_White.mod  >  Download  
File: QP_Gray_White.mod
Role: ???
Content type: text/plain
Description: A printing module that prints every other line gray
Class: QueryPrint
Author: By
Last change:
Date: 13 years ago
Size: 1,469 bytes
 

Contents

Class file image Download
<?php
class QP_Printer {
    
    var $gray = true;
    var $color_arr = array(1 => '#DDDDDD',
                           0 => '#FFFFFF');
    /*
        The number of records to be shown on each page. 
        Set the value to 0 in order to show the whole query on one page.
    */
    var $RecordsPerPage = 10;
    
    
    function OpenTable() {
        echo '<table border="0" cellspacing="1" cellpadding="1">';
    }

    
    function CloseTable() {
        echo '</table><p>';
    }

    
    function PrintHead($arr) {
        echo '<tr bgcolor=\"#999999\>';
        foreach($arr as $title) {
            echo "<td bgcolor=\"#999999\"><b>$title</b></td>";
        }
        echo '</tr>';
    }

    
    function PrintRow($arr) {
        echo "<tr bgcolor=\"{$this->color_arr[$this->gray]}\">";
        foreach($arr as $title => $val) {
            $val .= '&nbsp';
            echo "<td bgcolor=\"{$this->color_arr[$this->gray]}\">$val</td>";
        }
        echo '</tr>';
        $this->gray = !$this->gray;
    }
    
    
    function EmptyQuery() {
        echo '<i>Query is empty!</i>';
    }
    
    
    function PreviousLink($from) {
        global $PHP_SELF;
        echo "&nbsp;<a href=\"$PHP_SELF?QP_From=$from\">Previous</a>&nbsp;";
    }

    
    function NextLink($from) {
        global $PHP_SELF;
        echo "&nbsp;<a href=\"$PHP_SELF?QP_From=$from\">Next</a>&nbsp;";
    }
}
?>