Semantic MediaWiki and related extensions
Public Member Functions | Protected Member Functions | List of all members
SMW\DataValues\ValueFormatters\TimeValueFormatter Class Reference
Collaboration diagram for SMW\DataValues\ValueFormatters\TimeValueFormatter:
Collaboration graph
[legend]

Public Member Functions

 isFormatterFor (DataValue $dataValue)
 
 format ($type, $linker=null)
 
 getISO8601Date ($mindefault=true)
 
 getMediaWikiDate ()
 
 getCaptionFromDataItem (DITime $dataItem)
 
 getTimeString ($default= '00:00:00')
 
 getCaptionFromFreeFormat (DITime $dataItem=null)
 
 getLocalizedFormat (DITime $dataItem=null)
 
- Public Member Functions inherited from SMW\DataValues\ValueFormatters\DataValueFormatter
 __construct (DataValue $dataValue=null)
 
 isFormatterFor (DataValue $dataValue)
 
 setDataValue (DataValue $dataValue)
 
 getErrors ()
 
 setOption ($key, $value)
 
 getOption ($key)
 

Protected Member Functions

 getPreferredCaption ()
 

Additional Inherited Members

- Public Attributes inherited from SMW\DataValues\ValueFormatters\DataValueFormatter
const VALUE = 0
 
const WIKI_SHORT = 1
 
const HTML_SHORT = 2
 
const WIKI_LONG = 3
 
const HTML_LONG = 4
 
- Protected Attributes inherited from SMW\DataValues\ValueFormatters\DataValueFormatter
 $dataValue
 

Detailed Description

GNU GPL v2+

Since
2.4
Author
mwjames
Markus Krötzsch
Fabian Howahl
Terry A. Hurlbut

Member Function Documentation

SMW\DataValues\ValueFormatters\TimeValueFormatter::format (   $type,
  $linker = null 
)
Since
2.4

Since
2.4
Parameters
mixed$type
mixed | null$linker
Returns
mixed
Exceptions
RuntimeException

Implements SMW\DataValues\ValueFormatters\ValueFormatter.

SMW\DataValues\ValueFormatters\TimeValueFormatter::getCaptionFromDataItem ( DITime  $dataItem)
Todo:
Internationalize the CE and BCE strings.

Compute a suitable string to display the given date item.

Note
MediaWiki's date functions are not applicable for the range of historic dates we support.
Since
2.4
Parameters
DITime$dataitem
Returns
string
SMW\DataValues\ValueFormatters\TimeValueFormatter::getCaptionFromFreeFormat ( DITime  $dataItem = null)
Since
2.4
Parameters
DITime | null$dataItem
Returns
string
SMW\DataValues\ValueFormatters\TimeValueFormatter::getISO8601Date (   $mindefault = true)

Compute a string representation that largely follows the ISO8601 standard of representing dates. Large year numbers may have more than 4 digits, which is not strictly conforming to the standard. The date includes year, month, and day regardless of the input precision, but will only include time when specified.

Conforming to the 2000 version of ISO8601, year 1 BC(E) is represented as "0000", year 2 BC(E) as "-0001" and so on.

Since
2.4
Parameters
DITime$dataItem
boolean$mindefaultdetermining whether values below the precision of our input should be completed with minimal or maximal conceivable values
Returns
string
SMW\DataValues\ValueFormatters\TimeValueFormatter::getLocalizedFormat ( DITime  $dataItem = null)
Since
2.4
Parameters
DITime | null$dataItem
Returns
string
SMW\DataValues\ValueFormatters\TimeValueFormatter::getMediaWikiDate ( )

Use MediaWiki's date and time formatting. It can't handle all inputs properly, but has superior i18n support.

Since
2.4
Parameters
DITime$dataItem
Returns
string
SMW\DataValues\ValueFormatters\TimeValueFormatter::getPreferredCaption ( )
protected

Compute a suitable string to display this date, taking into account the output format and the preferrable calendar models for the data.

Note
MediaWiki's date functions are not applicable for the range of historic dates we support.
Returns
string
SMW\DataValues\ValueFormatters\TimeValueFormatter::getTimeString (   $default = '00:00:00')

Return the time as a string. The time string has the format HH:MM:SS, without any timezone information (see class documentation for details on current timezone handling). The parameter $default optionally specifies the value returned if the date is valid but has no explicitly specified time. It can also be set to false to detect this situation.

Since
2.4
Parameters
string$default
Returns
string
SMW\DataValues\ValueFormatters\TimeValueFormatter::isFormatterFor ( DataValue  $dataValue)
Since
2.4

The documentation for this class was generated from the following file: