diff --git a/app/Controller/AttributesController.php b/app/Controller/AttributesController.php index 8470f077f..1dd70cf9f 100644 --- a/app/Controller/AttributesController.php +++ b/app/Controller/AttributesController.php @@ -1974,8 +1974,6 @@ class AttributesController extends AppController $result = $this->Attribute->shortDist[$result]; } elseif ($field === 'to_ids') { $result = ($result == 0 ? 'No' : 'Yes'); - } elseif ($field === 'timestamp') { - $result = date('Y-m-d', $result); } elseif ($field === 'value') { $this->loadModel('Warninglist'); $attribute['Attribute'] = $this->Warninglist->checkForWarning($attribute['Attribute']); diff --git a/app/View/Attributes/ajax/attributeViewFieldForm.ctp b/app/View/Attributes/ajax/attributeViewFieldForm.ctp index 7ce1a1737..9c145fcc9 100644 --- a/app/View/Attributes/ajax/attributeViewFieldForm.ctp +++ b/app/View/Attributes/ajax/attributeViewFieldForm.ctp @@ -1,6 +1,8 @@ element('Events/View/value_field', ['object' => $object['Attribute']]); +} elseif ($field === 'timestamp') { + echo $this->Time->date($value); } else { if ($value === 'No') { echo ''; diff --git a/app/View/Elements/Events/View/row_attribute.ctp b/app/View/Elements/Events/View/row_attribute.ctp index 0660cea16..42d22f71a 100644 --- a/app/View/Elements/Events/View/row_attribute.ctp +++ b/app/View/Elements/Events/View/row_attribute.ctp @@ -73,7 +73,7 @@ $quickEdit = function($fieldName) use ($editScope, $object, $event) {
- + Time->date($object['timestamp']) ?>
-   >
diff --git a/app/View/Helper/TimeHelper.php b/app/View/Helper/TimeHelper.php index cbeb18552..4d729aebc 100644 --- a/app/View/Helper/TimeHelper.php +++ b/app/View/Helper/TimeHelper.php @@ -26,4 +26,17 @@ class TimeHelper extends AppHelper return ''; } + + /** + * @param int $date + * @return string + */ + public function date($date) + { + if (empty($date)) { + return ''; + } + $date = date('Y-m-d', $date); + return ''; + } }