Source for file dbobject.php
Documentation is available at dbobject.php
* database object base class (self-initialising and self-updating object)
* @author Stuart Prescott
* @copyright Copyright Stuart Prescott
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @subpackage FormsLibrary
/** Load ancillary functions */
require_once 'inc/typeinfo.php';
/** database connection script */
require_once 'inc/db.php';
/** sql manipulation routines */
/** status codes for success/failure of database actions */
require_once 'inc/statuscodes.php';
* database object base class (self-initialising and self-updating object)
* @subpackage FormsLibrary
/** @var string db table from which to take data */
/** @var string db column that is the id/key */
/** @var string ??? FIXME: unused? */
/** @var string the id/key value for this particlar row. -1 means not assigned yet (new object not in table) */
/** @var boolean if true, *don't* use the ID field in updates etc */
/** @var array list of Field objects in this row */
/** @var boolean this field is able to be edited by the user */
/** @var boolean this field is able to be deleted (or marked as deleted) */
/** @var boolean the fields in this row have changed cf the database */
/** @var boolean the data in the fields are valid */
/** @var boolean don't do validation on the data */
/** @var string output when doing text dumps of the object */
/** @var boolean sql errors should be considered fatal and the script will die() */
/** @var string prefixed to all name="$field[name]" sections of the html code */
/** @var string current error message */
/** @var integer status code from operation from statuscodes.php */
/** @var integer debug level 0=off */
* Create a new database object, designed to be superclasses
* @param string $table see $this->table
* @param string $id see $this->id
* @param mixed $idfield if string, $this->idfield. if array, ($this->idfield, $this->idfieldreal).
function DBO($table, $id, $idfield =
'id') {
* Sets a new name base for row and all fields within it
* The name base is prepended to the field name in all html name="" sequences for the widgets
* @param string $newname new name-base to use
$this->fields[$k]->setNamebase($newname);
* Sets whether a row and all fields within it are editable
* @param boolean $editable new editable state
$this->fields[$k]->setEditable($editable);
* Create a quick text representation of the object
* @return string text representation
foreach ($this->fields as $v) {
$t .=
"\t".
$v->text_dump();
* @return string object representation
* @param string $logstring debug message to be output
* @param integer $priority priority of the message, will not be written unless $priority <= $this->DEBUG
function log($logstring, $priority=
10) {
if ($priority <=
$this->DEBUG) {
echo
$logstring.
"<br />\n";
* PHP5 clone statement will perform only a shallow copy of the object. Any subobjects must also be cloned
//print "send in the clones! I'm cloning a ".get_class($this)."<br />";
//preDump($this->fields);
// Force a copy of contents of $this->fields array, otherwise the fields will only be references
foreach ($fields as $k =>
$f) {
//print "cloning $k<br />";
$this->fields[$k] =
clone($f);
Documentation generated on Tue, 06 Mar 2007 10:01:19 +0000 by phpDocumentor 1.3.0