Report_options is an object representing the user-selected report. More...
Public Member Functions | |
setup_properties () | |
Properties should be completely setup - with translations and all - before loading any options, and options are loaded by the construct, so do initialization here. | |
__construct ($options=false) | |
Public constructor, which optionally takes an iterable with properties to set. | |
offsetGet ($str) | |
Required by ArrayAccess. | |
offsetSet ($key, $val) | |
Required by ArrayAccess. | |
offsetExists ($key) | |
Required by ArrayAccess. | |
offsetUnset ($key) | |
Required by ArrayAccess. | |
properties () | |
This looks silly. | |
get_alternatives ($key) | |
For applicable keys, this returns a list of all possible values. | |
get_value ($key) | |
Returns the user-friendly value, given a machine-friendly option key. | |
get_report_members () | |
Return all objects (hosts or services) this report applies to This will return hosts or services regardless if the report object selection uses groups or not. | |
set_options ($options) | |
Update the options for the report. | |
set ($name, $value) | |
Set an option, with some validation. | |
as_keyval_string ($anonymous=false, $obj_only=false) | |
Generate a standard HTTP keyval string, suitable for URLs or POST bodies. | |
as_form ($anonymous=false, $obj_only=false) | |
Return the report as a HTML string of hidden form elements. | |
as_json () | |
Return the report as a JSON string. | |
expand () | |
Expand the private structure, to make a traversal iterate over all the properties. | |
get_date ($var) | |
Return the given timestamp typed property as a date string of the configured kind. | |
get_time ($var) | |
Return the given timestamp typed property as a time string. | |
rewind () | |
Required by Iterator. | |
current () | |
Required by Iterator. | |
key () | |
Required by Iterator. | |
next () | |
Required by Iterator. | |
valid () | |
Required by Iterator. | |
count () | |
Required by Countable. | |
__toString () | |
Print the options themselves when printing the object. | |
Static Public Member Functions | |
static | discover_options ($input=false) |
Finds properties to inject into. | |
static | setup_options_obj ($type, $input=false) |
Data Fields | |
const | ALL_AUTHORIZED = '*' |
Placeholder used instead of fetching all objects the user is authorized to see, to be able to fetch lazily and avoid large queries or filtering large result sets. | |
$options = array() | |
The the explicitly set options. | |
Protected Member Functions | |
calculate_time ($report_period) | |
Calculates $this['start_time'] and $this['end_time'] based on an availability report style period such as "today", "last24hours" or "lastmonth". | |
validate_value ($key, &$value) | |
Validates that $value isn't obviously unsuitable for $key. | |
update_value ($name, $value) | |
Will actually set the provided $name to the value $value. | |
Static Protected Member Functions | |
static | merge_with_loaded ($options, $report_info, $saved_report_info) |
So, my issue is, basically, that op5reports needs to override how what is loaded from DB, and our saved_reports_model is useless and fragile and scary and I'll kill it, as part of fixing #7491 at the very latest. | |
static | create_options_obj ($type, $report_info=false) |
Combines the provided properties with any saved information. | |
Protected Attributes | |
$rename_options | |
Can contains options that must be renamed when provided - for legacy links. | |
$properties | |
Contains a definition of all legal keys for this type of Report_options. |
Report_options is an object representing the user-selected report.
It's created to improve consistency between report types and frontend/backend
Report_options::as_keyval_string | ( | $ | anonymous = false , |
|
$ | obj_only = false | |||
) |
Generate a standard HTTP keyval string, suitable for URLs or POST bodies.
$anonymous | If true, any option on the exact objects in this report will be purged, so it's suitable for linking to sub-reports. If false, all options will be kept, completely describing this exact report. | |
$obj_only | Does more-or-less the inverse of $anonymous - if true, don't include anything that does not refer to the members of the report. |
Report_options::calculate_time | ( | $ | report_period | ) | [protected] |
Calculates $this['start_time'] and $this['end_time'] based on an availability report style period such as "today", "last24hours" or "lastmonth".
$report_period | The textual period to set our options by |
Reimplemented in Summary_options.
static Report_options::create_options_obj | ( | $ | type, | |
$ | report_info = false | |||
) | [static, protected] |
Combines the provided properties with any saved information.
You probably want setup_options_obj instead.
static Report_options::discover_options | ( | $ | input = false |
) | [static] |
Finds properties to inject into.
. myself
You probably want setup_options_obj instead.
$input | array = false Autodiscovers options using superglobals: $input > POST > GET |
Reimplemented in HttpApiEvent_options, and Sla_options_Core.
static Report_options::merge_with_loaded | ( | $ | options, | |
$ | report_info, | |||
$ | saved_report_info | |||
) | [static, protected] |
So, my issue is, basically, that op5reports needs to override how what is loaded from DB, and our saved_reports_model is useless and fragile and scary and I'll kill it, as part of fixing #7491 at the very latest.
Until then, I need to expose this algorithm so op5report can access it without having to copy-paste it or access the functionality the normal way.
Report_options::properties | ( | ) |
This looks silly.
..
Report_options::set | ( | $ | name, | |
$ | value | |||
) |
Set an option, with some validation.
$name | Option name | |
$value | Option value |
Reimplemented in Sla_options_Core.
Report_options::set_options | ( | $ | options | ) |
Update the options for the report.
$options | New options |
Reimplemented in HttpApiEvent_options.
static Report_options::setup_options_obj | ( | $ | type, | |
$ | input = false | |||
) | [static] |
$type | string avail|sla|summary | |
$input | array = false |
Report_options::update_value | ( | $ | name, | |
$ | value | |||
) | [protected] |
Will actually set the provided $name to the value $value.
Warning: you probably want to use set() or utilize the ArrayAccess API
Reimplemented in Alert_history_options, Histogram_options_Core, and Summary_options.
Report_options::validate_value | ( | $ | key, | |
&$ | value | |||
) | [protected] |
Validates that $value isn't obviously unsuitable for $key.
Warning: you probably want to use set() or utilize the ArrayAccess API
Reimplemented in HttpApiEvent_options.
Report_options::$options = array() |
The the explicitly set options.
Should not be accessed directly, outside of debugging.