16 use \PKP\components\forms\FormComponent;
18 define(
'FORM_DATE_TIME',
'dateTime');
38 $localizedOptions = [];
39 foreach ($this->locales as $key => $localeValue) {
40 $localizedOptions[$localeValue[
'key']] = $key;
44 'id' =>
'descriptions',
45 'label' => __(
'manager.setup.dateTime.descriptionTitle'),
46 'description' => __(
'manager.setup.dateTime.description'),
50 'label' => __(
'manager.setup.dateTime.longDate'),
51 'isMultilingual' =>
true,
52 'options' => $this->_setDateOptions([
58 'value' => $context->getDateTimeFormats(
'dateFormatLong'),
59 'groupId' =>
'descriptions',
63 'label' => __(
'manager.setup.dateTime.shortDate'),
64 'isMultilingual' =>
true,
65 'options' => $this->_setDateOptions([
71 'value' => $context->getDateTimeFormats(
'dateFormatShort'),
72 'groupId' =>
'descriptions',
76 'label' => __(
'manager.setup.dateTime.time'),
77 'isMultilingual' =>
true,
78 'options' => $this->_setDateOptions([
83 'value' => $context->getDateTimeFormats(
'timeFormat'),
84 'groupId' =>
'descriptions',
87 'label' => __(
'manager.setup.dateTime.longDateTime'),
88 'isMultilingual' =>
true,
89 'options' => array_map(
function ($value) use ($context, $localizedOptions) {
90 $locale = array_search($value, $localizedOptions);
91 $optionValue = $context->getLocalizedDateFormatLong($locale) .
' - ' . $context->getLocalizedTimeFormat($locale);
94 'value' => $optionValue,
95 'label' => $optionValue,
99 'label' => __(
'manager.setup.dateTime.custom'),
102 }, $localizedOptions),
103 'value' => $context->getDateTimeFormats(
'datetimeFormatLong'),
104 'groupId' =>
'descriptions',
107 'label' => __(
'manager.setup.dateTime.shortDateTime'),
108 'isMultilingual' =>
true,
109 'options' => array_map(
function ($value) use ($context, $localizedOptions) {
110 $locale = array_search($value, $localizedOptions);
111 $optionValue = $context->getLocalizedDateFormatShort($locale) .
' ' . $context->getLocalizedTimeFormat($locale);
114 'value' => $optionValue,
115 'label' => $optionValue,
119 'label' => __(
'manager.setup.dateTime.custom'),
122 }, $localizedOptions),
123 'value' => $context->getDateTimeFormats(
'datetimeFormatShort'),
124 'groupId' =>
'descriptions',
134 private function _setDateOptions($optionValues) {
136 foreach ($this->locales as $localeValue) {
137 $locale = $localeValue[
'key'];
138 foreach ($optionValues as $optionValue) {
139 $options[$locale][] = [
140 'value' => $optionValue,
141 'label' => $optionValue
145 $options[$locale][] = [
147 'label' => __(
'manager.setup.dateTime.custom'),