Sitellite Application Framework
Class Tree         Index         All Elements

Class: HtmlLayout

Source Location: Program_Root/GUI/Layout.php

Class Overview


HtmlLayout is an editable grid layout system using HTML tables, allowing for more complex GUIs to be developed more easily or at least in a more automated fashion.


Author(s)

Version

  • 1.2, 2002-08-18, $Id: Layout.php,v 1.3 2005/10/16 02:52:14 lux Exp $

Copyright

  • Copyright (C) 2001-2003, Simian Systems Inc.

Variables

Methods


Child Classes

Calendar
Calendar implements a graphical calendar generator. This class derives most of its functionality from the saf.GUI.Layout package, so for more information and additional functionality, please read up on that one as well.

Inherited Variables

Inherited Methods


Class Details

[line 115]
HtmlLayout is an editable grid layout system using HTML tables, allowing for more complex GUIs to be developed more easily or at least in a more automated fashion.

Note: Always reads from top-down *then* left to right. Take for example the following 3 x 3 grid:

  a1 | b1 | c1
 ----+----+----
  a2 | b2 | c2
 ----+----+----
  a3 | b3 | c3
 

This grid can also be expressed as:

  0,0 | 1,0 | 2,0
 -----+-----+-----
  0,1 | 1,1 | 2,1
 -----+-----+-----
  0,2 | 1,2 | 2,2
  

This would read a1, a2, a3, b1, b2, b3, etc. Be mindful of this when looping. Also of note when referring to cells is that you can refer to them in two different ways. The 'a1' notation is acceptable, and you can also pass an array of two values containing the column (x) and row (y) position of the cell. Please note that the first notation starts at 'a' and '1', but the second way starts at (0, 0). You can use the translate() method to convert between the two.

Also note that there is a cell limit of 701 cols (from a to zz), regardless of which way you refer to them. This is probably way more than you should ever need anyway. However, should you need more columns, you can use the sub() method to create sub-layouts inside any cell for practically unlimited depth. There is no limit on the number of rows available.

New in 1.2:

  • Fixed a bug in the render() output that was causing some cells not to appear.
  • Increased the column limit from 26 to 701.

1 <?php
2
3 $layout = new HtmlLayout (3, 3);
4
5 // assign a template to cell a1
6 $layout->assign ('a1', 'test test test');
7
8 // assign a template to c3
9 $layout->assign ('c3', 'foo bar');
10
11 // create a sub-layout in b2
12 $b2 =& $layout->sub ('b2');
13
14 // expand b2 one down
15 $layout->spanRows ('b2', 2);
16
17 // expand a1 two across
18 $layout->spanCols ('a1', 3);
19
20 // set some table properties
21 $layout->set ('table', 'border', '1');
22 $layout->set ('table', 'width', '50%');
23 $layout->set ('table', 'height', '50%');
24 $layout->set ('table', 'cellspacing', '2');
25 $layout->set ('table', 'cellpadding', '2');
26
27 // assign b2 (the sub-layout)'s a1 cell a template
28 $b2->assign ('a1', 'qwerty');
29
30 // render
31 echo $layout->render ();
32
33 ? >




Tags:

access:  public
version:  1.2, 2002-08-18, $Id: Layout.php,v 1.3 2005/10/16 02:52:14 lux Exp $
license:  http://www.sitellite.org/index/license
copyright:  Copyright (C) 2001-2003, Simian Systems Inc.
author:  John Luxford <mailto:lux@simian.ca>


[ Top ]


Class Variables

$cell = array ()

[line 147]

Contains all HTML <td> properties for the current object, if this layout is not the top-level layout object.



Tags:

access:  public

Type:   mixed


[ Top ]

$matrix = array ()

[line 122]

Contains the grid.



Tags:

access:  public

Type:   mixed


[ Top ]

$row = array ()

[line 138]

Contains all HTML <tr> properties for the current object.



Tags:

access:  public

Type:   mixed


[ Top ]

$table = array ()

[line 130]

Contains all HTML <table> properties for the current object.



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor HtmlLayout [line 157]

HtmlLayout HtmlLayout( [integer $x = 1], [integer $y = 1])

Constructor method.



Tags:

access:  public


Parameters:

integer   $x  
integer   $y  

[ Top ]

method addCol [line 226]

void addCol( )

Increases the number of columns by 1.



Tags:

access:  public


[ Top ]

method addRow [line 241]

void addRow( )

Increases the number of rows by 1.



Tags:

access:  public


[ Top ]

method append [line 211]

void append( mixed $part, string $template)

Appends more to the template of the specified child HtmlCell object. $part may be either a string of the format 'a1', or an array with two numeric values denoting the cell's x and y position.



Tags:

access:  public


Parameters:

mixed   $part  
string   $template  

[ Top ]

method assign [line 192]

void assign( mixed $part, string $template)

Assigns a template to the specified child HtmlCell object.

$part may be either a string of the format 'a1', or an array with two numeric values denoting the cell's x and y position.




Tags:

access:  public


Parameters:

mixed   $part  
string   $template  

[ Top ]

method col [line 286]

array col( [integer $num = 0])

Returns the specified column as an array of cells.



Tags:

access:  public


Parameters:

integer   $num  

[ Top ]

method render [line 365]

string render( [integer $td = 0])

Renders this layout and all of its cells as well.

$td is set to 1 automatically if the layout is a sub-layout of the top-most layout, otherwise you shouldn't need to change it at all.




Tags:

access:  public


Parameters:

integer   $td  

[ Top ]

method row [line 298]

array row( [integer $num = 0])

Returns the specified row as an array of cells.



Tags:

access:  public


Parameters:

integer   $num  

[ Top ]

method set [line 261]

void set( mixed $part, string $property, string $value)

Increases the number of columns by 1. Note that $part may be either 'table', 'row', or 'cell' to refer to internal properties, or 'a1, a2, etc' or an array of x and y to refer to pass the property/value pair on to the set() method of individual cells.



Tags:

access:  public


Parameters:

mixed   $part  
string   $property  
string   $value  

[ Top ]

method spanCols [line 449]

void spanCols( mixed $part, [integer $num = 1])

Sets the colspan on the specified cell, and set the cells that would be in the way to false. $num is the colspan.



Tags:

access:  public


Parameters:

mixed   $part  
integer   $num  

[ Top ]

method spanRows [line 423]

void spanRows( mixed $part, [integer $num = 1])

Sets the rowspan on the specified cell, and set the cells that would be in the way to false. $num is the rowspan.



Tags:

access:  public


Parameters:

mixed   $part  
integer   $num  

[ Top ]

method sub [line 338]

reference &sub( mixed $x, [mixed $xx = 1], [integer $yy = 1])

Create and return a sub HtmlLayout object in the

specified cell. The number of columns and rows for the sub-layout can be specified in $xx as an array, or in $xx and $yy. $x is the position of the cell to put the sub- layout in, in either method of notation.




Tags:

access:  public


Parameters:

mixed   $x  
mixed   $xx  
integer   $yy  

[ Top ]

method translate [line 476]

mixed translate( mixed $x, [integer $y = ''])

Translates between the 'a1, a2, b1, b2' notation and the array (0, 0), array (0, 1), array (1, 0), array (1, 1) notation.



Tags:

access:  public


Parameters:

mixed   $x  
integer   $y  

[ Top ]

method walk [line 314]

array walk( )

Returns the entire grid as an array of cells, going top-to-bottom, then left-to-right.



Tags:

access:  public


[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:17:52 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2