2020-05-29 13:41:58 +02:00
|
|
|
<?php
|
|
|
|
$data = $this->Hash->extract($row, $field['data_path']);
|
|
|
|
if (is_array($data)) {
|
|
|
|
if (count($data) > 1) {
|
|
|
|
$data = implode(', ', $data);
|
|
|
|
} else {
|
|
|
|
if (count($data) > 0) {
|
|
|
|
$data = $data[0];
|
|
|
|
} else {
|
|
|
|
$data = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (is_bool($data)) {
|
|
|
|
$data = sprintf(
|
2020-06-23 14:26:41 +02:00
|
|
|
'<i class="fa fa-%s"></i>',
|
2020-05-29 13:41:58 +02:00
|
|
|
$data ? 'check' : 'times'
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
$data = h($data);
|
2021-06-14 08:37:00 +02:00
|
|
|
if (!empty($field['options'])) {
|
|
|
|
$options = $this->Hash->extract($row, $field['options']);
|
|
|
|
if (!empty($options)) {
|
|
|
|
$data = h($options[$data]);
|
|
|
|
}
|
|
|
|
}
|
2020-05-29 13:41:58 +02:00
|
|
|
if (!empty($field['privacy'])) {
|
|
|
|
$data = sprintf(
|
|
|
|
'<span class="privacy-value" data-hidden-value="%s">****************************************</span> <i class="privacy-toggle fas fa-eye useCursorPointer"></i>',
|
|
|
|
$data
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2020-06-19 00:43:11 +02:00
|
|
|
if (!empty($field['url'])) {
|
|
|
|
if (!empty($field['url_vars'])) {
|
|
|
|
if (!is_array($field['url_vars'])) {
|
|
|
|
$field['url_vars'] = [$field['url_vars']];
|
|
|
|
}
|
|
|
|
foreach ($field['url_vars'] as $k => $path) {
|
|
|
|
$field['url'] = str_replace('{{' . $k . '}}', $this->Hash->extract($row, $path)[0], $field['url']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$data = sprintf(
|
2021-02-09 22:10:26 +01:00
|
|
|
'<a href="%s%s">%s</a>',
|
|
|
|
$baseurl,
|
2020-06-19 00:43:11 +02:00
|
|
|
h($field['url']),
|
|
|
|
$data
|
|
|
|
);
|
|
|
|
}
|
2020-05-29 13:41:58 +02:00
|
|
|
if (!empty($field['onClick'])) {
|
|
|
|
$data = sprintf(
|
|
|
|
'<span onClick="%s">%s</span>',
|
|
|
|
$field['onClick'],
|
|
|
|
$data
|
|
|
|
);
|
|
|
|
}
|
|
|
|
echo $data;
|
|
|
|
?>
|