Subversion-Projekte lars-tiefland.nagios-php

Revision

Revision 104 | Revision 109 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
86 lars 1
<?php
2
 
3
    /**
4
     * @package nagios-php
5
     * @author Lars Tiefland <ltiefland@gmail.com>
6
     * @copyright 2013
7
     * @version $Rev: 106 $
8
     */
9
 
10
    // $Id: servicegroup.php 106 2013-01-03 10:12:56Z lars $
11
 
106 lars 12
    /**
13
     * serviceGroup
14
     *
15
     * @package nagios-php
16
     * @author Lars Tiefland
17
     * @copyright 2013
18
     * @version $Id: servicegroup.php 106 2013-01-03 10:12:56Z lars $
19
     * @access public
20
     */
21
    class serviceGroup
22
    {
23
        public $alias;
24
        public $hostgroup_id;
25
        public $members;
86 lars 26
 
106 lars 27
        /**
28
         * serviceGroup::__construct()
29
         *
30
         * @param mixed $id
31
         * @return
32
         */
33
        public function __construct($id)
34
        {
35
            $sql = "SELECT
36
                    alias,
37
                    hostgroup_id
38
                FROM
39
                    hostgroups
40
                WHERE
41
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
42
                AND
43
                    hostgroup_id = $id
44
            ";
45
            $res = $GLOBALS["db"]->query( $sql );
46
            $row = $res->fetchRow();
47
            foreach ( $row as $feld => $wert )
48
            {
49
                $this->$feld = $wert;
50
            }
51
            //$this->members = $this->getMemberList( $id );
52
        }
53
 
54
        /**
55
         * serviceGroup::getList()
56
         *
57
         * @return
58
         */
59
        public static function getList()
60
        {
61
            $sql="SELECT
62
                    groupgroup_id
63
                FROM
64
                    servicegroups
65
                WHERE
66
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
67
            ";
68
            $res = $GLOBALS["db"]->query( $sql );
69
            while ( $row = $res->fetchRow() )
70
            {
71
                $ret[] = new serviceGroup( $row["servicegroup_id"] );
72
            }
73
            return $ret;
74
        }
104 lars 75
    }
86 lars 76
?>