fix: [factories] links and timestamps fixed

- really annoying timestamp issue
- as discovered during LS21
pull/7355/head
iglocska 2021-04-19 23:46:51 +02:00
parent a9efb7a551
commit 6c3dc5e0d5
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 18 additions and 14 deletions

View File

@ -18,16 +18,13 @@
$url_param_data_paths = implode('/', $temp);
} else {
$url_param_data_paths = Hash::extract($row, $field['url_params_data_paths']);
if (!empty($url_param_data_paths)) {
$url_param_data_paths = $url_param_data_paths[0];
} else {
if (empty($url_param_data_paths)) {
$url_param_data_paths = '';
}
}
$urlWithData .= '/' . $url_param_data_paths;
}
$links = array();
foreach ($data_elements as $data) {
foreach ($data_elements as $k => $data) {
if (!empty($data['name'])) {
$field['title'] = $data['name'];
}
@ -40,6 +37,13 @@
$data
);
} elseif (!empty($field['url_params_data_paths'])) {
if (!empty($url_param_data_paths)) {
if (is_array($url_param_data_paths)) {
$urlWithData .= '/' . $url_param_data_paths[$k];
} else {
$urlWithData .= '/' . $url_param_data_paths;
}
}
$url = $urlWithData;
} else {
$url = $data;

View File

@ -12,15 +12,15 @@
$offset = ceil($offset / 60);
$unit = 'minute(s)';
$colour = 'orange';
}
if ($offset >= 60) {
$offset = ceil($offset / 60);
$unit = 'hour(s)';
$colour = 'green';
}
if ($offset >= 24) {
$offset = ceil($offset / 24);
$unit = 'day(s)';
if ($offset >= 60) {
$offset = ceil($offset / 60);
$unit = 'hour(s)';
$colour = 'green';
if ($offset >= 24) {
$offset = floor($offset / 24);
$unit = 'day(s)';
}
}
}
$raw = true;
$timestamp = sprintf('<span class="bold %s">%s %s ago</span>', $colour, $offset, $unit);