fCRUDstatic classv1.0.0b5
Provides miscellaneous functionality for CRUD-like pages
| 1.0.0b5 | Updated class to use new fSession API 10/23/09 |
|---|---|
| 1.0.0b4 | Updated class to use new fSession API 5/8/09 |
| 1.0.0b3 | Backwards Compatiblity Break - moved printOption() to fHTML::printOption(), showChecked() to fHTMLshowChecked(), removeListItems() and reorderListItems() to fException::splitMessage(), generateRequestToken() to fRequestgenerateCSRFToken(), and validateRequestToken() to fRequest::validateCSRFToken() 5/8/09 |
| 1.0.0b2 | Fixed a bug preventing loaded search values from being included in redirects 3/18/09 |
| 1.0.0b | The initial implementation 6/14/07 |
Static Methods
::getColumnClass() public
Return the string 'sorted' if $column is the column that is currently being sorted by, otherwise returns ''
This method will only be useful if used with the other sort methods printSortableColumn(), getSortColumn() and getSortDirection().
Signature
string getColumnClass( string $column )
Parameters
| string | $column | The column to check |
Returns
The CSS class for the column, either '' or 'sorted'
::getRowClass() public
Returns a CSS class name for a row
Will return 'even', 'odd', or 'highlighted' if the two parameters are equal and not NULL. The first call to this method will return the appropriate class concatenated with ' first'.
Signature
string getRowClass( mixed $row_value=NULL, mixed $affected_value=NULL )
Parameters
| mixed | $row_value | The value from the row |
| mixed | $affected_value | The value that was just added or updated |
Returns
The css class
::getSearchValue() public
Gets the current value of a search field
If a value is an empty string and no cast to is specified, the value will become NULL.
If a query string of ?reset is passed, all previous search values will be erased.
Signature
mixed getSearchValue( string $column, string $cast_to=NULL, string $default=NULL )
Parameters
| string | $column | The column that is being pulled back |
| string | $cast_to | The data type to cast to |
| string | $default | The default value |
Returns
The current value
::getSortColumn() public
Gets the current column to sort by, defaults to first one specified
Signatures
string getSortColumn( string $possible_column )
string getSortColumn( string .. )
Parameters
| string | $possible_column | The columns that can be sorted by, defaults to first |
| string | .. | ... |
Returns
The column to sort by
::getSortDirection() public
Gets the current sort direction
Signature
string getSortDirection( string $default_direction )
Parameters
| string | $default_direction | The default direction, 'asc' or 'desc' |
Returns
The direction, 'asc' or 'desc'
::printSortableColumn() public
Prints a sortable column header a tag
The a tag will include the CSS class 'sortable_column' and the direction being sorted, 'asc' or 'desc'.
fCRUD::printSortableColumn('name', 'Name');
would create the following HTML based on the page context
<!-- If name is the current sort column in the asc direction, the output would be --> <a href="?sort=name&dir=desc" class="sorted_column asc">Name</a> <!-- If name is not the current sort column, the output would be --> <a href="?sort-name&dir=asc" class="sorted_column">Name</a>
Signature
void printSortableColumn( string $column, string $column_name=NULL )
Parameters
| string | $column | The column to create the sortable header for |
| string | $column_name | This will override the humanized version of the column |
::redirectWithLoadedValues() public
Checks to see if any values (search or sort) were loaded from the session, and if so redirects the user to the current URL with those values added
Signature
void redirectWithLoadedValues( )
::reset() internal public
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Resets the configuration and data of the class
Signature
void reset( )
