Public Method Details |
pxdb_commit |
public void pxdb_commit([ integer $id ])
|
|
|
Parameter |
|
integer |
$id |
= >>null<< |
|
The record id. |
|
Returns |
void |
|
get_id |
public integer get_id()
|
|
|
Returns |
integer The record id. |
|
set_id |
public void set_id(integer $id)
|
|
|
Parameter |
|
integer |
$id |
|
|
The record id. |
|
Returns |
void |
|
lookup_datatype |
public int lookup_datatype(int $rec_id)
|
|
|
Parameter |
|
|
Returns |
int datatype ID |
|
get_datatype |
public integer get_datatype()
|
|
Warning: documentation is missing.
|
Returns |
integer The datatype. |
|
set_datatype |
public void set_datatype(integer $dt)
|
|
Warning: documentation is missing.
|
Parameter |
|
integer |
$dt |
|
|
The datatype. |
|
Returns |
void |
|
read |
public void read()
|
|
|
Returns |
void |
|
import |
public void import([ array $source ])
|
|
Warning: documentation is missing.
|
Parameter |
|
array |
$source |
= >>null<< |
|
The location of source data to use. (for upward compatibility with pxdb::import()) |
|
Returns |
void |
|
validate |
public boolean validate()
|
|
This method is public and can be invoked separately. If you invoke this method you can expect to find the validation errors (array) in the global variable $pxdb['validator']. This array is automatically read-in by the pxdb_input class.
|
Returns |
boolean True on success and false on error. |
|
get_modified_fields |
public array get_modified_fields()
|
|
This will be set after the save method has been called. Note: it's not particularly useful after an insert(), since all fields will have been modified.
|
Returns |
array Fields that were modified. |
|
is_changed |
public boolean is_changed(string $field, mixed $value)
|
|
This method compares the value entered with $_original_record and returns true if they are not equal and false if they are.
|
Parameter |
|
string |
$field |
|
|
The field we are examining. |
|
|
mixed |
$value |
|
|
The new value for the field. |
|
Returns |
boolean true /false if changed |
|
get_save_type |
public string get_save_type()
|
|
|
Returns |
string 'insert' or 'update' |
|
save |
public boolean save()
|
|
This method loads up the $related and $record arrays, then calls the methods that perform the db updates and inserts.
|
Returns |
boolean on success. |
|
add_related |
public void add_related(mixed $related_id, int $relid)
|
|
|
Parameter |
|
mixed |
$related_id |
|
|
This is the record ID (or array of IDs) we are relating the current record to. |
|
|
int |
$relid |
|
|
This is the relid. |
|
Returns |
void |
|
add_secondaryrel_related |
public void add_secondaryrel_related(mixed $related_id)
|
|
|
Parameter |
|
mixed |
$related_id |
|
|
This is the record ID (or array of IDs) we are relating the current record to. |
|
Returns |
void |
|
add_child |
public void add_child(mixed $related_id, [ int $noderel_id ])
|
|
|
Parameter |
|
mixed |
$related_id |
|
|
This is the record ID (or array of IDs) we are relating the current record to. |
|
|
int |
$noderel_id |
= >>null<< |
|
The noderel ID of the noderel relationship type. Defaults to null for backward compatibility |
|
Returns |
void |
|
add_parent |
public void add_parent(mixed $related_id, [ int $noderel_id ])
|
|
|
Parameter |
|
mixed |
$related_id |
|
|
This is the record ID (or array of IDs) we are relating the current record to. |
|
|
int |
$noderel_id |
= >>null<< |
|
The noderel ID of the noderel relationship type. Defaults to null for backward compatibility |
|
Returns |
void |
|
approve |
public boolean approve()
|
|
Tests to make sure that bound user has write access to this record & appropriate priv level to approve records of this datatype. -- Assuming yes, sets the approved column to 1.
|
Returns |
boolean , false on error |
|
unapprove |
public boolean unapprove()
|
|
Tests to make sure that bound user has write access to this record & appropriate priv level to approve records of this datatype. -- Assuming yes, sets the approved column to 0.
|
Returns |
boolean , false on error |
|
set_approval_status |
public void set_approval_status(boolean $bit)
|
|
|
Parameter |
|
boolean |
$bit |
|
|
Approval bit for record. |
|
Returns |
void |
|
set_field |
public boolean set_field(string $field, mixed $value, [ boolean $quote ])
|
|
This is for manually writing a record to the database -- bypassing any input forms. Note that unless you set a record_id, it is assumed that you are inserting a new record. The datatype must be set before this function is invoked. -- You can do this with the set_datatype() method -- or it will happen automatically if you are editing an existing record. You may gets strange behavior if you are trying to overwrite a value set via a form and you do not use an identifier to specify the field.
|
Parameter |
|
string |
$field |
|
|
The fname -- or identifier -- of column we are adding. |
|
|
mixed |
$value |
|
|
The value for the new parameter.. |
|
|
boolean |
$quote |
= >>true<< |
|
Whether to quote the string (assumes that all values should be quoted) |
|
Returns |
boolean true /false on success. |
|
is_rlevel_authorized |
public boolean is_rlevel_authorized(integer $record_id)
|
|
|
Parameter |
|
integer |
$record_id |
|
|
The ID of the record we are checking. |
|
Returns |
boolean Whether or not current user has specified privs. |
|
is_flevel_authorized |
public boolean is_flevel_authorized(integer $field_id)
|
|
|
Parameter |
|
integer |
$field_id |
|
|
The typesfield id of the field we are checking. |
|
Returns |
boolean Whether a user has specified access to specified field |
|
set_default_priv |
public void set_default_priv(mixed $priv)
|
|
If empty, then no priv w/ ugid '0' will be inserted. The default is 'read,write'.
|
Parameter |
|
mixed |
$priv |
|
|
String or array containing the privileges to set. |
|
Returns |
void |
|
grant_priv |
public boolean grant_priv(int $ugid, mixed $priv)
|
|
|
Parameter |
|
int |
$ugid |
|
|
The user/group id (from records table) |
|
|
mixed |
$priv |
|
|
A string or array containing privilegs e.g. 'read,write' or array('read', 'write'). |
|
Returns |
boolean True or False (with $errors[] added) |
|
revoke_priv |
public boolean revoke_priv(int $ugid)
|
|
By default it uses values in $_imported array, but can also be passed parameters -- for revoking privilegs internally.
|
Parameter |
|
int |
$ugid |
|
|
The user/group id (from records table) |
|
Returns |
boolean True or False (with $errors[] added) |
|
delete_related |
public boolean delete_related(mixed $relid, [ mixed $dt ])
|
|
This function must be called manually. -- or you must override this class and redefine delete() to call this function *first*.
|
Parameter |
|
mixed |
$relid |
|
|
The integer relid or array of relids (only applicable to primaryrel relationships). |
|
|
mixed |
$dt |
= >>null<< |
|
The datatype of related records. |
|
Returns |
boolean true /false on success. |
|
delete_secondaryrel_related |
public boolean delete_secondaryrel_related([ mixed $dt ])
|
|
This function must be called manually. -- or you must override this class and redefine delete() to call this function *first*.
|
Parameter |
|
mixed |
$dt |
= >>null<< |
|
The integer relid or array of relids (only applicable to primaryrel relationships). |
|
Returns |
boolean true /false on success. |
|
delete_children |
public Array delete_children([ boolean $purge_records, int $parent ])
|
|
Note that this will recursively delete *all* rows from noderel that are subordinate (children) nodes of this record in the noderel table. This is different from standard delete() method in that, the standard method only removes the top node, essentially shifting everything up in the heirarchy. You may also pass a non false variable (i.e. type matters) as the first paramter to tell it to also purge the corresponding rows from records table. (dangerous!) relationship
|
Parameter |
|
boolean |
$purge_records |
= >>false<< |
|
Whether to remove records from records table (in addition to noderel). |
|
|
int |
$parent |
= >>null<< |
|
Used by the recursion to track the current $parent. Defaults to $this->record_id if false. |
|
Returns |
Array hash containing number of rows deleted (affected) for each table. |
|
delete |
public mixed delete()
|
|
This method does not delete any related or children records. If you want to do this, you must either call those delete methods individually, or extend this class and override this method to call those delete methods before calling parent::delete().
|
Returns |
mixed Boolean false on failure, array of affected rows on success |
|