Merge branch 'maint/7.0'
[ninja.git] / modules / test / libraries / Test_report_options.php
blob342992f00fa20952834c1b700450f25f39a7a5d4
1 <?php
3 /**
4 * A mock-implementation of the regular report options
5 * In particular, it exposes a way to set arbitrary report properties and members
6 */
7 class Test_report_options extends Avail_options {
8 public $properties_copy; /**< A public reference to the protected properties array */
9 public $members = array(); /**< A public list of group members used by our get_report_members */
10 /**
11 * Create new test report, optionally with default options
13 public function __construct($options=false) {
14 parent::__construct($options);
15 if (isset($options->members))
16 $this->members = $options->members;
17 $this->properties_copy =& $this->properties;
20 /**
21 * Return the report members you've setup for group reports,
22 * otherwise return the report's actual members
24 function get_report_members()
26 switch ($this['report_type']) {
27 case 'servicegroups':
28 case 'hostgroups':
29 $res_members = array();
30 foreach ($this->members as $group => $members) {
31 if (in_array($group, $this['objects']))
32 $res_members = array_merge($res_members, $members);
34 return $res_members;
36 return parent::get_report_members();