BlueShoes Application Framework made with PHP http://www.blueshoes.org/


Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: C:/usr/local/lib/php/blueshoes-4.2/core/html/table/Bs_HtmlTableWindrose.class.php
BlueShoes Application Framework - html/table

Bs_HtmlTableWindrose

Bs_Object
   |
  +-- Bs_HtmlTableWindrose

**********************************************************************

 

private class Bs_HtmlTableWindrose extends Bs_Object

**********************************************************************
HtmlTableWindrose classHas knowledge where to set attributes and styles at a RELATIVE positionof 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.phpo) The Relative Position mnomics ID's (or keys)- ALLAll cells- Boarders And CornersDefined by the wind rose mnomics. E.g. NW is top/left cell and N is top rowN +----+---+----+NW ¦ NE ¦ NW ¦ N ¦ NE ¦\ ¦ / +----+---+----+W ---- C ---- E ¦ W ¦ C ¦ E ¦/ ¦ \ +----+---+----+SW ¦ SE ¦ SW ¦ S ¦ SE ¦S +----+---+----+- C (Center)C (the center cells)- DD (Diogonal Down) and DU (Diogonal Up)- ZR_0/ZR_1 and ZC_0/ZC_1 (Zebra Row and Zebra Col)o) PrioritiesDepending 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 OPAQUEOPAQUE 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 actuallyalso 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 loated at bs-4.0/toolbox/Html/TableGenerator/Bs_TableGenerator.class.phpDISCLAIMER This code is provided to you, "as is". Best efforts have been made tomaintain it, but the authors are not responsible for the results of any defectsthat may be found to exist, or any lost profits or other consequential damagesthat may result from such defects. You should not assume that this code iserror-free or that it will be suitable for the particular purpose that you havein mind when using it.

Authors
Version4.0.$id$
Copyrightblueshoes.org

 

Methods inherited from Bs_Object

isex, isexception, tostring, tohtml, persist, unpersist, bs_object, bbsetoutput, bbawake, bbisawake, bbxmsg, bbxfunctionstart, bbxfunctionend, bbxecho, bbxvar, bbxvardump, bbforcetrace, bbbufferstart, bbbufferget, bbbufferendflush, bbbufferendclean

Public Method Summary

void

Bs_HtmlTableWindrose()

**********************************************************************
void

setStyle(mixed $windroseID, string $newStyle, [ string $transparent ])

**********************************************************************
void

setAttr(string $windroseID, mixed $newAttr, [ string $transparent ])

**********************************************************************
array

&getMatrix(int $rowSize, int $colSize)

**********************************************************************
string

&getCssBlock()

**********************************************************************
bool

isStyleTransparent(string $windroseID)

**********************************************************************
bool

isAttrTransparent(string $windroseID)

**********************************************************************
string

getStyleStrings()

**********************************************************************
string

getAttrStrings()

**********************************************************************
void

write([ string $path ])

**********************************************************************
void

read([ string $path ])

**********************************************************************

Private Method Summary

array

_hashKeysToLower(array $hashArray)

**********************************************************************
array

&_getMatrixStream(integer $rowPos, integer $colPos, [ string $x, string $y ])

**********************************************************************
void

_reset()

**********************************************************************
void

_resetMatrix()

**********************************************************************
void

_initMatrix(array &$windroseData, array &$windroseOrder, array &$variationList, string $key)

**********************************************************************

Public Field Summary

array

$windroseMnomics

**********************************************************************

Private Field Summary

array

$_styleVariation

**********************************************************************
array

$_styleData

**********************************************************************
array

$_attrVariation

string

$_windroseMatrix

integer

$_rowSize

integer

$_colSize

array

$_styleOrder

integer

$_styleOrderNr

array

$_attrData

array

$_attrOrder

integer

$_attrOrderNr

Private Constant Summary

BS_HTMLTABLEWINDROSE_VERSION >>4.0.$x$<< Warning: documentation is missing.

Public Method Details

Bs_HtmlTableWindrose

public void Bs_HtmlTableWindrose( )

  **********************************************************************
Constructor

Returns void


setStyle

public void setStyle( mixed $windroseID, string $newStyle, [ string $transparent ] )

  **********************************************************************
Set a style to a TD-cell at a relative position of a tableRelative position mnomic ID's areN +----+---+----+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 placedThe 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;'

Parameter
mixed $windroseID
string OR hash array of attribute(s) e.g. 'font:arial;...' OR array('font'=>'arial', ...)
string $newStyle
Relative position mnomics ID
string $transparent = >>TRUE<<
If TRUE merge data on top of previous style otherwise overwrite it
Returns void


setAttr

public void setAttr( string $windroseID, mixed $newAttr, [ string $transparent ] )

  **********************************************************************
Set a attribute to a TD-cell at a relative position of a tableRelative position mnomic ID's areN +----+---+----+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"'

Parameter
string $windroseID
Relative position mnomics ID
mixed $newAttr
string OR hash array of attribute(s) e.g. 'width="50px ...' OR array('width'=>'50px', ...)
string $transparent = >>TRUE<<
If TRUE merge data on top of previous attr otherwise overwrite it
Returns void


&getMatrix

public array &getMatrix( int $rowSize, int $colSize )

  **********************************************************************
Builds and inits the 2-D $_windroseMatrix of size $rowSize x $colSize whereevery cell holds the data for rendering.

Parameter
int $rowSize
comment above
int $colSize
comment above
Returns array

see comment above

See Also _initMatrix()

&getCssBlock

public string &getCssBlock( )

  **********************************************************************
If you're planing to work with CSS (Cascading Style Sheats) you canget 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.

Returns string

see above


isStyleTransparent

public bool isStyleTransparent( string $windroseID )

  **********************************************************************
Returns TRUE if the style given by windroseID is transparent

Parameter
string $windroseID
a position mnomics ID
Returns bool

see above


isAttrTransparent

public bool isAttrTransparent( string $windroseID )

  **********************************************************************
Returns TRUE if the attr given by windroseID is transparent

Parameter
string $windroseID
a position mnomics ID
Returns bool

see above


getStyleStrings

public string getStyleStrings( )

  **********************************************************************
Gets a hash array. The key is a position mnomics ID and the value isstring holding the data. E.g.array('N'=>'color:black; background-color:white; font-size:20px;', 'NE'=>'...', ...)

Returns string

see above


getAttrStrings

public string getAttrStrings( )

  **********************************************************************
Gets a hash array. The key is a position mnomics ID and the value isstring holding the data. E.g.array('N'=>'aligne="center"', ...)

Returns string

see above


write

public void write( [ string $path ] )

  **********************************************************************
Wtite the data to a file in a readable and changeable form

Parameter
string $path = >>''<<
Fullpath (incl. file name) to store the data
Returns void


read

public void read( [ string $path ] )

  **********************************************************************
Read the data from a file in.

Parameter
string $path = >>''<<
Fullpath (incl. file name) to store the data
Returns void


Private Method Details

_hashKeysToLower

private array _hashKeysToLower( array $hashArray )

  **********************************************************************
Transform all keys of a hash array to lower case

Parameter
array $hashArray
Returns array

with all keys to lower case


&_getMatrixStream

private array &_getMatrixStream( integer $rowPos, integer $colPos, [ string $x, string $y ] )

  **********************************************************************
Gets a 1-D array stream by *reference* of a area of the windroseMatrix.Used to set areas.

Parameter
integer $rowPos
Start of get row
integer $colPos
Start of get col
string $x = >>''<<
(opt) amount of row (Default ALL)
string $y = >>''<<
(opt) amount of col (Default ALL)
Returns array

stream by *reference* of the area. Or empty array if off limit.


_reset

private void _reset( )

  **********************************************************************
Reset all object vars

Returns void


_resetMatrix

private void _resetMatrix( )

  **********************************************************************
Reset the style- (attr-) windroseMatrix only keeping all otherdata.Reason: The windroseMatrix produced just befor table rendering.As soon as any set-function is called, it loses its validity.

Returns void


_initMatrix

private void _initMatrix( array &$windroseData, array &$windroseOrder, array &$variationList, string $key )

  **********************************************************************
Inits the $_windroseMatrix with data.Not easy to understand. So lets start with the result.After a call from getMatrix() that sets up the empty $_windroseMatrix and then callsthis function 2x, passing the style parameters and then the attr parameters,the $_windroseMatrix will have all the data set for future use (HTML table rendering).The cells (if set) will hold thea) ['styleID'] A position mnomic ID representing a style-key.b) ['style'] The corresponding style arrayc) ['attrID'] A position mnomic ID representing a attr-key.d) ['attr'] The corresponding attrDuring this process styles (and attrs) may have been merged producing newstyles (attrs). For identification also new merged position mnomic (like NW_W_N)representing a merged style are created. This is very usefull in conection withCSS and the 'CLASS=<styleID>' attribute.All styles (attrs) incl. the new ones are placed in the appropiate variation list.

Parameter
array &$windroseData
style- or attr-data.
array &$windroseOrder
the windrose position order E.g. ('NE'=>1, 'N'=>3,'W'=>1,...)
array &$variationList
all variations of style- or attr-data.
string $key
data is put in the $_windroseMatrix in 2 fields of [$key] and [$key.'ID']
Returns void


Public Field Details

$windroseMnomics

public array $windroseMnomics

>>array('ALL','C','DD','DU','N','W','S','E','NW','SW','SE','NE', 'ZR_0', 'ZR_1', 'ZC_0', 'ZC_1')<<

**********************************************************************
All windrose mnomics.


Private Field Details

$_styleVariation

private array $_styleVariation

>>array()<<

**********************************************************************
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.


$_styleData

private array $_styleData

>>array()<<

**********************************************************************
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") areTRANSPARENT (style merging) or OPAQUE (covering)$_styleData[mnomics]['style'] Hash array" " ['transparent'] bool$_attrData[mnomics]['attr'] Hash array" " ['transparent'] bool


$_attrVariation

private array $_attrVariation

>>array()<<



$_windroseMatrix

private string $_windroseMatrix

>>NULL<<



$_rowSize

private integer $_rowSize

>><<



$_colSize

private integer $_colSize

>><<



$_styleOrder

private array $_styleOrder

>>array()<<



$_styleOrderNr

private integer $_styleOrderNr

>><<



$_attrData

private array $_attrData

>>array()<<



$_attrOrder

private array $_attrOrder

>>array()<<



$_attrOrderNr

private integer $_attrOrderNr

>><<



Private Constant Details

BS_HTMLTABLEWINDROSE_VERSION

define( BS_HTMLTABLEWINDROSE_VERSION, >>4.0.$x$<< )
Case: default: case sensitive




Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta