Class: IcmsPersistableObjectHandler
Source Location: /kernel/icmspersistableobjecthandler.php
Class IcmsPersistableObjectHandler
Class Overview
|
IcmsPersistableObjectHandler
This class is responsible for providing data access mechanisms to the data source of derived class objects as well as some basic operations inherant to objects manipulation
Located in /kernel/icmspersistableobjecthandler.php [line 22]
XoopsObjectHandler
|
--IcmsPersistableObjectHandler
Author(s):
API Tags:
Information Tags:
| Version: | $Id: icmspersistableobjecthandler.php 6931 2008-11-15 13:49:11Z pesian_stranger $ |
| Copyright: | The ImpressCMS Project http://www.impresscms.org/ |
| Since: | 1.1 |
| License: | GNU General Public License (GPL) |
|
Properties
|
Methods
|
Inherited Properties, Constants, and Methods
Property Summary
| array |
$eventArray |
Array containing the events name and functions |
| array |
$permissionsArray |
Array containing the permissions that this handler will manage on the objects |
| string |
$summaryName |
Name of the field which will be use as a summary for the object |
Method Summary
| void |
addPermission() |
Add a permission that this handler will manage for its objects |
| bool |
delete() |
delete an object from the database |
| bool |
deleteAll() |
delete all objects meeting the conditions |
| mixed |
executeEvent() |
Execute the function associated with an event This method will check if the function is available |
| int |
getCount() |
count objects matching a condition |
| array |
getList() |
Retrieve a list of objects as arrays - DON'T USE WITH JOINT KEYS |
| array |
getObjects() |
retrieve objects from the database |
| array |
getObjectsD() |
retrieve objects with debug mode - so will show the query |
| bool |
insert() |
insert a new object in the database |
| bool |
updateAll() |
Change a value for objects with a certain criteria |
Properties
Name of the class derived from IcmsPersistableObject and which this handler is handling
Note that this string needs to be lowercase For example : "smartsectioncategory"
Array containing the events name and functions
Name of the field which properly identify the IcmsPersistableObject
For example : "name" (this will be the category's name)
Array containing the permissions that this handler will manage on the objects
Name of the field which will be use as a summary for the object
For example : "summary"
Name of the table use to store this IcmsPersistableObject
Note that the name of the table needs to be free of the database prefix. For example "smartsection_categories"
Full path of the module using this IcmsPersistableObject
Information Tags:
| Todo: | this could probably be automatically deducted from the class name as it is always prefixed with the module name |
Page name use to basically manage and display the IcmsPersistableObject
This page needs to be the same in user side and admin side For example category.php - we will deduct smartsection/category.php as well as smartsection/admin/category.php
Information Tags:
| Todo: | this could probably be automatically deducted from the class name - for example, the class SmartsectionCategory will have "category.php" as it's managing page |
Methods
IcmsPersistableObjectHandler IcmsPersistableObjectHandler(
&$db,
$itemname, string
$keyname, string
$idenfierName,
$summaryName,
$modulename, object
$db, string
$tablename, string
$page, string
$moduleName
)
|
|
Constructor - called from child classes
Parameters:
void addEventHook(
$event,
$method
)
|
|
Parameters:
void addPermission(
string
$perm_name, string
$caption, [string
$description = false]
)
|
|
Add a permission that this handler will manage for its objects
Example : $this->addPermission('view', _AM_SSHOP_CAT_PERM_READ, _AM_SSHOP_CAT_PERM_READ_DSC);
Parameters:
|
string |
$perm_name: |
name of the permission |
|
string |
$caption: |
caption of the control that will be displayed in the form |
|
string |
$description: |
description of the control that will be displayed in the form |
array convertResultSet(
object
$result, [bool
$id_as_key = false], [bool
$as_object = true]
)
|
|
Convert a database resultset to a returnable array
Parameters:
|
object |
$result: |
database resultset |
|
bool |
$id_as_key: |
- should NOT be used with joint keys |
|
bool |
$as_object: |
|
bool delete(
&$obj, [bool
$force = false], object
$obj
)
|
|
delete an object from the database
Parameters:
|
object |
$obj: |
reference to the object to delete |
|
bool |
$force: |
|
|
|
&$obj: |
|
API Tags:
Redefinition of:
- XoopsObjectHandler::delete()
- delete object from database
bool deleteAll(
[object
$criteria = null]
)
|
|
delete all objects meeting the conditions
Parameters:
void disableEvent(
$event
)
|
|
Parameters:
mixed executeEvent(
string
$event,
&$executeEventObj, object
$obj
)
|
|
Execute the function associated with an event This method will check if the function is available
Parameters:
|
string |
$event: |
name of the event |
|
object |
$obj: |
$object on which is performed the event |
|
|
&$executeEventObj: |
|
API Tags:
| Return: | result of the execution of the function or FALSE if the function was not executed |
mixed &get(
mixed
$id, [bool
$as_object = true], [
$debug = false], [
$criteria = false]
)
|
|
retrieve a IcmsPersistableObject
Parameters:
|
mixed |
$id: |
ID of the object - or array of ids for joint keys. Joint keys MUST be given in the same order as in the constructor |
|
bool |
$as_object: |
whether to return an object or an array |
|
|
$debug: |
|
|
|
$criteria: |
|
API Tags:
Redefinition of:
- XoopsObjectHandler::get()
- gets a value object
int getCount(
[object
$criteria = null]
)
|
|
count objects matching a condition
Parameters:
API Tags:
mixed &getD(
mixed
$id, [bool
$as_object = true]
)
|
|
retrieve a IcmsPersistableObject
Parameters:
|
mixed |
$id: |
ID of the object - or array of ids for joint keys. Joint keys MUST be given in the same order as in the constructor |
|
bool |
$as_object: |
whether to return an object or an array |
API Tags:
void getIdentifierName(
[
$withprefix = true]
)
|
|
Parameters:
void getIdsFromObjectsAsArray(
array
$objectsAsArray
)
|
|
Build an array containing all the ids of an array of objects as array
Parameters:
|
array |
$objectsAsArray: |
array of IcmsPersistableObject |
array getList(
[object
$criteria = null], [int
$limit = 0], [int
$start = 0], [
$debug = false]
)
|
|
Retrieve a list of objects as arrays - DON'T USE WITH JOINT KEYS
Parameters:
|
object |
$criteria: |
CriteriaElement conditions to be met |
|
int |
$limit: |
Max number of objects to fetch |
|
int |
$start: |
Which record to start at |
|
|
$debug: |
|
void getListD(
[
$criteria = null], [
$limit = 0], [
$start = 0]
)
|
|
Parameters:
|
|
$criteria: |
|
|
|
$limit: |
|
|
|
$start: |
|
void getModuleItemString(
)
|
|
array getObjects(
[object
$criteria = null], [bool
$id_as_key = false], [bool
$as_object = true], [
$sql = false], [
$debug = false]
)
|
|
retrieve objects from the database
Parameters:
|
object |
$criteria: |
CriteriaElement conditions to be met |
|
bool |
$id_as_key: |
use the ID as key for the array? |
|
bool |
$as_object: |
return an array of objects? |
|
|
$sql: |
|
|
|
$debug: |
|
void getObjectsAsArray(
$arrayObjects
)
|
|
Parameters:
array getObjectsD(
[object
$criteria = null], [bool
$id_as_key = false], [bool
$as_object = true], [
$sql = false]
)
|
|
retrieve objects with debug mode - so will show the query
Parameters:
|
object |
$criteria: |
CriteriaElement conditions to be met |
|
bool |
$id_as_key: |
use the ID as key for the array? |
|
bool |
$as_object: |
return an array of objects? |
|
|
$sql: |
|
bool insert(
&$obj, [bool
$force = false], [bool
$checkObject = true], [
$debug = false], object
$obj
)
|
|
insert a new object in the database
Parameters:
|
object |
$obj: |
reference to the object |
|
bool |
$force: |
whether to force the query execution despite security settings |
|
bool |
$checkObject: |
check if the object is dirty and clean the attributes |
|
|
&$obj: |
|
|
|
$debug: |
|
API Tags:
| Return: | FALSE if failed, TRUE if already present and unchanged or successful |
Redefinition of:
- XoopsObjectHandler::insert()
- insert/update object
void insertD(
&$obj, [
$force = false], [
$checkObject = true], [
$debug = false]
)
|
|
Parameters:
|
|
&$obj: |
|
|
|
$force: |
|
|
|
$checkObject: |
|
|
|
$debug: |
|
void query(
$sql,
$criteria, [
$force = false], [
$debug = false]
)
|
|
Parameters:
|
|
$sql: |
|
|
|
$criteria: |
|
|
|
$force: |
|
|
|
$debug: |
|
void setGrantedObjectsCriteria(
&$criteria,
$perm_name
)
|
|
Parameters:
void setUploaderConfig(
[
$_uploadPath = false], [
$_allowedMimeTypes = false], [
$_maxFileSize = false], [
$_maxWidth = false], [
$_maxHeight = false]
)
|
|
Parameters:
|
|
$_uploadPath: |
|
|
|
$_allowedMimeTypes: |
|
|
|
$_maxFileSize: |
|
|
|
$_maxWidth: |
|
|
|
$_maxHeight: |
|
bool updateAll(
string
$fieldname, string
$fieldvalue, [object
$criteria = null], [
$force = false]
)
|
|
Change a value for objects with a certain criteria
Parameters:
|
string |
$fieldname: |
Name of the field |
|
string |
$fieldvalue: |
Value to write |
|
object |
$criteria: |
CriteriaElement |
|
|
$force: |
|
void updateCounter(
$object
)
|
|
Parameters:
|
|