\n"; return $current_color; } /* html_boolean - returns the boolean equivalent of an HTML checkbox value @arg $html_boolean - the value of the HTML checkbox @returns - true or false based on the value of the HTML checkbox */ function html_boolean($html_boolean) { if ($html_boolean == "on") { return true; }else{ return false; } } /* html_boolean_friendly - returns the natural language equivalent of an HTML checkbox value @arg $html_boolean - the value of the HTML checkbox @returns - 'Selected' or 'Not Selected' based on the value of the HTML checkbox */ function html_boolean_friendly($html_boolean) { if ($html_boolean == "on") { return "Selected"; }else{ return "Not Selected"; } } /* get_checkbox_style - finds the proper CSS padding to apply based on the current client browser in use @returns - a CSS style string which should be used with an HTML checkbox control */ function get_checkbox_style() { if (get_web_browser() == "moz") { return "padding: 4px; margin: 4px;"; }elseif (get_web_browser() == "ie") { return "padding: 0px; margin: 0px;"; }elseif (get_web_browser() == "other") { return "padding: 4px; margin: 4px;"; } } /* load_current_session_value - finds the correct value of a variable that is being cached as a session variable on an HTML form @arg $request_var_name - the array index name for the request variable @arg $session_var_name - the array index name for the session variable @arg $default_value - the default value to use if values cannot be obtained using the session or request array */ function load_current_session_value($request_var_name, $session_var_name, $default_value) { if (isset($_REQUEST[$request_var_name])) { $_SESSION[$session_var_name] = $_REQUEST[$request_var_name]; }elseif (isset($_SESSION[$session_var_name])) { $_REQUEST[$request_var_name] = $_SESSION[$session_var_name]; }else{ $_REQUEST[$request_var_name] = $default_value; } } /* get_colored_device_status - given a device's status, return the colored text in HTML format suitable for display @arg $disabled (bool) - true if the device is disabled, false is it is not @arg $status - the status type of the device as defined in config_constants.php @returns - a string containing html that represents the device's current status */ function get_colored_device_status($disabled, $status) { $disabled_color = "a1a1a1"; $status_colors = array( HOST_DOWN => "ff0000", HOST_RECOVERING => "ff8f1e", HOST_UP => "198e32" ); if ($disabled) { return "Disabled"; }else{ switch ($status) { case HOST_DOWN: return "Down"; break; case HOST_RECOVERING: return "Recovering"; break; case HOST_UP: return "Up"; break; default: return "Unknown"; break; } } } ?>