b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Class: DataObject

Source Location: /blogs/inc/_core/model/dataobjects/_dataobject.class.php

Class DataObject

Direct descendents
Child Class Description
Comment Comment Class
Skin Skin Class
Filetype Filetype Class
File Represents a file or folder on disk. Optionnaly stores meta data from DB.
Country Country Class
Currency Currency Class
ComponentWidget ComponentWidget Class
Goal Goal Class
ItemLight ItemLight Class
Link Item Link
ItemType ItemType Class
Group User Group
Userfield Userfield Class
User User Class
GenericElement User Element
Thread Thread Class
Message Message Class
Cronjob Cronjob
Blog Blog

[ Top ]
Property Summary
mixed   $allow_ID_insert  
mixed   $delete_cascades   Relations that will cascade deletion.
mixed   $delete_restrictions   Relations that may restrict deletion.
int   $ID   Unique ID of object in database

[ Top ]
Method Summary
DataObject   DataObject()   Constructor
void   action_icon()   Generate requested action icon depending on perm
void   action_link()   Generate requested action link depending on perm
boolean   check_delete()   Check relations for restrictions before deleting
void   check_relations()   Check relations for restrictions or cascades.
void   confirm_delete()   Displays form to confirm deletion of this object
void   dbchange()   Records a change that will need to be updated in the db
boolean   dbdelete()   Delete object from DB.
int   dbexists()   Check existence of specified value in unique field.
boolean   dbinsert()   Insert object into DB based on previously recorded changes.
boolean   dbsave()   Inserts or Updates depending on object state.
boolean   dbupdate()   Update the DB based on previously recorded changes
void   dget()   Get a ready-to-display member param by its name
void   disp()   Display a member param by its name
mixed   get()   Get a member param by its name
string   get_action_title()   Generate help title text for action
void   history_info_icon()   Create icon with dataobject history
void   ID()   Template function: Displays object ID.
boolean   set()   Set param value
boolean   set_from_Request()   Set a parameter from a Request form value.
boolean   set_param()   Set param value.
boolean   set_string_from_param()   Set a string parameter from a Request form value.

[ Top ]
Properties
mixed   $allow_ID_insert = false [line 63]

[ Top ]
mixed   $delete_cascades = array() [line 86]

Relations that will cascade deletion.


[ Top ]
mixed   $delete_restrictions = array() [line 81]

Relations that may restrict deletion.


[ Top ]
int   $ID = 0 [line 61]

Unique ID of object in database

Please use get/set functions to read or write this param

API Tags:
Access:  protected


[ Top ]
Methods
Constructor DataObject  [line 100]

  DataObject DataObject( string $tablename, [string $prefix = ''], [string $dbIDname = 'ID'], [string $datecreated_field = ''], [string $datemodified_field = ''], [string $creator_field = ''], [string $lasteditor_field = '']  )

Constructor

Parameters:
string   $tablename:  Name of table in database
string   $prefix:  Prefix of fields in the table
string   $dbIDname:  Name of the ID field (including prefix)
string   $datecreated_field:  datetime field name
string   $datemodified_field:  datetime field name
string   $creator_field:  User ID field name
string   $lasteditor_field:  User ID field name


[ Top ]
action_icon  [line 735]

  void action_icon( $action, [ $help_texts = array()]  )

Generate requested action icon depending on perm

Parameters:
   $action: 
   $help_texts: 


[ Top ]
action_link  [line 751]

  void action_link( $action, $link_text, [ $help_texts = array()]  )

Generate requested action link depending on perm

Parameters:
   $action: 
   $link_text: 
   $help_texts: 


[ Top ]
check_delete  [line 424]

  boolean check_delete( string $restrict_title, [array $ignore = array()]  )

Check relations for restrictions before deleting

Parameters:
string   $restrict_title: 
array   $ignore:  list of foreign keys to ignore

API Tags:
Return:  true if no restriction prevents deletion


[ Top ]
check_relations  [line 395]

  void check_relations( $what, [ $ignore = array()]  )

Check relations for restrictions or cascades.

Parameters:
   $what: 
   $ignore: 

Information Tags:
Todo:  dh> Add link to affected items, e.g. items when trying to delete an attachment, where it gets used.

[ Top ]
confirm_delete  [line 453]

  void confirm_delete( string $confirm_title, string $crumb_name, string $delete_action, array $hiddens  )

Displays form to confirm deletion of this object

Parameters:
string   $confirm_title:  Title for confirmation
string   $crumb_name:  crumb name
string   $delete_action:  "action" param value to use (hidden field)
array   $hiddens:  Hidden keys (apart from "action")


[ Top ]
dbchange  [line 120]

  void dbchange( string $dbfieldname, string $dbfieldtype, mixed $valuepointer  )

Records a change that will need to be updated in the db

Parameters:
string   $dbfieldname:  Name of parameter
string   $dbfieldtype:  DB field type ('string', 'number', 'date', 'dbfield' )
mixed   $valuepointer:  Pointer to value of parameter - dh> pointer? So it should be a reference? Would make sense IMHO anyway.. fp> I just wonder why it's not already a reference... :@

API Tags:
Access:  protected


[ Top ]
dbdelete  [line 325]

  boolean dbdelete( )

Delete object from DB.


API Tags:
Return:  true on success


Redefined in descendants as:

[ Top ]
dbexists  [line 378]

  int dbexists( string $unique_field, mixed $value  )

Check existence of specified value in unique field.

Parameters:
string   $unique_field:  Name of unique field
mixed   $value:  specified value

API Tags:
Return:  ID if value exists otherwise NULL/false


Redefined in descendants as:

[ Top ]
dbinsert  [line 217]

  boolean dbinsert( )

Insert object into DB based on previously recorded changes.

Note: DataObject does not require a matching *Cache object. Therefore it will not try to update the Cache. If something like that was needed, sth like *Cache->add() should be called. ATTENTION: Any dbinsert should typically be followed by a 303 redirect. Updating the Cache before redirect is generally not needed.


API Tags:
Return:  true on success
Usedby:  DataObject::dbsave()


Redefined in descendants as:

[ Top ]
dbsave  [line 305]

  boolean dbsave( )

Inserts or Updates depending on object state.


API Tags:
Return:  true on success, false on failure
Uses:  DataObject::dbupdate()
Uses:  DataObject::dbinsert()


[ Top ]
dbupdate  [line 134]

  boolean dbupdate( [boolean $auto_track_modification = true]  )

Update the DB based on previously recorded changes

Parameters:
boolean   $auto_track_modification:  do we want to auto track the mod date?

API Tags:
Return:  true on success, false on failure to update, NULL if no update necessary
Usedby:  DataObject::dbsave()


Redefined in descendants as:

[ Top ]
dget  [line 515]

  void dget( string $parname, [string $format = 'htmlbody']  )

Get a ready-to-display member param by its name

Same as disp but don't echo

Parameters:
string   $parname:  Name of parameter
string   $format:  Output format, see format_to_output()


[ Top ]
disp  [line 528]

  void disp( string $parname, [string $format = 'htmlbody']  )

Display a member param by its name

Parameters:
string   $parname:  Name of parameter
string   $format:  Output format, see format_to_output()


[ Top ]
get  [line 501]

  mixed get( mixed $parname  )

Get a member param by its name

Parameters:
mixed   $parname:  Name of parameter

API Tags:
Return:  Value of parameter


Redefined in descendants as:

[ Top ]
get_action_title  [line 719]

  string get_action_title( string $action  )

Generate help title text for action

Parameters:
string   $action:  action code: edit, delete, etc.

API Tags:
Return:  translated help string


Redefined in descendants as:

[ Top ]
history_info_icon  [line 766]

  void history_info_icon( )

Create icon with dataobject history



[ Top ]
ID  [line 707]

  void ID( )

Template function: Displays object ID.



[ Top ]
set  [line 545]

  boolean set( string $parname, mixed $parvalue, [boolean $make_null = false]  )

Set param value

By default, all values will be considered strings

Parameters:
string   $parname:  parameter name
mixed   $parvalue:  parameter value
boolean   $make_null:  true to set to NULL if empty value

API Tags:
Return:  true, if a value has been set; false if it has not changed


Redefined in descendants as:

[ Top ]
set_from_Request  [line 651]

  boolean set_from_Request( string $parname, [string $var = NULL], [boolean $make_null = false], [ $cleanup_function = NULL]  )

Set a parameter from a Request form value.

Parameters:
string   $parname:  Dataobject parameter name
string   $var:  Request parameter name (NULL means to use Dataobject param name with its prefix)
boolean   $make_null:  true to set to NULL if empty string value
   $cleanup_function: 

API Tags:
Return:  true, if value has been set/changed, false if not.


[ Top ]
set_param  [line 560]

  boolean set_param( string $parname, string $fieldtype, mixed $parvalue, [boolean $make_null = false]  )

Set param value.

Parameters:
string   $parname:  Name of parameter
string   $fieldtype:  DB field type ('string', 'number', 'date' )
mixed   $parvalue:  Value of parameter
boolean   $make_null:  true to set to NULL if empty string value

API Tags:
Return:  true, if value has been set/changed, false if not.


[ Top ]
set_string_from_param  [line 679]

  boolean set_string_from_param( string $parname, [boolean $required = false], [string $cleanup_function = NULL], [string $validation_function = NULL], [ $error_message = NULL]  )

Set a string parameter from a Request form value.

Parameters:
string   $parname:  Dataobject parameter name
boolean   $required:  true to set to NULL if empty string value
string   $cleanup_function:  name of function used to clean up input
string   $validation_function:  name of fucntion used to validate input (TODO)
   $error_message: 

API Tags:
Return:  true, if value is required


[ Top ]

Documentation generated on Sat, 06 Mar 2010 04:07:44 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).