Packageindex Classtrees Modulegroups Elementlist Report XML Files

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

CDBTemplateTable

CSnippet
  |
  +-- CSplitBar
    |
    +-- CDBTable
      |
      +-- CDBTemplateTable

The template-based table snippet class

 

private class CDBTemplateTable extends CDBTable

The template-based table snippet class
that is db-driven just like CDBForm. For example: | $table = new CDBTemplateTable("T2", | //HEADER// | "<tr><td class=navbar colspan=...><NAVIGATOR></td></tr>" | "<tr class=header>", | ."<td class=col1><SORT FIELD1></td>" | ."<td class=col2><SORT FIELD2></td>" | ."<*>" | ."</tr>", | //ROW// | "<tr class=row<ROW>>", | ."<td> <FIELD1></td>" | ."<td class=col2><FIELD2></td>" | ."<*>" | ."</tr>", | //FOOTER// | "<tr><td class=navbar colspan=...><NAVIGATOR></td></tr>" | ); It uses template substitution technique to generate a code: Header/Footer: - <NAVIGATOR> - the whole splitbar. - <SORT /FIELD_NAME/>...</SORT> - sort by /FIELD_NAME/. - <*> - the fields, not explicitely mentioned by SORT tags. - <INS>...</INS> - insert record text 'button'. Data row: - <EDIT>...</EDIT> - edit record text 'button'. - <DEL>...</DEL> - delete record text 'button'. - <ROW> - 1 for odd and 2 for even rows. - <NUM> - row (NOT record!) number. - </FIELD_NAME/> - value of /FIELD_NAME/. - <*> - values of fields , not explicitely mentioned by previous tag. - <WHERE> - 'where' condition uniquely identifying the given record.

 

Methods inherited from CDBTable

cdbtable, do_query_size, do_query_page, fetch_fields, identify, process_specially

Methods inherited from CSplitBar

csplitbar, subst_globals

Methods inherited from CSnippet

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

Public Method Summary

void

CDBTemplateTable(string $id, string $QUERY, string $HEADER, string $ROW, [ string $FOOTER, array $extra ])

Constructs the table.

Private Method Summary

void

render()

Main rendering method.No additional comments.

Fields inherited from CDBTable

$formfile, $query, $sorting, $editbar, $insbar, $field_descr

Fields inherited from CSplitBar

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

Fields inherited from CSnippet

$id

Private Field Summary

unknown

$HEADER

Public Method Details

CDBTemplateTable

public void CDBTemplateTable( string $id, string $QUERY, string $HEADER, string $ROW, [ string $FOOTER, array $extra ] )

  Constructs the table.

Parameter
string $id
string $QUERY
- sql-statement.
string $HEADER
- header template.
string $ROW
- data row template.
string $FOOTER = >>""<<
- footer template.
array $extra = >>array()<<
Returns void


Private Method Details

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

$HEADER

private unknown $HEADER

>><<




Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta