/**
  * Get Host States
  *
  * @param string $sgName
  * @param int $detailFlag
  * @param int $admin
  * @param CentreonACL $aclObj
  * @param array $preferences
  * @param bool $isNdo
  * @param string $ndoPrefix
  * @return array
  */
 public function getHostStates($sgName, $detailFlag = false, $admin, $aclObj, $preferences, $isNdo = false, $ndoPrefix = "nagios_")
 {
     if ($isNdo == false) {
         $query = "SELECT DISTINCT h.host_id, h.state, h.name, ssg.servicegroup_id\n                      FROM `services_servicegroups` ssg, `hosts` h, `servicegroups` sg\n                      WHERE h.host_id = ssg.host_id\n                      AND h.name NOT LIKE '_Module_%'\n                      AND h.enabled = 1\n                      AND ssg.servicegroup_id = sg.servicegroup_id\n                      AND sg.name = '" . $this->dbb->escape($sgName) . "' ";
         if (!$admin) {
             $query .= $aclObj->queryBuilder("AND", "h.host_id", $aclObj->getHostsString("ID", $this->dbb));
         }
         $query .= " ORDER BY h.name ";
     } else {
         $query = "SELECT DISTINCT h.host_id, hs.current_state as state, h.display_name as name, ssg.servicegroup_id\n                      FROM `{$ndoPrefix}servicegroup_members` ssg, `{$ndoPrefix}hosts` h, `{$ndoPrefix}services` s,\n                           `{$ndoPrefix}hoststatus` hs, `{$ndoPrefix}servicegroups` sg, `{$ndoPrefix}objects` o\n                      WHERE h.host_object_id = s.host_object_id\n                      AND s.host_object_id = hs.host_object_id\n                      AND s.service_object_id = ssg.service_object_id\n                      AND ssg.servicegroup_id = sg.servicegroup_id\n                      AND sg.servicegroup_object_id = o.object_id\n                      AND h.display_name NOT LIKE '_Module_%'                                            \n                      AND o.name1 = '" . $this->dbb->escape($sgName) . "' ";
         if (!$admin) {
             $query .= $aclObj->queryBuilder("AND", "h.display_name", $aclObj->getHostsString("NAME", $this->dbb));
         }
         $query .= " ORDER BY h.display_name ";
     }
     $res = $this->dbb->query($query);
     $tab = array();
     $detailTab = array();
     while ($row = $res->fetchRow()) {
         if (!isset($tab[$row['state']])) {
             $tab[$row['state']] = 0;
         }
         if (!isset($detailTab[$row['name']])) {
             $detailTab[$row['name']] = array();
         }
         foreach ($row as $key => $val) {
             $detailTab[$row['name']][$key] = $val;
         }
         $tab[$row['state']]++;
     }
     if ($detailFlag == true) {
         return $detailTab;
     }
     return $tab;
 }
$locale = $oreon->user->get_lang();
putenv("LANG={$locale}");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", $syslog_mod_path . "locale/");
bind_textdomain_codeset("messages", "UTF-8");
textdomain("messages");
/*
 * Get ACL
 */
$pearDB = new CentreonDB();
$pearDBndo = new CentreonDB("ndo");
$sid = session_id($_GET["sid"]);
$contact_id = check_session($sid, $pearDB);
$is_admin = isUserAdmin($sid);
$access = new CentreonACL($contact_id, $is_admin);
$aclHostString = $access->getHostsString("ID", $pearDBndo);
/*
 * Get selected option in lists
 */
if (isset($_GET['collector_id']) && $_GET['collector_id'] != "") {
    $collector_id = $_GET['collector_id'];
} else {
    $collector_id = "";
}
if (isset($_GET['Ffacility']) && $_GET['Ffacility'] != "" && $_GET['Ffacility'] != "undefined") {
    $Ffacility_selected = $_GET['Ffacility'];
} else {
    $Ffacility_selected = "";
}
if (isset($_GET['Fseverity']) && $_GET['Fseverity'] != "" && $_GET['Fseverity'] != "undefined") {
    $Fseverity_selected = $_GET['Fseverity'];