Fullscreen
[Show/Hide Right Column]

Object Attributes and Relations

This feature was started in Tiki5 and will be more & more used in Tiki6

Attributes should be used to create cross-feature functionality.

Attributes

To implement transversal features such as geolocalization of objects in tiki, Object Attributes were introduced. Not unlike user preferences, they are key-value pairs stored in the database and are associated to the type and itemId (same as object permissions).

To avoid the inconsistencies seen in the preference naming conventions, the attribute library enforces a few conventions.

  1. Attribute names may only contain lowercase letters and dots.
  2. Two levels of scoping are required. First level for bundled attributes must be tiki. Custom extensions can use an other prefix. Second level must be some sort of package name. The rest is up to the implementor.


Valid attributes would be tiki.geo.lat or tiki.geo.lon

Library code is located in lib/attributes/attributelib.php. The library allows to:

  • Get all attributes for an object as a map using get_attributes().
  • Set a single attribute on an object using set_attribute().


Because all values are fetched at once, the length of the content must remain small. The limit of the size of attribute and relation names is 25 characters.

Current attribute usage in the tiki.* namespace


Please document namespace use here as you start using new attributes in Tiki features

AttributeUsage
tiki.geo.latLatitude coordinate of the object
tiki.geo.lonLongitude coordinate of the object
tiki.geo.google.zoomZoom level of an object used in Google Maps
tiki.relation.targetLabel to be used when referring to the target of a relation
tiki.relation.sourceLabel to be used when referring to the source of a relation
tiki.article.*Custom attribute fields for articlesNot appropriate! Attributes should be applicable to all object types

Relations

The Object Relations allow to qualify a relationship between any two objects in the system or with external resources (URLs). Just like attributes, the qualified name of the relationship must be scoped.

Relations are managed with lib/attributes/relationlib.php.

Because all values are fetched at once, the length of the content must remain small. The limit of the size of attribute and relation names is 25 characters.

Current relation usage in the tiki.* namespace

Please document any relations used in Tiki features here

Relation Usage
tiki.article.attribute Relationship between an article type and it's related custom attribute fields
tiki.file.attach Attaches File Gallery files to objects (tracker items so far?)
tiki.general.related Any generic relationship not specific to any feature/module
tiki.link.$type Links wiki pages ($types are probably semantic etc)
tiki.sheet.$type Relates sheets and trackers
tiki.user.favorite Links users to favourite objects (wiki pages only so far?)
tiki.user.banned To ban users from objedcts (groups initially for 8.x could be extended)


A smarty tag like this will show a link to the object that is at the target end of the relation. The text of the link will be the "tiki.relation.target" attribute set for that relation (i.e. the attribute for an object of type 'relation' and relationId, if any. If there is no such attribute set for that relation, then it will show the usual link as per the normal behavior of the object_link tag.

{object_link type=relation_target id=x}



alias


Page last modified on Wednesday 28 September, 2011 15:25:36 UTC

Search Wishes (subject only) [toggle]

Categorize Object Attributes and Relations

Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.