Skip to content

Neues value time #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/yform/value/custom_link.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Author: Joachim Doerr
* Date: 2019-02-26
Expand Down
5 changes: 2 additions & 3 deletions lib/yform/value/number_lat.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

class rex_yform_value_number_lat extends rex_yform_value_number
{

/**
* Nachdem ggf. auf das Feld gesetzte individuelle Validierungen durchgeführt
* wurden, erfolgt hier noch final die impliziete Validierung auf den Gültigkeits-
Expand All @@ -28,14 +27,14 @@ public function postValidateAction(): void
}

$value = $this->getValue() ?? '';
if ('' === trim($value) ) {
if ('' === trim($value)) {
return;
}

$value = is_numeric($value) ? (float) $value : 999;
if ($value < -90.0 || $value > 90.0) {
$this->params['warning'][$this->getId()] = $this->params['error_class'];
$this->params['warning_messages'][$this->getId()] = rex_i18n::msg('yform_values_numberlat_range_error',$this->getLabel());
$this->params['warning_messages'][$this->getId()] = rex_i18n::msg('yform_values_numberlat_range_error', $this->getLabel());
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/yform/value/number_lng.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ public function postValidateAction(): void
}

$value = $this->getValue() ?? '';
if ('' === trim($value) ) {
if ('' === trim($value)) {
return;
}

$value = is_numeric($value) ? (float) $value : 999;
if ($value < -90.0 || $value > 90.0) {
$this->params['warning'][$this->getId()] = $this->params['error_class'];
$this->params['warning_messages'][$this->getId()] = rex_i18n::msg('yform_values_numberlng_range_error',$this->getLabel());
$this->params['warning_messages'][$this->getId()] = rex_i18n::msg('yform_values_numberlng_range_error', $this->getLabel());
}
}

Expand Down
1 change: 1 addition & 0 deletions lib/yform/value/tabs.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Tabs in YForm-Formularen.
*
Expand Down
45 changes: 45 additions & 0 deletions lib/yform/value/time.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

class rex_yform_value_time extends rex_yform_value_abstract
{
public function enterObject()
{
if ($this->needsOutput()) {
$this->params['form_output'][$this->getId()] = $this->parse(
['value.text.tpl.php'],
['type' => 'time', 'min' => $this->getElement('min'), 'max' => $this->getElement('max'), 'value' => date('H:i')],
);
}

$this->params['value_pool']['email'][$this->getName()] = $this->getValue();
if ($this->saveInDb('2')) {
$this->params['value_pool']['sql'][$this->getName()] = $this->getValue();
}
}

public function getDescription(): string
{
return 'time|name|label|min|max|[1/Aktuelles Datum voreingestellt]|[no_db]';
}

public function getDefinitions(): array
{
return [
'type' => 'value',
'name' => 'time',
'values' => [
'name' => ['type' => 'name', 'label' => rex_i18n::msg('yform_values_defaults_name')],
'label' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_label')],
'min' => ['type' => 'text', 'attributes' => '{"type": "time", "value":"00:00"}', 'label' => rex_i18n::msg('yform_values_time_start')],
'max' => ['type' => 'text', 'attributes' => '{"type": "time", "value":"00:00"}', 'label' => rex_i18n::msg('yform_values_time_end')],
'current_date' => ['type' => 'boolean', 'label' => rex_i18n::msg('yform_values_time_current_time')],
'no_db' => ['type' => 'no_db', 'label' => rex_i18n::msg('yform_values_defaults_table'), 'default' => 0],
'attributes' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_attributes'), 'notice' => rex_i18n::msg('yform_values_defaults_attributes_notice')],
'notice' => ['type' => 'text', 'label' => rex_i18n::msg('yform_values_defaults_notice')],
],
'description' => rex_i18n::msg('yform_values_datetime_local_description'),
'db_type' => ['varchar(5)'],
'famous' => false,
];
}
}
6 changes: 3 additions & 3 deletions ytemplates/bootstrap/value.submit_once.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
$label_translated = rex_i18n::translate($label, true);
?>
<button onclick="
history.pushState({ page: 1 }, '', '#');
history.pushState({ page: 1 }, '', '#');
this.disabled = true;
this.value = '<?= $loading ?>';
HTMLFormElement.prototype.submit.call(this.form);"
this.value = '<?= $loading ?>';
HTMLFormElement.prototype.submit.call(this.form);"
class="<?= implode(' ', $classes) ?>" type="submit" name="<?= $this->getFieldName() ?>" id="<?= $id ?>">
<?= $label_translated ?>
</button>
1 change: 1 addition & 0 deletions ytemplates/bootstrap/value.tabs.tpl.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Template für den privaten YForm-Datentyp "rex_yform_value_tabs".
*/
Expand Down