/** * * @param array $resultSet */ protected function formatDatas(&$resultSet) { foreach ($resultSet as $key => &$myHostSet) { $sideMenuCustom = new SlideMenu($myHostSet['host_id']); $events = Di::getDefault()->get('events'); $events->emit('centreon-realtime.slide.menu.host', array($sideMenuCustom)); $myHostSet['DT_RowData']['right_side_menu_list'] = $sideMenuCustom->getMenu(); $myHostSet['DT_RowData']['right_side_default_menu'] = $sideMenuCustom->getDefaultMenu(); $aTagUsed = array(); // @todo remove virtual hosts and virtual services if ($myHostSet['name'] === '_Module_BAM') { unset($resultSet[$key]); continue; } // Set host_name $myHostSet['name'] = '<span class="icoListing">' . HostConfigurationRepository::getIconImage($myHostSet['name']) . '</span>' . $myHostSet['name']; if ($myHostSet['state'] != '0' && $myHostSet['state'] != '4') { $acknowledgement = HostRealtimeRepository::getAcknowledgementInfos($myHostSet['host_id']); if (count($acknowledgement) > 0) { $myHostSet['name'] .= ' <i class="fa fa-thumb-tack"></i>'; } } $myHostSet['duration'] = Datetime::humanReadable(time() - $myHostSet['duration'], Datetime::PRECISION_FORMAT, 2); $myHostSet['last_check'] = Datetime::humanReadable(time() - $myHostSet['last_check'], Datetime::PRECISION_FORMAT, 2); /* Tags */ $myHostSet['tagname'] = ""; /* $aTags = TagsRepository::getList('host', $myHostSet['host_id'], 2, 0); foreach ($aTags as $oTags) { $myHostSet['tagname'] .= TagsRepository::getTag('host', $myHostSet['host_id'], $oTags['id'], $oTags['text'], $oTags['user_id'], $oTags['template_id']); } * */ $aTags = TagsRepository::getList('host', $myHostSet['host_id'], 2, 0); foreach ($aTags as $oTags) { if (!in_array($oTags['id'], $aTagUsed)) { $aTagUsed[] = $oTags['id']; $myHostSet['tagname'] .= TagsRepository::getTag('host', $myHostSet['host_id'], $oTags['id'], $oTags['text'], $oTags['user_id'], $oTags['template_id']); } } //Get tags affected by the template $templates = HostConfigurationRepository::getTemplateChain($myHostSet['host_id'], array(), -1); foreach ($templates as $template) { $aTags = TagsRepository::getList('host', $template['id'], 2, 0); foreach ($aTags as $oTags) { if (!in_array($oTags['id'], $aTagUsed)) { $aTagUsed[] = $oTags['id']; $myHostSet['tagname'] .= TagsRepository::getTag('host', $template['id'], $oTags['id'], $oTags['text'], $oTags['user_id'], 1); } } } $myHostSet['tagname'] .= TagsRepository::getAddTag('host', $myHostSet['host_id']); } $resultSet = array_values($resultSet); }