2009-01-07 11:42:38 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Pandora FMS - the Flexible Monitoring System
|
|
|
|
// ============================================
|
|
|
|
// Copyright (c) 2008 Artica Soluciones Tecnologicas, http://www.artica.es
|
|
|
|
// Please see http://pandora.sourceforge.net for full contribution list
|
|
|
|
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public License (LGPL)
|
|
|
|
// as published by the Free Software Foundation for version 2.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
/**
|
2009-01-07 11:49:42 +01:00
|
|
|
* Evaluates a result using empty() and then prints an error message or a
|
2009-01-07 11:42:38 +01:00
|
|
|
* success message
|
|
|
|
*
|
2009-01-08 16:52:13 +01:00
|
|
|
* @param mixed $result the results to evaluate. 0, NULL, false, '' or
|
|
|
|
* array() is bad, the rest is good
|
2009-01-07 11:42:38 +01:00
|
|
|
* @param string $good the string to be displayed if the result was good
|
|
|
|
* @param string $bad the string to be displayed if the result was bad
|
|
|
|
* @param string $attributes any other attributes to be set for the h3
|
|
|
|
* @param bool $return whether to output the string or return it
|
|
|
|
* @param string $tag what tag to use (you could specify something else than
|
2009-01-08 16:52:13 +01:00
|
|
|
* h3 like div or h2)
|
2009-01-07 11:42:38 +01:00
|
|
|
*
|
2009-01-08 16:52:13 +01:00
|
|
|
* @return string XHTML code if return parameter is true.
|
|
|
|
*/
|
2009-01-07 11:42:38 +01:00
|
|
|
function print_error_message ($result, $good = '', $bad = '', $attributes = '', $return = false, $tag = 'h3') {
|
|
|
|
if ($good == '' || $good === false)
|
|
|
|
$good = __('Request successfully processed');
|
|
|
|
|
|
|
|
if ($bad == '' || $bad === false)
|
|
|
|
$bad = __('Error processing request');
|
|
|
|
|
|
|
|
if (empty ($result)) {
|
|
|
|
$output = '<'.$tag.' class="error" '.$attributes.'>'.$bad.'</'.$tag.'>';
|
|
|
|
} else {
|
|
|
|
$output = '<'.$tag.' class="suc" '.$attributes.'>'.$good.'</'.$tag.'>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($return)
|
|
|
|
return $output;
|
|
|
|
|
|
|
|
echo $output;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Evaluates a unix timestamp and returns a span (or whatever tag specified)
|
|
|
|
* with as title the correctly formatted full timestamp and a time comparation
|
|
|
|
* in the tag
|
|
|
|
*
|
|
|
|
* @param int $unixtime: Any type of timestamp really, but we prefer unixtime
|
|
|
|
* @param bool $return whether to output the string or return it
|
|
|
|
* @param array $option: An array with different options for this function
|
2009-01-12 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/alert_manager.php: Complete rewritten of the alert
system when assigned alerts to an agent.
* pandoradb.sql: New tables for alert system. These are:
talert_commands, talert_actions, talert_templates,
talert_template_modules, talert_template_module_actions. No migration
tool is available yet.
* godmode/alerts/configure_alert_template.php,
godmode/alerts/configure_alert_action.php,
godmode/alerts/alert_templates.php,
godmode/alerts/configure_alert_command.php,
godmode/alerts/alert_actions.php: Added to repository. Administration
interface to new alert system.
* godmode/alerts/modify_alert.php: Deleted from repository.
* godmode/setup/setup.php: Added an example of the date format. Main
table has now percentage width.
* godmode/menu.php, operation/menu.php: Added new alert options.
Removed refr value when it's not neccesary.
* include/styles/pandora.css: Added width to textarea elements. Style
correction and cleanup. Tables doesn't have a odd-even pattern, but
the hovered row now changes its colour. New styles for alert pages.
* include/functions_custom_graphs.php: Added to repository. custom
graphs functions moved here.
* include/functions_incidents.php, include/functions_events.php: Moved
to LGPL. Style comment corrections.
* include/functions_html.php: Documentation style correction. Added
print_input_file() and print_label().
* include/functions_ui.php: Doc style correction.
* operation/reporting/graph_viewer.php: Include new function file with
custom graphs. Use generic functions.
* index.php: Unset pass from POST and REQUEST arrays.
* include/functions_db.php: Some documentation updated to new format.
Added format_array_to_update_sql() to generate SQL sentences for
updates. Style correction.
* godmode/agentes/configurar_agente.php: Variables renamed to have a
meaning.
* extensions/update_manager/main.php: Mark an string translatable.
* extensions/update_manager/lib/libupdate_manager_client.php,
godmode/alerts/configure_alert.php, include/functions.php,
godmode/agentes/module_manager.php, operation/agentes/networkmap.php,
operation/reporting/reporting_viewer.php,
godmode/agentes/manage_config.php: Style correction.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1331 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-12 15:31:01 +01:00
|
|
|
* Key html_attr: which html attributes to add (defaults to none)
|
|
|
|
* Key tag: Which html tag to use (defaults to span)
|
|
|
|
* Key prominent: Overrides user preference and display "comparation" or "timestamp"
|
2009-01-07 11:42:38 +01:00
|
|
|
*
|
|
|
|
* @return string HTML code if return parameter is true.
|
|
|
|
*/
|
|
|
|
function print_timestamp ($unixtime, $return = false, $option = array ()) {
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
//TODO: Add/use a javascript timer for the seconds so it automatically updates as time passes by
|
|
|
|
|
|
|
|
if (isset ($option["html_attr"])) {
|
|
|
|
$attributes = $option["html_attr"];
|
|
|
|
} else {
|
|
|
|
$attributes = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset ($option["tag"])) {
|
|
|
|
$tag = $option["tag"];
|
|
|
|
} else {
|
|
|
|
$tag = "span";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty ($option["prominent"])) {
|
|
|
|
$prominent = $option["prominent"];
|
|
|
|
} else {
|
|
|
|
$prominent = $config["prominent_time"];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!is_numeric ($unixtime)) {
|
|
|
|
$unixtime = strtotime ($unixtime);
|
|
|
|
}
|
|
|
|
|
|
|
|
//prominent_time is either timestamp or comparation
|
|
|
|
if ($unixtime == 0) {
|
|
|
|
$title = __('Never');
|
|
|
|
$data = __('Never');
|
|
|
|
} elseif ($prominent == "timestamp") {
|
|
|
|
$title = human_time_comparation ($unixtime);
|
|
|
|
$data = date ($config["date_format"], $unixtime);
|
|
|
|
} else {
|
|
|
|
$title = date ($config["date_format"], $unixtime);
|
|
|
|
$data = human_time_comparation ($unixtime);
|
|
|
|
}
|
|
|
|
|
|
|
|
$output = '<'.$tag;
|
|
|
|
switch ($tag) {
|
|
|
|
default:
|
|
|
|
//Usually tags have title attributes, so by default we add, then fall through to add attributes and data
|
|
|
|
$output .= ' title="'.$title.'"';
|
|
|
|
case "h1":
|
|
|
|
case "h2":
|
|
|
|
case "h3":
|
|
|
|
//Above tags don't have title attributes
|
|
|
|
$output .= ' '.$attributes.'>'.$data.'</'.$tag.'>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($return)
|
|
|
|
return $output;
|
|
|
|
|
|
|
|
echo $output;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prints a username with real name, link to the user_edit page etc.
|
|
|
|
*
|
|
|
|
* @param string $username The username to render
|
|
|
|
* @param bool $return Whether to return or print
|
|
|
|
*
|
|
|
|
* @return string HTML code if return parameter is true.
|
|
|
|
*/
|
|
|
|
function print_username ($username, $return = false) {
|
2009-01-22 18:44:33 +01:00
|
|
|
$string = '<a href="index.php?sec=usuario&sec2=operation/users/user_edit&id='.$username.'">'.get_user_fullname ($username).'</a>';
|
2009-01-07 11:42:38 +01:00
|
|
|
|
|
|
|
if ($return)
|
|
|
|
return $string;
|
|
|
|
|
|
|
|
echo $string;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print group icon within a link
|
|
|
|
*
|
|
|
|
* @param string $id_group Group id
|
|
|
|
* @param bool $return Whether to return or print
|
|
|
|
* @param string $path What path to use (relative to images/). Defaults to groups_small
|
|
|
|
*
|
|
|
|
* @return string HTML code if return parameter is true.
|
|
|
|
*/
|
|
|
|
function print_group_icon ($id_group, $return = false, $path = "groups_small") {
|
|
|
|
$icon = (string) get_db_value ('icon', 'tgrupo', 'id_grupo', (int) $id_group);
|
|
|
|
|
|
|
|
if (empty ($icon)) {
|
|
|
|
return "-";
|
|
|
|
}
|
|
|
|
|
2009-01-07 11:49:42 +01:00
|
|
|
$output = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60&group_id='.$id_group.'">';
|
|
|
|
$output .= '<img class="bot" src="images/'.$path.'/'.$icon.'.png" alt="'.get_group_name ($id_group).'" title="'.get_group_name ($id_group).'" />';
|
|
|
|
$output .= '</a>';
|
2009-01-07 11:42:38 +01:00
|
|
|
|
|
|
|
if ($return)
|
2009-01-07 11:49:42 +01:00
|
|
|
return $output;
|
2009-01-07 11:42:38 +01:00
|
|
|
|
2009-01-07 11:49:42 +01:00
|
|
|
echo $output;
|
2009-01-07 11:42:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the icon of an operating system.
|
|
|
|
*
|
|
|
|
* @param int Operating system id
|
|
|
|
* @param bool Whether to also append the name of the OS after the icon
|
|
|
|
* @param bool Whether to return or echo the result
|
|
|
|
*
|
|
|
|
* @return string HTML with icon of the OS
|
|
|
|
*/
|
|
|
|
function print_os_icon ($id_os, $name = true, $return = false) {
|
|
|
|
$icon = (string) get_db_value ('icon_name', 'tconfig_os', 'id_os', (int) $id_os);
|
|
|
|
$os_name = get_os_name ($id_os);
|
|
|
|
if (empty ($icon)) {
|
|
|
|
return "-";
|
|
|
|
}
|
|
|
|
|
|
|
|
$output = '<img src="images/'.$icon.'" border="0" alt="'.$os_name.'" title="'.$os_name.'" />';
|
|
|
|
|
|
|
|
if ($name === true) {
|
|
|
|
$output .= ' - '.$os_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($return)
|
|
|
|
return $output;
|
|
|
|
|
|
|
|
echo $output;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prints an agent name with the correct link
|
|
|
|
*
|
2009-01-08 16:52:13 +01:00
|
|
|
* @param int $id_agent Agent id
|
2009-01-07 11:42:38 +01:00
|
|
|
* @param bool $return Whether to return the string or echo it too
|
2009-01-08 16:52:13 +01:00
|
|
|
* @param int $cutoff After how much characters to cut off the inside of the
|
|
|
|
* link. The full agent name will remain in the roll-over
|
2009-01-07 11:42:38 +01:00
|
|
|
*
|
|
|
|
* @return string HTML with agent name and link
|
2009-01-08 16:52:13 +01:00
|
|
|
*/
|
2009-01-07 11:42:38 +01:00
|
|
|
function print_agent_name ($id_agent, $return = false, $cutoff = 0) {
|
|
|
|
$agent_name = (string) get_agent_name ($id_agent);
|
2009-02-13 21:23:44 +01:00
|
|
|
$output = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'" title="'.$agent_name.'"><b>';
|
2009-01-07 11:42:38 +01:00
|
|
|
if ($cutoff > 0 && (mb_strlen ($agent_name, "UTF-8") > $cutoff)) {
|
|
|
|
$output .= mb_substr (utf8_decode ($agent_name), 0, $cutoff, "UTF-8").'...';
|
|
|
|
} else {
|
|
|
|
$output .= $agent_name;
|
|
|
|
}
|
|
|
|
$output .= '</b></a>';
|
|
|
|
|
|
|
|
//TODO: Add a pretty javascript (using jQuery) popup-box with agent details
|
|
|
|
|
|
|
|
if ($return)
|
|
|
|
return $output;
|
|
|
|
|
|
|
|
echo $output;
|
|
|
|
}
|
2009-01-15 11:21:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Formats a row from the alert table and returns an array usable in the table function
|
|
|
|
*
|
|
|
|
* @param array A valid (non empty) row from the alert table
|
|
|
|
* @param bool Whether or not this is a combined alert
|
|
|
|
* @param bool Whether to print the agent information with the module information
|
|
|
|
* @param string Tab where the function was called from (used for urls)
|
|
|
|
*
|
|
|
|
* @return array A formatted array with proper html for use in $table->data (6 columns)
|
|
|
|
*/
|
2009-02-11 17:55:04 +01:00
|
|
|
function format_alert_row ($alert, $compound = false, $agent = true, $url = '') {
|
2009-01-15 11:21:38 +01:00
|
|
|
require_once ("include/functions_alerts.php");
|
|
|
|
|
|
|
|
if (empty ($alert))
|
|
|
|
return array ("", "", "", "", "", "", "");
|
|
|
|
|
|
|
|
// Get agent id
|
2009-02-11 17:55:04 +01:00
|
|
|
if ($compound) {
|
|
|
|
$id_agent = $alert['id_agent'];
|
|
|
|
$description = $alert['description'];
|
|
|
|
} else {
|
|
|
|
$id_agent = get_agentmodule_agent ($alert['id_agent_module']);
|
|
|
|
$template = get_alert_template ($alert['id_alert_template']);
|
|
|
|
$description = $template['description'];
|
|
|
|
}
|
2009-01-15 11:21:38 +01:00
|
|
|
$data = array ();
|
|
|
|
|
|
|
|
// Force alert execution
|
|
|
|
$data[0] = '';
|
2009-02-11 17:55:04 +01:00
|
|
|
if (! $compound) {
|
2009-01-15 11:21:38 +01:00
|
|
|
if ($alert["force_execution"] == 0) {
|
|
|
|
$data[0] = '<a href="'.$url.'&id_alert='.$alert["id"].'&force_execution=1&refr=60"><img src="images/target.png" ></a>';
|
|
|
|
} else {
|
|
|
|
$data[0] = '<a href="'.$url.'&id_alert='.$alert["id"].'&refr=60"><img src="images/refresh.png" /></a>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-11 17:55:04 +01:00
|
|
|
if ($compound) {
|
|
|
|
$data[1] = print_agent_name ($id_agent, true, 20);
|
2009-01-15 11:21:38 +01:00
|
|
|
} elseif ($agent == 0) {
|
|
|
|
$data[1] = mb_substr (get_agentmodule_name ($alert["id_agent_module"]), 0, 20);
|
|
|
|
} else {
|
|
|
|
$data[1] = print_agent_name (get_agentmodule_agent ($alert["id_agent_module"]), true, 20);
|
|
|
|
}
|
|
|
|
|
|
|
|
$data[2] = '<span class="left">';
|
2009-02-11 17:55:04 +01:00
|
|
|
$data[2] .= mb_substr (safe_input ($description), 0, 35);
|
|
|
|
$data[2] .= '</span>';
|
|
|
|
if (! $compound) {
|
|
|
|
$data[2] .= ' <span class="right">';
|
|
|
|
$data[2] .= '<a class="template_details" href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$template['id'].'">';
|
|
|
|
$data[2] .= '<img src="images/zoom.png" />';
|
|
|
|
$data[2] .= '</a></span>';
|
|
|
|
}
|
2009-01-15 11:21:38 +01:00
|
|
|
|
|
|
|
$data[3] = print_timestamp ($alert["last_fired"], true);
|
|
|
|
|
|
|
|
$options = array ();
|
2009-02-11 17:55:04 +01:00
|
|
|
$options["height"] = 18;
|
|
|
|
$options["width"] = 40;
|
2009-01-15 11:21:38 +01:00
|
|
|
|
|
|
|
if ($alert["times_fired"] > 0) {
|
|
|
|
$options["src"] = "images/pixel_red.png";
|
|
|
|
$options["title"] = __('Alert fired').' '.$alert["times_fired"].' '.__('times');
|
|
|
|
} elseif ($alert["disabled"] > 0) {
|
|
|
|
$options["src"] = "images/pixel_gray.png";
|
|
|
|
$options["title"] = __('Alert disabled');
|
|
|
|
} else {
|
|
|
|
$options["src"] = "images/pixel_green.png";
|
|
|
|
$options["title"] = __('Alert not fired');
|
|
|
|
}
|
|
|
|
|
|
|
|
$data[4] = print_image ($options["src"], true, $options);
|
|
|
|
|
2009-02-11 17:55:04 +01:00
|
|
|
if ($compound) {
|
|
|
|
$data[5] = print_checkbox ("validate_compound[]", $alert["id"], false, true);
|
|
|
|
} else {
|
|
|
|
$data[5] = print_checkbox ("validate[]", $alert["id"], false, true);
|
|
|
|
}
|
2009-01-15 11:21:38 +01:00
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
2009-01-20 Evi Vanoost <vanooste@rcbi.rochester.edu>
* ajax.php, include/config.inc.php, include/config_process.php,
include/functions.php, include/functions_db.php,
include/functions_ui.php, index.php, install.php,
operation/users/user.php, operation/users/user_edit.php,
reporting/fgraph.php: Added pluggable authentication and moved functions
* general/login_page.php, general/logon_ok.php,
godmode/agentes/modificar_agente.php,
godmode/users/configure_users.php, godmode/users/user_list.php,
operation/agentes/estado_agente.php, operation/incidents/incident.php,
operation/incidents/incident_search.php: Updated functions
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1366 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-20 19:21:20 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prints a substracted string, length specified by cutoff, the full string will be in a rollover.
|
|
|
|
*
|
|
|
|
* @param string The string to be cut
|
|
|
|
* @param int At how much characters to cut
|
|
|
|
* @param bool Whether to return or print it out
|
|
|
|
*
|
|
|
|
* @return An HTML string
|
|
|
|
*/
|
|
|
|
function print_string_substr ($string, $cutoff = 16, $return = false) {
|
2009-02-17 19:20:04 +01:00
|
|
|
if (empty ($string)) {
|
|
|
|
return "";
|
|
|
|
}
|
2009-01-20 Evi Vanoost <vanooste@rcbi.rochester.edu>
* ajax.php, include/config.inc.php, include/config_process.php,
include/functions.php, include/functions_db.php,
include/functions_ui.php, index.php, install.php,
operation/users/user.php, operation/users/user_edit.php,
reporting/fgraph.php: Added pluggable authentication and moved functions
* general/login_page.php, general/logon_ok.php,
godmode/agentes/modificar_agente.php,
godmode/users/configure_users.php, godmode/users/user_list.php,
operation/agentes/estado_agente.php, operation/incidents/incident.php,
operation/incidents/incident_search.php: Updated functions
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1366 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-01-20 19:21:20 +01:00
|
|
|
$string = '<span title="'.safe_input ($string).'">'.mb_substr ($string, 0, $cutoff, "UTF-8").(mb_strlen ($string. "UTF-8") > $cutoff ? '...' : '').'</span>';
|
|
|
|
if ($return === false) {
|
|
|
|
echo $string;
|
|
|
|
}
|
|
|
|
return $string;
|
|
|
|
}
|
2009-01-21 15:56:55 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a helper text explaining the requirement needs for an alert template
|
|
|
|
* to get it fired.
|
|
|
|
*
|
|
|
|
* @param int Alert template id.
|
|
|
|
* @param bool Wheter to return or print it out.
|
2009-01-29 10:06:38 +01:00
|
|
|
* @param bool Wheter to put the values in the string or not.
|
2009-01-21 15:56:55 +01:00
|
|
|
*
|
|
|
|
* @return An HTML string if return was true.
|
|
|
|
*/
|
2009-01-29 10:06:38 +01:00
|
|
|
function print_alert_template_example ($id_alert_template, $return = false, $print_values = true) {
|
2009-01-21 15:56:55 +01:00
|
|
|
$output = '';
|
|
|
|
|
|
|
|
$output .= '<img src="images/information.png" /> ';
|
|
|
|
$output .= '<span id="example">';
|
2009-01-26 11:44:26 +01:00
|
|
|
$template = get_alert_template ($id_alert_template);
|
|
|
|
|
|
|
|
switch ($template['type']) {
|
|
|
|
case 'equal':
|
|
|
|
/* Do not translate the HTML attributes */
|
|
|
|
$output .= __('The alert would fire when the value is <span id="value"></span>');
|
|
|
|
break;
|
|
|
|
case 'not_equal':
|
|
|
|
/* Do not translate the HTML attributes */
|
|
|
|
$output .= __('The alert would fire when the value is not <span id="value"></span>');
|
|
|
|
break;
|
|
|
|
case 'regex':
|
|
|
|
if ($template['matches_value'])
|
2009-01-21 15:56:55 +01:00
|
|
|
/* Do not translate the HTML attributes */
|
2009-01-26 11:44:26 +01:00
|
|
|
$output .= __('The alert would fire when the value matches <span id="value"></span>');
|
|
|
|
else
|
2009-01-21 15:56:55 +01:00
|
|
|
/* Do not translate the HTML attributes */
|
2009-01-26 11:44:26 +01:00
|
|
|
$output .= __('The alert would fire when the value doesn\'t match <span id="value"></span>');
|
|
|
|
$value = $template['value'];
|
|
|
|
break;
|
|
|
|
case 'max_min':
|
|
|
|
if ($template['matches_value'])
|
2009-01-21 15:56:55 +01:00
|
|
|
/* Do not translate the HTML attributes */
|
2009-01-26 11:44:26 +01:00
|
|
|
$output .= __('The alert would fire when the value is between <span id="min"></span> and <span id="max"></span>');
|
|
|
|
else
|
2009-01-21 15:56:55 +01:00
|
|
|
/* Do not translate the HTML attributes */
|
2009-01-26 11:44:26 +01:00
|
|
|
$output .= __('The alert would fire when the value is not between <span id="min"></span> and <span id="max"></span>');
|
|
|
|
break;
|
|
|
|
case 'max':
|
|
|
|
/* Do not translate the HTML attributes */
|
|
|
|
$output .= __('The alert would fire when the value is over <span id="max"></span>');
|
|
|
|
|
|
|
|
break;
|
|
|
|
case 'min':
|
|
|
|
/* Do not translate the HTML attributes */
|
|
|
|
$output .= __('The alert would fire when the value is under <span id="min"></span>');
|
|
|
|
break;
|
2009-01-21 15:56:55 +01:00
|
|
|
}
|
|
|
|
|
2009-01-29 10:06:38 +01:00
|
|
|
if ($print_values) {
|
|
|
|
/* Replace span elements with real values. This is done in such way to avoid
|
|
|
|
duplicating strings and make it easily modificable via Javascript. */
|
|
|
|
$output = str_replace ('<span id="value"></span>', $template['value'], $output);
|
|
|
|
$output = str_replace ('<span id="max"></span>', $template['max_value'], $output);
|
|
|
|
$output = str_replace ('<span id="min"></span>', $template['min_value'], $output);
|
|
|
|
}
|
2009-01-21 15:56:55 +01:00
|
|
|
$output .= '</span>';
|
|
|
|
if ($return)
|
|
|
|
return $output;
|
|
|
|
echo $output;
|
|
|
|
}
|
|
|
|
|
2009-02-13 21:23:44 +01:00
|
|
|
/**
|
|
|
|
* DEPRECATED: Use print_help_icon to avoid confusion with pandora_help javascript function
|
|
|
|
*/
|
|
|
|
function pandora_help ($help_id, $return = false) {
|
|
|
|
return print_help_icon ($help_id, $return);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prints a help tip icon.
|
|
|
|
*
|
|
|
|
* @param string $help_id Id of the help article
|
|
|
|
* @param bool $return Whether to return or output the result
|
|
|
|
*
|
|
|
|
* @return string The help tip
|
|
|
|
*/
|
|
|
|
function print_help_icon ($help_id, $return = false) {
|
|
|
|
$output = ' '.print_image ("images/help.png", true, array ("class" => "img_help", "title" => __('Help'), "onclick" => "pandora_help ('".$help_id."')"));
|
|
|
|
if (!$return)
|
|
|
|
echo $output;
|
|
|
|
|
|
|
|
return $output;
|
|
|
|
}
|
2009-01-07 11:42:38 +01:00
|
|
|
?>
|