<?php /**
* @package Table
**/
/** Module Name : class.CC_Table.php -- Classname : Table
*
* HTML Table generation class
* creates a table in html, with indents in source code
* and makes all columns, even if not filled , valid
*
*
* @description <Description of the module/ server>
*
*/ class Table {
/**
* array[$row][$col]: <br> value of columns in table
* @see AddColumn()
* @see Table()
* @access private
*/
var $cols = array();
/**
* array[$rows] : amount of columns in a row
* @see AddColumn()
* @access private
**/
var $col_amount = array();
/**
* boolean: if set to true, first row is an html Table header
* @see TableHeader(), with argument true if header, false if not
* @access private
**/
var $is_header_active = false;
/**
* array: all rows have now a flag for heading column
*
* when row should be a heading row set row to 1
*
**/
var $row_headings = array();
/**
* number: amount of rows;
* @access private
*/
var $max_row;
/**
* the maximum amount of columns in the table ( e.g. row1 = 5 cols, row2 = 8 cols --> max_cols = 8 )
* @access private
**/
var $max_col;
/** in case of table was called without initial load of columns, the actual column writing into is set here
* @see Table()
* @access private
**/
var $act_col;
/**
* array[$col]: size of column $col
* @see ChangeColSize()
* @access private
**/
var $col_size = array();
/**
* size of table in percent
* @see SetTableWidth()
* @access private
**/
var $t_size = "95%";
/**
* tabulator index for source code indention, raised on new table element, smallered on end table element
* @access private
**/
var $open_tab=0;
/**
* tabulator index for source code indention, raised on new row element, smallered on end row element
* @see AddRow()
* @access private
**/
var $open_Row=0;
/**
* tabulator index for source code indention, raised on new column element, smallered on end column element
* @see AddColumn()
* @access private
**/
var $open_Col=0;
/**
* number if set to 0, no borders are shown, if set to >0 a border with width $t_border is shown
* @see SetTableBorder()
* @access private
**/
var $t_border=0;
/**
* number the empty space between value and border of column in pixels
* @see SetTableCellSpacing()
* @access private
**/
var $t_cellspacing=2;
/**
* number the distance between to columns in pixels
* @see SetTableCellPadding()
* @access private
**/
var $t_cellpadding=2;
/**
* Backgroundcolor of the table element
* @see SetTableBackgroundColor()
* @access private
**/
var $t_bgcolor=DefTableBackgroundcolour;
/**
* the vertical alignment of the table in html display
* @see SetTableAlign()
* @access private
**/
var $t_align="CENTER";
/**
* array[$col]: the prefix of the value in column $col ( e.g put a html tag like < b> )
* @see SetColumnPrefix()
* @access private
**/
var $c_prefix = array();
/**
* array[$col]: the postfix of the value in column $col ( e.g put a end html tag like </B> )
* @see SetColumnPostfix()
* @access private
**/
var $c_postfix = array();
/**
* array[$row][$col]: Backgroundcolor of the column $col in row $row
* @see {@link ChangeColumnColor} {@link ChangeRowColor} {@link SetColumnBackgroundColor}
* @access private
**/
var $c_bgcolor = array();
/**
* string: the default alignmend of the columns in table, if NO ALIGNMENT IS SET IN c_align for a column
* @access private
**/
var $c_align_default = "CENTER";
/**
* string: the default vertical alignment of the columns in table, if NO ALIGNMENT IS SET IN c_valign for a column
* @access private
**/
var $c_valign_default = "MIDDLE";
/**
* array[$row][$col]: the alignment of the value in column $col in row $row
* @see SetColumnAlign()
* @access private
**/
var $c_align = array();
/**
* array[$row][$col]: the columnspan of the column $col in row $row
* @see ChangeColSpan()
* @access private
**/
var $c_colspan = array();
/**
* $array[$row][$col]: vertical alignment in column $col in row $row
* @see SetColumnVertikalAlign()
* @access private
**/
var $c_valign = array();
/**
** ???????
* @access private
**/
var $c_vspace = array();
/**
* array[$row][$col]: heigth of column $col in row $row ( not properly working, always heighest column is standard )
* @access private
**/
var $c_height = array();
/**
* array[$col]: width of column $col in row $row ( not properly working, always biggest column is standard )
* @access private
**/
var $c_width = array();
/**
* array[$row][$col]: wrap mode in column $column row $row
* @access private
**/
var $c_nowrap = array();
/**
* array[$row][$col]: rowspan of the column $column in row $row (default is 1 )
* @access private
**/
var $c_rowspan = array();
/**
* array[$row][$col]: column $column in row $row is an header
* @access private
**/
var $c_head = array();
/**
* boolean: internal use only, flag if table was already checked for validation
* @access private
**/
var $table_finished = false;
/** Kontruktor of Class Table
* A HTML TABLE Template is prepared, if called with arguments, then columns and rows are initialized
* if not, each new column(row) must be added manually using {@link AddColumn}({@link AddRow})
*
* @desc Konstruktor of TableClass, with parameter called create a table with row and cols, if not, empty table
* @param boolean if true, all arguments must be given,
* @param number amount of rows
* @param number amount of columns in one row
**/
function Table($create=false,$row_amount=1,$col_amount=1) // _contructor
{
$this->max_row = 0;
$this->max_col = 0;
$this->act_col = 0;
if ( $create )
{
$this->Table2($row_amount,$col_amount);
$this->SaneTable();
}
}
/** Konstruktor extension, if Table has already definition
*
* @desc no direct call please, will be called by Konstruktor
*
* @param number amount of rows in the table
* @param number amount of column in one row
* @return void
* @access private
**/
function Table2($row_amount,$col_amount)
{
for ( $the_row = 1; $the_row <= $row_amount; $the_row++ )
{
$this->AddRow();
for ( $the_col = 1; $the_col <= $col_amount; $the_col++ )
{
$this->AddColumn();
}
}
if ( $col_amount == 1 )
{
$this->c_size[1][1] = "100%";
}
else
{
$this->ChangeColSize(1,ceil(100/$col_amount));
}
}
/** Activates or deactivates Borders in table
*
* @desc Activates or deactivates Borders in table
* @param number 0 for no border, >0 for size of border in pixels
* @return void
**/
function SetTableBorder($bordersize=0)
{
$this->t_border = $bordersize;
}
/** Activates or deactivates Header row in table
*
* Header row is ALWAYS ONLY the FIRST ROW
*
* @desc Activates or deactivates Header row in table
* @param boolean true if header is active
* @return void
**/
function SetTableHeader($setting=true)
{
//$this->is_header_active = $setting;
$this->SetRowToHeader(1);
}
function SetRowToHeader($row)
{
$this->row_headings[$row] = 1;
}
/** Width of table in percent in Browser
*
* width of table in percent in the browser
* if table is in an other table, the width in percent
* is depending of the with of the column
*
* @desc Width of table in percent in Browser
* @param number width in percent
* @return void
**/
function SetTableWidth($width="80")
{
$this->t_size = $width."%";
}
/** distance between value end borders of a column
*
* @desc distance between value end borders of a column
* @param number distance in pixels
* @return void
**/
function SetTableCellSpacing($space=2)
{
$this->t_cellspacing = $space;
}
/** distance between two column or rows
*
* @desc distance between two column or rows
* @param number distance between two column or rows in pixels
* @return void
**/
function SetTableCellPadding($padding=2)
{
$this->t_cellpadding = $padding;
}
/** Alignment of Table in Browser
*
* @desc Alignment of Table in Browser ( CENTER,LEFT,RIGTH )
* @param string HTML TAG for alignment ( CENTER,LEFT,RIGTH )
*/
function SetTableAlign($align=CENTER)
{
$this->t_align = $align;
}
/** Prefix of value of one complete column
* the prefix of the value in column $col ( e.g put a html tag like < b>)
*
* @desc Prefix of value of one complete column
* @param number columnnumber ( complete column will be set with the prefix)
* @param string prefix of value
* @return void
**/
function SetColumnPrefix($col,$prefix="")
{
$this->c_prefix[$col] = $prefix;
}
/** Postfix of a column for one complete column
* the prefix of the value in column $col ( e.g put a html tag like < /b>)
*
* @desc Postfix of value of one complete column
* @param number columnnumber ( complete column will be set with the prefix)
* @param string postfix of value
* @return void
**/
function SetColumnPostfix($col,$postfix="")
{
$this->c_postfix[$col] = $postfix;
}
/** Changes the Width of a column in row $row, does not change any other column
* @desc Changes the Width of a column in row $row
* @param number number of column to change in row $row
* @param string the width of the column in percent ( without percent sign
* @return void
**/
function SetColumnWidth($row,$col,$width)
{
//$this->c_width[$row][$col] = $width."%";
$this->c_width[$col] = $width."%";
}
/** Setting the backgroundcolor of one column
*
* @desc Setting the backgroundcolor of one column
* @param number row in table
* @param number column in table
* @param html color synthax
* @return void
**/
function SetColumnBackgroundColor($row,$col,$color)
{
$this->c_bgcolor[$row][$col] = $color;
}
/** Alignment for one column in one row
*
* @desc Alignment for one column in one row
* @param number number of row
* @param number number of column
* @param string alignment in html synthax
* @return void
**/
function SetColumnAlign($row,$col,$align)
{
$this->c_align[$row][$col] = $align;
}
/** Change Default Value for column alignment in a complete table
*
* Change Default Value for column alignment in a complete table
* is used for every column, where no c_align is defined explicit
*
* @param string the alignment of all columns( RIGHT CENTER LEFT )
**/
function SetColumnAlignDefault($align)
{
$this->c_align_default = $align;
}
/** Change Default Value for vertical column alignment in a complete table
*
* Change Default Value for vertical column alignment in a complete table
* is used for every column, where no c_valign is defined explicit
*
* @param string the vertical alignment of all columns( MIDDLE TOP BOTTOM )
**/
function SetColumnVerticalAlignDefault($align)
{
$this->c_valign_default = $align;
}
/** set the backgroundcolor of an html table
*
* @desc set the backgroundcolor of an html table
* @param string color in html synthax
* @return void
**/
function SetTableBackgroundColor($color=DefTableBackgroundcolour)
{
$this->t_bgcolor = $color;
}
/** set the vertical alignment in a column
*
* @desc set the vertical alignment in a column
* @param number number of row
* @param number number of column
* @param string alignment in html synthax
* @return void
**/
function SetColumnVerticalAlign($row,$col,$align=MIDDLE)
{
$this->c_valign[$row][$col] = $align;
}
/** Changes the size of one Column to col_size.
* All rest of the table size is evenly distributed to the remaining cols
* @desc Changes the size of one Column to col_size.
* @param column to change
* @param Size in Percent ( without the % sign )
* @return void
*/
function ChangeColSize($column,$col_size)
{
$rest = 100 - $col_size;
$per_col = ceil($rest/($this->max_col-1));
for ( $cols = 1; $cols <= $this->max_col; $cols++ )
{
$this->c_width[$cols] = $per_col."%";
}
$this->c_width[$column] = $col_size."%";
}
/** Changes the Width of a column, does not change any other column
* @desc Changes the Width of a column, does not change any other column
* @param number number of column to change
* @param string the width of the column in percent ( without percent sign
* @return void
**/
function ChangeCompleteColumnWidth($col,$width)
{
for ( $row = 1; $row <= $this->max_row; $row++)
{
$this->SetColumnWidth($row,$col,$width);
}
}
/** the columnspan of the column $col in row $row
*
* @desc the columnspan of the column $col in row $row
* @param number number of row
* @param number number of column
* @param number amount of columns used by column
* @return void
**/
function ChangeColSpan($row,$column,$colspan)
{
if ( is_array($this->c_colspan[$row]) )
{
$amount = array_sum($this->c_colspan[$row]);
if ( $amount >= $this->max_col && $colspan > 1 )
{
$anzahl = sizeof($this->cols[$row]);
unset($this->cols[$row][$anzahl]);
unset($this->c_colspan[$row][$anzahl]);
$this->ChangeColSpan($row,$column,$colspan);
}
else if ( $colspan > 1 )
{
$this->c_colspan[$row][$column] = $colspan;
}
else
{
echo "Fehler beim erstellen der Tabelle beim �ndern des ColSpan";
echo "Fehler beim erstellen der Tabelle beim �ndern des ColSpan";
}
}
else
{
for ( $i = 1; $i <= $this->max_col ; $i++)
{
$this->c_colspan[$row][$i] = 0;
}
$amount = array_sum($this->c_colspan[$row]);
if ( $amount >= $this->max_col && $colspan > 1 )
{
$anzahl = sizeof($this->cols[$row]);
unset($this->cols[$row][$anzahl]);
unset($this->c_colspan[$row][$anzahl]);
$this->ChangeColSpan($row,$column,$colspan);
}
else if ( $colspan > 1 )
{
$this->c_colspan[$row][$column] = $colspan;
}
else
{
echo "Fehler beim erstellen der Tabelle beim �ndern des ColSpan";
}
}
}
/** Puts a value into an html table column
*
* @desc Puts a value into an html table column
* @param string the value that should be shown in the row $row and column $column
* @param number the row number, if not given, the actual row is used ( the last row created )
* @param number the column number, if not given the actual is used ( the last created )
* @return void
**/
function PutIntoColumn( $_theLine, $row= "", $column= "" )
{
//global $ht;
if ( empty($column) )
{
$column= $this->act_col;
}
if ( empty($row) )
{
$row= $this->max_row;
}
$this->cols[$row][$column] = $_theLine;
}
/** Changes the Vertical Alignment of an complete column
* @return void
* @param column_to_change column_number ( starting from 1 )
* @param ALIGN CENTER or LEFT or RIGHT
* @desc Changes the alignment of all fields in the column column_to_change
*/
function ChangeColumnVerticalAlignment($column_to_change,$ALIGN)
{
for ( $i = 1; $i <= $this->max_row; $i++)
{
$this->c_valign[$i][$column_to_change] = $ALIGN;
}
}
/** Changes the Alignment of an complete column
* @return void
* @param column_to_change column_number ( starting from 1 )
* @param ALIGN CENTER or LEFT or RIGHT
* @desc Changes the alignment of all fields in the column column_to_change
*/
function ChangeColumnAlignment($column_to_change,$ALIGN)
{
for ( $i = 1; $i <= $this->max_row; $i++)
{
$this->c_align[$i][$column_to_change] = $ALIGN;
}
}
/** Changes the Alignment of an complete row
* @return void
* @param row_to_change Number Of Row ( starting from 1 )
* @param ALIGN CENTER or RIGHT or LEFT
* @desc Changes the Alignment of all fields in the Row (row_to_change )
*/
function ChangeRowAlignment($row_to_change,$ALIGN)
{
for ( $i = 1; $i <= $this->max_col; $i++ )
{
$this->c_align[$row_to_change][$i] = $ALIGN;
}
}
/** Changes the color of a complete row
* or on all rows from the named one, if arg #3 is true
*
* @return void
* @param row_to_change Number Of Row ( starting from 1 )
* @param color e.g. "#000000" or "black"
* @param all = false true or false
* @desc Changes the color of all fields in the Row (row_to_change) or all fields in table ( if all = true )
*/
function ChangeRowColor($row_to_change,$color,$all=false)
{
if ( $all )
{
for ( $The_rows_to_change = $row_to_change ; $The_rows_to_change <= $this->max_row; $The_rows_to_change++ )
{
for ( $i = 1; $i <= $this->max_col; $i++ )
{
$this->c_bgcolor[$The_rows_to_change][$i] = $color;
}
}
}
else
{
for ( $i = 1; $i <= $this->max_col; $i++ )
{
$this->c_bgcolor[$row_to_change][$i] = $color;
}
}
}
/** Changes the color of a complete color
* or on all column from the named one, if arg #3 is true
*
* @return void
* @param column_to_change Number of Column( starting from 1 )
* @param color e.g. #000000 or "black"
* @desc Change all fields in one Column(column_to_change) to color ( color )
*/
function ChangeColumnColor($column_to_change,$color)
{
for ( $i = 1; $i <= $this->max_row; $i++)
{
//$this->c_bgcolor[$i][$column_to_change] = $color;
//$this->ColumnBackgroundColor($i,$column_to_change,$color);
$this->SetColumnBackgroundColor($i,$column_to_change,$color);
}
}
/** Adds a column after the actual row ( the last one created )
* @return void
* @desc Adds a column to the Actual Row. If the Actual row has the most columns, all other rows are updated to the same amount of cols
*/
function AddColumn()
{
$this->act_col++;
if ( $this->act_col > $this->max_col )
$this->max_col = $this->act_col;
//$this->cols[$this->max_row][$this->act_col] = $_theLine;
}
/** Adds a column after the actual column ( the last one created )
* @return void
* @desc Adds a new row to the table construct
*/
function AddRow()
{
$this->max_row++;
$this->act_col = 0;
}
function GetRowAmount()
{
return $this->max_row;
}
/** Inserts a new Column in all rows between col-1 and col
* before the column with the number $col
* @return void
* @param col Column number ( starts from 1)
* @desc Inserts a new Column in all rows between col-1 and col
*/
function InsertColumn($col)
{
for ( $_row = 1; $_row <= $this->max_row; $_row++ )
{
for ( $_col = $this->max_col; $_col >= $col; $_col-- )
{
$this->cols[$_row][$_col+1] = $this->cols[$_row][$_col];
$this->cols[$_row-2][$col] = "";
}
}
//global $ht;
$this->cols[$_row-2][$col] = "";
$this->max_col++;
}
/** Inserts a new Row between $row-1 and $row
*
* @desc Inserts a new Row between $row-1 and $row
*
* @param number the row number, which will be after the new row
* @return void
**/
function InsertRow($row)
{
for ( $_row = $this->max_row ; $_row >= $row ; $_row-- )
{
for ( $_col = 1; $_col <= $this->max_col; $_col++)
{
$this->cols[$_row+1][$_col] = $this->cols[$_row][$_col];
$this->c_colspan[$_row+1][$_col] = $this->c_colspan[$_row][$_col];
}
}
for ( $_col = 1; $_col <= $this->max_col; $_col++)
{
$this->cols[$row][$_col] = "";
$this->c_colspan[$row][$_col] = 1;
}
$this->max_row++;
}
/** Finalizes a table construct,
* adds all tags, wich are not specially defined
* @desc Finalizes a table construct
* @return void
* @access private
**/
function SaneTable()
{
for ( $_row = 1; $_row <= $this->max_row; $_row++ )
{
for ( $_col = 1; $_col <= $this->max_col; $_col++ )
{
$tmp = trim($this->cols[$_row][$_col]);
$x = isset($this->cols[$_row][$_col]);
if ( ! isset($this->cols[$_row][$_col]) )
{
$this->cols[$_row][$_col] = " ";
}
else if ( empty($tmp) )
{
$this->cols[$_row][$_col] = $this->cols[$_row][$_col]." ";
}
if ( empty( $this->c_colspan[$_row][$_col]) )
{
$this->c_colspan[$_row][$_col] = 1;
}
if ( $this->table_finished )
{
if ( empty($this->c_bgcolor[$_row][$_col]) )
{
$this->c_bgcolor[$_row][$_col] = $this->t_bgcolor;
}
if ( empty( $this->c_align[$_row][$_col]) )
{
$this->c_align[$_row][$_col] = $this->c_align_default;
}
if ( empty( $this->c_valign[$_row][$_col]) )
{
$this->c_valign[$_row][$_col] = $this->c_valign_default;
}
if ( empty( $this->c_vspace[$_row][$_col]) )
{
$this->c_vspace[$_row][$_col] = "";
}
if ( empty( $this->c_height[$_row][$_col]) )
{
$this->c_height[$_row][$_col] = "";
}
if ( empty( $this->c_width[$_col]) )
{
$this->c_width[$_col] = ceil(100/$this->max_col);
}
if ( empty( $this->c_head[$_col]) )
{
$this->c_head[$_row][$_col] = false;
}
}
//$this->cols[$_row][$_col] .= " $_row --> $_col ";
}
// $col_span = array_sum($this->c_colspan[$_row]);
//echo $col_span;
}
}
/** Checks if the table definition is complete
* @return void
* @desc The current table construct is beeing parsed, and searched for missing or invalid columns
*/
function TestTable()
{
//global $ht;
//$ht->Write_R($this->cols);
for ( $i = 0; $i < $this->rows; $i++ )
{
if ( sizeof($this->cols[$i]) != $sizeof($this->cols[0]) )
{
print "Fehler in zeile $i";
}
}
}
/**
* Writes the $_theLine with an Linebreak in HTML AND in source code
* @desc Schreibe nach HTML mit HTML Newline und mit Sourcecode Newline
*/
function W_WriteLn($_theLine="")
{
return $_theLine . "n<br>n";
}
/** generates the table and returns the html code for it
* returnes a complete ( and sane ) HTML Table construct
* @return string
* @desc returns the HTML Table constructm after validating and filling the missing columns
*/
function GenTable()
{
//global $ht;
//$ht = new W_HTMLGeneration();
$this->table_finished = true;
$this->TestTable();
$this->SaneTable();
$c_size = 100 / $this->max_col;
$the_table = $this->OpenTableX();
for ( $_row = 1; $_row <= $this->max_row; $_row++ )
{
$the_table .= $this->Row(true);
for ( $_col = 1; $_col <= $this->max_col; $_col++ )
{
if ( $this->row_headings[$_row] == 1 )
{
$this->c_head[$_row][$_col] = true;
$the_table .= $this->Column(true,$_row,$_col);
if ( !empty($this->c_prefix[$_col]))
{
$the_table .= $this->c_prefix[$_col];
}
$the_table .= $this->cols[$_row][$_col];
if ( !empty($this->c_postfix[$_col]))
{
$the_table .= $this->c_postfix[$_col];
}
$the_table .= $this->Column(false,$_row,$_col);
if ( $this->c_colspan[$_row][$_col] > 1 )
{
$_col += $this->c_colspan[$_row][$_col] -1;
}
}
else
{
$the_table .= $this->Column(true,$_row,$_col);
if ( !empty($this->c_prefix[$_col]))
{
$the_table .= $this->c_prefix[$_col];
}
$the_table .= $this->cols[$_row][$_col];
if ( !empty($this->c_postfix[$_col]))
{
$the_table .= $this->c_postfix[$_col];
}
$the_table .= $this->Column(false);
if ( $this->c_colspan[$_row][$_col] > 1 )
{
$_col += $this->c_colspan[$_row][$_col] -1;
}
}
}
$the_table .= $this->Row(false);
}
$the_table .= $this->CloseTableX();
return $the_table;
}
/** DO NOT USE
* @desc DO NOT USE
* @access private
**/
function OpenTableX()
{
$this->open_tab++;
$result = "n";
for ( $i=0;$i<=$this->open_tab;$i++)
{
$result .= " ";
}
$result .= '<table summary="_" ';
if ( !empty($this->t_size) )
{
$result .= ' width="'.$this->t_size.'"';
}
$result .= ' border="'.$this->t_border.'"';
$result .= ' cellspacing="'.$this->t_cellspacing.'"';
$result .= ' cellpadding="'.$this->t_cellpadding.'"';
if ( !empty($this->t_bgcolor) )
{
$result .= ' bgcolor="'.$this->t_bgcolor.'"';
}
if ( !empty($bordercolor) )
{
$result .= ' BORDERCOLOR="'.$bordercolor.'" ';
}
if ( $this->t_align != "" )
{
$result .= ' align="'. $this->t_align .'" ';
}
$result .= ">";
return $result;
}
/**
* @return unknown
* @desc DO NOT CALL THIS FUNCTION DIRECTLY. Ends the HTML Table Construct. DO NOT CALL THIS FUNCTION DIRECTLY
*/
function CloseTableX()
{
$result = "n";
for ( $i=0;$i<=$this->open_tab;$i++)
{
$result .= "";
}
$this->open_tab--;
$result .= '</TABLE>';
return $result;
}
/**
* @return unknown
* @param start true ( td open ) or false (td close )
* @param _row = null Rownumber ( starts from 1 )
* @param _col = null Columnnumber ( starts from 1 )
* @desc Creates the HTML Code for an tabledatafield. uses Classvariablesarray for instructions
*/
function Column($start,$_row=0,$_col=0)
{
if ( $start )
{
$this->open_Col++;
}
$result = "n";
for ( $i=0;$i<=$this->open_tab + $this->open_Row + $this->open_Col ;$i++)
{
$result .= " ";
}
if ( !$start)
{
$this->open_Col--;
}
if ( $start ) {
$result .= '<T';
}
else {
$result .= '</T';
}
if ( $this->c_head[$_row][$_col] == true ) {
$result .= 'H ';
}
else {
$result .= 'D ';
}
if ( $start ) {
if ( !empty($this->c_bgcolor[$_row][$_col]) )
$result .= 'BGCOLOR="'.$this->c_bgcolor[$_row][$_col] .'" ';
if ( !empty($this->c_align[$_row][$_col]) )
$result .= ' ALIGN="'.$this->c_align[$_row][$_col].'" ';
if ( !empty($this->c_colspan[$_row][$_col]) )
$result .= ' COLSPAN="'.$this->c_colspan[$_row][$_col].'" ';
if ( !empty($this->c_rowspan[$_row][$_col]) )
$result .= ' ROWSPAN="'.$this->c_rowspan[$_row][$_col].'" ';
if ( !empty($this->c_valign[$_row][$_col]) )
$result .= ' VALIGN="'.$this->c_valign[$_row][$_col].'" ';
if ( !empty($this->c_vspace[$_row][$_col]) )
$result .= ' VSPACE="'.$this->c_vspace[$_row][$_col].'" ';
if ( !empty($this->c_height[$_row][$_col]) )
$result .= ' HEIGHT="'.$this->c_height[$_row][$_col].'" ';
if ( !empty($this->c_width[$_row][$_col]) )
$result .= ' WIDTH="'.$this->c_width[$_col].'" ';
/*if ( $this->c_bgcolor != "") { $result .= 'BGCOLOR="'.$this->c_bgcolor .'" '; }
if ( $this->c_align != "" ) { $result .= ' ALIGN="'.$this->c_align.'" '; }
if ( $this->c_colspan != "") { $result .= ' COLSPAN="'.$this->c_colspan.'" '; }
if ( $this->c_rowspan != "") { $result .= ' ROWSPAN="'.$this->c_rowspan.'" '; }
if ( $this->c_valign != "" ) { $result .= ' VALIGN="'.$this->c_valign.'" '; }
if ( $this->c_vspace != "" ) { $result .= ' VSPACE="'.$this->c_vspace.'" '; }
if ( $this->c_height != "" ) { $result .= ' HEIGHT="'.$this->c_height.'" '; }
if ( $this->c_width != "" ) { $result .= ' WIDTH="'.$this->c_width.'" '; }*/
//if ( $this->c_nowrap != "" ) { $result .= ' nowrap';}
}
$result .= ">n";
return $result;
}
/** DO NOT USE
* @desc DO NOT USE
* @access private
**/
function Row($start,$valign="")
{
if ( $start )
{
$this->open_Row++;
}
$result = "n";
for ( $i=0;$i<=$this->open_tab + $this->open_Row ;$i++)
{
$result .= " ";
}
if ( !$start )
{
$this->open_Row--;
}
if ( $start )
{
$result .= "<TR";
if ( $valign != "" )
{
$result .= ' VALIGN="'.$valign.'" ';
}
}
else
{
$result .= "</TR";
}
$result .= ">n";
return $result;
}
/** DO NOT USE
* @desc DO NOT USE
* @access private
**/
function WriteTableHead($heading)
{
global $w_ht;
$result = $this->Row(true);
for ( $i = 0; $i < sizeof($heading); $i++)
{
$result .= $this->Column(true,"",CENTER,"","","","","","","",true);
$result .= $this->PutIntoColumn($w_ht->W_WriteLn($heading[$i]),1,$i+1);
//$result .= $this->PutIntoColumn(($heading[$i]),1,$i+1);
$result .= $this->Column(false,"","","","","","","","","",true);
}
$result .= $this->Row(false);
return $result;
}
/**
* generates a empty HTML Table column
*
* for $colsize look at StartColumn ($width)
*/
function NullColumn($colsize="",$head=false,$bgcol="",$colspan=1,$rowspan=1)
{
if (!empty($colsize))
{
$result = $this->Column(true,$bgcol,CENTER,$colspan,0,0,"",$colsize,"",$rowspan,$head);
}
else
{
$result = $this->Column(true,$bgcol,CENTER,$colspan,0,0,"","50%","",$rowspan,$head);
}
$result .= $this->WriteLine(" ");
$result .= $this->Column(false);
return $result;
}
function ReadCommentsForColumns($column_name,$table_name,$which=0)
{
global $db,$CONNECTION;
$sql = "select comments from all_col_comments where table_name = '";
$sql .= $table_name ;
$sql .= "'";
$sql .= " AND COLUMN_NAME = '";
$sql .= $column_name;
$sql .= "'";
$Column_info = $db->loadATable($sql, $CONNECTION, "DBA_COL_COMMENTS");
array_shift($Column_info);
$commentar = explode(":",$Column_info[0][0]);
if ( !empty($commentar[$which] ))
{
return $commentar[$which];
}
elseif ( !empty($commentar[0]) )
{
return $commentar[0];
}
else
{
return "Keine Kommentar f�r Feld ". $column_name;
}
}
} ?>
|
|