User item
Base class with common features for database based items and item collections.
package | CONTENIDO API |
---|---|
subpackage | Model |
copyright | four for business AG |
Item($sTable, $sPrimaryKey, $iLifetime)
inherited_from | \Item::Item() |
---|
__construct(mixed $mId) : void
mixed
Specifies the ID of item to load
\cInvalidArgumentException |
If table name or primary key is not set |
---|
_inFilter(mixed $mData) : mixed
see | \setFilters |
---|---|
inherited_from | \Item::_inFilter() |
mixed
Data to filter
mixed
Filtered datacApiUser($mId)
deprecated | [2011-03-15] Old constructor function for downwards compatibility |
---|
checkPasswordMask(string $password) : int
.. This behaviour is configurable in global configuration $cfg['password'].
string
The password check
int
One of defined PASS_* constants (PASS_OK if everything was
ok)deleteProperty(string $sType, string $sName) : bool
inherited_from | \Item::deleteProperty() |
---|
string
Specifies the type
string
Specifies the name
bool
deletePropertyById(int $idprop) : bool
inherited_from | \Item::deletePropertyById() |
---|
int
Id of property
bool
deleteUserProperty(string $type, string $name) : bool
string
Type (class, category etc) of property to retrieve
string
Name of property to retrieve
bool
encodePassword(string $password) : string
string
The password to encode
string
Encoded passwordescape(string $sString) : string
inherited_from | \cItemBaseAbstract::escape() |
---|---|
inherited_from | \Item::escape() |
string
The string to escape
string
Escaped stringget(string $sField) : mixed
inherited_from | \Item::get() |
---|
string
Specifies the field to retrieve
mixed
Value of the fieldgetAddressData() : array
array
Address data array like:
$aAddress['street'], $aAddress['city'], $aAddress['country'], $aAddress['zip']
getEffectiveName() : string
string
Realname or username of usergetEffectiveUserPerms() : string
getErrorString(int $iErrorCode) : string
int
string
getField(string $sField) : mixed
inherited_from | \Item::getField() |
---|
string
Specifies the field to retrieve
mixed
Value of the fieldgetGroupIDsByUserID(string $userid) : array
string
Optional user id, uses id of loaded user by default.
array
getGroupNamesByUserID(string $userid, bool $bAddDescription) : array
string
Optional user id, uses id of loaded user by default.
bool
Flag to add description like "groupname (description)"
array
getMail() : string
string
getMetaObject()
inherited_from | \Item::getMetaObject() |
---|
getPerms() : string
string
getPermsArray() : array
array
getProperty(string $sType, string $sName) : mixed
inherited_from | \Item::getProperty() |
---|
string
Specifies the type
string
Specifies the name
mixed
Value of the given property or falsegetRealName() : string
string
Realname of usergetTelNumber() : string
string
getUseTiny()
deprecated | [2012-03-06] Function name should be more generic |
---|
getUseWysi() : int
int
getUserId() : string
string
getUserName() : string
string
getUserProperties(bool $beDownwardsCompatible) : array
Works with a downwards compatible mode.
NOTE: Even if downwards compatible mode is enbabled by default, this mode is deprecated...
bool
Flag to return downwards compatible values
array
bool a array or false in downwards compatible mode,
otherwhise a array.
Return value in new mode is:
- $arr[iduserprop][name]
- $arr[iduserprop][type]
- $arr[iduserprop][value]
Return value in downwards compatible mode is:
- $arr[pos][name]
- $arr[pos][type]getUserPropertiesByType(string $type, bool $group) : array
todo | return value should be similar to getUserProperties() |
---|
string
Type (class, category etc) of the properties to retrieve
bool
Flag to retrieve in group properties. If enabled, group properties will be merged with user properties where the user poperties will overwrite group properties
array
Assoziative properties array as follows:
- $arr[name] = valuegetUserProperty(string $type, string $name, bool $group) : string
string
Type (class, category etc) for the property to retrieve
string
Name of the property to retrieve
bool
Flag to search in groups
string
bool value of the retrieved property or falsegetValidDateFrom() : string
string
getValidDateTo() : string
string
isLoaded() : bool
inherited_from | \Item::isLoaded() |
---|
bool
loadBy(string $sField, mixed $mValue, bool $bSafe) : bool
inherited_from | \Item::loadBy() |
---|
string
Specifies the field
mixed
Specifies the value
bool
Use inFilter or not
\cException |
if more than one item has been found matching the given arguments |
---|
bool
True if the load was successfulloadByMany(array $aAttributes, bool $bSafe) : bool
inherited_from | \Item::loadByMany() |
---|
array
associative array with field / value pairs
bool
Use inFilter or not
\cException |
if more than one item could be found matching the given arguments |
---|
bool
True if the load was successfulloadByPrimaryKey(string $mValue) : bool
inherited_from | \Item::loadByPrimaryKey() |
---|
string
Specifies the primary key value
bool
True if the load was successfulloadByRecordSet(array $aRecordSet)
inherited_from | \Item::loadByRecordSet() |
---|
array
The recordset of the item
loadUserByUserID(string $userId) : bool
string
Specifies the userID
bool
True if the load was successfulloadUserByUsername(string $userName) : bool
string
Specifies the username
bool
True if the load was successfulregister(string $event, mixed $callback, mixed $class) : void
Example: cGenericDb::register(cGenericDb::CREATE_SUCCESS, 'itemCreateHandler', 'cApiArticle'); cGenericDb::register(cGenericDb::CREATE_SUCCESS, array('cCallbackHandler', 'executeCreateHandle'), 'cApiArticle');
inherited_from | \cGenericDb::register() |
---|---|
inherited_from | \cItemBaseAbstract::register() |
inherited_from | \Item::register() |
string
Callback event, must be a valid value of a cGenericDb event constant
mixed
Callback to register
mixed
Class name for registering callback (can be string of array with names of the concrete Item classes)
\cInvalidArgumentException |
if event or class are not set or the callback is not callable |
---|
save() : bool
bool
Return value of store()savePassword(string $password) : int
The password has to be checked, before it is set to the database. The resulting integer value represents the result code. Use the PASS_* constants to check what happens.
string
int
bool PASS_* or false if saving failsset(string $sField, string $mValue, bool $bSafe)
inherited_from | \Item::set() |
---|
string
Field name
string
Value to set
bool
Flag to run defined inFilter on passed value
setAddressData(string $sStreet, string $sCity, string $sZip, string $sCountry)
string
string
string
string
setCity(string $sCity)
string
setCountry(string $sCountry)
string
setField(string $sField, string $mValue, bool $bSafe)
string
Field name
string
Value to set
bool
Flag to run defined inFilter on passed value
setFilters(array $aInFilters, array $aOutFilters) : void
Examples:
$obj->setFilters(array('addslashes'), array('stripslashes')); $obj->setFilters(array('htmlencode', 'addslashes'), array('stripslashes', 'htmlencode'));
inherited_from | \Item::setFilters() |
---|
array
Array with function names
array
Array with function names
setMail(string $sMail)
string
setPassword(string $password) : int
on success PASS_OK).
string
int
setPerms(array | string $perms)
array
string
setProperty(string $sType, string $sName, mixed $mValue) : bool
inherited_from | \Item::setProperty() |
---|
string
Specifies the type
string
Specifies the name
mixed
Specifies the value
bool
setRealName(string $sRealName)
string
setStreet(string $sStreet)
string
setTelNumber(string $sTelNumber)
string
setUseTiny($iUseTiny)
deprecated | [2012-03-06] Function name should be more generic |
---|
setUseWysi(int $iUseWysi)
int
setUserId(string $uid)
NOTE: Setting the user id by this method will load the user model.
string
setUserName(string $sUserName)
string
setUserProperty(string $type, string $name, string $value) : \cApiUserProperty
string
Type (class, category etc) for the property to retrieve
string
Name of the property to retrieve
string
Value to insert
setValidDateFrom(string $sValidateFrom)
string
TODO add type checks
setValidDateTo(string $sValidateTo)
string
TODO add type check
setZip(string $sZip)
string
store() : bool
inherited_from | \Item::store() |
---|
bool
toArray() : array | false
inherited_from | \Item::toArray() |
---|
array
false
unregister(string $event, mixed $class) : void
Example: cGenericDb::unregister(cGenericDb::CREATE_SUCCESS, 'cApiArticle');
inherited_from | \cGenericDb::unregister() |
---|---|
inherited_from | \cItemBaseAbstract::unregister() |
inherited_from | \Item::unregister() |
string
Callback event, must be a valid value of a cGenericDb event constant
mixed
Class name for unregistering callback (can be string of array with names of the concrete Item classes)
\cInvalidArgumentException |
if the event or the class are not set |
---|
userExists($userId) : bool
bool
user exists or notusernameExists(string $username) : bool
string
the name
bool
username exists or not_executeCallbacks(string $event, string $class, array $arguments) : void
inherited_from | \cGenericDb::_executeCallbacks() |
---|---|
inherited_from | \cItemBaseAbstract::_executeCallbacks() |
inherited_from | \Item::_executeCallbacks() |
string
Callback event, must be a valid value of a cGenericDb event constant
string
Class name for executing callback
array
Arguments to pass to the callback function
\cInvalidArgumentException |
if the event or class is not set |
---|
_getPropertiesCollectionInstance() : \cApiPropertyCollection
inherited_from | \cItemBaseAbstract::_getPropertiesCollectionInstance() |
---|---|
inherited_from | \Item::_getPropertiesCollectionInstance() |
_getSecondDBInstance() : \cDb
inherited_from | \cItemBaseAbstract::_getSecondDBInstance() |
---|---|
inherited_from | \Item::_getSecondDBInstance() |
_loadByWhereClause(string $sWhere) : bool
This function is expensive, since it executes allways a query to the database to retrieve the primary key, even if the record set is aleady cached. NOTE: Passed value has to be escaped before. This will not be done by this function.
inherited_from | \Item::_loadByWhereClause() |
---|
string
The where clause like 'idart = 123 AND idlang = 1'
\cException |
if more than one item could be found matching the given where clause |
---|
bool
True if the load was successful_onLoad() : void
Inherited classes should override this function if desired.
inherited_from | \Item::_onLoad() |
---|
_outFilter(mixed $mData) : mixed
see | \setFilters |
---|---|
inherited_from | \Item::_outFilter() |
mixed
Data to filter
mixed
Filtered data_setMetaObject($sObjectName)
inherited_from | \Item::_setMetaObject() |
---|
$primaryKey : string
inherited_from | \cItemBaseAbstract::$$primaryKey |
---|---|
inherited_from | \Item::$$primaryKey |
$values : array
inherited_from | \Item::$$values |
---|
$virgin : bool
If true, the object is virgin and no operations on it except load-Functions are allowed.
inherited_from | \cItemBaseAbstract::$$virgin |
---|---|
inherited_from | \Item::$$virgin |
$_arrInFilters : array
inherited_from | \Item::$$_arrInFilters |
---|
$_arrOutFilters : array
inherited_from | \Item::$$_arrOutFilters |
---|
$_className : string
inherited_from | \cItemBaseAbstract::$$_className |
---|---|
inherited_from | \Item::$$_className |
$_oCache : \cItemCache
inherited_from | \cItemBaseAbstract::$$_oCache |
---|---|
inherited_from | \Item::$$_oCache |
$_settings : array
inherited_from | \cItemBaseAbstract::$$_settings |
---|---|
inherited_from | \Item::$$_settings |
$cache : array
inherited_from | \cItemBaseAbstract::$$cache |
---|---|
inherited_from | \Item::$$cache |
$lasterror : string
inherited_from | \cItemBaseAbstract::$$lasterror |
---|---|
inherited_from | \Item::$$lasterror |
$lifetime : int
inherited_from | \cItemBaseAbstract::$$lifetime |
---|---|
inherited_from | \Item::$$lifetime |
$modifiedValues : array
inherited_from | \Item::$$modifiedValues |
---|
$oldPrimaryKey : string
inherited_from | \Item::$$oldPrimaryKey |
---|
$properties : \cApiPropertyCollection
inherited_from | \cItemBaseAbstract::$$properties |
---|---|
inherited_from | \Item::$$properties |
$secondDb : \cDb
inherited_from | \cItemBaseAbstract::$$secondDb |
---|---|
inherited_from | \Item::$$secondDb |
$table : string
inherited_from | \cItemBaseAbstract::$$table |
---|---|
inherited_from | \Item::$$table |
$_callbacks : array
inherited_from | \cGenericDb::$$_callbacks |
---|---|
inherited_from | \cItemBaseAbstract::$$_callbacks |
inherited_from | \Item::$$_callbacks |
CREATE_BEFORE
Expected parameters for callback: none
inherited_from | \cGenericDb::CREATE_BEFORE |
---|---|
inherited_from | \cItemBaseAbstract::CREATE_BEFORE |
inherited_from | \Item::CREATE_BEFORE |
CREATE_FAILURE
Expected parameters for callback: none
inherited_from | \cGenericDb::CREATE_FAILURE |
---|---|
inherited_from | \cItemBaseAbstract::CREATE_FAILURE |
inherited_from | \Item::CREATE_FAILURE |
CREATE_SUCCESS
Expected parameters for callback: ID of created item
inherited_from | \cGenericDb::CREATE_SUCCESS |
---|---|
inherited_from | \cItemBaseAbstract::CREATE_SUCCESS |
inherited_from | \Item::CREATE_SUCCESS |
DELETE_BEFORE
Expected parameters for callback: ID of them item to delete
inherited_from | \cGenericDb::DELETE_BEFORE |
---|---|
inherited_from | \cItemBaseAbstract::DELETE_BEFORE |
inherited_from | \Item::DELETE_BEFORE |
DELETE_FAILURE
Expected parameters for callback: ID of them item to delete
inherited_from | \cGenericDb::DELETE_FAILURE |
---|---|
inherited_from | \cItemBaseAbstract::DELETE_FAILURE |
inherited_from | \Item::DELETE_FAILURE |
DELETE_SUCCESS
Expected parameters for callback: ID of them item to delete
inherited_from | \cGenericDb::DELETE_SUCCESS |
---|---|
inherited_from | \cItemBaseAbstract::DELETE_SUCCESS |
inherited_from | \Item::DELETE_SUCCESS |
EXCEPTION_PASSWORD_INVALID : int
final |
---|
EXCEPTION_USERNAME_EXISTS : int
final |
---|
MIN_PASS_LENGTH_DEFAULT : int
final |
---|
PASS_NOT_COMPLEX : int
final |
---|
PASS_NOT_ENOUGH_DIFFERENT_CHARS : int
final |
---|
PASS_NOT_ENOUGH_MIXED_CHARS : int
final |
---|
PASS_NOT_ENOUGH_NUMBERS : int
final |
---|
PASS_NOT_ENOUGH_SYMBOLS : int
final |
---|
PASS_NOT_STRONG : int
final |
---|
PASS_OK : int
final |
---|
PASS_TO_SHORT : int
final |
---|
STORE_BEFORE
Expected parameters for callback: Item instance
inherited_from | \cGenericDb::STORE_BEFORE |
---|---|
inherited_from | \cItemBaseAbstract::STORE_BEFORE |
inherited_from | \Item::STORE_BEFORE |
STORE_FAILURE
This is also likely to happen if query would not change anything in database! Expected parameters for callback: Item instance
inherited_from | \cGenericDb::STORE_FAILURE |
---|---|
inherited_from | \cItemBaseAbstract::STORE_FAILURE |
inherited_from | \Item::STORE_FAILURE |
STORE_SUCCESS
Expected parameters for callback: Item instance
inherited_from | \cGenericDb::STORE_SUCCESS |
---|---|
inherited_from | \cItemBaseAbstract::STORE_SUCCESS |
inherited_from | \Item::STORE_SUCCESS |