/** * * @param array $resultSet */ protected function formatDatas(&$resultSet) { $router = Di::getDefault()->get('router'); foreach ($resultSet as &$myServiceSet) { $myServiceSet['service_description'] = '<span class="icoListing">' . ServiceRepository::getIconImage($myServiceSet['service_id']) . '</span>' . $myServiceSet['service_description']; // Set Tpl Chain $tplStr = null; if (isset($myServiceSet["service_template_model_stm_id"])) { $tplArr = ServicetemplateRepository::getMyServiceTemplateModels($myServiceSet["service_template_model_stm_id"]); $tplRoute = str_replace("//", "/", Di::getDefault()->get('router')->getPathFor('/centreon-configuration/servicetemplate/[i:id]', array('id' => $tplArr['id']))); if (isset($tplArr['description'])) { $tplStr .= '<span><a href="' . $tplRoute . '">' . $tplArr['description'] . '</a></span>'; } } $sideMenuCustom = new SlideMenu($myServiceSet['service_id']); $events = Di::getDefault()->get('events'); $events->emit('centreon-configuration.slide.menu.service.template', array($sideMenuCustom)); //$myHostSet['DT_RowData']['right_side_details'] = $router->getPathFor('/centreon-configuration/host/snapshot/').$myHostSet['host_id']; $myServiceSet['DT_RowData']['right_side_menu_list'] = $sideMenuCustom->getMenu(); $myServiceSet['DT_RowData']['right_side_default_menu'] = $sideMenuCustom->getDefaultMenu(); $myServiceSet['service_template_model_stm_id'] = $tplStr; /* Display human readable the check/retry interval */ $myServiceSet['service_normal_check_interval'] = HumanReadable::convert($myServiceSet['service_normal_check_interval'], 's', $units, null, true); $myServiceSet['service_retry_check_interval'] = HumanReadable::convert($myServiceSet['service_retry_check_interval'], 's', $units, null, true); /* Get personal tags */ $myServiceSet['tagname'] = ''; $aTagUsed = array(); $aTags = TagsRepository::getList('service', $myServiceSet['service_id'], 0, 0); foreach ($aTags as $oTags) { if (!in_array($oTags['id'], $aTagUsed)) { $aTagUsed[] = $oTags['id']; $myServiceSet['tagname'] .= TagsRepository::getTag('service', $myServiceSet['service_id'], $oTags['id'], $oTags['text'], $oTags['user_id'], 1); } } $myServiceSet['tagname'] .= TagsRepository::getAddTag('service', $myServiceSet['service_id']); } }
/** * * @param array $resultSet */ protected function formatDatas(&$resultSet) { $router = Di::getDefault()->get('router'); foreach ($resultSet as &$myHostSet) { $myHostSet['host_name'] = '<span class="icoListing">' . HostRepository::getIconImage($myHostSet['host_name']) . '</span>' . $myHostSet['host_name']; /* Templates */ $myHostSet['host_template'] = ""; $templates = HostRepository::getTemplateChain($myHostSet['host_id'], array(), 1); foreach ($templates as $template) { $myHostSet['host_template'] .= '<a href="' . $router->getPathFor("/centreon-configuration/hosttemplate/[i:id]", array('id' => $template['id'])) . '"><i class="icon-template ico-20"></i></a>'; } /* Display human readable the check/retry interval */ $myHostSet['host_check_interval'] = HumanReadable::convert($myHostSet['host_check_interval'], 's', $units, null, true); $myHostSet['host_retry_check_interval'] = HumanReadable::convert($myHostSet['host_retry_check_interval'], 's', $units, null, true); $sideMenuCustom = new SlideMenu($myHostSet['host_id']); $events = Di::getDefault()->get('events'); $events->emit('centreon-configuration.slide.menu.host.template', array($sideMenuCustom)); //$myHostSet['DT_RowData']['right_side_details'] = $router->getPathFor('/centreon-configuration/host/snapshot/').$myHostSet['host_id']; $myHostSet['DT_RowData']['right_side_menu_list'] = $sideMenuCustom->getMenu(); $myHostSet['DT_RowData']['right_side_default_menu'] = $sideMenuCustom->getDefaultMenu(); /* Get personal tags */ $myHostSet['tagname'] = ''; $aTagUsed = array(); $aTags = TagsRepository::getList('host', $myHostSet['host_id'], 0, 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'], 1); } } $myHostSet['tagname'] .= TagsRepository::getAddTag('host', $myHostSet['host_id']); } }
/** * * @param int $interval * @return string */ public static function formatNotificationOptions($interval) { return HumanReadable::convert($interval, 's', $units, null, true); }