phpDocumentor pond
[ class tree: pond ] [ index: pond ] [ all elements ]

Class: DataObject

Source Location: /qp_inc/_core/model/dataobjects/_dataobject.class.php

Class DataObject

Class Overview

Data Object Base Class

This is typically an abstract class, useful only when derived.

Located in /qp_inc/_core/model/dataobjects/_dataobject.class.php [line 51]



		
				Author(s):
		
API Tags:
Abstract:  

Information Tags:
Version:  beta

Properties

Methods

[ Top ]
Descendants
Child Class Description
Blog Blog
Comment Comment Class
Cronjob Cronjob
File Represents a file or folder on disk. Optionnaly stores meta data from DB.
Filetype Filetype Class
GenericElement User Element
ItemLight ItemLight Class
ItemType ItemType Class
Link Item Link
Goal Filetype Class
Template Template Class
Group User Group
User User Class
ComponentWidget ComponentWidget Class

[ Top ]
Property Summary
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
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.
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
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.

[ Top ]
Properties
mixed   $delete_cascades = array() [line 84]

Relations that will cascade deletion.


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

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 98]

  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 ]
check_delete  [line 406]

  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 363]

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

Check relations for restrictions or cascades

Parameters:
string   $what:  Which relation should be checked ('delete_restrictions' or 'delete_cascades')?
string   $ignore:  An array of foreign key checks to skip.
array   $verbose_callbacks:  An array of callbacks used to display more information about a relation.
  • Array keys (string): Foreign key this callback should apply to.
    • 'fk': The foreign key.
    • 'table': The SQL table for this relation.
    • 'msg': A format string -- a base message to be displayed. It normally shows the number of results.
    • 'id': The ID of this object.


    [ Top ]
    confirm_delete  [line 435]

      void confirm_delete( string $confirm_title, string $delete_action, array $hiddens, [string $cancel_action = NULL]  )

    Displays form to confirm deletion of this object

    Parameters:
    string   $confirm_title:  Title for confirmation
    string   $delete_action:  "action" param value to use (hidden field)
    array   $hiddens:  Hidden keys (apart from "action")
    string   $cancel_action:  most of the time we don't need a cancel action since we'll want to return to the default display


    [ Top ]
    dbchange  [line 118]

      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' )
    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 301]

      boolean dbdelete( )

    Delete object from DB.


    API Tags:
    Return:  true on success


    Redefined in descendants as:

    [ Top ]
    dbinsert  [line 202]

      boolean dbinsert( )

    Insert object into DB based on previously recorded changes.


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


    Redefined in descendants as:

    [ Top ]
    dbsave  [line 283]

      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 131]

      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 500]

      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 513]

      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 486]

      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 ]
    history_info_icon  [line 658]

      void history_info_icon( )

    Create icon with dataobject history



    [ Top ]
    ID  [line 650]

      void ID( )

    Template function: Displays object ID.



    [ Top ]
    set  [line 530]

      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 636]

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

    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

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


    [ Top ]
    set_param  [line 545]

      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 ]