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 |
void action_icon(
$action, [
$help_texts = array()]
)
|
|
Generate requested action icon depending on perm
Parameters:
void action_link(
$action,
$link_text, [
$help_texts = array()]
)
|
|
Generate requested action link depending on perm
Parameters:
|
|
$action: |
|
|
|
$link_text: |
|
|
|
$help_texts: |
|
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 |
void check_relations(
$what, [
$ignore = array()]
)
|
|
Check relations for restrictions or cascades.
Parameters:
Information Tags:
| Todo: | dh> Add link to affected items, e.g. items when trying to delete an attachment, where it gets used. |
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") |
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:
Delete object from DB.
API Tags:
Redefined in descendants as:
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:
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:
Redefined in descendants as:
Inserts or Updates depending on object state.
API Tags:
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:
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:
void disp(
string
$parname, [string
$format = 'htmlbody']
)
|
|
Display a member param by its name
Parameters:
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:
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:
void history_info_icon(
)
|
|
Create icon with dataobject history
Template function: Displays object ID.
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:
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. |
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. |
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 |