Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: g:\Work\WWW\php\tbox\lib/cdbtable.phps
PHP Documentation - PHP/Toolbox::Table

CDBTable

CSnippet
  |
  +-- CSplitBar
    |
    +-- CDBTable

The basic html table snippet class

 

private class CDBTable extends CSplitBar

The basic html table snippet class
that is db-driven as well as CDBForm. The class creates the table rows with
  • the split bar that allows table pagination;
  • the header that allows sorting by given field in ascending/descending order;
  • the insert text 'button' that invokes the edit script;
  • the set of data rows followed by edit/delete text 'buttons' that also invokes the edit script.
| $table = new CDBTable("T1", | "select * from table_1", | array( | "FIELD_DESCR" => array( | new CField(array( | ... | )), | ... | ), | ... | ) | ); | ... | $table->render(); The presentation is controlled by CSS:
  • .navbar - navigator (splitbar) class
  • .header - the table header class
  • .headN - column N header class (N=0..field_count)
  • .colN - column N class
  • .row1/row2 - odd/even rows classes
  • .edit - edit/delete text 'buttons' class
  • .null - null value class

 
Direct known subclasses: CDBTemplateTable

Methods inherited from CSplitBar

csplitbar, subst_globals

Methods inherited from CSnippet

csnippet, append, qualify, getglobal, setglobal, write, flush, writecode

Public Method Summary

void

CDBTable(string $id, string $QUERY, [ array $attrs ])

Constructs the table:
int

do_query_size([ string $QUERY ])

Queries the dataset size.

Private Method Summary

int

do_query_page(int &$rset, string $sort, bool $sdir)

Queries the page.
int

fetch_fields(int $rset)

Fetches the field set (meta-info)
string

identify(array $where)

Returns http query string that identifies the dataset row.
void

process_specially( &$fd, &$value)

Performs the custom processing of field value.
void

render()

Main rendering method.No additional comments.

Fields inherited from CSplitBar

$splitbar, $pagesize, $totrows, $pgoffs, $pagecount

Fields inherited from CSnippet

$id

Private Field Summary

string

$FORMFILE

Script file that provides the record editing functionality.
string

$QUERY

string

$SORTING

string

$EDITBAR

string

$INSBAR

array

$FIELD_DESCR

Public Method Details

CDBTable

public void CDBTable( string $id, string $QUERY, [ array $attrs ] )

  Constructs the table:

Parameter
string $id
string $QUERY
- sql-statement to get the data.
array $attrs = >>array()<<
- optional fields (see CSnippet).
Returns void

See Also $SORTING, $EDITBAR, $INSBAR, $FORMFILE

do_query_size

public int do_query_size( [ string $QUERY ] )

  Queries the dataset size.
Use it to get this size in advance.

Parameter
string $QUERY = >>""<<
- if it is NOT set then TOTROWS just recalculated, otherwise new sql-statement and field set is set up as well.
Returns int

- TOTROWS


Private Method Details

do_query_page

private int do_query_page( int &$rset, string $sort, bool $sdir )

  Queries the page.

Parameter
int &$rset
- out recordset.
string $sort
- sorting field
bool $sdir
- sorting direction (descendant if TRUE).
Returns int

- recordset.


fetch_fields

private int fetch_fields( int $rset )

  Fetches the field set (meta-info)
from given recordset.

Parameter
int $rset
- recordset.
Returns int

- field count.


identify

private string identify( array $where )

  Returns http query string that identifies the dataset row.

Parameter
array $where
- 'where' clause condition list.
Returns string

- http query string


process_specially

private void process_specially( &$fd, &$value )

  Performs the custom processing of field value.
Use it to override the default behavior that is the invokation of field descriptor process method.

Parameter
&$fd
No additional comments.
&$value
No additional comments.
Returns void


render

private void render( )

  Main rendering method.
If page size isn't specified then it calculated as min(max(ceil($this->TOTROWS/10),25),50).

No additional comments.

Returns void


Private Field Details

$FORMFILE

private string $FORMFILE

>>"edit.php"<<

Script file that provides the record editing functionality.
Note that conctructor sets this field to $PHP_SELF by default.

See Also CDBTable()

$QUERY

private string $QUERY

>>""<<



$SORTING

private string $SORTING

>>TRUE<<



$EDITBAR

private string $EDITBAR

>>"<EDIT>&nbsp;Edit&nbsp;</EDIT>|<DEL>&nbsp;Del&nbsp;</DEL>"<<



$INSBAR

private string $INSBAR

>>"<INS>&nbsp;Insert&nbsp;</INS>"<<



$FIELD_DESCR

private array $FIELD_DESCR

>>array()<<




Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta