Start a new Browser, add columns, set a join and Render it to create a basic list of records in a table.
You can, of course, get a lot fancier with setting ordering, where clauses totalled columns and so forth.
Located in /classBrowser.php (line 174)
The Browser class constructor
Add a column to the Browser.
This constructs a new BrowserColumn, appending it to the array of columns in this Browser.
Note that if the $format parameter starts with '<td>' the format will replace the column format, otherwise it will be used within '<td>...</td>' tags.
The name of a global function which will preprocess the column value
The hook function should be defined as follows: function hookfunction( $column_value, $column_name, $database_row ) { ... return $value; }
Add a hidden column - one that is present in the SQL result, but for which there is no column displayed.
This can be useful for including a value in (e.g.) clickable links or title attributes which is not actually displayed as a visible column.
Add an ordering to the browser widget.
The ordering can be overridden by GET parameters which will be rendered into the column headers so that a user can click on the column headers to control the actual order.
Add an extra arbitrary row onto the end of the browser.
Mark a column as something to be totalled. You can also specify the name of a function which may modify the value before the actual totalling.
The callback function will be called with each row, with the first argument being the entire record object and the second argument being only the column being totalled. The callback should return a number, to be added to the total.
Add an OR ... to the SQL Where clause
This method is used to build and execute the database query.
You need not call this method, since Browser::Render() will call it for you if you have not done so at that point.
Force a particular ordering onto the browser widget.
Retrieve the total from a totalled column
Replace a row where $column = $value with an extra arbitrary row, returned from calling $function
Add an [operator] ... to the SQL Where clause
You will generally want to call OrWhere or AndWhere rather than this function, but hey: who am I to tell you how to code!
Add an OR ... to the SQL Where clause
This method is used to render the browser as HTML. If the query has not yet been executed then this will call DoQuery to do so.
The browser (including the title) will be displayed in a div with id="browser" so that you can style '#browser tr.header', '#browser tr.totals' and so forth.
Set the format for an output row.
The row format is set as an sprintf format string for the start of the row, and a plain text string for the close of the row. Subsequent arguments are interpreted as names of fields, the values of which will be sprintf'd into the beginrow string for each row.
Some special field names exist beginning with the '#' character which have 'magic' functionality, including '#even' which will insert '0' for even rows and '1' for odd rows, allowing a nice colour alternation if the beginrow format refers to it like: 'class="r%d"' so that even rows will become 'class="r0"' and odd rows will be 'class="r1"'.
At present only '#even' exists, although other magic values may be defined in future.
Set the SQL DISTINCT clause to a specific value.
The whole clause (except the keyword) needs to be supplied
Set a div for wrapping the browse.
Set the tables and joins for the SQL.
For a single table this should just contain the name of that table, but for multiple tables it should be the full content of the SQL 'FROM ...' clause (excluding the actual 'FROM' keyword).
Set the SQL LIMIT clause to a specific value.
Only the limit number should be supplied.
Set the SQL OFFSET clause to a specific value.
Only the offset number
Set up the ordering for the browser. Generally you should call this with the first parameter set as a field to order by default. Call with the second parameter set to 'D' or 'DESCEND' if you want to reverse the default order.
Set a Sub Title for the browse.
Set the Title for the browse.
This can also be set in the constructor but if you create a template Browser and then clone it in a loop you may want to assign a different Title for each instance.
Set the named columns to be translatable
Set a Union SQL statement.
In rare cases this might be useful. It's currently a fairly simple hack which requires you to put an entire valid (& matching) UNION subclause (although without the UNION keyword).
Set the SQL Where clause to a specific value.
The WHERE keyword should not be included.
Accessor for the Title for the browse, which could set the title also.
Return values from the current row for replacing into a template.
This is used to return values from the current row, so they can be inserted into a row template. It is used as a callback function for preg_replace_callback.
Documentation generated on Thu, 15 Apr 2010 20:23:02 +1200 by phpDocumentor 1.3.2