Subversion-Projekte lars-tiefland.nagios-php

Revision

Revision 61 | Revision 63 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
58 lars 1
<?php
2
 
3
    class hostGroup
4
    {
5
        public $alias;
6
        public $hostgroup_id;
7
        public $members;
8
        public function __construct( $id )
9
        {
10
            $sql = "SELECT
11
                    alias,
12
                    hostgroup_id
13
                FROM
14
                    hostgroups
15
                WHERE
16
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
17
                AND
18
                    hostgroup_id = $id
19
            ";
20
            $res = $GLOBALS["db"]->query( $sql );
21
            $row = $res->fetchRow();
22
            foreach ( $row as $feld => $wert )
23
            {
24
                $this->$feld = $wert;
25
            }
61 lars 26
            $this->members = $this->getMemberList( $id );
58 lars 27
        }
28
 
29
        public static function getList()
30
        {
31
 
32
        }
33
 
34
        public function getMemberList( $hg_id )
35
        {
36
            $sql = "SELECT
37
                    host_object_id
38
                FROM
60 lars 39
                    hostgroup_members
58 lars 40
                WHERE
41
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
42
                AND
43
                    hostgroup_id = $hg_id
44
            ";
45
            $res = $GLOBALS["db"]->query( $sql );
46
            while ( $row = $res->fetchRow() )
47
            {
48
                $ret[] = new host( $row["host_object_id"] );
49
            }
62 lars 50
            return $ret;
58 lars 51
        }
52
    }
53
 
54
?>