Updated testing for filter selects in reports
[ninja.git] / modules / orm / models / serviceset.php
blob34d32e3c1fe48bed81539eaaca47b19327606f92
1 <?php
3 require_once( dirname(__FILE__).'/base/baseserviceset.php' );
5 /**
6 * Describes a set of objects from livestatus
7 */
8 class ServiceSet_Model extends BaseServiceSet_Model {
10 /**
11 * Get statistics from the given set
13 public function get_totals() {
14 $pool = new ServicePool_Model();
15 $stats = array(
16 'service_state_ok' => $pool->get_by_query('[services] state = 0 and has_been_checked=1'),
17 'service_state_warning' => $pool->get_by_query('[services] state = 1 and has_been_checked=1'),
18 'service_state_critical' => $pool->get_by_query('[services] state = 2 and has_been_checked=1'),
19 'service_state_unknown' => $pool->get_by_query('[services] state = 3 and has_been_checked=1'),
20 'service_pending' => $pool->get_by_query('[services] has_been_checked=0'),
21 'service_all' => $pool->get_by_query('[services] all')
23 $stats_result = $this->stats($stats);
24 $totals = array();
25 foreach( $stats as $name => $set ) {
26 $totals[$name] = array($this->intersect($set)->get_query(), $stats_result[$name]);
29 return $totals;
32 /**
33 * Get a set of comments for the services in the set
35 public function get_comments() {
36 $set = parent::get_comments();
37 return $set->reduce_by('is_service', true, '=');