$value = CentreonDuration::toString($value);
     } elseif ($key == "check_attempt") {
         $value = $value . "/" . $row['max_check_attempts'] . ' (' . $aStateType[$row['state_type']] . ')';
     } elseif ($key == "s_state") {
         $data[$row['host_id'] . "_" . $row['service_id']]['color'] = $stateSColors[$value];
         $value = $stateLabels[$value];
     } elseif ($key == "h_state") {
         $data[$row['host_id'] . "_" . $row['service_id']]['hcolor'] = $stateHColors[$value];
         $value = $stateLabels[$value];
     } elseif ($key == "output") {
         $value = substr($value, 0, $outputLength);
     } elseif (($key == "h_action_url" || $key == "h_notes_url") && $value) {
         $value = urlencode($hostObj->replaceMacroInString($row['hostname'], $value));
     } elseif (($key == "s_action_url" || $key == "s_notes_url") && $value) {
         $value = $hostObj->replaceMacroInString($row['hostname'], $value);
         $value = urlencode($svcObj->replaceMacroInString($row['service_id'], $value));
     } elseif ($key == "criticality_id" && $value != '') {
         $critData = $criticality->getData($row["criticality_id"], 1);
         $value = "<img src='../../img/media/" . $media->getFilename($critData['icon_id']) . "' title='" . $critData["sc_name"] . "' width='16' height='16'>";
     }
     $data[$row['host_id'] . "_" . $row['service_id']][$key] = $value;
 }
 $data[$row['host_id'] . '_' . $row['service_id']]['encoded_description'] = urlencode($data[$row['host_id'] . '_' . $row['service_id']]['description']);
 $data[$row['host_id'] . '_' . $row['service_id']]['encoded_hostname'] = urlencode($data[$row['host_id'] . '_' . $row['service_id']]['hostname']);
 if ($row['host_ticket_time'] > $row['host_last_hard_state_change'] && isset($row['host_ticket_id']) && !is_null($row['host_ticket_id']) && $row['host_ticket_id'] != '') {
     $ticket_id = $row['host_ticket_id'];
     $url = $rule->getUrl($preferences['rule'], $ticket_id, $row, $widgetId);
     if (!is_null($url) && $url != '') {
         $ticket_id = '<a href="' . $url . '" target="_blank">' . $ticket_id . '</a>';
     }
     $data[$row['host_id'] . "_" . $row['service_id']]['ticket_id'] = $ticket_id;
            $value = CentreonDuration::toString($value);
        } elseif ($key == "check_attempt") {
            $value = $value . "/" . $row['max_check_attempts'];
        } elseif ($key == "s_state") {
            $data[$row['host_id'] . "_" . $row['service_id']]['color'] = $stateSColors[$value];
            $value = $stateLabels[$value];
        } elseif ($key == "h_state") {
            $data[$row['host_id'] . "_" . $row['service_id']]['hcolor'] = $stateHColors[$value];
            $value = $stateLabels[$value];
        } elseif ($key == "output") {
            $value = substr($value, 0, $outputLength);
        } elseif (($key == "h_action_url" || $key == "h_notes_url") && $value) {
            $value = $hostObj->replaceMacroInString($row['hostname'], $value);
        } elseif (($key == "s_action_url" || $key == "s_notes_url") && $value) {
            $value = $hostObj->replaceMacroInString($row['hostname'], $value);
            $value = $svcObj->replaceMacroInString($service_id, $value);
        } elseif ($key == "criticality_id" && $value != '') {
            $critData = $criticality->getData($row["criticality_id"], 1);
            $value = $critData["hc_name"];
        }
        $data[$row['host_id'] . "_" . $row['service_id']][$key] = $value;
    }
    if (isset($preferences['display_last_comment']) && $preferences['display_last_comment']) {
        $res2 = $dbb->query('SELECT data FROM comments where host_id = ' . $row['host_id'] . ' AND service_id = ' . $row['service_id'] . ' ORDER BY entry_time DESC LIMIT 1');
        if ($row2 = $res2->fetchRow()) {
            $data[$row['host_id'] . "_" . $row['service_id']]['comment'] = substr($row2['data'], 0, $commentLength);
        } else {
            $data[$row['host_id'] . "_" . $row['service_id']]['comment'] = '-';
        }
    }
}