Widget base class. More...
Public Member Functions | |
__construct (Widget_Model $model) | |
Create new widget instance from a given widget model. | |
get_title () | |
Returns the widgets title, takes into account user configured title, the widgets override title and lastly the "default" title of the widget. | |
get_metadata () | |
Return the default friendly name for the widget type default to the model name, but should be overridden by widgets. | |
get_arguments () | |
Returns the populated argument array. | |
view_path ($view=false) | |
Find path of widget viewer. | |
options () | |
Return the list of options to use in this widget. | |
add_css_class ($class) | |
Hook to force additional CSS classes to the rendering. | |
render ($method= 'index', $with_chrome=true) | |
Method to render a widget. | |
index () | |
Print the widget contents here. | |
resources ($in_files=false, $type='js') | |
Weird little method that returns all the resources referenced in this instance. | |
add_path ($rel_path) | |
Set correct paths. | |
Data Fields | |
$model = false | |
The widget model instance this widget represents. | |
$extra_data_attributes = array() | |
Array Key-value to attach to widget-container (for example ["hello"] => "bye" which renders as <div data-hello="bye" />, good for javascript-hooks. | |
$js = false | |
Additional JavaScript files to load. | |
$css = false | |
Additional CSS files to load. | |
$inline_js = false | |
A JavaScript string to inline into the widget. | |
$arguments = array() | |
The arguments for this instance, constructed from the option objects. | |
Protected Member Functions | |
get_setting ($key) | |
Retrieves this widgets setting value for $key, if not yet configured it will fetch the default from the widgets option definition. | |
get_suggested_title () | |
The backwards compatible way to get widget default title. | |
Protected Attributes | |
$editable = true | |
An editable widget has settings that can be changed. | |
$movable = true | |
A movable widget can be dragged around. | |
$collapsable = true | |
A collapsable widget can be collapsed, so only the title bar is visible. | |
$removable = TRUE | |
A removable widget can be deleted. | |
$closeconfirm = TRUE | |
Whether to ask the user to confirm widget deletion. | |
$duplicatable = FALSE | |
Whether the widget can be copied. | |
$widget_full_path = false | |
Path to this widget's directory. |
Widget base class.
widget_Base::__construct | ( | Widget_Model $ | model | ) |
Create new widget instance from a given widget model.
$model | Ninja_Widget_Model ORM Model for a ninja widget |
Reimplemented in Netw_health_Widget, and State_summary_Widget.
widget_Base::add_path | ( | $ | rel_path | ) |
Set correct paths.
$rel_path | string: Relative path |
widget_Base::get_arguments | ( | ) |
Returns the populated argument array.
widget_Base::get_metadata | ( | ) |
Return the default friendly name for the widget type default to the model name, but should be overridden by widgets.
Reimplemented in bignumber_Widget, gridstat_Widget, Listview_Widget, Monitoring_performance_Widget, Nagvis_Widget, Netw_health_Widget, Netw_outages_Widget, State_summary_Widget, tablestat_Widget, Tac_acknowledged_Widget, Tac_disabled_Widget, Tac_hosts_Widget, Tac_monfeat_Widget, Tac_problems_Widget, Tac_scheduled_Widget, Tac_services_Widget, and Dead_Widget.
widget_Base::get_setting | ( | $ | key | ) | [protected] |
Retrieves this widgets setting value for $key, if not yet configured it will fetch the default from the widgets option definition.
$key | string |
widget_Base::get_suggested_title | ( | ) | [protected] |
The backwards compatible way to get widget default title.
Reimplemented in bignumber_Widget, Listview_Widget, Nagvis_Widget, and State_summary_Widget.
widget_Base::get_title | ( | ) | [final] |
Returns the widgets title, takes into account user configured title, the widgets override title and lastly the "default" title of the widget.
widget_Base::index | ( | ) |
Print the widget contents here.
Concrete widgets typically want to override this.
Reimplemented in bignumber_Widget, gridstat_Widget, Listview_Widget, Monitoring_performance_Widget, Nagvis_Widget, Netw_health_Widget, Netw_outages_Widget, State_summary_Widget, tablestat_Widget, Tac_acknowledged_Widget, Tac_disabled_Widget, Tac_monfeat_Widget, and Dead_Widget.
widget_Base::options | ( | ) |
Return the list of options to use in this widget.
This should be an array of option instances, or - if you want to do more manual work - strings.
Actual widgets typically want to extend this method.
Reimplemented in bignumber_Widget, gridstat_Widget, Listview_Widget, Nagvis_Widget, Netw_health_Widget, State_summary_Widget, and tablestat_Widget.
widget_Base::render | ( | $ | method = 'index' , |
|
$ | with_chrome = true | |||
) |
widget_Base::view_path | ( | $ | view = false |
) |
widget_Base::$duplicatable = FALSE [protected] |
Whether the widget can be copied.
Setting this to true requires testing, so default to the more backwards compatible mode
Reimplemented in bignumber_Widget, gridstat_Widget, Listview_Widget, Monitoring_performance_Widget, Nagvis_Widget, Netw_health_Widget, Netw_outages_Widget, tablestat_Widget, Tac_acknowledged_Widget, Tac_disabled_Widget, and Tac_monfeat_Widget.