widget_Base Class Reference

Widget base class. More...

Inheritance diagram for widget_Base:
bignumber_Widget Dead_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

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.

Detailed Description

Widget base class.


Constructor & Destructor Documentation

widget_Base::__construct ( Widget_Model model  ) 

Create new widget instance from a given widget model.

Parameters:
$model Ninja_Widget_Model ORM Model for a ninja widget

Reimplemented in Netw_health_Widget, and State_summary_Widget.


Member Function Documentation

widget_Base::add_path ( rel_path  ) 

Set correct paths.

Parameters:
$rel_path string: Relative path
Returns:
false on errors, "full relative" path on success.
widget_Base::get_arguments (  ) 

Returns the populated argument array.

Returns:
array
widget_Base::get_metadata (  ) 
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.

Parameters:
$key string
Returns:
mixed
widget_Base::get_suggested_title (  )  [protected]

The backwards compatible way to get widget default title.

Returns:
string

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.

Returns:
string
widget_Base::index (  ) 
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.

Returns:
array of option

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 
)

Method to render a widget.

Parameters:
$method Name of method
$with_chrome True to generate widget with the menus and everything, false otherwise
Returns:
The rendered widget as a string
widget_Base::view_path ( view = false  ) 

Find path of widget viewer.

Parameters:
$view Template object
Returns:
str path to viewer

Field Documentation

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.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables

Generated on 19 Dec 2018 for ninja by  doxygen 1.6.1