Class QWatcherBase
QWatcher is a helper class that allows controls and forms to watch database tables and automatically redraw when changes are detected. It works together with the codegened model classes, the controls, and the QForm class to draw or refresh when needed.
Static functions handle the database updating, while member variables store the current state of a control's watched tables.
This Base class is a template on which to build watchers that use specific caching mechanisms. See QWatcher to select the caching mechanism you would like to use.
- QBaseClass
- QWatcherBase
protected static
string
|
#
GetKey( $strDbName, $strTableName )
Returns a unique key corresponding to the given table in the given database. Override this function to return a key value that will define a subset of the table to watch. For example, if you have records associated with User Ids, combine the user id with the table name, and then only records associated with that user id will be watched. |
public
|
#
Watch(
Call from control to watch a node. Watches all tables associated with the node. |
protected
|
|
abstract public
|
#
MakeCurrent( )
Controls should call this function just after rendering. Updates strWatchedTables to the current state of the database. |
abstract public
boolean
|
|
public static
|
#
MarkTableModified( string $strDbName, $strTableName )
Model Save() calls this to indicate that a table has changed. |
public static
boolean
|
#
WatchersChanged( )
Support function for the Form to determine if any of the watchers have changed since the last time it checked. Since this is relying on a global variable, the variable is reset upon program entry, including ajax entry. So really, we are just detecting if any operation we have currently done has changed a watcher, so that the form can broadcast that fact to other browser windows that might be looking. |
OverrideAttributes(),
__call(),
__get(),
__set()
|
public static
string
|
$strAppKey
key representing all tables being watched. This is used to create a key so that we can know if any table that other forms care about changes, and notify other windows of the change. If you have multiple installations of QCubed running on the same machine, you should change this in the QWatcher override and make it different for each application. However, if two QCubed installations are modifying the same tables in the same databases, they should have the same app key |
#
'QWATCH_APPKEY'
|
protected static
|
$blnWatcherChanged
|
|
protected
array
|
$strWatchedKeys
|
#
array()
|