Subversion-Projekte lars-tiefland.nagios-php

Revision

Revision 106 | Revision 110 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

    /**
     * @package nagios-php
     * @author Lars Tiefland <ltiefland@gmail.com>
     * @copyright 2013
     * @version $Rev: 109 $
     */

    // $Id: servicegroup.php 109 2013-01-03 10:16:06Z lars $

    /**
     * serviceGroup
     * 
     * @package nagios-php
     * @author Lars Tiefland
     * @copyright 2013
     * @version $Id: servicegroup.php 109 2013-01-03 10:16:06Z lars $
     * @access public
     */
    class serviceGroup
    {
        public $alias;
        public $hostgroup_id;
        public $members;

        /**
         * serviceGroup::__construct()
         * 
         * @param mixed $id
         * @return
         */
        public function __construct($id)
        {
            $sql = "SELECT
                    alias,
                    hostgroup_id
                FROM
                    hostgroups
                WHERE
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
                AND
                    hostgroup_id = $id
            ";
            $res = $GLOBALS["db"]->query( $sql );
            $row = $res->fetchRow();
            foreach ( $row as $feld => $wert )
            {
                $this->$feld = $wert;
            }
            //$this->members = $this->getMemberList( $id );
        }
        
        /**
         * serviceGroup::getList()
         * 
         * @return
         */
        public static function getList()
        {
            $sql="SELECT
                    servicegroup_id
                FROM
                    servicegroups
                WHERE
                    instance_id = " . $GLOBALS["cfg"]["instance"] . "
            ";
            $res = $GLOBALS["db"]->query( $sql );
            while ( $row = $res->fetchRow() )
            {
                $ret[] = new serviceGroup( $row["servicegroup_id"] );
            }
            return $ret;
        }
    }
?>