Inherits SMWDataItem.
Public Member Functions | |
| __construct ($key, $inverse=false) | |
| Initialise a property. | |
| getDIType () | |
| Convenience method that returns a constant that defines the concrete class that implements this data item. | |
| getKey () | |
| isInverse () | |
| getSortKey () | |
| Return a value that can be used for sorting data of this type. | |
| isShown () | |
| Specifies whether values of this property should be shown in the Factbox. | |
| isUserDefined () | |
| Return true if this is a usual wiki property that is defined by a wiki page, and not a property that is pre-defined in the wiki. | |
| getLabel () | |
| Find a user-readable label for this property, or return '' if it is a predefined property that has no label. | |
| getDiWikiPage () | |
| Get an object of type SMWDIWikiPage that represents the page which relates to this property, or null if no such page exists. | |
| findPropertyTypeID () | |
| Find the property's type ID, either by looking up its predefined ID (if any) or by retrieving the relevant information from the store. | |
| getSerialization () | |
| Get a UTF-8 encoded string serialization of this data item. | |
Static Public Member Functions | |
| static | doUnserialize ($serialization) |
| Create a data item from the provided serialization string and type ID. | |
| static | newFromUserLabel ($label, $inverse=false) |
| Construct a property from a user-supplied label. | |
| static | getPredefinedPropertyTypeId ($key) |
| Get the type ID of a predefined property, or '' if the property is not predefined. | |
| static | registerProperty ($id, $typeid, $label=false, $show=false) |
| A method for registering/overwriting predefined properties for SMW. | |
| static | registerPropertyAlias ($id, $label) |
| Add a new alias label to an existing property ID. | |
Static Protected Member Functions | |
| static | findPropertyID ($label, $useAlias=true) |
| Find and return the ID for the pre-defined property of the given local label. | |
| static | findPropertyLabel ($id) |
| Get the translated user label for a given internal property ID. | |
| static | initPropertyRegistration () |
| Set up predefined properties, including their label, aliases, and typing information. | |
Protected Attributes | |
| $m_key | |
| $m_inverse | |
| $m_proptypeid | |
Static Protected Attributes | |
| static | $m_prop_types |
| static | $m_prop_labels |
| static | $m_prop_aliases |
The static part of this class also manages global registrations of predefined (built-in) properties, and maintains an association of property IDs, localized labels, and aliases.
Definition at line 19 of file SMW_DI_Property.php.
| SMWDIProperty::__construct | ( | $ | key, | |
| $ | inverse = false | |||
| ) |
Initialise a property.
This constructor checks that keys of predefined properties do really exist (in the current configuration of the wiki). No check is performed to see if a user label is in fact the label or alias of a predefined property. If this should be done, the function SMWDIProperty::newFromUserLabel() can be used.
| $key | string key for the property (internal SMW key or wikipage DB key) | |
| $inverse | boolean states if the inverse of the property is constructed |
Definition at line 78 of file SMW_DI_Property.php.
References $m_prop_types, and initPropertyRegistration().
| SMWDIProperty::getDIType | ( | ) |
Convenience method that returns a constant that defines the concrete class that implements this data item.
Used to switch when processing data items.
Reimplemented from SMWDataItem.
Definition at line 94 of file SMW_DI_Property.php.
References SMWDataItem::TYPE_PROPERTY.
| SMWDIProperty::getKey | ( | ) |
Definition at line 98 of file SMW_DI_Property.php.
Referenced by SMWSemanticData::addPropertyObjectValue(), SMWExporter::addPropertyValues(), SMWSQLStore2QueryEngine::compilePropertyCondition(), SMWSQLStore2::findPropertyTableID(), findPropertyTypeID(), SMWSqlStubSemanticData::getPropertyValues(), SMWSemanticData::getPropertyValues(), SMWSQLStore2::getSMWPropertyID(), and SMWSQLStore2::makeSMWPropertyID().
| SMWDIProperty::isInverse | ( | ) |
Definition at line 102 of file SMW_DI_Property.php.
Referenced by SMWDataValueFactory::newPropertyObjectValue().
| SMWDIProperty::getSortKey | ( | ) |
Return a value that can be used for sorting data of this type.
If the data is of a numerical type, the sorting must be done in numerical order. If the data is a string, the data must be sorted alphabetically.
Wiki pages are a special case in SMW. They are ordered by a sortkey that is assigned to them as a property value. When pages are sorted, this data should be used if possible.
Reimplemented from SMWDataItem.
Definition at line 106 of file SMW_DI_Property.php.
| SMWDIProperty::isShown | ( | ) |
Specifies whether values of this property should be shown in the Factbox.
A property may wish to prevent this if either (1) its information is really dull, e.g. being a mere copy of information that is obvious from other things that are shown, or (2) the property is set in a hook after parsing, so that it is not reliably available when Factboxes are displayed. If a property is internal so it should never be observed by users, then it is better to just not associate any translated label with it, so it never appears anywhere.
Examples of properties that are not shown include Modificaiton date (not available in time), and Has improper value for (errors are shown directly on the page anyway).
Definition at line 127 of file SMW_DI_Property.php.
References $m_prop_types, and isUserDefined().
| SMWDIProperty::isUserDefined | ( | ) |
Return true if this is a usual wiki property that is defined by a wiki page, and not a property that is pre-defined in the wiki.
Definition at line 139 of file SMW_DI_Property.php.
Referenced by findPropertyTypeID(), getDiWikiPage(), getLabel(), and isShown().
| SMWDIProperty::getLabel | ( | ) |
Find a user-readable label for this property, or return '' if it is a predefined property that has no label.
Definition at line 149 of file SMW_DI_Property.php.
References $m_prop_labels, initPropertyRegistration(), and isUserDefined().
Referenced by getDiWikiPage().
| SMWDIProperty::getDiWikiPage | ( | ) |
Get an object of type SMWDIWikiPage that represents the page which relates to this property, or null if no such page exists.
The latter can happen for special properties without user-readable label, and for inverse properties.
Definition at line 170 of file SMW_DI_Property.php.
References getLabel(), and isUserDefined().
Referenced by SMWExporter::getResourceElementForProperty().
| SMWDIProperty::findPropertyTypeID | ( | ) |
Find the property's type ID, either by looking up its predefined ID (if any) or by retrieving the relevant information from the store.
If no type is stored for a user defined property, the global default type will be used.
Definition at line 196 of file SMW_DI_Property.php.
References $smwgPDefaultType, getKey(), isUserDefined(), and smwfGetStore().
Referenced by SMWSQLStore2QueryEngine::compilePropertyCondition(), SMWSqlStubSemanticData::getPropertyValues(), SMWSQLStore2::getPropertyValues(), and SMWDataValueFactory::newPropertyObjectValue().
| SMWDIProperty::getSerialization | ( | ) |
Get a UTF-8 encoded string serialization of this data item.
The serialisation should be concise and need not be pretty, but it must allow unserialization. Each subclass of SMWDataItem implements a static method doUnserialize() for this purpose.
Reimplemented from SMWDataItem.
Definition at line 224 of file SMW_DI_Property.php.
| static SMWDIProperty::doUnserialize | ( | $ | serialization | ) | [static] |
Create a data item from the provided serialization string and type ID.
| string | $serialization |
Definition at line 236 of file SMW_DI_Property.php.
| static SMWDIProperty::newFromUserLabel | ( | $ | label, | |
| $ | inverse = false | |||
| ) | [static] |
Construct a property from a user-supplied label.
The main difference to the normal constructor of SMWDIProperty is that it is checked whether the label refers to a known predefined property. Note that this function only gives access to the registry data that SMWDIProperty stores, but does not do further parsing of user input. For example, '-' as first character is not interpreted for inverting a property. Likewise, no normalization of title strings is done. To process wiki input, SMWPropertyValue should be used.
| $label | string label for the property | |
| $inverse | boolean states if the inverse of the property is constructed |
Definition at line 262 of file SMW_DI_Property.php.
References findPropertyID().
Referenced by SFUtils::getSMWPropertyValues(), SMWPropertyPage::initParameters(), SMWPropertyListValue::parseUserValue(), SMWPropertyValue::parseUserValue(), and SFTemplateField::setTypeAndPossibleValues().
| static SMWDIProperty::findPropertyID | ( | $ | label, | |
| $ | useAlias = true | |||
| ) | [static, protected] |
Find and return the ID for the pre-defined property of the given local label.
If the label does not belong to a pre-defined property, return false.
This function is protected. The public way of getting this data is to simply create a new property object and to get its ID (if any).
| $label | string normalized property label | |
| $useAlias | boolean determining whether to check if the label is an alias |
Definition at line 285 of file SMW_DI_Property.php.
References $m_prop_aliases, $m_prop_labels, and initPropertyRegistration().
Referenced by newFromUserLabel().
| static SMWDIProperty::getPredefinedPropertyTypeId | ( | $ | key | ) | [static] |
Get the type ID of a predefined property, or '' if the property is not predefined.
The function is guaranteed to return a type ID for keys of properties where isUserDefined() returns false.
| $key | string key of the property |
Definition at line 308 of file SMW_DI_Property.php.
References $m_prop_types.
| static SMWDIProperty::findPropertyLabel | ( | $ | id | ) | [static, protected] |
Get the translated user label for a given internal property ID.
Returns false for properties without a translation (these are usually internal, generated by SMW but not shown to the user).
| string | $id |
Definition at line 325 of file SMW_DI_Property.php.
References $m_prop_labels, and initPropertyRegistration().
| static SMWDIProperty::initPropertyRegistration | ( | ) | [static, protected] |
Set up predefined properties, including their label, aliases, and typing information.
Definition at line 338 of file SMW_DI_Property.php.
References $m_prop_aliases, $m_prop_labels, $m_prop_types, and $smwgUseCategoryHierarchy.
Referenced by __construct(), findPropertyID(), findPropertyLabel(), and getLabel().
| static SMWDIProperty::registerProperty | ( | $ | id, | |
| $ | typeid, | |||
| $ | label = false, |
|||
| $ | show = false | |||
| ) | [static] |
A method for registering/overwriting predefined properties for SMW.
It should be called from within the hook 'smwInitProperties' only. IDs should start with three underscores "___" to avoid current and future confusion with SMW built-ins.
| $id | string id | |
| $typeid | SMW type id | |
| $label | mixed string user label or false (internal property) | |
| $show | boolean only used if label is given, see isShown() |
Definition at line 397 of file SMW_DI_Property.php.
References $m_prop_labels, and $m_prop_types.
Referenced by SMWPropertyValue::registerProperty(), SFUtils::registerProperty(), and sdfInitProperties().
| static SMWDIProperty::registerPropertyAlias | ( | $ | id, | |
| $ | label | |||
| ) | [static] |
Add a new alias label to an existing property ID.
Note that every ID should have a primary label, either provided by SMW or registered with SMWDIProperty::registerProperty(). This function should be called from within the hook 'smwInitDatatypes' only.
| $id | string id of a property | |
| $label | string alias label for the property |
Definition at line 418 of file SMW_DI_Property.php.
References $m_prop_aliases.
Referenced by SMWPropertyValue::registerPropertyAlias(), and sdfInitProperties().
SMWDIProperty::$m_prop_types [static, protected] |
Definition at line 35 of file SMW_DI_Property.php.
Referenced by __construct(), getPredefinedPropertyTypeId(), initPropertyRegistration(), isShown(), and registerProperty().
SMWDIProperty::$m_prop_labels [static, protected] |
Definition at line 41 of file SMW_DI_Property.php.
Referenced by findPropertyID(), findPropertyLabel(), getLabel(), initPropertyRegistration(), and registerProperty().
SMWDIProperty::$m_prop_aliases [static, protected] |
Definition at line 47 of file SMW_DI_Property.php.
Referenced by findPropertyID(), initPropertyRegistration(), and registerPropertyAlias().
SMWDIProperty::$m_key [protected] |
Definition at line 54 of file SMW_DI_Property.php.
SMWDIProperty::$m_inverse [protected] |
Definition at line 60 of file SMW_DI_Property.php.
SMWDIProperty::$m_proptypeid [protected] |
Definition at line 66 of file SMW_DI_Property.php.
1.5.6