| core_html

# Class: Bs_HtmlTableWindrose Source Location: /core/html/table/Bs_HtmlTableWindrose.class.php
### Class Overview
    Bs_Object
       |
       --Bs_HtmlTableWindrose
HtmlTableWindrose class Has knowledge where to set attributes and styles at a RELATIVE position of a HTML table. #### Author(s): Sam Blum <at blueshoes dot org> #### Version: 4.3.$Revision: 1.4 $ $Date: 2003/10/29 17:48:41 $ #### Copyright: blueshoes.org | ### Variables $metaInfo $windroseMnomics $_attrData $_attrOrder $_attrOrderNr $_attrVariation $_colSize $_rowSize $_styleData $_styleOrder $_styleOrderNr $_styleVariation $_windroseMatrix | ### Methods Bs_HtmlTableWindrose getAttrStrings getCssBlock getMatrix getStyleStrings isAttrTransparent isStyleTransparent read readByString setAttr setStyle write
### Inherited Variables | ### Inherited Methods #### Class: Bs_Object Bs_Object::Bs_Object() Bs_Object::getErrors() Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack. Bs_Object::getLastError() Basic error handling: Get last error string from the global Bs_Error-error stack. Bs_Object::getLastErrors() Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors(). Bs_Object::persist() Persists this object by serializing it and saving it to a file with unique name. Bs_Object::setError() Basic error handling: Push an error string on the global Bs_Error-error stack. Bs_Object::toHtml() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::toString() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::unpersist() Fetches an object that was persisted with persist()
### Class Details [line 66] HtmlTableWindrose class Has knowledge where to set attributes and styles at a RELATIVE position of a HTML table. The rel. pos. are given by position mnomics ID's like 'N', 'NW', .... It manly finds use in the Bs_HtmlTable.class.php
     o) The Relative Position mnomics ID's (or keys)
        - ALL
          All cells
        - Borders And Corners
          Defined by the wind rose mnomics. E.g. NW is top/left cell and N is top row
                     N                +----+---+----+
                NW   ¦   NE           ¦ NW ¦ N ¦ NE ¦
                   \ ¦ /              +----+---+----+
              W ---- C ---- E         ¦ W  ¦ C ¦  E ¦
                   / ¦ \              +----+---+----+
                SW   ¦   SE           ¦ SW ¦ S ¦ SE ¦
                     S                +----+---+----+
        - C (Center)
          C (the center cells)
        - DD (Diagonal Down) and DU (Diagonal Up)
        - ZR_0/ZR_1 and ZC_0/ZC_1 (Zebra Row and Zebra Col)

     o) Priorities
        Depending in which order you set what and if styles are transparent (to be merged) or not,
        you will get differnt results at the style "intersections".
        E.g. Setting NW, W, N and ALL would effect the top/left cell 3x (!).
        That's way 2 things matter:
        1) The ORDER you set things.
        2) If setting is TRASPARENT (default) or OPAQUE
           OPAQUE will cover the previous style.
           TRANSPARENT will merge with the previous style; covering attr. with same name like 'font'

     NOTE  I'm distinguishing between HTML-attributes and STYLE although STYLE is actually
           also a HTML-attributes that holds another set of attributes (which gave me a name space headache ;-) )
           So fuctions end often with 'Attr' or 'Style' like setAttr() or setStyle()
           One setting the STYLE attributes, the other the HTML-tag attributes.

     hint: use the table generator located at /toolbox/html/tablegenerator/Bs_TableGenerator.class.php

     DISCLAIMER  This code is provided to you, "as is". Best efforts have been made to
       maintain it, but the authors are not responsible for the results of any defects
       that may be found to exist, or any lost profits or other consequential damages
       that may result from such defects. You should not assume that this code is
       error-free or that it will be suitable for the particular purpose that you have
       in mind when using it.
#### Tags:
see: | Bs_HtmlTable.class.php
version: | 4.3.$Revision: 1.4 $ $Date: 2003/10/29 17:48:41 $
copyright: | blueshoes.org
author: | Sam Blum <at blueshoes dot org>
[ Top ] ### Class Variables #### $metaInfo = array() [line 117] array with meta information about the style. the keys are: isFirstRowTitle => bool isLastRowTitle => bool isFirstColTitle => bool isLastColTitle => bool tableTag => string. note that this is only a hint. not used with Bs_HtmlTable. example: <table border="0"> #### Tags:
since: | bs4.4
access: | public
Type: | array
[ Top ] #### $windroseMnomics = array( 'ALL'=>'All Cells', 'C' =>'Center Cells', 'DD' =>'Diagonal Down Row', 'DU' =>'Diagonal Up Row', 'N' =>'North Row', 'W' =>'West Row', 'S' =>'South Row', 'E' =>'East Row', 'NW' =>'North West Cell', 'SW' =>'South West Cell', 'SE' =>'South East Cell', 'NE' =>'North East Cell', 'ZR_0' =>'Zebra Rows, (the even numbers)', 'ZR_1' =>'Zebra Rows (the odd numbers)', 'ZC_0' =>'Zebra Cols (the even numbers)', 'ZC_1' =>'Zebra Rows (the odd numbers)', ) [line 123] *********************************************************************** All windrose mnomics. #### Tags:
access: | public
Type: | mixed
[ Top ] #### $_attrData = array() [line 100]
Type: | mixed
[ Top ] #### $_attrOrder = array() [line 101]
Type: | mixed
[ Top ] #### $_attrOrderNr = 0 [line 102]
Type: | mixed
[ Top ] #### $_attrVariation = array() [line 77]
Type: | mixed
[ Top ] #### $_colSize = 0 [line 81]
Type: | mixed
[ Top ] #### $_rowSize = 0 [line 80]
Type: | mixed
[ Top ] #### $_styleData = array() [line 96] *********************************************************************** Following var's are used to memorize ... a) the style of each relative position (windrose position) given by position mnomics ID's 'N', 'W', 'NE', ... b) in which the order to apply the styles. c) if styles that affect a cell more the once (style "intersections") are TRANSPARENT (style merging) or OPAQUE (covering) $_styleData[mnomics]['style'] Hash array " " ['transparent'] bool $_attrData[mnomics]['attr'] Hash array " " ['transparent'] bool
Type: | mixed
[ Top ] #### $_styleOrder = array() [line 97]
Type: | mixed
[ Top ] #### $_styleOrderNr = 0 [line 98]
Type: | mixed
[ Top ] #### $_styleVariation = array() [line 76] *********************************************************************** Following var's are used when HTML table rendering is to take place. If a transparent style affects a cell more the once the styles are merges at the "style-intersections". We then consequently come out with a NEW style at that cell: Old style merged with follow style. E.g. The old 'NW'-style and a following tranparent 'N'-style will give a new 'NW_N'-style. All styles and style variations are kept in $_styleVariation array. E.g. $_styleVariation = array('NW' => <styleArray>, 'N' => <styleArray>, 'NW_N'=><styleArray>, ...) This finds use if you use CSS and need an ID for each style.
Type: | mixed
[ Top ] #### $_windroseMatrix = NULL [line 79]
Type: | mixed
[ Top ] ### Class Methods ### constructor Bs_HtmlTableWindrose [line 145]
`Bs_HtmlTableWindrose Bs_HtmlTableWindrose( )`
*********************************************************************** Constructor [ Top ] ### method getAttrStrings [line 340]
`string getAttrStrings( )`
*********************************************************************** Gets a hash array. The key is a position mnomics ID and the value is string holding the data. E.g. array('N'=>'aligne="center"', ...) #### Tags:
return: | see above
access: | public
[ Top ] ### method getCssBlock [line 274]
`string &getCssBlock( )`
*********************************************************************** If you're planing to work with CSS (Cascading Style Sheats) you can get a STYLE block.
     E.g.
       .N     { color:black; background-color:white; font-size:20px; font-family:Verdana,Arial; font-style:normal;}
       .N_NW  { color:black; background-color:white; font-size:16px; font-family:Verdana,Arial; font-style:normal;}
       .W     { color:#0066CC; background-color:white; font-size:12px; font-family:Verdana,Arial; font-style:normal; cursor:hand; }
NOTE: You must have called $this->getMatrix() before the data is available. #### Tags:
return: | see above
access: | public
[ Top ] ### method getMatrix [line 238]
`&$matrix &getMatrix( $rowSize $rowSize, $colSize $colSize)`
*********************************************************************** Builds and inits the 2-D $_windroseMatrix of size $rowSize x $colSize where every cell holds the data for rendering. #### Tags:
return: | a 2-D array see comment above
access: | public
see: | _initMatrix() for structure.
#### Parameters:
$rowSize | $rowSize | int see comment above
$colSize | $colSize | int see comment above
[ Top ] ### method getStyleStrings [line 319]
`string getStyleStrings( )`
*********************************************************************** Gets a hash array. The key is a position mnomics ID and the value is string holding the data. E.g. array('N'=>'color:black; background-color:white; font-size:20px;', 'NE'=>'...', ...) #### Tags:
return: | see above
access: | public
[ Top ] ### method isAttrTransparent [line 307]
`bool isAttrTransparent( string $windroseID)`
*********************************************************************** Returns TRUE if the attr given by windroseID is transparent #### Tags:
return: | see above
access: | public
#### Parameters:
string | $windroseID | a position mnomics ID
[ Top ] ### method isStyleTransparent [line 296]
`bool isStyleTransparent( string $windroseID)`
*********************************************************************** Returns TRUE if the style given by windroseID is transparent #### Tags:
return: | see above
access: | public
#### Parameters:
string | $windroseID | a position mnomics ID
[ Top ] ### method read [line 498]
`void read( [string $path = ''])`
Read the data from a file in. #### Tags:
see: | Bs_HtmlTableWindrose::readByString(), Bs_HtmlTableWindrose::write()
access: | public
#### Parameters:
string | $path | Fullpath (incl. file name) to store the data
[ Top ] ### method readByString [line 432]
`void readByString( string $string)`
Read the data from the given text string. #### Tags:
todo: | why is the inihandler not used here? i think this code could be replaced. i think the inihandler did not exist at that time.
see: | Bs_HtmlTableWindrose::read(), Bs_HtmlTableWindrose::write()
access: | public
#### Parameters:
string | $string |
[ Top ] ### method setAttr [line 213]
`void setAttr( string $windroseID, mixed $newAttr, [bool $transparent = TRUE])`
*********************************************************************** Set a attribute to a TD-cell at a relative position of a table Relative position mnomic ID's are
                     N                +----+---+----+
                NW   ¦   NE           ¦ NW ¦ N ¦ NE ¦
                   \ ¦ /              +----+---+----+
              W ---- C ---- E         ¦ W  ¦ C ¦  E ¦
                   / ¦ \              +----+---+----+
                SW   ¦   SE           ¦ SW ¦ S ¦ SE ¦
                     S                +----+---+----+
Pass a hash array containing the name(s) and value(s) pair(s) you wish to set. If value = NULL only a name will be placed. The hash array must have the form: array(name=>value, name=>value, name=>NULL, ...). NOTE: Using hash array is more perfomant. If you use a string, then use the right syntax! 'name="value" name="value"' #### Tags:
access: | public
#### Parameters:
string | $windroseID | Relative position mnomics ID
mixed | $newAttr | string OR hash array of attribute(s) e.g. 'width="50px ...' OR array('width'=>'50px', ...)
bool | $transparent | If TRUE merge data on top of previous attr otherwise overwrite it
[ Top ] ### method setStyle [line 173]
`void setStyle( string $windroseID, mixed $newStyle, [bool $transparent = TRUE])`
*********************************************************************** Set a style to a TD-cell at a relative position of a table Relative position mnomic ID's are
                     N                +----+---+----+
                NW   ¦   NE           ¦ NW ¦ N ¦ NE ¦
                   \ ¦ /              +----+---+----+
              W ---- C ---- E         ¦ W  ¦ C ¦  E ¦
                   / ¦ \              +----+---+----+
                SW   ¦   SE           ¦ SW ¦ S ¦ SE ¦
                     S                +----+---+----+
Pass a hash array containing the name(s) and value(s) pair(s) you wish to set. If value = NULL only name will be placed. If value = NULL only name will be placed The hash array must have the form: array(name=>value, name=>value, name=>NULL, ...). NOTE: Using hash array is more perfomant. If you use a string, then use the right syntax! 'name:value; name:value;' #### Tags:
access: | public
#### Parameters:
mixed | $newStyle | string OR hash array of attribute(s) e.g. 'font:arial;...' OR array('font'=>'arial', ...)
string | $windroseID | Relative position mnomics ID
bool | $transparent | If TRUE merge data on top of previous style otherwise overwrite it
[ Top ] ### method write [line 360]
`void write( [string $path = ''])`
*********************************************************************** Wtite the data to a file in a readable and changeable form #### Tags:
access: | public
#### Parameters:
string | $path | Fullpath (incl. file name) to store the data
[ Top ] Documentation generated on Mon, 29 Dec 2003 21:11:04 +0100 by phpDocumentor 1.2.3