Subversion-Projekte lars-tiefland.nagios-php

Revision

Revision 110 | 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: 111 $
8
     */
9
 
10
    // $Id: servicegroup.php 111 2013-01-03 10:17:28Z lars $
11
 
106 lars 12
    /**
13
     * serviceGroup
14
     *
15
     * @package nagios-php
16
     * @author Lars Tiefland
17
     * @copyright 2013
18
     * @version $Id: servicegroup.php 111 2013-01-03 10:17:28Z lars $
19
     * @access public
20
     */
21
    class serviceGroup
22
    {
23
        public $alias;
111 lars 24
        public $servicegroup_id;
106 lars 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,
110 lars 37
                    servicegroup_id
106 lars 38
                FROM
110 lars 39
                    servicegroups
106 lars 40
                WHERE
41
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
42
                AND
110 lars 43
                    servicegroup_id = $id
106 lars 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
109 lars 62
                    servicegroup_id
106 lars 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
?>