Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

BaseObject Class Reference
[Base Objects]

Inheritance diagram for BaseObject:

MyModule BaseModule MyObject BaseAlert BaseComment BaseEvent BaseForum BaseForumThread BaseGroup BaseImage BaseInvitation BaseMessage BaseRPSGame BaseUser BaseUserAction List of all members.

Detailed Description

BaseObject is a class for dealing with simple objects.

A class that simplifies loading, editing, deleting, and saving of an object linked to a mysql database. Also provides hooks for API data, and easy rss creation. Plus, easy integration with comments and tags.

Definition at line 13 of file base-object.inc.php.

Public Member Functions

 __construct ($data, $tableName)
 Creates a new BaseObject.
 __destruct ()
 handle all our stuff after we clean up our object
 __toString ()
 This function translates the object to a string.
 __get ($name)
 This function is for getting at the various data internal to the object.
 __set ($name, $value)
 Function to set data values for the object.
 initJSONPage ()
 This function initializes the json page.
 drawJSONPage ()
 this function draws the json data.
 initPHPPage ()
 this function initializes the php serialized() data page.
 drawPHPPage ()
 this function draws teh object data as serialized php
 initXMLPage ()
 this function initializes the xml serialized() data page.
 drawXMLPage ()
 this function draws teh object data as serialized xml
 getPublicData ()
 This function gets an array of publicly available data for the object.
 getRssItem ()
 this function generates the rss item for each base object.
 load ($data, $deep=true)
 This function handles loading the data into the object.
 threadFactory ()
 This function creates our thread.
 tagFactory ()
 This function creates our tags class.
 addPrivacyField ()
 This function adds a privacy field to your edit form.
 save ()
 This function handles saving the object.
 lookupCommentCount ()
 lookup our comment count information
 clean ()
 This function handles any validation/cleaning of our data.
 cleanField ($field)
 Clean a field's data.
 isDirty ()
 Tells us if the object is dirty or not.
 delete ()
 This function handles deleting our object.
 drawEditPage ()
 This function does all the stuff we need to be done on the logic page.
 lookupLatLon ()
 If your object has city, state, zip, and street fields, and also lat and lon fields, this function will automatically look these up using Yahoo's geocoding API.
 drawViewPage ($ignore=array())
 This function handles the view/detail page.
 drawDeletePage ($preText=null, $button=null, $postText=null, $isUrl=true)
 This function handles all the delete page stuff.
 canEdit ()
 This function determines if we can edit the object.
 canDelete ()
 This function determines if we can delete the object.
 drawHeaderRow ()
 this function draws a header row for searches.
 getName ($link=false, $text= '')
 Get the name of an object...
 drawRow ()
 Called by an objectmanager to draw the row for the object.
 getAutoCompleteRow ()
 get a element suitable for use with the Ajax.Autocompleter from del.icio.us
 getCommentsLink ()
 get a link to the object's comment thread
 drawHeaderLine ()
 called by object manager to draw the header line for a bunch of objects.
 drawLine ()
 called by object manager to draw one line of info about the object.
 drawPostedOwner ()
 A shortcut function that draws basic info about the owner and when it was posted/updated.
 getPagesXml ()
 This function gets the page xml for the object.
 canView ()
 This function determines if a user can view the object or not.
 setData ($data, $ignore=null)
 This function sets all the data for the object.
 loadDirtyData ($data)
 load some 'dirty' data...
 getDbFields ()
 this function gets an array of information on the fields...
 checkTable ($skip=array())
 This function checks our table to make sure it exists.
 isAdmin ()
 This function determines admin status.
 hasField ($key)
 This function tells you if an object has a field or not.
 getCreateTableSql ()
 this function gets teh create table syntax.
 getCreateFieldsArray ()
 get an array of fields for our object table.
 getCreateIndexesArray ()
 get an array of keys for our object table.
 getCacheKey ($id=null)
 this function creates our key to use with caching.
 getCache ()
 this function gets our data from the cache.
 setCache ()
 this function saves our data to the cache.
 deleteCache ()
 this funciton deletes our data from teh cache.

Public Attributes

 $tableName
 Private.
 $creator
 this is our creator object...
 $comments
 public.
 $commentsEnabled = false
 public.
 $useLatLng = false
 public.
 $useObjectCaching = false
 public.
 $useTags = false
 public.
 $tags
 public our tags object
 $hasAuthor = true
 public.
 $fullTextFields = array()
 an array of fields to include in the fulltext index.
 $likeFields = array()
 an array of fields to use on LIKE queries.

Static Public Attributes

 $objectCacheLife = 3000000
 how long we cache the object data in seconds.

Protected Member Functions

 initEditPage ($title=null, $data=null)
 This function initializes the edit page.
 initDeletePage ($title=null)
 This function initializes the delete page.
 initViewPage ($title=null)
 This function initializes the view page.
 loadData ($id, $deep=true)
 load our objects data.
 lookupData ($deep=true)
 get our data from the db.
 loadCacheData ($deep=true)
 load data from cache
 getViewPageXml ()
 this function gets the view page xml.
 getDeletePageXml ()
 this function gets the delete page xml.
 getJSONPageXml ()
 this function gets the json page xml.
 getPHPPageXml ()
 this function gets the php page xml.
 getXMLPageXml ()
 this function gets the xml page xml.
 getEditPageXml ()
 this function gets the edit page xml.
 getEditPageParamXml ()
 this gets all the parameters for the edit page.
 getData ($useDb=true)
 This function gets an associative array of the object's members most commonly this will be from a db, but you never know.
 saveData ()
 This function handles saving the data to wherever.
 editFormInit ()
 This function sets up the form and such.
 editFormCreate ()
 This function creates the edit form object...
 editFormAddFields ($form)
 This function adds the fields to the edit form.
 editPageLogic ()
 This function handles the logic of the edit page.
 editFormValidate ($form)
 This is where you put any validation code.
 editFormLoad ($form)
 This function loads our data from the object into the form.
 editPagePostSaveSync ($form)
 This function saves our data after a post and sync's with the object.
 editPagePostSuccess ($form)
 This function is called on a successful post.
 editFormDraw ($form)
 This function draws the form.
 deleteForm ($body=null, $button=null)
 This function draws the delete form.
 deletePost ($body=null, $isUrl=true)
 This function handles the delete page post.
 getDataToCache ($deep=true)
 this is the funciton that gets the data we need saved to cache.
 setDataFromCache ($data, $deep=true)
 this function sets the data in the object from the data we retrieved from the cache.

Protected Attributes

 $data = array()
 Protected.

Private Member Functions

 getDbData ()
 This function gets all the member information from a database.
 saveDb ()
 This function saves the object back to the database.
 deleteDb ()
 This function deletes the object from the database.

Private Attributes

 $dirtyFields = array()
 Private.
 $internalId
 The id that references the table.


Member Function Documentation

BaseObject::__construct data,
tableName
 

Creates a new BaseObject.

Parameters:
$data if $data is an integer id, in which case it will load the data from the database. If $data is an array, it will load the data from the array to the equivalent properties of the object.
$tableName the name of the table to reference.

Reimplemented in BaseAlert, BaseComment, BaseForumThread, BaseForum, BaseInvitation, BaseRPSGame, BaseUserAction, and BaseUser.

Definition at line 101 of file base-object.inc.php.

References checkTable(), and load().

BaseObject::__destruct  ) 
 

handle all our stuff after we clean up our object

Definition at line 126 of file base-object.inc.php.

BaseObject::__get name  ) 
 

This function is for getting at the various data internal to the object.

Parameters:
$name is the name of the field
Returns:
the value from the data array or the id

Definition at line 144 of file base-object.inc.php.

References hasField().

BaseObject::__set name,
value
 

Function to set data values for the object.

Parameters:
$name is the name of the field
$value is the stored value

Definition at line 159 of file base-object.inc.php.

References BaseModule::__construct(), and hasField().

BaseObject::__toString  ) 
 

This function translates the object to a string.

Returns:
the string value for the funtction

Definition at line 134 of file base-object.inc.php.

References getName().

Referenced by initEditPage().

BaseObject::addPrivacyField  ) 
 

This function adds a privacy field to your edit form.

Does nothing by default. Override if necessary.

Definition at line 535 of file base-object.inc.php.

BaseObject::canDelete  ) 
 

This function determines if we can delete the object.

Returns:
true if they can delete, false if they cant

Reimplemented in BaseAlert, BaseForumThread, BaseForum, BaseInvitation, BaseRPSGame, and BaseUser.

Definition at line 732 of file base-object.inc.php.

Referenced by BaseEvent::canUnInvite(), BaseComment::drawCommentDetails(), BaseImage::drawViewNav(), BaseImage::drawViewPage(), getPublicData(), and initDeletePage().

BaseObject::canEdit  ) 
 

This function determines if we can edit the object.

Returns:
true if they can edit, false if they cant.

Reimplemented in BaseForumThread, BaseForum, BaseMessage, BaseRPSGame, and BaseUser.

Definition at line 714 of file base-object.inc.php.

Referenced by BaseEvent::canInvite(), BaseComment::drawCommentDetails(), BaseImage::drawViewNav(), BaseImage::drawViewPage(), getPublicData(), and initEditPage().

BaseObject::canView  ) 
 

This function determines if a user can view the object or not.

Returns:
true if they can view it, false if they cant.

Reimplemented in BaseAlert, BaseForumThread, BaseForum, BaseInvitation, BaseMessage, BaseRPSGame, and BaseUserAction.

Definition at line 966 of file base-object.inc.php.

Referenced by BaseEvent::canAttend(), BaseComment::drawComment(), getPublicData(), and initViewPage().

BaseObject::checkTable skip = array()  ) 
 

This function checks our table to make sure it exists.

Definition at line 1373 of file base-object.inc.php.

References BaseModule::addStatus(), and BaseJumper::dbHasTable().

Referenced by __construct().

BaseObject::clean  ) 
 

This function handles any validation/cleaning of our data.

Definition at line 585 of file base-object.inc.php.

References cleanField().

Referenced by save().

BaseObject::cleanField field  ) 
 

Clean a field's data.

called from clean()

Parameters:
$field the name of the field to clean.

Definition at line 596 of file base-object.inc.php.

Referenced by clean().

BaseObject::delete  ) 
 

This function handles deleting our object.

Returns:
ture on success, false on failure.

Reimplemented in BaseComment, BaseEvent, BaseForumThread, BaseImage, and BaseMessage.

Definition at line 614 of file base-object.inc.php.

References deleteCache(), and deleteDb().

BaseObject::deleteCache  ) 
 

this funciton deletes our data from teh cache.

no need to override

Definition at line 1593 of file base-object.inc.php.

References CacheBot::delete().

Referenced by delete(), and save().

BaseObject::deleteDb  )  [private]
 

This function deletes the object from the database.

Returns:
true on success, false on failure

Definition at line 1125 of file base-object.inc.php.

References dbExecute().

Referenced by delete().

BaseObject::deleteForm body = null,
button = null
[protected]
 

This function draws the delete form.

Parameters:
$body the text to display for the form.
$button the text for the submit button.

Definition at line 1331 of file base-object.inc.php.

Referenced by drawDeletePage().

BaseObject::deletePost body = null,
isUrl = true
[protected]
 

This function handles the delete page post.

It deletes the object then either shows the result or redirects.

Parameters:
$body either the text to display or a link.
$isUrl true if it is a url.

Definition at line 1355 of file base-object.inc.php.

References Util::redirect().

Referenced by drawDeletePage().

BaseObject::drawDeletePage preText = null,
button = null,
postText = null,
isUrl = true
 

This function handles all the delete page stuff.

Shows the page and handles the post.

Parameters:
$preText this is the text to be displayed on the delete page.
$button the text for the submit button on the delete page.
$postText either the text to be displayed on the result page, or may be a url. Default: $this->baseUrl
$isUrl if true, then it will redirect to the url in $postText. Default: true

Definition at line 702 of file base-object.inc.php.

References deleteForm(), and deletePost().

BaseObject::drawEditPage  ) 
 

This function does all the stuff we need to be done on the logic page.

Definition at line 637 of file base-object.inc.php.

References editPageLogic().

BaseObject::drawHeaderLine  ) 
 

called by object manager to draw the header line for a bunch of objects.

Definition at line 813 of file base-object.inc.php.

BaseObject::drawHeaderRow  ) 
 

this function draws a header row for searches.

by default doesnt do anything.

Reimplemented in BaseForumThread.

Definition at line 745 of file base-object.inc.php.

BaseObject::drawJSONPage  ) 
 

this function draws the json data.

Definition at line 278 of file base-object.inc.php.

References JSON::encode().

BaseObject::drawLine  ) 
 

called by object manager to draw one line of info about the object.

you'll need to override.

Reimplemented in BaseAlert, BaseEvent, and BaseInvitation.

Definition at line 821 of file base-object.inc.php.

BaseObject::drawPHPPage  ) 
 

this function draws teh object data as serialized php

Definition at line 296 of file base-object.inc.php.

BaseObject::drawPostedOwner  ) 
 

A shortcut function that draws basic info about the owner and when it was posted/updated.

Definition at line 828 of file base-object.inc.php.

BaseObject::drawRow  ) 
 

Called by an objectmanager to draw the row for the object.

Does some default stuff... but you'll most likely want to override it.

Reimplemented in BaseAlert, BaseForumThread, BaseForum, BaseImage, BaseInvitation, and BaseUserAction.

Definition at line 773 of file base-object.inc.php.

References Time::formatRelative(), getCommentsLink(), and getName().

BaseObject::drawViewPage ignore = array()  ) 
 

This function handles the view/detail page.

It prints out each field line by line. You'll prolly want to override this guy =)

Parameters:
$ignore an array of fields to ignore.

Definition at line 679 of file base-object.inc.php.

BaseObject::drawXMLPage  ) 
 

this function draws teh object data as serialized xml

Definition at line 314 of file base-object.inc.php.

References $data, and getPublicData().

BaseObject::editFormAddFields form  )  [protected]
 

This function adds the fields to the edit form.

Override this if you want access.

Parameters:
$form the form to add fields to

Reimplemented in BaseComment, BaseEvent, BaseForumThread, BaseForum, BaseGroup, BaseImage, BaseMessage, and BaseUser.

Definition at line 1176 of file base-object.inc.php.

Referenced by editFormInit().

BaseObject::editFormCreate  )  [protected]
 

This function creates the edit form object...

with no fields.

Returns:
the form to add objects to

Definition at line 1162 of file base-object.inc.php.

References BaseModule::getUrl().

Referenced by editFormInit().

BaseObject::editFormDraw form  )  [protected]
 

This function draws the form.

Parameters:
$form teh form to draw

Definition at line 1320 of file base-object.inc.php.

Referenced by editPageLogic().

BaseObject::editFormInit  )  [protected]
 

This function sets up the form and such.

By default it creates a basic form based on your table.

Returns:
teh edit form itself.

Definition at line 1146 of file base-object.inc.php.

References editFormAddFields(), and editFormCreate().

Referenced by editPageLogic().

BaseObject::editFormLoad form  )  [protected]
 

This function loads our data from the object into the form.

Parameters:
$form teh form to load data into

Reimplemented in BaseEvent, and BaseMessage.

Definition at line 1227 of file base-object.inc.php.

Referenced by editPageLogic().

BaseObject::editFormValidate form  )  [protected]
 

This is where you put any validation code.

Parameters:
$form teh form to validate

Reimplemented in BaseUser.

Definition at line 1216 of file base-object.inc.php.

Referenced by editPageLogic().

BaseObject::editPageLogic  )  [protected]
 

This function handles the logic of the edit page.

Definition at line 1183 of file base-object.inc.php.

References editFormDraw(), editFormInit(), editFormLoad(), editFormValidate(), editPagePostSaveSync(), and editPagePostSuccess().

Referenced by drawEditPage().

BaseObject::editPagePostSaveSync form  )  [protected]
 

This function saves our data after a post and sync's with the object.

Parameters:
$form teh form to get data from

Reimplemented in BaseImage, BaseMessage, and BaseUser.

Definition at line 1267 of file base-object.inc.php.

References getDbFields(), hasField(), lookupLatLon(), and save().

Referenced by editPageLogic().

BaseObject::editPagePostSuccess form  )  [protected]
 

This function is called on a successful post.

It saves the object then redirects you back to the homepage.

Reimplemented in BaseComment, BaseEvent, and BaseGroup.

Definition at line 1310 of file base-object.inc.php.

References Util::redirect().

Referenced by editPageLogic().

BaseObject::getAutoCompleteRow  ) 
 

get a element suitable for use with the Ajax.Autocompleter from del.icio.us

Since:
2.2
Returns:
the html markup for the object

Definition at line 792 of file base-object.inc.php.

References getName().

BaseObject::getCache  ) 
 

this function gets our data from the cache.

no need to override

Definition at line 1577 of file base-object.inc.php.

References CacheBot::get().

Referenced by loadCacheData().

BaseObject::getCacheKey id = null  ) 
 

this function creates our key to use with caching.

no need to override

Returns:
a key used with CacheBot to cache the object.

Definition at line 1488 of file base-object.inc.php.

BaseObject::getCommentsLink  ) 
 

get a link to the object's comment thread

usually threads are on the view page, and they have an anchor of "comments" from BaseThread. It will also pluralize the comments word

Returns:
a href tag with the link

Definition at line 805 of file base-object.inc.php.

References BaseModule::getLink().

Referenced by drawRow().

BaseObject::getCreateFieldsArray  ) 
 

get an array of fields for our object table.

extend this to add fields to the table. or remove fields from table

Returns:
the keyed array of field name => create syntax

Reimplemented in BaseAlert, BaseComment, BaseEvent, BaseForumThread, BaseForum, BaseGroup, BaseImage, BaseInvitation, BaseMessage, BaseRPSGame, BaseUserAction, and BaseUser.

Definition at line 1434 of file base-object.inc.php.

BaseObject::getCreateIndexesArray  ) 
 

get an array of keys for our object table.

extend this to add keys to the table. or remove keys from table

Returns:
the keyed array of index name => create syntax

Reimplemented in BaseAlert, BaseComment, BaseEvent, BaseForumThread, BaseImage, BaseInvitation, BaseMessage, BaseRPSGame, BaseUserAction, and BaseUser.

Definition at line 1467 of file base-object.inc.php.

BaseObject::getCreateTableSql  ) 
 

this function gets teh create table syntax.

Returns:
the string to create the table.

Reimplemented from BaseModule.

Reimplemented in BaseGroup.

Definition at line 1416 of file base-object.inc.php.

BaseObject::getData useDb = true  )  [protected]
 

This function gets an associative array of the object's members most commonly this will be from a db, but you never know.

Returns:
an associative array of the objects data.

Definition at line 980 of file base-object.inc.php.

References $data, and getDbData().

Referenced by lookupData().

BaseObject::getDataToCache deep = true  )  [protected]
 

this is the funciton that gets the data we need saved to cache.

by default it saves our data, and will save the comments or tags objects if needed. its recommended to extend this to add data that you'd like cached by the object

Returns:
an array of data to cache

Reimplemented in BaseForumThread, BaseRPSGame, and BaseUser.

Definition at line 1504 of file base-object.inc.php.

References $data.

Referenced by setCache().

BaseObject::getDbData  )  [private]
 

This function gets all the member information from a database.

Returns:
an associative array of data or false on failure.

Definition at line 1045 of file base-object.inc.php.

References dbFetchAssoc(), and dbQuery().

Referenced by getData().

BaseObject::getDbFields  ) 
 

this function gets an array of information on the fields...

useful for automatic stuff.

Returns:
an array of info about the fields identical to DESCRIBE $table

Definition at line 1257 of file base-object.inc.php.

References BaseJumper::getDbTable().

Referenced by editPagePostSaveSync(), loadDirtyData(), and saveDb().

BaseObject::getDeletePageXml  )  [protected]
 

this function gets the delete page xml.

Returns:
the delete page xml string.

Reimplemented in BaseRPSGame, and BaseUserAction.

Definition at line 875 of file base-object.inc.php.

Referenced by getPagesXml().

BaseObject::getEditPageParamXml  )  [protected]
 

this gets all the parameters for the edit page.

Returns:
the xml string for edit page parameters.

Reimplemented in BaseComment, BaseEvent, and BaseMessage.

Definition at line 946 of file base-object.inc.php.

Referenced by getEditPageXml().

BaseObject::getEditPageXml  )  [protected]
 

this function gets the edit page xml.

Returns:
the edit page xml string.

Reimplemented in BaseAlert, BaseInvitation, BaseRPSGame, and BaseUserAction.

Definition at line 931 of file base-object.inc.php.

References getEditPageParamXml().

Referenced by getPagesXml().

BaseObject::getJSONPageXml  )  [protected]
 

this function gets the json page xml.

Returns:
the json page xml string.

Definition at line 889 of file base-object.inc.php.

Referenced by getPagesXml().

BaseObject::getName link = false,
text = ''
 

Get the name of an object...

used by base-user, and many other things as a shortcut for drawing the view link or just the name

Parameters:
$link Boolean of whether or not we want to draw the link
Returns:
the name of the object

Reimplemented in BaseUser.

Definition at line 758 of file base-object.inc.php.

References BaseModule::getLink().

Referenced by __toString(), drawRow(), getAutoCompleteRow(), and initViewPage().

BaseObject::getPagesXml  ) 
 

This function gets the page xml for the object.

Adds edit, delete, view, json, and php. Override to customize.

Returns:
the object page xml string.

Reimplemented from BaseModule.

Reimplemented in BaseEvent, BaseForum, BaseGroup, BaseImage, BaseInvitation, BaseRPSGame, BaseUserAction, and BaseUser.

Definition at line 842 of file base-object.inc.php.

References getDeletePageXml(), getEditPageXml(), getJSONPageXml(), getPHPPageXml(), getViewPageXml(), and getXMLPageXml().

BaseObject::getPHPPageXml  )  [protected]
 

this function gets the php page xml.

Returns:
the php page xml string.

Definition at line 903 of file base-object.inc.php.

Referenced by getPagesXml().

BaseObject::getPublicData  ) 
 

This function gets an array of publicly available data for the object.

it is used by json, php, and other pages that export data.

Returns:
an array of public data.

Reimplemented in BaseAlert, BaseComment, BaseEvent, BaseForumThread, BaseForum, BaseGroup, BaseImage, BaseMessage, BaseUserAction, and BaseUser.

Definition at line 338 of file base-object.inc.php.

References $data, canDelete(), canEdit(), canView(), BaseModule::getUrl(), and hasField().

Referenced by drawXMLPage().

BaseObject::getRssItem  ) 
 

this function generates the rss item for each base object.

you'll need to override this to implement rss feeds for your objects.

Returns:
a FeedItem from the feedcreateor library.

Reimplemented in BaseAlert, BaseComment, BaseEvent, BaseForumThread, BaseForum, BaseGroup, BaseImage, BaseMessage, and BaseUserAction.

Definition at line 390 of file base-object.inc.php.

References Config::get(), and BaseModule::getUrl().

BaseObject::getViewPageXml  )  [protected]
 

this function gets the view page xml.

Returns:
the view page xml string.

Definition at line 861 of file base-object.inc.php.

Referenced by getPagesXml().

BaseObject::getXMLPageXml  )  [protected]
 

this function gets the xml page xml.

Returns:
the xml page xml string.

Definition at line 917 of file base-object.inc.php.

Referenced by getPagesXml().

BaseObject::hasField key  ) 
 

This function tells you if an object has a field or not.

Parameters:
$key the name of the field.
Returns:
Boolean if field exists.

Definition at line 1403 of file base-object.inc.php.

References BaseJumper::tableHasField().

Referenced by __get(), __set(), BaseUser::createSession(), BaseUser::drawEditPassPage(), BaseUser::editFormAddFields(), BaseUser::editPagePostSaveSync(), editPagePostSaveSync(), BaseUser::emailPrefsFormAddFields(), BaseUser::getName(), getPublicData(), BaseImage::getPublicData(), BaseComment::getRssItem(), lookupCommentCount(), BaseUser::registerFormAddFields(), and setData().

BaseObject::initDeletePage title = null  )  [protected]
 

This function initializes the delete page.

Parameters:
$title the title of the page.

Definition at line 224 of file base-object.inc.php.

References canDelete(), and BaseModule::params().

Referenced by BaseUser::initDeleteMePage().

BaseObject::initEditPage title = null,
data = null
[protected]
 

This function initializes the edit page.

Parameters:
$title the title of the page.
$data some data to load the object with.

Definition at line 197 of file base-object.inc.php.

References $data, __toString(), canEdit(), BaseModule::params(), and tagFactory().

BaseObject::initJSONPage  ) 
 

This function initializes the json page.

Definition at line 266 of file base-object.inc.php.

References initViewPage(), and BaseModule::setTemplate().

BaseObject::initPHPPage  ) 
 

this function initializes the php serialized() data page.

Definition at line 286 of file base-object.inc.php.

References initViewPage(), and BaseModule::setTemplate().

BaseObject::initViewPage title = null  )  [protected]
 

This function initializes the view page.

Parameters:
$title the title of the page.

Definition at line 242 of file base-object.inc.php.

References canView(), getName(), BaseModule::needsJs(), and BaseModule::params().

Referenced by initJSONPage(), initPHPPage(), and initXMLPage().

BaseObject::initXMLPage  ) 
 

this function initializes the xml serialized() data page.

Definition at line 304 of file base-object.inc.php.

References initViewPage(), and BaseModule::setTemplate().

BaseObject::isAdmin  ) 
 

This function determines admin status.

Parameters:
$acl the acl to authenticate against.
$errorFunc the error function to call. this forces authentication.
Returns:
true if they are admin, false if not.

Reimplemented in BaseUser.

Definition at line 1390 of file base-object.inc.php.

BaseObject::isDirty  ) 
 

Tells us if the object is dirty or not.

Used to determine if we clean and/or if we need to save.

Definition at line 604 of file base-object.inc.php.

Referenced by save().

BaseObject::load data,
deep = true
 

This function handles loading the data into the object.

Todo:
this will change in v2.2 to load the data from cache or look it up from the db.
Parameters:
$data either an id of an object or an array of data that represents that object.

Reimplemented in BaseImage.

Definition at line 417 of file base-object.inc.php.

References loadData(), and setDataFromCache().

Referenced by __construct(), and loadCacheData().

BaseObject::loadCacheData deep = true  )  [protected]
 

load data from cache

will be removed in v2.2.

Definition at line 490 of file base-object.inc.php.

References $data, getCache(), and load().

Referenced by loadData().

BaseObject::loadData id,
deep = true
[protected]
 

load our objects data.

this will be changed around in v2.2

Todo:
remove and put comments / tags into load. also make a loadfromdb function

Definition at line 433 of file base-object.inc.php.

References loadCacheData(), lookupData(), setCache(), tagFactory(), and threadFactory().

Referenced by load().

BaseObject::loadDirtyData data  ) 
 

load some 'dirty' data...

that is data that is potentially not the same data and should thusly be saved eventually.

Parameters:
$data a keyed array of data.

Definition at line 1239 of file base-object.inc.php.

References $data, and getDbFields().

BaseObject::lookupCommentCount  ) 
 

lookup our comment count information

Returns:
the number of comments on it

Definition at line 571 of file base-object.inc.php.

References hasField().

Referenced by save().

BaseObject::lookupData deep = true  )  [protected]
 

get our data from the db.

Todo:
update this whole data loading process to be much smoother

Reimplemented in BaseForumThread, BaseRPSGame, and BaseUser.

Definition at line 465 of file base-object.inc.php.

References $data, and getData().

Referenced by loadData().

BaseObject::lookupLatLon  ) 
 

If your object has city, state, zip, and street fields, and also lat and lon fields, this function will automatically look these up using Yahoo's geocoding API.

Definition at line 647 of file base-object.inc.php.

Referenced by editPagePostSaveSync().

BaseObject::save  ) 
 

This function handles saving the object.

Returns:
true on success, false on failure.

Reimplemented in BaseComment, BaseForumThread, and BaseForum.

Definition at line 544 of file base-object.inc.php.

References $data, clean(), deleteCache(), isDirty(), lookupCommentCount(), and saveData().

Referenced by BaseUser::createSession(), BaseRPSGame::drawChallengePage(), BaseUserAction::drawDoActionPage(), BaseUser::drawEditPassPage(), BaseUserAction::drawMessagePage(), BaseRPSGame::drawTauntPage(), editPagePostSaveSync(), BaseRPSGame::initDefendPage(), BaseImage::prepFile(), BaseUser::requestPassReset(), BaseImage::resize(), BaseUser::saveEmailPrefs(), BaseInvitation::saveInvite(), BaseUser::sendActivationEmail(), and BaseUser::setProfileImage().

BaseObject::saveData  )  [protected]
 

This function handles saving the data to wherever.

Returns:
true on success, false on failure

Definition at line 1035 of file base-object.inc.php.

References saveDb().

Referenced by save().

BaseObject::saveDb  )  [private]
 

This function saves the object back to the database.

It is a bit trickier. It will smartly insert or update depending on if there is an id or not. It also only saves the properties of the object that are named the same as the table fields, all automatically.

Definition at line 1069 of file base-object.inc.php.

References dbExecute(), and getDbFields().

Referenced by saveData().

BaseObject::setCache  ) 
 

this function saves our data to the cache.

no need to override

Definition at line 1585 of file base-object.inc.php.

References getDataToCache(), and CacheBot::set().

Referenced by loadData().

BaseObject::setData data,
ignore = null
 

This function sets all the data for the object.

Parameters:
$data an associative array of data. The keys must match up with the object properties.
$ignore the fields to ignore and not set

Definition at line 1001 of file base-object.inc.php.

References hasField().

BaseObject::setDataFromCache data,
deep = true
[protected]
 

this function sets the data in the object from the data we retrieved from the cache.

it takes the data from the array and puts it in the object. you'll want to override this one if you added custome data in getDataToCache() and load it into the object.

Parameters:
$data the data we got from teh cache

Reimplemented in BaseForumThread, BaseRPSGame, and BaseUser.

Definition at line 1543 of file base-object.inc.php.

References $data.

Referenced by load().

BaseObject::tagFactory  ) 
 

This function creates our tags class.

You may want to manually create your own.

Definition at line 524 of file base-object.inc.php.

Referenced by initEditPage(), and loadData().

BaseObject::threadFactory  ) 
 

This function creates our thread.

You may want to manually create your thread.

Returns:
the thread class.

Definition at line 513 of file base-object.inc.php.

Referenced by loadData().


Member Data Documentation

BaseObject::$comments
 

public.

BaseThread extended object that is used for comments.

Definition at line 39 of file base-object.inc.php.

BaseObject::$commentsEnabled = false
 

public.

Boolean that tells us if we are using comments or not.

Definition at line 44 of file base-object.inc.php.

BaseObject::$creator
 

this is our creator object...

the user that owns us.

Definition at line 34 of file base-object.inc.php.

BaseObject::$data = array() [protected]
 

Protected.

Internal data array

Definition at line 29 of file base-object.inc.php.

Referenced by drawXMLPage(), getData(), getDataToCache(), getPublicData(), initEditPage(), loadCacheData(), loadDirtyData(), lookupData(), save(), and setDataFromCache().

BaseObject::$dirtyFields = array() [private]
 

Private.

Array of fields that are dirty.

Definition at line 24 of file base-object.inc.php.

BaseObject::$fullTextFields = array()
 

an array of fields to include in the fulltext index.

Definition at line 84 of file base-object.inc.php.

BaseObject::$hasAuthor = true
 

public.

Boolean of whether the classes has a user_id field for the author.

Definition at line 69 of file base-object.inc.php.

BaseObject::$internalId [private]
 

The id that references the table.

Definition at line 74 of file base-object.inc.php.

BaseObject::$likeFields = array()
 

an array of fields to use on LIKE queries.

Since:
2.2

Definition at line 91 of file base-object.inc.php.

BaseObject::$objectCacheLife = 3000000 [static]
 

how long we cache the object data in seconds.

defaults to a bit over a month (3 million seconds)

Definition at line 79 of file base-object.inc.php.

BaseObject::$tableName
 

Private.

The name of the database table its linked to.

Definition at line 19 of file base-object.inc.php.

BaseObject::$tags
 

public our tags object

Definition at line 64 of file base-object.inc.php.

BaseObject::$useLatLng = false
 

public.

Boolean Do we use and also allow searching by lat/lon (must have 2 fields in DB called lat and lon that are of type double)

Definition at line 49 of file base-object.inc.php.

BaseObject::$useObjectCaching = false
 

public.

Boolean if we use object caching or not. you should understand the object caching system before you use this.

Definition at line 54 of file base-object.inc.php.

BaseObject::$useTags = false
 

public.

Boolean Do we use tags or not?

Definition at line 59 of file base-object.inc.php.


The documentation for this class was generated from the following file:
Generated on Fri Oct 27 12:26:41 2006 for BaseJumper by doxygen 1.3.9.1