Public Member Functions | |
__construct ( $in_db_object=NULL, $in_db_result=NULL) | |
set_batch_mode () | |
clear_batch_mode () | |
load_from_db ( $in_db_result) | |
id () | |
lock () | |
locked () | |
danger_will_robinson_danger_clear_id () | |
user_can_read () | |
user_can_write () | |
set_read_security_id ($in_new_id) | |
set_write_security_id ($in_new_id) | |
set_name ($in_new_value) | |
delete_from_db () | |
update_db () | |
reload_from_db () | |
get_access_object () | |
get_lang () | |
set_lang ( $in_lang_id=NULL) | |
Public Attributes | |
$class_description | |
This is a description of the class (not the instance). More... | |
$instance_description | |
This is a description that describes the instance. More... | |
$last_access | |
This is a UNIX epoch date that describes the last modification. The default is UNIX Day Two (in case of UTC timezone issues). More... | |
$name | |
This is the "object_name" string field. More... | |
$read_security_id | |
This is a single integer, defining the security ID required to view the record. If it is 0, then it is "open.". More... | |
$write_security_id | |
This is a single integer, defining the required security token to modify the record. If it is 0, then any logged-in user can modify. More... | |
$context | |
This is a mixed associative array, containing fields for the object. More... | |
$error | |
If there is an error, it is contained here, in a LGV_Error instance. More... | |
Protected Member Functions | |
_default_setup () | |
_build_parameter_array () | |
_badger_serialize ( $in_data) | |
_badger_unserialize ( $in_data) | |
_write_to_db () | |
_seppuku () | |
Protected Attributes | |
$_db_object | |
This is the actual database object that "owns" this instance. It should not be exposed beyond this class or subclasses, thereof. More... | |
$_id | |
This is the within-table unique ID of this record. More... | |
$_batch_mode | |
If this is true, then the write_record call will not be made in update_db. It will be done when clear_batch_mode() is called, instead. More... | |
This is the abstract base class for All database records used by Badger.
Badger works on a very simple basis. All records, regardless of their ultimate implementation, have the same basic structure.
The data and security database tables each take a slightly different tack from the baseline, but this class describes the baseline, which is common to both tabases and tables.
Definition at line 43 of file a_co_db_table_base.class.php.
A_CO_DB_Table_Base::__construct | ( | $in_db_object = NULL , |
|
$in_db_result = NULL |
|||
) |
This is the basic constructor.
$in_db_object | This is the database instance that "owns" this record. |
$in_db_result | This is a database-format associative array that is used to initialize this instance. |
Reimplemented in CO_Owner, CO_Security_ID, and CO_Security_Node.
Definition at line 179 of file a_co_db_table_base.class.php.
References _default_setup(), and load_from_db().
|
protected |
This is just a 1-step abstraction for serializing data.
$in_data | This is the data to be serialized. |
Definition at line 109 of file a_co_db_table_base.class.php.
Referenced by _build_parameter_array().
|
protected |
This is just a 1-step abstarction for unserializing data.
$in_data | This is the data to be un-serialized. |
Definition at line 120 of file a_co_db_table_base.class.php.
Referenced by load_from_db().
|
protected |
This builds up the basic section of the instance database record. It should be overloaded, and the parent called before adding new fields.
Reimplemented in CO_Security_Login, CO_LL_Location, CO_Security_Node, and CO_Main_DB_Record.
Definition at line 83 of file a_co_db_table_base.class.php.
References $name, _badger_serialize(), and id().
Referenced by _write_to_db().
|
protected |
This is called to populate the object fields for this class with default values. These use the SQL table tags.
This should be subclassed, and the parent should be called before applying specific instance properties.
Reimplemented in CO_Security_Login, CO_LL_Location, CO_Security_Node, and CO_Main_DB_Record.
Definition at line 67 of file a_co_db_table_base.class.php.
Referenced by __construct().
|
protected |
This function deletes this object's record from the database.
It should be noted that a successful seppuku means the instance is no longer viable, and the ID is set to 0, which makes it a new record (if saved).
Definition at line 161 of file a_co_db_table_base.class.php.
Referenced by delete_from_db().
|
protected |
This is the fundamental database write function. It's a "trigger," and the state of the instance is what is written. If the 'id' field is 0, then a new databse row is created.
This calls the _build_parameter_array() function to create a database-format associative array that is interpreted into SQL by the "owning" database object.
Definition at line 133 of file a_co_db_table_base.class.php.
References _build_parameter_array(), get_access_object(), and id().
Referenced by CO_Security_Login\delete_from_db(), and update_db().
A_CO_DB_Table_Base::clear_batch_mode | ( | ) |
Calling this clears batch mode. It also sees if we were in batch mode previously, in which case, we call the write function.
returns true, if the write function was called and successful.
Definition at line 216 of file a_co_db_table_base.class.php.
References $_batch_mode, and update_db().
A_CO_DB_Table_Base::danger_will_robinson_danger_clear_id | ( | ) |
VERY DANGEROUS! This only exists as a utility for the deleter. It has to be public, because PHP does not allow "friend" classes.
DON'T CALL THIS!
Definition at line 327 of file a_co_db_table_base.class.php.
A_CO_DB_Table_Base::delete_from_db | ( | ) |
This is the public database record deleter.
This checks to make sure the user has write permission before deleting.
Reimplemented in CO_Security_Login.
Definition at line 444 of file a_co_db_table_base.class.php.
References _seppuku(), and user_can_write().
A_CO_DB_Table_Base::get_access_object | ( | ) |
Definition at line 494 of file a_co_db_table_base.class.php.
References $_db_object.
Referenced by CO_Security_Login\__construct(), CO_User_Collection\_load_login(), _write_to_db(), CO_Security_Login\add_id(), CO_Security_Login\add_personal_token_from_current_login(), CO_Security_Login\get_logins_that_have_any_of_my_ids(), CO_Security_Login\get_user_object(), CO_Security_Login\ids(), CO_Security_Login\personal_ids(), reload_from_db(), CO_Security_Login\remove_id(), CO_Security_Login\remove_personal_token_from_this_login(), CO_Security_Login\set_ids(), CO_User_Collection\set_login(), CO_Security_Login\set_personal_ids(), CO_User_Collection\set_tag(), CO_User_Collection\set_tags(), CO_Security_Login\user_can_edit_ids(), user_can_read(), CO_Security_ID\user_can_read(), user_can_write(), and CO_Security_Login\user_can_write().
A_CO_DB_Table_Base::get_lang | ( | ) |
Reimplemented in CO_User_Collection, and CO_Security_Login.
Definition at line 508 of file a_co_db_table_base.class.php.
References $lang.
A_CO_DB_Table_Base::id | ( | ) |
Simple accessor for the ID.
Definition at line 299 of file a_co_db_table_base.class.php.
References $_id.
Referenced by CO_Security_ID\__construct(), _build_parameter_array(), _write_to_db(), CO_Security_Login\is_god(), load_from_db(), and CO_Security_ID\load_from_db().
A_CO_DB_Table_Base::load_from_db | ( | $in_db_result | ) |
This function sets up this instance, according to the DB-formatted associative array passed in.
This should be subclassed, and the parent should be called before applying specific instance properties.
$in_db_result | This is an associative array, formatted as a database row response. |
Reimplemented in CO_Security_Login, CO_Security_ID, CO_Login_Manager, CO_Cobra_Login, CO_User_Collection, CO_US_Place_Collection, CO_Place_Collection, CO_Owner, CO_KeyValue_CO_Collection, CO_Collection, CO_LL_Location, and CO_Main_DB_Record.
Definition at line 239 of file a_co_db_table_base.class.php.
References _badger_unserialize(), and id().
Referenced by __construct(), and reload_from_db().
A_CO_DB_Table_Base::lock | ( | ) |
Locks the resource by setting the read_security_id column to -2.
Definition at line 309 of file a_co_db_table_base.class.php.
A_CO_DB_Table_Base::locked | ( | ) |
Definition at line 317 of file a_co_db_table_base.class.php.
A_CO_DB_Table_Base::reload_from_db | ( | ) |
This gets the object data from the database, using the instance's ID, and reloads everything. It throws out the current state, and replaces it with the one stored in the database.
Definition at line 479 of file a_co_db_table_base.class.php.
References get_access_object(), and load_from_db().
Referenced by CO_Security_Login\add_personal_token_from_current_login(), and CO_Security_Login\remove_personal_token_from_this_login().
A_CO_DB_Table_Base::set_batch_mode | ( | ) |
Calling this sets the object into "batch mode," where we don't call the write function (we're saving it up).
Definition at line 206 of file a_co_db_table_base.class.php.
A_CO_DB_Table_Base::set_lang | ( | $in_lang_id = NULL | ) |
$in_lang_id | The lang ID. This is not used for the low-level error handlers (which use the server setting). It is used to determine higher-level strings. |
Reimplemented in CO_Security_Login.
Definition at line 523 of file a_co_db_table_base.class.php.
References update_db(), and user_can_write().
A_CO_DB_Table_Base::set_name | ( | $in_new_value | ) |
Setter Accessor for the Object Name. Also updates the DB.
$in_new_value | The new value |
Definition at line 424 of file a_co_db_table_base.class.php.
References update_db().
A_CO_DB_Table_Base::set_read_security_id | ( | $in_new_id | ) |
Setter Accessor for the Read Security ID. Also updates the DB.
This checks to make sure the user has write permission before changing the ID.
$in_new_id | The new value |
Definition at line 388 of file a_co_db_table_base.class.php.
References update_db(), and user_can_write().
A_CO_DB_Table_Base::set_write_security_id | ( | $in_new_id | ) |
Setter Accessor for the Write Security ID. Also updates the DB.
This checks to make sure the user has write permission before changing the ID.
$in_new_id | The new value |
Definition at line 407 of file a_co_db_table_base.class.php.
References update_db(), and user_can_write().
A_CO_DB_Table_Base::update_db | ( | ) |
This is a "trigger" to update the database with the current instance state.
This checks to make sure the user has write permission before saving.
Reimplemented in CO_LL_Location.
Definition at line 460 of file a_co_db_table_base.class.php.
References _write_to_db(), and user_can_write().
Referenced by CO_Security_Login\add_id(), CO_Security_Login\clear_api_key(), clear_batch_mode(), CO_Security_Login\set_ids(), set_lang(), CO_Security_Login\set_lang(), set_name(), CO_Main_DB_Record\set_owner_id(), CO_Security_Login\set_password_from_cleartext(), CO_Main_DB_Record\set_payload(), CO_Security_Login\set_personal_ids(), set_read_security_id(), CO_Main_DB_Record\set_tag(), CO_Main_DB_Record\set_tags(), and set_write_security_id().
A_CO_DB_Table_Base::user_can_read | ( | ) |
Reimplemented in CO_Security_ID.
Definition at line 335 of file a_co_db_table_base.class.php.
References get_access_object().
A_CO_DB_Table_Base::user_can_write | ( | ) |
Reimplemented in CO_Security_Login.
Definition at line 362 of file a_co_db_table_base.class.php.
References get_access_object().
Referenced by CO_User_Collection\delete_from_db(), delete_from_db(), set_lang(), CO_Main_DB_Record\set_owner_id(), CO_Main_DB_Record\set_payload(), set_read_security_id(), CO_Main_DB_Record\set_tag(), CO_User_Collection\set_tag(), CO_Main_DB_Record\set_tags(), set_write_security_id(), and update_db().
|
protected |
If this is true, then the write_record call will not be made in update_db. It will be done when clear_batch_mode() is called, instead.
Definition at line 46 of file a_co_db_table_base.class.php.
Referenced by clear_batch_mode().
|
protected |
This is the actual database object that "owns" this instance. It should not be exposed beyond this class or subclasses, thereof.
Definition at line 44 of file a_co_db_table_base.class.php.
Referenced by get_access_object().
|
protected |
This is the within-table unique ID of this record.
Definition at line 45 of file a_co_db_table_base.class.php.
Referenced by id(), and CO_Security_Login\user_can_edit_ids().
A_CO_DB_Table_Base::$class_description |
This is a description of the class (not the instance).
Definition at line 48 of file a_co_db_table_base.class.php.
A_CO_DB_Table_Base::$context |
This is a mixed associative array, containing fields for the object.
Definition at line 55 of file a_co_db_table_base.class.php.
A_CO_DB_Table_Base::$error |
If there is an error, it is contained here, in a LGV_Error instance.
Definition at line 56 of file a_co_db_table_base.class.php.
A_CO_DB_Table_Base::$instance_description |
This is a description that describes the instance.
Definition at line 49 of file a_co_db_table_base.class.php.
A_CO_DB_Table_Base::$last_access |
This is a UNIX epoch date that describes the last modification. The default is UNIX Day Two (in case of UTC timezone issues).
Definition at line 51 of file a_co_db_table_base.class.php.
A_CO_DB_Table_Base::$name |
This is the "object_name" string field.
Definition at line 52 of file a_co_db_table_base.class.php.
Referenced by _build_parameter_array().
A_CO_DB_Table_Base::$read_security_id |
This is a single integer, defining the security ID required to view the record. If it is 0, then it is "open.".
Definition at line 53 of file a_co_db_table_base.class.php.
A_CO_DB_Table_Base::$write_security_id |
This is a single integer, defining the required security token to modify the record. If it is 0, then any logged-in user can modify.
Definition at line 54 of file a_co_db_table_base.class.php.