Source
xxxxxxxxxx
break;
default:
order_result($data['discoveries'], $sort_field, $sort_order);
}
$data['discoveries'] = expandItemNamesWithMasterItems($data['discoveries'], 'items');
// Set is_template false, when one of hosts is not template.
if ($data['discoveries']) {
$hosts_status = array_unique(
array_column(array_column(array_column($data['discoveries'], 'hosts'), 0), 'status')
);
foreach ($hosts_status as $value) {
if ($value != HOST_STATUS_TEMPLATE) {
$hosts_status = [];
foreach ($data['discoveries'] as $discovery) {
$hosts_status[$discovery['hosts'][0]['status']] = true;
}
foreach ($hosts_status as $key => $value) {
if ($key != HOST_STATUS_TEMPLATE) {
$data['is_template'] = false;
break;
}
}
}
// pager
if (hasRequest('page')) {
$page_num = getRequest('page');
}