The ezdatetime datatype (Date and time)
Class eZDateTimeType in kernel/classes/datatypes/ezdatetime/ezdatetimetype.php; identifier ezdatetime, listed in settings/content.ini [DataTypeSettings] AvailableDataTypes[].
What it stores
The columns of the attribute tables its class reads or writes: data_int, data_int1, data_int2, data_text5, sort_key_int (data_text, data_int, data_float and sort_key_* are the object attribute's; data_text1 ... data_int4 the class attribute's settings). Found by reading the class: a heuristic.
Sorting: sortKeyType() returns int.
It is indexed by the search; collects information (forms).
In templates
my_attribute stands for the identifier of an attribute of this type in your class:
def $attribute = $node.data_map.my_attribute
if $attribute.has_content
attribute_view_gui attribute=$attribute
/if
{* the value as the datatype returns it (objectAttributeContent()) *}
$attribute.content|attribute( show, 1 )The shipped template that shows it (attribute_view_gui), design/standard/templates/content/datatype/view/ezdatetime.tpl:
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
if $attribute.content.is_valid
if $attribute.contentclass_attribute.data_int2|eq(1)
$attribute.content.timestamp|l10n(shortdate) $attribute.content.timestamp|l10n(time)
else
$attribute.content.timestamp|l10n(shortdatetime)
/if
/ifThe shipped template that edits it (attribute_edit_gui), design/standard/templates/content/datatype/edit/ezdatetime.tpl (first 25 lines):
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
default attribute_base=ContentObjectAttribute
if ne( $attribute_base, 'ContentObjectAttribute' )
def $id_base = concat( 'ezcoa-', $attribute_base, '-', $attribute.contentclassattribute_id, '_', $attribute.contentclass_attribute_identifier )
else
def $id_base = concat( 'ezcoa-', $attribute.contentclassattribute_id, '_', $attribute.contentclass_attribute_identifier )
/if
<div class="block">
<div class="date">
<div class="element">
<label for="$id_base_year">'Year'|i18n( 'design/standard/content/datatype' ):</label>
<input id="$id_base_year" class="ezcc-$attribute.object.content_class.identifier ezcca-$attribute.object.content_class.identifier_$attribute.contentclass_attribute_identifier" type="text" name="$attribute_base_datetime_year_$attribute.id" size="5" value="if $attribute.content.is_valid$attribute.content.year/if" />
</div>
<div class="element">
<label for="$id_base_month">'Month'|i18n( 'design/standard/content/datatype' ):</label>
<input id="$id_base_month" class="ezcc-$attribute.object.content_class.identifier ezcca-$attribute.object.content_class.identifier_$attribute.contentclass_attribute_identifier" type="text" name="$attribute_base_datetime_month_$attribute.id" size="3" value="if $attribute.content.is_valid$attribute.content.month/if" />
</div>
<div class="element">
<label for="$id_base_day">'Day'|i18n( 'design/standard/content/datatype' ):</label>
<input id="$id_base_day" class="ezcc-$attribute.object.content_class.identifier ezcca-$attribute.object.content_class.identifier_$attribute.contentclass_attribute_identifier" type="text" name="$attribute_base_datetime_day_$attribute.id" size="3" value="if $attribute.content.is_valid$attribute.content.day/if" />
Override them for one class attribute in an override.ini.append.php with Source=content/datatype/view/ezdatetime.tpl and a match on attribute_identifier (see A template override).
Related
Generated by ./console exp:help:examples from kernel/classes/datatypes/ezdatetime/ezdatetimetype.php, settings/content.ini, design/standard/templates/content/datatype/view/ezdatetime.tpl, design/standard/templates/content/datatype/edit/ezdatetime.tpl. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.