Skip to content

Commit 4d6b92c

Browse files
committed
Neues value time
close #97
1 parent d2e67fb commit 4d6b92c

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

lib/yform/value/time.php

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
class rex_yform_value_time extends rex_yform_value_abstract
4+
{
5+
6+
public function enterObject()
7+
{
8+
if ($this->needsOutput()) {
9+
10+
$this->params['form_output'][$this->getId()] = $this->parse(
11+
['value.text.tpl.php'],
12+
['type' => 'time', 'min' => $this->getElement('min'), 'max' => $this->getElement('max'), 'value' => date('H:i')],
13+
);
14+
15+
}
16+
17+
$this->params['value_pool']['email'][$this->getName()] = $this->getValue();
18+
if ($this->saveInDb('2')) {
19+
$this->params['value_pool']['sql'][$this->getName()] = $this->getValue();
20+
}
21+
}
22+
23+
public function getDescription(): string
24+
{
25+
return 'time|name|label|min|max|[1/Aktuelles Datum voreingestellt]|[no_db]';
26+
}
27+
public function getDefinitions(): array
28+
{
29+
return [
30+
'type' => 'value',
31+
'name' => 'time',
32+
'values' => [
33+
'name' => ['type' => 'name', 'label' => rex_i18n::msg('yform_values_defaults_name')],
34+
'label' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_label')],
35+
'min' => ['type' => 'text', 'attributes' => '{"type": "time", "value":"00:00"}', 'label' => rex_i18n::msg('yform_values_time_start')],
36+
'max' => ['type' => 'text', 'attributes' => '{"type": "time", "value":"00:00"}', 'label' => rex_i18n::msg('yform_values_time_end')],
37+
'current_date' => ['type' => 'boolean', 'label' => rex_i18n::msg('yform_values_time_current_time')],
38+
'no_db' => ['type' => 'no_db', 'label' => rex_i18n::msg('yform_values_defaults_table'), 'default' => 0],
39+
'attributes' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_attributes'), 'notice' => rex_i18n::msg('yform_values_defaults_attributes_notice')],
40+
'notice' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_notice')],
41+
],
42+
'description' => rex_i18n::msg('yform_values_datetime_local_description'),
43+
'db_type' => ['varchar(5)'],
44+
'famous' => false,
45+
];
46+
}
47+
48+
}

0 commit comments

Comments
 (0)