gui_nacoma_Model Class Reference

The gui_nacoma_Model is responsible for drawing all the various elements of the page. More...

Public Member Functions

 __construct ()
 Constructor.
 run_import ($reason, $user=false)
 Import configuration from files to database.
 import_if_changes ($user=false)
 Import the configuration if there are changes in the files.
 html_start ($subtitle=false)
 Print HTML header.
 html_end ($exit_code=0)
 Print HTML footer.
 form_start ($name= 'foo_form', $method= 'post')
 Create a form.
 form_end ($return=false)
 Close a form.
 get_flashed_messages ()
 Get messages stored in session, deletes them after retreival.
 submit_button ($text=false, $name=false, $skinny=false, $extra=false)
 Draw a form submit button.
 hidden_var ($name, $value, $return=false)
 Add a hidden form variable.
 draw_object ($obj)
 Print the current object on the webpage.
 make_filtered_selection ($values, $dflt= '', $select_name= 'selection', $required=false)
 Create a filtered selection inside a webform.
 make_multi_obj_selection ($obj_type, $exclude=array(), $target_type=false)
 Generic function to create selection lists from any type of object that also has a group-type (hosts, services and contacts).
 make_multi_host_selection ($exclude=array())
 Simple wrapper around make_multi_obj_selection().
 make_multi_service_selection ($exclude=array())
 Simple wrapper around make_multi_obj_selection().
 print_problem_array ($subject, $ary)
 Prints an array of entries, using $subject as the table header and then printing one line of text per row.
 print_validation_error_table ($obj, $ary=false)
 Print a list of object validation errors.
 print_related ($obj_type, $link_ary)
 Given an object type and an array of links, generates the related info div.
 print_related_object ($obj)
 Print links and info related to object type.
 print_services_link ($obj)
 Create the link "Services for {host,hostgroup}".
 make_drop_down ($objects=false, $dflt='', $selection_name='', $classname='xlarge', $onchange= '')
 Create drop-down (select) with the option of specifying classname and onchange action.
 get_index_property ($type='', $id=0)
 Get an object name from an id.
 pretty_print_custom_vars ($obj)
 Print custom variables for one object.
 print_propagate_checkbox ($token)
 Returns a checkbox used for selecting variables to propagate.
 pretty_print_one ($obj)
 Print form for each object.
 insert_widget ($name, $obj, $token, $value)
 Include and render the correct widget for the specified token.
 get_page_vars ($obj)
 Get variables is shown on page.
 help_for_object (object_nacoma_Model $obj)
 draw_command_bar ($obj)
 Draws the border and frames of the object listing in the gui.
 hidden_var_array ($name, $ary)
 Print out the contents of an array as hidden variables.
 print_message ($input=false, $left_margin=false)
 Print message to user.
 draw_object_selector ($obj)
 Draw the object selector that is on top of most object editing pages.
 make_multi_selection ($tokenvalues, $dflt, $select_name= 'selection')
 Render a multi-select widget.

Detailed Description

The gui_nacoma_Model is responsible for drawing all the various elements of the page.


Constructor & Destructor Documentation

gui_nacoma_Model::__construct (  ) 

Constructor.

Responsible for validating that the user is authorized to use the GUI and to make sure this is no poller system in a distributed setup.


Member Function Documentation

gui_nacoma_Model::draw_command_bar ( obj  ) 

Draws the border and frames of the object listing in the gui.

Parameters:
$obj A Nagios-specific php object class.
gui_nacoma_Model::draw_object ( obj  ) 

Print the current object on the webpage.

Parameters:
$obj class_object A class related to a specific object type
gui_nacoma_Model::form_end ( return = false  ) 

Close a form.

Parameters:
$return Unused
gui_nacoma_Model::form_start ( name = 'foo_form',
method = 'post' 
)

Create a form.

Parameters:
$name Form name
$method Form method
gui_nacoma_Model::get_flashed_messages (  ) 

Get messages stored in session, deletes them after retreival.

Returns:
array of strings
gui_nacoma_Model::get_index_property ( type = '',
id = 0 
)

Get an object name from an id.

Parameters:
$type string: Nagios-style object type
$id int: Id of the object
Returns:
string: The object name
gui_nacoma_Model::get_page_vars ( obj  ) 

Get variables is shown on page.

Parameters:
$obj A Nagios-specific php object class
Returns:
array: key => value indexed array
gui_nacoma_Model::help_for_object ( object_nacoma_Model $  obj  ) 
Parameters:
$obj object_nacoma_Model
Returns:
string html
gui_nacoma_Model::hidden_var ( name,
value,
return = false 
)

Add a hidden form variable.

Parameters:
$name Name of the variable
$value Value of the variable
$return Unused
gui_nacoma_Model::hidden_var_array ( name,
ary 
)

Print out the contents of an array as hidden variables.

Parameters:
$name Base name of the array
$ary The variable array in 'key => value' form
gui_nacoma_Model::html_start ( subtitle = false  ) 

Print HTML header.

Parameters:
$subtitle string: Page subtitle
gui_nacoma_Model::import_if_changes ( user = false  ) 

Import the configuration if there are changes in the files.

Parameters:
$user The user running the import
gui_nacoma_Model::make_drop_down ( objects = false,
dflt = '',
selection_name = '',
classname = 'xlarge',
onchange = '' 
)

Create drop-down (select) with the option of specifying classname and onchange action.

Parameters:
$objects array: Objects to list
$dflt string: Default object
$selection_name string: Name of the selection
$classname string: css class name
$onchange javascript gunk to add to form
gui_nacoma_Model::make_filtered_selection ( values,
dflt = '',
select_name = 'selection',
required = false 
)

Create a filtered selection inside a webform.

Parameters:
$values Array of values in the form
$dflt The default selected value
$select_name The form name of this variable
$required If not true, an empty selectable value will be inserted
gui_nacoma_Model::make_multi_host_selection ( exclude = array()  ) 

Simple wrapper around make_multi_obj_selection().

Parameters:
$exclude array: Hosts to exclude
gui_nacoma_Model::make_multi_obj_selection ( obj_type,
exclude = array(),
target_type = false 
)

Generic function to create selection lists from any type of object that also has a group-type (hosts, services and contacts).

The input_nacoma_Model understands the format we create here and can parse them correctly, which aids the various programs rather nicely.

Parameters:
$obj_type Object type
$exclude Objects to exclude from listing
$target_type Ultimate target type
gui_nacoma_Model::make_multi_service_selection ( exclude = array()  ) 

Simple wrapper around make_multi_obj_selection().

Parameters:
$exclude array: Services to exclude
gui_nacoma_Model::pretty_print_custom_vars ( obj  ) 

Print custom variables for one object.

Parameters:
$obj A Nagios-specific php object class
gui_nacoma_Model::pretty_print_one ( obj  ) 

Print form for each object.

Parameters:
$obj Nagios-specific php object class
gui_nacoma_Model::print_problem_array ( subject,
ary 
)

Prints an array of entries, using $subject as the table header and then printing one line of text per row.

If $ary is empty, this function does nothing.

Returns:
The number of entries printed.
gui_nacoma_Model::print_propagate_checkbox ( token  ) 

Returns a checkbox used for selecting variables to propagate.

Parameters:
$token The name of the variable
gui_nacoma_Model::print_related_object ( obj  ) 

Print links and info related to object type.

REWRITE ME PLEASE!!!

Parameters:
$obj A Nagios-object-specific php class object
gui_nacoma_Model::print_services_link ( obj  ) 

Create the link "Services for {host,hostgroup}".

Returns:
string: The link, complete with image and all
gui_nacoma_Model::print_validation_error_table ( obj,
ary = false 
)

Print a list of object validation errors.

Parameters:
$obj A Nagios-object-specific php object
$ary The validation errors, if not set in $obj
gui_nacoma_Model::run_import ( reason,
user = false 
)

Import configuration from files to database.

Parameters:
$reason Reason why import was run
$user The user running the import
gui_nacoma_Model::submit_button ( text = false,
name = false,
skinny = false,
extra = false 
)

Draw a form submit button.

Parameters:
$text The text on the button, or FALSE for default
$name The form name of the button, or FALSE for default
$skinny If false, the button will take up a comfortable amount of space. If true, it will be narrower
$extra An array of HTML attribute key-vals to append/replace the automatic ones

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

Generated on 24 Feb 2020 for nacoma by  doxygen 1.6.1