Revision 108 | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?php/*** @package nagios-php* @author Lars Tiefland <ltiefland@gmail.com>* @copyright 2013* @version $Rev: 115 $*/// $Id: hostgroup.php 115 2013-01-05 19:05:29Z lars $/*** hostGroup** @package nagios-php* @author Lars Tiefland* @copyright 2013* @version $Id: hostgroup.php 115 2013-01-05 19:05:29Z lars $* @access public*/class hostGroup{public $alias;public $hostgroup_id;public $members;/*** hostGroup::__construct()** @param mixed $id* @return*/public function __construct( $id ){$sql = "SELECTalias,hostgroup_idFROMhostgroupsWHEREinstance_id = " . $GLOBALS["cfg"]["instance"] . "ANDhostgroup_id = $id";$res = $GLOBALS["db"]->query( $sql );$row = $res->fetchRow();foreach ( $row as $feld => $wert ){$this->$feld = $wert;}$this->members = $this->getMemberList( $id );}/*** hostGroup::getList()** @return*/public static function getList(){$sql="SELECThostgroup_idFROMhostgroupsWHEREinstance_id = " . $GLOBALS["cfg"]["instance"] . "";$res = $GLOBALS["db"]->query( $sql );while ( $row = $res->fetchRow() ){$ret[] = new hostGroup( $row["hostgroup_id"] );}return $ret;}/*** hostGroup::getMemberList()** @param mixed $hg_id* @return*/private function getMemberList( $hg_id ){$sql = "SELECThost_object_idFROMhostgroup_membersWHEREinstance_id = " . $GLOBALS["cfg"]["instance"] . "ANDhostgroup_id = $hg_id";$res = $GLOBALS["db"]->query( $sql );while ( $row = $res->fetchRow() ){$ret[] = new host( $row["host_object_id"], true );}return $ret;}}?>