Location: PHPKode > scripts > Print Line Table > print-line-table/PrintLineTable.inc.php
<?php
class PrintLineTable {
    var $first_row = true;
    var $save_columns;

    function PrintLineTable($title) {
     	print "<body background='../_themes/rmnsque/romtextb.jpg' bgcolor='#CCCC99' text='#000000' link='#996600' vlink='#666666' alink='#336600'>\n";
	    print "<table border='0' width='100%'>\n";
	    print "  <tr>\n";
	    print "    <td width='112%'>\n";
	    print "        <tr>\n";
	    print "          <td width='70%' align='center'>\n";
	    print "            <h3><font face='Times New Roman' color='#000080'>$title</font></h3>\n";
	    print "          </td>\n";
	    print "        </tr>\n";
	    print "    </td>\n";
	    print "  </tr>\n";
	    print "</table>\n";
    }

    function PrintLine($row,$field_select=null,$select_ref=null) {
        if ($this->first_row) {
            $this->first_row = false;
            print "<fieldset>\n";
            print "<table width='100%' cellspacing='1' cellpadding='4' bgcolor='#FFFFFF' align='left'><tr bgcolor='#E6E6FF'>\n";
	        foreach ($row as $title => $value) {
                print "   <td><font size='2' face='Verdana, Arial, Helvetica, sans-serif'><b>$title</b></font></td>\n";
            }
        }
        if ($field_select != null) {
	        $i = 0;
	        foreach ($field_select as $field => $value) {
	            if ($i == 0) {
	                $select_name = $field . "=" . $value;
	            }
	            else {
	                $select_name .= "&" . $field . "=" . $value;
	            }
	            $i++;
	        }
        }
        print "<tr bgcolor=#F0F0F0 onmouseover=\"javascript:style.background='#ffec8b'\" onmouseout=\"javascript:style.background='#F0F0F0'\">\n";
        $i = 0;
        foreach ($row as $column => $value) {
            if ($field_select != null and $i == 0) {
               print "<td onmouseover=\"javascript:style.cursor='hand'\"><font size='2' face='Verdana, Arial, Helvetica, sans-serif'><b><a href='$select_ref?$select_name' target='_blank'>$value</a></b></font></td>\n";
            }
            else {
               print "<td><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">$value</font></td>\n";
            }
            $i++;
        }
        print "</tr>\n";
    }

    function PrintLineIndented($row,$until_column) {
        if ($this->first_row) {
            $this->first_row = false;
            $i = 0;
            print "<fieldset>\n";
            print "<table width='100%' cellspacing='1' cellpadding='4' bgcolor='#FFFFFF' align='left'><tr bgcolor='#E6E6FF'>\n";
	        foreach ($row as $title => $value) {
                print "   <td><font size='2' face='Verdana, Arial, Helvetica, sans-serif'><b>$title</b></font></td>\n";
                $this->save_columns[$i++] = null;
            }
        }
        print "<tr bgcolor=#F0F0F0 onmouseover=\"javascript:style.background='#ffec8b'\" onmouseout=\"javascript:style.background='#F0F0F0'\">\n";
        $i = 0;
        foreach ($row as $column => $value) {
           if ($value == $this->save_columns[$i] and $i <= $until_column) {
               print "<td bgcolor='#C0C0C0'></td>";
           }
           else {
               $this->save_columns[$i] = $value;
               print "<td><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">$value</font></td>\n";
           }
           $i++;
        }
        print "</tr>\n";
    }

    function PrintLineClose() {
         print "</table>\n";
         print "</fieldset>\n";
    }
}
?>
Return current item: Print Line Table