KWeb
6.4
|
Objects with named attributes. More...
Public Member Functions | |
getObjectProperties ($data=true, $cache=true, $temp=false) | |
Returns object properties as an array. | |
isBeingCreated () | |
isNew () | |
Czy jest obiektem zupełnie nowym?. | |
makeStoreable ($storeable=true) | |
isStoreable () | |
getValidObject ($strict=false) | |
Returns currently valid version of this object. | |
convertData ($data, $format, $conversion, $includeUnknown=false) | |
Converts all specified data between formats (INTERNAL to/from $internal). | |
getObjectAttributes (array $options=array()) | |
Returns attribute table for this object. | |
buildObjectForm ($id, array $options=array()) | |
Builds the user input form for this object. | |
setObjectForm ($form) | |
getObjectForm () | |
getAttribute ($name) | |
warmupObject ($lang=false, $cache=false, $force=false) | |
Warms up object's data - ensures that everything that should be in $data is there. | |
getDataValue ($name, $lang=false) | |
Returns object's data value The data is first looked up in object's properties, then in $data. | |
setDataValue ($name, $value, $lang=false, $setChanged=true, $requestSqlUpdate=true) | |
Sets object's data value (without validation) | |
copyDataValue ($id, KWebObject_Attributable $from) | |
Copies entire data value, with all translations, from another object. | |
getObjectData ($lang=false, $includeMainTranslation=false) | |
Returns object data as flat array ($name => $value) for specified or active language. | |
storePostedFormData (KWebAttribute_Table_Form $form, array $data) | |
Stores form's data in the object. | |
isDataChanged ($name, $lang=false) | |
getDataChanges () | |
setDataChanged ($name, $changed=true, $lang=false) | |
Adds specified field to the _changes list. | |
requestDataUpdate ($field, $request=true, $lang=false) | |
Marks specifield field as updated. | |
isDataUpdateRequested ($field, $lang=false) | |
Returns true if update was requested for this data. | |
isDeleteRequested ($lang=false) | |
getEditObject ($selection=true, $search=true) | |
Returns version of this object ready for editing. | |
getEditId () | |
Returns the ID of an object, that this object is editing. | |
getMainObject ($object=true) | |
commitUpdates () | |
Commits all pending updates to the data sources. | |
Static Public Member Functions | |
static | isTranslateable () |
static | getClassAttributes (array $options=array()) |
Returns attribute table for this class. | |
Protected Attributes | |
$_changes = array() | |
Hashmap of changed attributes as [id:lang] => true/false. | |
$_storeable = null | |
$_form | |
$_update | |
Hashmap of fields to be updated. | |
$_attributes |
Objects with named attributes.
KWebObject_Attributable::buildObjectForm | ( | $ | id, |
array $ | options = array() |
||
) |
Builds the user input form for this object.
Options specify the intent of the form (full edit, quick edit, quick add, and so on). Once build, the form should be attached to this object with setObjectForm().
By default, the form will be built automatically, using KWebAttribute form intents ($group and $forms)
Reimplemented in KWebItem_User, KWebItem, KWebItem_MMedia, KWebItem_NewsLetter, KWebItem_NewsLetterGenerator, KWebItem_NewsList, KWebItem_Redirect, KWebItem_Inc, KWebItem_Art, KWebItem_File, KWebItem_Download, and KWebItemInfo.
KWebObject_Attributable::commitUpdates | ( | ) |
Commits all pending updates to the data sources.
Reimplemented from KWebObject.
Reimplemented in KWebItem, and KWebComment.
KWebObject_Attributable::convertData | ( | $ | data, |
$ | format, | ||
$ | conversion, | ||
$ | includeUnknown = false |
||
) |
Converts all specified data between formats (INTERNAL to/from $internal).
By default, object's attributes table is used
KWebObject_Attributable::copyDataValue | ( | $ | id, |
KWebObject_Attributable $ | from | ||
) |
Copies entire data value, with all translations, from another object.
Reimplemented in KWebObject_Translateable.
KWebObject_Attributable::getAttribute | ( | $ | name | ) |
static KWebObject_Attributable::getClassAttributes | ( | array $ | options = array() | ) | [static] |
Returns attribute table for this class.
Once created, the table should be stored in a static value. The table should be read only.
Options contain 'genre', 'type' and 'object' for which this attribute table is needed. However, the best practice is to always return always the same, static attribute table.
Overriding classes should be responsible to clone the table and it's attributes and modify them if needed.
Reimplemented in KWebItem_User, KWebItem_MMedia, KWebComment, KWebItem, KWebItem_NewsList, KWebItem_Inc, KWebItem_Art, KWebItem_Redirect, KWebItem_NewsLetter, KWebItem_NewsLetterGenerator, KWebItem_File, KWebItem_Dir, KWebItem_Download, KWebItemInfo, and KWebItem_Image.
KWebObject_Attributable::getDataChanges | ( | ) |
KWebObject_Attributable::getDataValue | ( | $ | name, |
$ | lang = false |
||
) |
Returns object's data value The data is first looked up in object's properties, then in $data.
Reimplemented in KWebObject_Translateable.
KWebObject_Attributable::getEditId | ( | ) |
Returns the ID of an object, that this object is editing.
Reimplemented in KWebItem.
KWebObject_Attributable::getEditObject | ( | $ | selection = true , |
$ | search = true |
||
) |
Returns version of this object ready for editing.
This may be the object itself, it's draft, or list of already existing drafts.
$selection | - if FALSE, only single object will be returned in any circumstances, otherwise, an array of possible objects will be returned |
$search | - if TRUE, database will be searched for existing drafts. Otherwise, a new draft will be created |
Reimplemented in KWebItem, and KWebComment.
KWebObject_Attributable::getMainObject | ( | $ | object = true | ) |
KWebObject_Attributable::getObjectAttributes | ( | array $ | options = array() | ) |
Returns attribute table for this object.
The table is a shallow copy of class's attribute table. Descendands can change this table however they please, however no attribute objects should be altered without cloning them first...
The table is stored in $_attributes for future calls.
KWebObject_Attributable::getObjectData | ( | $ | lang = false , |
$ | includeMainTranslation = false |
||
) |
Returns object data as flat array ($name => $value) for specified or active language.
KWebObject_Attributable::getObjectForm | ( | ) |
KWebObject_Attributable::getObjectProperties | ( | $ | data = true , |
$ | cache = true , |
||
$ | temp = false |
||
) |
Returns object properties as an array.
Reimplemented from KWebObject.
Reimplemented in KWebComment, KWebItem, and KWebObject_Translateable.
KWebObject_Attributable::getValidObject | ( | $ | strict = false | ) |
Returns currently valid version of this object.
For example, if this is a draft object that was recently published, then the original object becomes it's currently valid version.
$strict | - if TRUE, will not return temporary objects |
Reimplemented in KWebItem.
KWebObject_Attributable::isBeingCreated | ( | ) |
KWebObject_Attributable::isDataChanged | ( | $ | name, |
$ | lang = false |
||
) |
Reimplemented in KWebObject_Translateable.
KWebObject_Attributable::isDataUpdateRequested | ( | $ | field, |
$ | lang = false |
||
) |
Returns true if update was requested for this data.
$lang | Language of the field - FALSE - active language, TRUE - main language, string - specified language |
Reimplemented in KWebObject_Translateable.
KWebObject_Attributable::isDeleteRequested | ( | $ | lang = false | ) |
KWebObject_Attributable::isNew | ( | ) |
Czy jest obiektem zupełnie nowym?.
Reimplemented from KWebObject.
KWebObject_Attributable::isStoreable | ( | ) |
static KWebObject_Attributable::isTranslateable | ( | ) | [static] |
Reimplemented in KWebItem_User, KWebItem_NewsLetter, KWebItem_NewsLetterGenerator, KWebItem_Right, KWebItem_Group, KWebObject_Translateable, and KWebItem_Special.
KWebObject_Attributable::makeStoreable | ( | $ | storeable = true | ) |
KWebObject_Attributable::requestDataUpdate | ( | $ | field, |
$ | request = true , |
||
$ | lang = false |
||
) |
Marks specifield field as updated.
It will be stored in the commitUpdates
$lang | Language of the field - FALSE - active language, TRUE - main language, string - specified language |
Reimplemented in KWebObject_Translateable.
KWebObject_Attributable::setDataChanged | ( | $ | name, |
$ | changed = true , |
||
$ | lang = false |
||
) |
Adds specified field to the _changes list.
List of changes is used in the backoffice, to display the list of changes made to the object (specifically, a draft).
This list is NOT used when deciding what to store in the database!
$name | |
$changed | |
$lang |
Reimplemented in KWebObject_Translateable.
KWebObject_Attributable::setDataValue | ( | $ | name, |
$ | value, | ||
$ | lang = false , |
||
$ | setChanged = true , |
||
$ | requestSqlUpdate = true |
||
) |
Sets object's data value (without validation)
$setChanged | - marks this data item in $changed table |
$setSqlUpdate | - marks this data item for database storage |
Reimplemented in KWebObject_Translateable.
KWebObject_Attributable::setObjectForm | ( | $ | form | ) |
KWebObject_Attributable::storePostedFormData | ( | KWebAttribute_Table_Form $ | form, |
array $ | data | ||
) |
Stores form's data in the object.
Data is in FORMAT_INTERNAL as (attr_id => value)
If data is missing in the table, it shouldn't be stored!
Reimplemented in KWebItem, and KWebItem_User.
KWebObject_Attributable::warmupObject | ( | $ | lang = false , |
$ | cache = false , |
||
$ | force = false |
||
) |
Warms up object's data - ensures that everything that should be in $data is there.
$lang | - FALSE for every language, or specific language to warm up |
$cache | - should additional information be cached? |
$force | - normally, warmup should work only once, TRUE will force it again |
It works by calling getDataValue() on every attribute in the object
Reimplemented from KWebObject.
KWebObject_Attributable::$_attributes [protected] |
KWebObject_Attributable::$_changes = array() [protected] |
Hashmap of changed attributes as [id:lang] => true/false.
KWebObject_Attributable::$_form [protected] |
KWebObject_Attributable::$_storeable = null [protected] |
KWebObject_Attributable::$_update [protected] |
Hashmap of fields to be updated.