CDM
[ class tree: CDM ] [ index: CDM ] [ all elements ]

Class: CDMBaseHandler

Source Location: /modules/xbs_cdm/class/class.cdm.base.php

Class Overview

XoopsObjectHandler
   |
   --CDMBaseHandler

Object handler for CDM objects


Author(s):

Copyright:

  • copyright © 2000 The XOOPS Project

Variables

Methods


Child classes:

Xbs_CdmCDMMetaHandler
Object handler for CDMMeta
Xbs_CdmCDMCodeHandler
Object handler for CDMCode
Xbs_CdmCDMSetHandler
Object handler for CDMSet

Inherited Variables

Inherited Methods

Class: XoopsObjectHandler

XoopsObjectHandler::XoopsObjectHandler()
called from child classes only
XoopsObjectHandler::create()
creates a new object
XoopsObjectHandler::delete()
delete obejct from database
XoopsObjectHandler::get()
gets a value object
XoopsObjectHandler::insert()
insert/update object

Class Details

[line 554]
Object handler for CDM objects



Tags:

copyright:  copyright © 2000 The XOOPS Project
author:  Kazumi Ono <onokazu@xoops.org>
abstract:  


[ Top ]


Class Variables

$classname =

[line 561]

Set in descendent constructor to name of object that this handler handles


Type:   string


[ Top ]

$ins_tagname =

[line 566]

Set in ancestor to name of unique ID generator tag for use with insert function


Type:   string


[ Top ]



Class Methods


constructor CDMBaseHandler [line 589]

CDMBaseHandler CDMBaseHandler( xoopsDatabase &$db)

Constructor



Parameters:

xoopsDatabase   &$db   handle for xoops database object

[ Top ]

method create [line 651]

object descendent &create( [mixed $isNew = true], boolean $isNew=true)

Create a new object

Relies on _create to create the actual object




Tags:

return:  of CDMBase else False if failure


Overrides XoopsObjectHandler::create() (creates a new object)

Parameters:

boolean   $isNew=true   create a new object and tell it is new. If False then create object but set it as not new

[ Top ]

method delete [line 879]

bool delete( CDMObject &$obj)

Delete object from the database

Actually all that happens is that the row is made 'defunct' here and saved to the database




Tags:

return:  TRUE on success else False


Overrides XoopsObjectHandler::delete() (delete obejct from database)

Parameters:

CDMObject   &$obj   Object to delete

[ Top ]

method errno [line 609]

int errno( )

Return last error number



[ Top ]

method error [line 618]

string error( )

Return last error message



[ Top ]

method get [line 728]

object Descendent get( int $id, [string $lang = CDM_DEF_LANG])

Get safe data from database.

This function is the one that should normally be called to set up the object as it will only return active rows and of a language set that must be specified




Tags:

return:  of CDMBase if success else FALSE on failure


Overridden in child classes as:

Xbs_CdmCDMSetHandler::get()
Safe data get

Overrides XoopsObjectHandler::get() (gets a value object)

Parameters:

int   $id   internal id of the object. Internal code is a unique int value.
string   $lang   default CDM_DEF_LANG, Valid LANGUAGE code. Will only return codes of that language set

[ Top ]

method getall [line 693]

object descendent &getall( int $id, [string $row_flag = null], [string $lang = null])

Get all data for object given id.

For safety use the get method which will only return Active rows.




Tags:

return:  of CDMBase


Overridden in child classes as:

Xbs_CdmCDMSetHandler::getall()
Retrieve a set of data

Parameters:

int   $id   data item internal identifier
string   $row_flag   default null (get all), Option(CDM_RSTAT_ACT, CDM_RSTAT_DEF, CDM_RSTAT_SUS)
string   $lang   default null (get all), Valid LANGUAGE code. Will only return object of that language set

[ Top ]

method getError [line 627]

string getError( )

return last error number and message



[ Top ]

method getKey [line 741]

object of getKey( mixed 0)

Get internal identifier (primary key) based on user visible code

overide in ancestor to return the identifier




Tags:

return:  required type
abstract:  


Overridden in child classes as:

Xbs_CdmCDMCodeHandler::getKey()
Return code object internal identifier (primary key) based on its unique user key

Parameters:

mixed   0   Dependednt on descendent class

[ Top ]

method insert [line 840]

bool insert( CDMObject &$obj)

Write an object back to the database

Overide in ancestor only if you need to add extra process before or after the insert.




Tags:

return:  True if successful


Overridden in child classes as:

Xbs_CdmCDMMetaHandler::insert()
Insert or update a meta set object
Xbs_CdmCDMCodeHandler::insert()
Insert or update a code object
Xbs_CdmCDMSetHandler::insert()
Function insert - Does nothing. Use getCode and getMeta to instantiate CDM objects and then insert (save) them individually

Overrides XoopsObjectHandler::insert() (insert/update object)

Parameters:

CDMObject   &$obj   reference to a CDM object

[ Top ]

method reload [line 764]

object Descendent reload( object Descendent &$obj, [mixed $key = null])

Reload object from database

reload data to an existing object




Tags:

return:  of CDMBase


Overridden in child classes as:

Xbs_CdmCDMSetHandler::reload()
Function reload - overwrite ancestor. Does nothing

Parameters:

mixed   $key   unique identifier for object
object Descendent   &$obj   of CDMBase, object to be reloaded

[ Top ]

method setError [line 599]

void setError( [mixed $errnum = 0], [mixed $errstr = ''], int $errnum=0, string $errstr='')

Set error information



Parameters:

int   $errnum=0   Error number
string   $errstr=''   Error Message

[ Top ]

method _create [line 638]

object or &_create( )

Must be overidden in ancestor to return a new object of the required kind (descendent of CDMBase)



Tags:

return:  False if no object created
abstract:  


[ Top ]

method _get [line 679]

string &_get( mixed $key, string $row_flag, string $lang, int $id)

Get data from the database and create a new object with it

Abstract method. Overide in ancestor and supply the sql string to get the data




Tags:

return:  SQL string to get data
abstract:  


Parameters:

int   $id   internal id of the object. Internal code is a unique int value.
string   $row_flag   default null (get all), Option(CDM_RSTAT_ACT, CDM_RSTAT_DEF, CDM_RSTAT_SUS)
string   $lang   default null (get all), Valid LANGUAGE code. Will only return object of that language set

[ Top ]

method _ins_insert [line 806]

string _ins_insert( mixed $cleanVars, array $cleanvars)

OVERIDE in ancestor to provide an INSERT string for insert function

You can generate a new variable with the same name as the key of the cleanVars array and a value equal to the value element of that array using;

  1. foreach ($cleanVars as $k => $v) {
  2. ${$k} = $v;
  3. }




Tags:

return:  SQL string to insert object data into database
abstract:  


Parameters:

array   $cleanvars   array of cleaned up variable name/value pairs as returned by $this->cleanVars()

[ Top ]

method _ins_update [line 826]

string _ins_update( mixed $cleanVars, array $cleanvars)

OVERIDE in ancestor to provide an UPDATE string for insert function

You can generate a new variable with the same name as the key of the cleanVars array and a value equal to the value element of that array using;

  1. foreach ($cleanVars as $k => $v) {
  2. ${$k} = $v;
  3. }




Tags:

return:  SQL string to update object data into database
abstract:  


Parameters:

array   $cleanvars   array of cleaned up variable name/value pairs as returned by $this->cleanVars()

[ Top ]

method _reload [line 751]

string &_reload( mixed $key)

Return SQL string to reload an object from database



Tags:

abstract:  


[ Top ]


Documentation generated on Fri, 03 Mar 2006 08:55:52 +0000 by phpDocumentor 1.3.0RC3