mirror of https://github.com/MISP/MISP
chg: [UI] Use date helper
parent
dbc244f860
commit
559e51e8e0
|
@ -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']);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
if ($field === 'value') {
|
||||
echo $this->element('Events/View/value_field', ['object' => $object['Attribute']]);
|
||||
} elseif ($field === 'timestamp') {
|
||||
echo $this->Time->date($value);
|
||||
} else {
|
||||
if ($value === 'No') {
|
||||
echo '<input type="checkbox" disabled>';
|
||||
|
|
|
@ -73,7 +73,7 @@ $quickEdit = function($fieldName) use ($editScope, $object, $event) {
|
|||
</td>
|
||||
<td class="short">
|
||||
<div id="Attribute_<?= $objectId ?>_timestamp_solid">
|
||||
<?= date('Y-m-d', $object['timestamp']) ?>
|
||||
<?= $this->Time->date($object['timestamp']) ?>
|
||||
</div>
|
||||
</td>
|
||||
<?php
|
||||
|
@ -102,7 +102,6 @@ $quickEdit = function($fieldName) use ($editScope, $object, $event) {
|
|||
endif;
|
||||
endif;
|
||||
?>
|
||||
|
||||
</td>
|
||||
<td class="short"<?= $quickEdit('category') ?>>
|
||||
<div id="Attribute_<?= $objectId ?>_category_solid" class="inline-field-solid">
|
||||
|
|
|
@ -26,4 +26,17 @@ class TimeHelper extends AppHelper
|
|||
|
||||
return '<time>' . h($time) . '</time>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $date
|
||||
* @return string
|
||||
*/
|
||||
public function date($date)
|
||||
{
|
||||
if (empty($date)) {
|
||||
return '';
|
||||
}
|
||||
$date = date('Y-m-d', $date);
|
||||
return '<time>' . h($date) . '</time>';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue