2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
< ? php
2008-08-22 20:07:32 +02:00
2009-06-08 20:26:14 +02:00
// Pandora FMS - http://pandorafms.com
// ==================================================
2011-03-02 22:56:48 +01:00
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
2009-06-08 20:26:14 +02:00
// Please see http://pandorafms.org for full contribution list
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
// This program is free software; you can redistribute it and/or
2009-06-08 20:26:14 +02:00
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
// 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.
2009-06-08 20:26:14 +02:00
2009-08-14 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/agent_manager.php, godmode/agentes/massive_config.php,
godmode/alerts/alert_list.php, godmode/reporting/graph_builder.php,
godmode/reporting/map_builder.php, include/functions_db.php,
include/functions_html.php, operation/agentes/exportdata.php,
operation/agentes/ver_agente.php: very changes for add input text
autocomplete with ajax jquery for agent input in several forms. Add to form
this exportdata, graph_builder, map_builder.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1849 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-14 18:38:57 +02:00
/**
2019-01-30 16:18:44 +01:00
* @ package Include
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/ldap.php,
include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/config_process.php,
include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change or add the subpackage in phpdoc
comment blocks for to organize more the result phpdoc files. Start to
document undocument functions.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1882 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-26 17:37:47 +02:00
* @ subpackage HTML
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php,
include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/FusionCharts/FusionCharts_Gen.php,
include/FusionCharts/FusionCharts.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/help/en/help_plugin_parameters.php,
include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php,
include/help/en/help_postprocess.php,
include/help/en/help_prediction_source_module.php,
include/help/en/help_date_format.php, include/help/en/help_recontask.php,
include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php,
include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php,
include/help/en/help_agent_status.php,
include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php,
include/help/en/help_alert_type.php,
include/help/en/help_network_component.php,
include/help/en/help_time_stamp-comparation.php,
include/help/en/help_eventview.php, include/help/en/help_timesource.php,
include/help/en/help_alert_validation.php,
include/help/en/help_map_builder.php,
include/help/en/help_alert_recovery.php,
include/help/en/help_module_type.php,
include/help/en/help_planned_downtime.php,
include/help/en/help_serverlag.php, include/help/en/help_alerts.php,
include/help/en/help_snmpwalk.php,
include/help/en/help_module_definition.php,
include/help/en/help_plugin_definition.php,
include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php
include/help/en/help_manageconfig.php,
include/help/es/help_alert_validation.php,
include/help/es/help_plugin_parameters.php,
include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php,
include/help/es/help_map_builder.php, include/help/es/help_postprocess.php,
include/help/es/help_date_format.php,
include/help/es/help_alert_recovery.php,
include/help/es/help_prediction_source_module.php,
include/help/es/help_module_type.php,
include/help/es/help_planned_downtime.php,
include/help/es/help_alert-matches.php, include/help/es/help_recontask.php,
include/help/es/help_alerts.php, include/help/es/help_serverlag.php,
include/help/es/help_snmpwalk.php,
include/help/es/help_module_definition.php,
include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php,
include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php,
include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php,
include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php,
include/help/es/help_wminamespace.php,
include/help/es/help_network_component.php,
include/help/es/help_time_stamp-comparation.php,
include/help/es/help_manageconfig.php, include/help/es/help_timesource.php,
include/config_process.php, include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change comments blocks for delete the
warnings to construct phpDoc Files, give a struct and order in the
phpDoc files.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
*/
2011-04-20 16:22:40 +02:00
if ( ! isset ( $config )) {
2019-01-30 16:18:44 +01:00
$working_dir = getcwd ();
$working_dir = str_replace ( '\\' , '/' , $working_dir );
2019-02-26 12:04:18 +01:00
// Windows compatibility.
2019-01-30 16:18:44 +01:00
$levels = substr_count ( $working_dir , '/' );
for ( $i = 0 ; $i < $levels ; $i ++ ) {
if ( file_exists ( str_repeat ( '../' , $i ) . 'config.php' )) {
include_once str_repeat ( '../' , $i ) . 'config.php' ;
break ;
2019-02-26 12:04:18 +01:00
// Skip config.php loading after load the first one.
2019-01-30 16:18:44 +01:00
} else if ( file_exists ( str_repeat ( '../' , $i ) . 'include/config.php' )) {
// For path from the enterprise structure dirs.
include_once str_repeat ( '../' , $i ) . 'include/config.php' ;
break ;
2019-02-26 12:04:18 +01:00
// Skip config.php loading after load the first one.
2019-01-30 16:18:44 +01:00
}
}
} else {
include_once $config [ 'homedir' ] . '/include/functions.php' ;
include_once $config [ 'homedir' ] . '/include/functions_users.php' ;
include_once $config [ 'homedir' ] . '/include/functions_groups.php' ;
include_once $config [ 'homedir' ] . '/include/functions_ui.php' ;
2017-03-22 15:26:54 +01:00
}
2012-02-24 Miguel de Dios <miguel.dedios@artica.es>
* pandora_console/include/functions_ui.php: changed the source code into the
function "ui_get_full_url" for accept false for to return url with the home
url or with any string (as query) return url with the php file.
* pandora_console/include/functions_graph.php,
pandora_console/include/functions_html.php,
pandora_console/include/functions_events.php,
pandora_console/include/functions_reporting.php,
pandora_console/include/functions_api.php,
pandora_console/include/functions.php, pandora_console/index.php,
pandora_console/extensions/system_info.php,
pandora_console/operation/agentes/stat_win.php,
pandora_console/operation/menu.php,
pandora_console/operation/events/events_rss.php,
pandora_console/operation/events/events_marquee.php,
pandora_console/operation/events/events.php: change in more part of source
code to use "ui_get_full_url" instead the hard write method of $_SERVER
vars, now Pandora Console run fine (in all actions I hope) with web servers
in other ports instead the typical 80.
Merged from branch pandora_4.0
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5646 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-02-24 14:48:46 +01:00
* include/functions_graph.php
include/functions_html.php
include/functions_messages.php
include/db/postgresql.php
include/db/mysql.php
include/db/oracle.php
include/functions_reporting.php
include/functions_filemanager.php
include/functions_gis.php
include/auth/ldap.php
include/auth/mysql.php
include/functions_networkmap.php
include/functions_network_components.php
include/ajax/skins.ajax.php
include/ajax/reporting.ajax.php
include/ajax/visual_console_builder.ajax.php
include/ajax/alert_list.ajax.php
include/ajax/module.php
include/functions_config.php
include/functions_api.php
include/help/en/help_timesource.php
include/help/es/help_timesource.php
include/help/ja/help_timesource.php
include/config_process.php
include/functions_ui.php
include/functions_custom_graphs.php
include/fgraph.php
include/functions_incidents.php
include/api.php
include/functions_reports.php
include/functions_ui_renders.php
extensions/insert_data.php
extensions/system_info.php
extensions/extension_uploader.php
extensions/pandora_logs.php
extensions/agents_modules.php
extensions/update_manager.php
extensions/ssh_console.php
extensions/dbmanager.php
extensions/vnc_view.php
extensions/resource_registration.php
extensions/resource_exportation.php
extensions/users_connected.php
extensions/module_groups.php
extensions/update_manager/load_updatemanager.php
extensions/update_manager/lib/libupdate_manager_client.php
extensions/update_manager/lib/libupdate_manager.php
extensions/update_manager/lib/libupdate_manager_components.php
extensions/update_manager/lib/libupdate_manager_updates.php
extensions/update_manager/settings.php
extensions/update_manager/main.php
extensions/plugin_registration.php
operation/incidents/incident.php
operation/incidents/incident_detail.php
operation/incidents/incident_statistics.php
operation/search_modules.php
operation/visual_console/render_view.php
operation/visual_console/index.php
operation/extensions.php
operation/agentes/status_monitor.php
operation/agentes/export_csv.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/datos_agente.php
operation/agentes/alerts_status.php
operation/agentes/estado_generalagente.php
operation/agentes/custom_fields.php
operation/agentes/estado_agente.php
operation/agentes/networkmap.topology.php
operation/agentes/networkmap.groups.php
operation/agentes/sla_view.php
operation/agentes/exportdata.php
operation/agentes/gis_view.php
operation/agentes/estado_monitores.php
operation/agentes/ver_agente.php
operation/agentes/graphs.php
operation/agentes/agent_fields.php
operation/agentes/tactical.php
operation/agentes/group_view.php
operation/agentes/networkmap.php
operation/agentes/stat_win.php
operation/servers/view_server.php
operation/servers/view_server_detail.php
operation/menu.php
operation/search_agents.php
operation/search_graphs.php
operation/snmpconsole/snmp_view.php
operation/users/user_edit.php
operation/gis_maps/render_view.php
operation/gis_maps/ajax.php
operation/integria_incidents/incident.php
operation/integria_incidents/incident_detail.php
operation/integria_incidents/incident_statistics.php
operation/events/event_statistics.php
operation/events/events_rss.php
operation/events/export_csv.php
operation/events/sound_events.php
operation/events/events_validate.php
operation/events/events_list.php
operation/events/events_marquee.php
operation/events/events.php
operation/search_alerts.php
operation/messages/message.php
operation/reporting/reporting_xml.php
operation/reporting/reporting_viewer.php
operation/reporting/graph_viewer.php
operation/search_reports.php
operation/search_maps.php
operation/search_users.php
extras/pandora_diag.php
mobile/operation/agents/monitor_status.php
mobile/operation/agents/view_agents.php
mobile/operation/agents/view_alerts.php
mobile/operation/agents/group_view.php
mobile/operation/events/events.php
mobile/index.php
general/error_authconfig.php
general/links_menu.php
general/logon_ok.php
general/error_dbconfig.php
general/ui/agents_list.php
general/header.php
godmode/groups/modu_group_list.php
godmode/groups/configure_group.php
godmode/groups/configure_modu_group.php
godmode/groups/group_list.php
godmode/admin_access_logs.php
godmode/db/db_main.php
godmode/db/db_audit.php
godmode/db/db_sanity.php
godmode/db/db_refine.php
godmode/db/db_info.php
godmode/db/db_event.php
godmode/db/db_purge.php
godmode/extensions.php
godmode/agentes/agent_template.php
godmode/agentes/module_manager_editor_common.php
godmode/agentes/fields_manager.php
godmode/agentes/agent_conf_gis.php
godmode/agentes/module_manager_editor_prediction.php
godmode/agentes/module_manager.php
godmode/agentes/modificar_agente.php
godmode/agentes/configurar_agente.php
godmode/agentes/configure_field.php
godmode/agentes/module_manager_editor.php
godmode/agentes/planned_downtime.php
godmode/agentes/manage_config_remote.php
godmode/agentes/agent_manager.php
godmode/servers/recon_script.php
godmode/servers/plugin.php
godmode/servers/manage_recontask.php
godmode/servers/modificar_server.php
godmode/servers/manage_recontask_form.php
godmode/alerts/alert_list.list.php
godmode/alerts/configure_alert_compound.php
godmode/alerts/alert_compounds.php
godmode/alerts/alert_list.php
godmode/alerts/configure_alert_template.php
godmode/alerts/alert_templates.php
godmode/alerts/configure_alert_action.php
godmode/alerts/configure_alert_command.php
godmode/alerts/alert_actions.php
godmode/alerts/alert_list.builder.php
godmode/alerts/alert_commands.php
godmode/setup/file_manager.php
godmode/setup/os.list.php
godmode/setup/news.php
godmode/setup/gis_step_2.php
godmode/setup/links.php
godmode/setup/setup.php
godmode/setup/os.php
godmode/setup/performance.php
godmode/setup/setup_auth.php
godmode/setup/gis.php
godmode/setup/os.builder.php
godmode/setup/setup_visuals.php
godmode/snmpconsole/snmp_alert.php
godmode/snmpconsole/snmp_filters.php
godmode/users/user_list.php
godmode/users/configure_profile.php
godmode/gis_maps/configure_gis_map.php
godmode/gis_maps/index.php
godmode/massive/massive_add_alerts.php
godmode/massive/massive_copy_modules.php
godmode/massive/massive_delete_agents.php
godmode/massive/massive_enable_disable_alerts.php
godmode/massive/massive_operations.php
godmode/massive/massive_delete_profiles.php
godmode/massive/massive_edit_agents.php
godmode/massive/massive_delete_action_alerts.php
godmode/massive/massive_delete_modules.php
godmode/massive/massive_add_profiles.php
godmode/massive/massive_delete_alerts.php
godmode/massive/massive_edit_modules.php
godmode/massive/massive_standby_alerts.php
godmode/massive/massive_add_action_alerts.php
godmode/modules/manage_network_components_form.php
godmode/modules/manage_nc_groups_form.php
godmode/modules/manage_network_templates.php
godmode/modules/module_list.php
godmode/modules/manage_network_components_form_common.php
godmode/modules/manage_network_components_form_network.php
godmode/modules/manage_network_templates_form.php
godmode/modules/manage_network_components_form_wmi.php
godmode/modules/manage_network_components.php
godmode/modules/manage_nc_groups.php
godmode/reporting/visual_console_builder.wizard.php
godmode/reporting/graph_builder.main.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/visual_console_builder.php
godmode/reporting/reporting_builder.preview.php
godmode/reporting/reporting_builder.main.php
godmode/reporting/visual_console_builder.data.php
godmode/reporting/visual_console_builder.elements.php
godmode/reporting/graph_builder.php
godmode/reporting/visual_console_builder.preview.php
godmode/reporting/graph_builder.graph_editor.php
godmode/reporting/reporting_builder.php
godmode/reporting/visual_console_builder.editor.php
godmode/reporting/reporting_builder.item_editor.php
godmode/reporting/map_builder.php
godmode/reporting/graphs.php
godmode/reporting/graph_builder.preview.php
include/functions_db.php: Added some includes and functions of this code have "db_" prefix.
* include/functions.php: Moved function check_login(), check_acl(),
dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php.
* include/functions_groups.php: Moved functions get_childrens(), safe_acl_group()
and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(),
get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(),
get_group_name(), get_group_users() from functions_db.php to this code.
* include/functions_profile.php: New library with profile functions. Moved functions
get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(),
delete_profile() from functions_db.php to this code. Added new parameter in function
get_profile() to retrieve profiles with filter conditions applied.
* include/functions_users.php: New library with users functions. Moved functions
get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(),
get_user_first_group(), user_access_to_agent() from funtions_db.php to this code.
* godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile().
* include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(),
get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(),
check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(),
agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(),
get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(),
get_agent_group() from functions_db.php to this code.
* include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(),
get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(),
get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(),
get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(),
get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(),
get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(),
get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(),
give_modulecategory_name(),
give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(),
get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(),
get_modulegroup_name() from functions_db.php to this code.
* include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(),
get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(),
get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(),
get_agentmodule_last_status() from functions_db.php to this code.
* include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion()
from functions_db.php to this code.
* include/functions_events.php: Moved functions get_group_events(), get_agent_events(),
get_module_events() from functions_db.php to this code.
* include/functions_servers.php: Moved functions get_server_name(), show_server_type(),
check_server_status(), server_status() from functions_db.php to this code.
* include/functions_network_profiles.php: Moved function get_networkprofile_name()
from functions_db.php to this code.
* include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y()
from fucntions_db.php to this code.
* include/functions_io.php: Moved function __() from functions_db.php to this code.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
2009-08-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_menu.php, include/functions_html.php,
include/functions_events.php, include/functions_messages.php,
include/functions_modules.php, include/functions_exportserver.php,
include/functions_reporting.php, include/functions_filemanager.php,
include/pchart_graph.php, include/pandora_graph.php, include/auth/dev.php,
include/auth/ldap.php, include/auth/mysql.php, include/config.inc.php,
include/functions_networkmap.php, include/functions_servers.php,
include/FusionCharts/FusionCharts_Gen.php,
include/FusionCharts/FusionCharts.php,
include/functions_network_profiles.php, include/gettext.php,
include/functions_network_components.php, include/functions_visual_map.php,
include/fgraph2.php, include/Image/image_functions.php,
include/functions_config.php, include/help/en/help_plugin_parameters.php,
include/help/en/help_snmpcommunity.php, include/help/en/help_wmiquery.php,
include/help/en/help_postprocess.php,
include/help/en/help_prediction_source_module.php,
include/help/en/help_date_format.php, include/help/en/help_recontask.php,
include/help/en/help_alert-matches.php, include/help/en/help_tcp_send.php,
include/help/en/help_wmifield.php, include/help/en/help_duplicateconfig.php,
include/help/en/help_agent_status.php,
include/help/en/help_manage_alerts.php, include/help/en/help_wmikey.php,
include/help/en/help_alert_type.php,
include/help/en/help_network_component.php,
include/help/en/help_time_stamp-comparation.php,
include/help/en/help_eventview.php, include/help/en/help_timesource.php,
include/help/en/help_alert_validation.php,
include/help/en/help_map_builder.php,
include/help/en/help_alert_recovery.php,
include/help/en/help_module_type.php,
include/help/en/help_planned_downtime.php,
include/help/en/help_serverlag.php, include/help/en/help_alerts.php,
include/help/en/help_snmpwalk.php,
include/help/en/help_module_definition.php,
include/help/en/help_plugin_definition.php,
include/help/en/help_wminamespace.php, include/help/en/help_snmpoid.php
include/help/en/help_manageconfig.php,
include/help/es/help_alert_validation.php,
include/help/es/help_plugin_parameters.php,
include/help/es/help_snmpcommunity.php, include/help/es/help_wmiquery.php,
include/help/es/help_map_builder.php, include/help/es/help_postprocess.php,
include/help/es/help_date_format.php,
include/help/es/help_alert_recovery.php,
include/help/es/help_prediction_source_module.php,
include/help/es/help_module_type.php,
include/help/es/help_planned_downtime.php,
include/help/es/help_alert-matches.php, include/help/es/help_recontask.php,
include/help/es/help_alerts.php, include/help/es/help_serverlag.php,
include/help/es/help_snmpwalk.php,
include/help/es/help_module_definition.php,
include/help/es/help_tcp_send.php, include/help/es/help_duplicateconfig.php,
include/help/es/help_wmifield.php, include/help/es/help_manage_alerts.php,
include/help/es/help_wmikey.php, include/help/es/help_plugin_definition.php,
include/help/es/help_alert_type.php, include/help/es/help_snmpoid.php,
include/help/es/help_wminamespace.php,
include/help/es/help_network_component.php,
include/help/es/help_time_stamp-comparation.php,
include/help/es/help_manageconfig.php, include/help/es/help_timesource.php,
include/config_process.php, include/functions_ui.php, include/htmlawed.php,
include/functions_custom_graphs.php, include/fgraph.php,
include/functions_incidents.php, include/functions.php,
include/functions_agents.php, include/functions_db.php,
include/functions_themes.php, include/streams.php,
include/functions_fsgraph.php, include/functions_alerts.php,
include/functions_reports.php, include/functions_extensions.php,
include/functions_ui_renders.php: change comments blocks for delete the
warnings to construct phpDoc Files, give a struct and order in the
phpDoc files.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-25 19:39:28 +02:00
/**
* Prints the print_r with < pre > tags
2009-08-14 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/agent_manager.php, godmode/agentes/massive_config.php,
godmode/alerts/alert_list.php, godmode/reporting/graph_builder.php,
godmode/reporting/map_builder.php, include/functions_db.php,
include/functions_html.php, operation/agentes/exportdata.php,
operation/agentes/ver_agente.php: very changes for add input text
autocomplete with ajax jquery for agent input in several forms. Add to form
this exportdata, graph_builder, map_builder.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1849 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-14 18:38:57 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_debug_print ( $var , $file = '' , $oneline = false )
{
$more_info = '' ;
if ( is_string ( $var )) {
$more_info = 'size: ' . strlen ( $var );
} else if ( is_bool ( $var )) {
$more_info = 'val: ' . ( $var ? 'true' : 'false' );
} else if ( is_null ( $var )) {
$more_info = 'is null' ;
} else if ( is_array ( $var )) {
$more_info = count ( $var );
}
if ( $file === true ) {
$file = '/tmp/logDebug' ;
}
if ( $oneline && is_string ( $var )) {
$var = preg_replace ( " /[ \t | \n | ]+/ " , ' ' , $var );
}
if ( strlen ( $file ) > 0 ) {
$f = fopen ( $file , 'a' );
ob_start ();
echo date ( 'Y/m/d H:i:s' ) . ' (' . gettype ( $var ) . ') ' . $more_info . " \n " ;
print_r ( $var );
echo " \n \n " ;
$output = ob_get_clean ();
fprintf ( $f , '%s' , $output );
fclose ( $f );
} else {
echo '<pre>' . date ( 'Y/m/d H:i:s' ) . ' (' . gettype ( $var ) . ') ' . $more_info . '</pre>' ;
echo '<pre>' ;
print_r ( $var );
echo '</pre>' ;
}
2009-08-14 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/agent_manager.php, godmode/agentes/massive_config.php,
godmode/alerts/alert_list.php, godmode/reporting/graph_builder.php,
godmode/reporting/map_builder.php, include/functions_db.php,
include/functions_html.php, operation/agentes/exportdata.php,
operation/agentes/ver_agente.php: very changes for add input text
autocomplete with ajax jquery for agent input in several forms. Add to form
this exportdata, graph_builder, map_builder.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1849 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2009-08-14 18:38:57 +02:00
}
2019-01-30 16:18:44 +01:00
2015-03-09 20:20:37 +01:00
// Alias for "html_debug_print"
2019-01-30 16:18:44 +01:00
function html_debug ( $var , $file = '' , $oneline = false )
{
html_debug_print ( $var , $file , $oneline );
2018-09-20 16:00:08 +02:00
}
2019-01-30 16:18:44 +01:00
2018-09-20 16:00:08 +02:00
// Alias for "html_debug_print"
2019-01-30 16:18:44 +01:00
function hd ( $var , $file = '' , $oneline = false )
{
html_debug_print ( $var , $file , $oneline );
2015-03-09 20:20:37 +01:00
}
2019-01-30 16:18:44 +01:00
function debug ()
{
$args_num = func_num_args ();
$arg_list = func_get_args ();
for ( $i = 0 ; $i < $args_num ; $i ++ ) {
html_debug_print ( $arg_list [ $i ], true );
}
2018-12-10 09:20:06 +01:00
}
2019-01-30 16:18:44 +01:00
function html_f2str ( $function , $params )
{
ob_start ();
call_user_func_array ( $function , $params );
return ob_get_clean ();
2009-12-22 13:56:46 +01:00
}
2019-01-30 16:18:44 +01:00
2013-02-18 19:10:53 +01:00
/**
* Print side layer
2019-01-30 16:18:44 +01:00
*
2013-02-18 19:10:53 +01:00
* @ params mixed Hash with all the params :
2019-01-30 16:18:44 +01:00
*
* position : left or right
2013-02-18 19:10:53 +01:00
* width : width of the layer
2019-01-30 16:18:44 +01:00
* height : height of the layer
* icon_closed : icon showed when layer is hidden
* icon_open : icon showed when layer is showed
* top_text : text over the content
* body_text : content of layer
* bottom_text : text under the contet
2013-02-18 19:10:53 +01:00
*
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_side_layer ( $params )
{
global $config ;
// Check mandatory values, if any of them is missed, return ''
$mandatory = [
'icon_closed' ,
'body_text' ,
];
foreach ( $mandatory as $man ) {
if ( ! isset ( $params [ $man ])) {
return '' ;
}
}
// Set default values if not setted
$defaults = [
'position' => 'left' ,
'width' => '400' ,
'height' => '97%' ,
'top_text' => '' ,
'bottom_text' => '' ,
'top' => '0' ,
'autotop' => '' ,
'right' => '0' ,
'autoright' => '' ,
'vertical_mode' => 'out' ,
'icon_width' => 50 ,
'icon_height' => 50 ,
'icon_open' => $params [ 'icon_closed' ],
];
foreach ( $defaults as $token => $value ) {
if ( ! isset ( $params [ $token ])) {
$params [ $token ] = $value ;
}
}
// z-index is 1 because 2 made the calendar show under the side_layer
switch ( $params [ 'position' ]) {
case 'left' :
$round_class = 'menu_sidebar_radius_right' ;
$body_float = 'left' ;
$button_float = 'right' ;
break ;
case 'right' :
$round_class = 'menu_sidebar_radius_left' ;
$body_float = 'right' ;
$button_float = 'left' ;
break ;
case 'bottom' :
$round_class = 'menu_sidebar_radius_left menu_sidebar_radius_right' ;
$body_float = 'right' ;
$button_float = 'left' ;
break ;
}
$out_html = '<div id="side_layer" class="menu_sidebar ' . $round_class . '" style="display:none; z-index:1; overflow: hidden; height: ' . $params [ 'height' ] . '; width: ' . $params [ 'width' ] . ';">' ;
$table = new stdClass ();
$table -> id = 'side_layer_layout' ;
$table -> width = $params [ 'width' ] . 'px' ;
$table -> cellspacing = 2 ;
$table -> cellpadding = 2 ;
$table -> class = 'none' ;
$top = '<div id="side_top_text" style="width: 100%";">' . $params [ 'top_text' ] . '</div>' ;
$button = '<div id="show_menu" style="vertical-align: middle; position: relative; width: ' . $params [ 'icon_width' ] . 'px; padding-right: 17px; text-align: right; height: ' . $params [ 'icon_height' ] . 'px;">' ;
// Use the no_meta parameter because this image is only in the base console
$button .= html_print_image (
$params [ 'position' ] == 'left' ? $params [ 'icon_open' ] : $params [ 'icon_closed' ],
true ,
[ 'id' => 'graph_menu_arrow' ],
false ,
false ,
true
);
$button .= '</div>' ;
$body = '<div id="side_body_text" style="width: 100%;">' . $params [ 'body_text' ] . '</div>' ;
$bottom = '<div id="side_bottom_text" style="text-align: ' . $params [ 'position' ] . ';">' . $params [ 'bottom_text' ] . '</div>' ;
switch ( $params [ 'position' ]) {
case 'left' :
$table -> size [ 1 ] = '15%' ;
$table -> data [ 0 ][ 0 ] = $top ;
$table -> data [ 0 ][ 1 ] = '' ;
$table -> rowclass [ 0 ] = '' ;
$table -> data [ 1 ][ 0 ] = $body ;
$table -> data [ 1 ][ 1 ] = $button ;
$table -> rowclass [ 1 ] = '' ;
$table -> data [ 2 ][ 0 ] = $bottom ;
$table -> data [ 2 ][ 1 ] = '' ;
$table -> rowclass [ 2 ] = '' ;
break ;
case 'right' :
$table -> size [ 0 ] = '15%' ;
$table -> data [ 0 ][ 0 ] = '' ;
$table -> data [ 0 ][ 1 ] = $top ;
$table -> rowclass [ 0 ] = '' ;
$table -> data [ 1 ][ 0 ] = $button ;
$table -> data [ 1 ][ 1 ] = $body ;
$table -> rowclass [ 1 ] = '' ;
$table -> data [ 2 ][ 0 ] = '' ;
$table -> data [ 2 ][ 1 ] = $bottom ;
$table -> rowclass [ 2 ] = '' ;
break ;
case 'bottom' :
$table -> data [ 0 ][ 0 ] = $button ;
$table -> cellstyle [ 0 ][ 0 ] = 'text-align: center;' ;
$table -> rowclass [ 0 ] = '' ;
$table -> data [ 1 ][ 0 ] = $top ;
$table -> rowclass [ 1 ] = '' ;
$table -> data [ 2 ][ 0 ] = $body ;
$table -> rowclass [ 2 ] = '' ;
$table -> data [ 3 ][ 0 ] = $bottom ;
$table -> rowclass [ 3 ] = '' ;
break ;
}
$out_html .= html_print_table ( $table , true );
$out_html .= '</div>' ;
$out_js = " <script type='text/javascript'>
2013-02-18 19:10:53 +01:00
<!--
2019-01-30 16:18:44 +01:00
hidded_sidebar ( '".$params[' position ']."' , " . $params['width'] . " , '".$params[' height ']."' , " . $params['icon_width'] . " ,
'".$params[' top ']."' , '".$params[' autotop ']."' , '".$params[' right ']."' ,
'".$params[' autoright ']."' , '".$params[' icon_closed ']."' , '".$params[' icon_open ']."' , '".$config[' homeurl ']."'
, '".$params[' vertical_mode ']."' );
2013-02-18 19:10:53 +01:00
//-->
</ script > " ;
2019-01-30 16:18:44 +01:00
echo $out_html . $out_js ;
2013-02-18 19:10:53 +01:00
}
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
2019-01-30 16:18:44 +01:00
2009-07-22 17:26:31 +02:00
/**
* Prints an array of fields in a popup menu of a form .
2019-01-30 16:18:44 +01:00
*
* Based on choose_from_menu () from Moodle
*
2009-07-22 17:26:31 +02:00
* @ param array Array with dropdown values . Example : $fields [ " value " ] = " label "
* @ param string Select form name
* @ param variant Current selected value . Can be a single value or an
* array of selected values ( in combination with multiple )
* @ param string Javascript onChange code .
* @ param string Label when nothing is selected .
* @ param variant Value when nothing is selected
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
* @ param bool Set the input to allow multiple selections ( optional , single selection by default ) .
* @ param bool Whether to sort the options or not ( optional , unsorted by default ) .
*
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_select_style ( $fields , $name , $selected = '' , $style = '' , $script = '' , $nothing = '' , $nothing_value = 0 , $return = false , $multiple = false , $sort = true , $class = '' , $disabled = false )
{
$output = " \n " ;
static $idcounter = [];
// If duplicate names exist, it will start numbering. Otherwise it won't
if ( isset ( $idcounter [ $name ])) {
$idcounter [ $name ] ++ ;
} else {
$idcounter [ $name ] = 0 ;
}
$id = preg_replace ( '/[^a-z0-9\:\;\-\_]/i' , '' , $name . ( $idcounter [ $name ] ? $idcounter [ $name ] : '' ));
$attributes = '' ;
if ( ! empty ( $script )) {
$attributes .= ' onchange="' . $script . '"' ;
}
if ( ! empty ( $multiple )) {
$attributes .= ' multiple="multiple" size="10"' ;
}
if ( ! empty ( $class )) {
$attributes .= ' class="' . $class . '"' ;
}
if ( ! empty ( $disabled )) {
$attributes .= ' disabled="disabled"' ;
}
$output .= '<select style="' . $style . '" id="' . $id . '" name="' . $name . '"' . $attributes . '>' ;
if ( $nothing != '' || empty ( $fields )) {
if ( $nothing == '' ) {
$nothing = __ ( 'None' );
}
$output .= '<option value="' . $nothing_value . '"' ;
if ( $nothing_value == $selected ) {
$output .= ' selected="selected"' ;
}
$output .= '>' . $nothing . '</option>' ;
}
if ( ! empty ( $fields )) {
if ( $sort !== false ) {
asort ( $fields );
}
foreach ( $fields as $value => $label ) {
$output .= '<option value="' . $value . '"' ;
if ( is_array ( $selected ) && in_array ( $value , $selected )) {
$output .= ' selected="selected"' ;
} else if ( is_numeric ( $value ) && is_numeric ( $selected ) && $value == $selected ) {
// This fixes string ($value) to int ($selected) comparisons
$output .= ' selected="selected"' ;
} else if ( $value === $selected ) {
// Needs type comparison otherwise if $selected = 0 and $value = "string" this would evaluate to true
$output .= ' selected="selected"' ;
}
if ( $label === '' ) {
$output .= '>' . $value . '</option>' ;
} else {
$output .= '>' . $label . '</option>' ;
}
}
}
$output .= '</select>' ;
if ( $return ) {
return $output ;
}
echo $output ;
2009-07-22 17:26:31 +02:00
}
2019-01-30 16:18:44 +01:00
2010-07-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: added the function "print_select_groups" to
print the field select box for groups with tree style.
* include/functions_db.php: in function "get_user_groups" added test to
false value in parameter $privilege for get all groups without ACL test.
Fixed in function "get_user_groups_tree" the call to "get_user_groups" with
the correct parameters.
* operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/events/events.php, operation/agentes/status_monitor.php,
operation/agentes/estado_agente.php,
operation/agentes/alerts_status.functions.php,
operation/agentes/exportdata.php, operation/agentes/networkmap.php,
operation/messages/message.php, general/ui/agents_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/agentes/massive_add_alerts.php,
godmode/agentes/massive_delete_agents.php,
godmode/agentes/massive_config.php,
godmode/agentes/massive_delete_action_alerts.php,
godmode/agentes/massive_delete_alerts.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/massive_delete_modules.php,
godmode/agentes/massive_add_action_alerts.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/configure_alert_action.php, godmode/setup/gis_step_2.php,
godmode/users/configure_user.php, godmode/gis_maps/configure_gis_map.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/visual_console_builder.data.php: changed the fields select
box of group to tree style select box for groups.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3009 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-07-15 17:20:43 +02:00
/**
* Prints the groups of user of fields in a popup menu of a form .
2019-01-30 16:18:44 +01:00
*
2010-07-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: added the function "print_select_groups" to
print the field select box for groups with tree style.
* include/functions_db.php: in function "get_user_groups" added test to
false value in parameter $privilege for get all groups without ACL test.
Fixed in function "get_user_groups_tree" the call to "get_user_groups" with
the correct parameters.
* operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/events/events.php, operation/agentes/status_monitor.php,
operation/agentes/estado_agente.php,
operation/agentes/alerts_status.functions.php,
operation/agentes/exportdata.php, operation/agentes/networkmap.php,
operation/messages/message.php, general/ui/agents_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/agentes/massive_add_alerts.php,
godmode/agentes/massive_delete_agents.php,
godmode/agentes/massive_config.php,
godmode/agentes/massive_delete_action_alerts.php,
godmode/agentes/massive_delete_alerts.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/massive_delete_modules.php,
godmode/agentes/massive_add_action_alerts.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/configure_alert_action.php, godmode/setup/gis_step_2.php,
godmode/users/configure_user.php, godmode/gis_maps/configure_gis_map.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/visual_console_builder.data.php: changed the fields select
box of group to tree style select box for groups.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3009 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-07-15 17:20:43 +02:00
* @ param string User id
* @ param string The privilege to evaluate
2019-01-30 16:18:44 +01:00
* @ param boolean $returnAllGroup Flag the return group , by default true .
* @ param boolean $returnAllColumns Flag to return all columns of groups .
2010-07-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: added the function "print_select_groups" to
print the field select box for groups with tree style.
* include/functions_db.php: in function "get_user_groups" added test to
false value in parameter $privilege for get all groups without ACL test.
Fixed in function "get_user_groups_tree" the call to "get_user_groups" with
the correct parameters.
* operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/events/events.php, operation/agentes/status_monitor.php,
operation/agentes/estado_agente.php,
operation/agentes/alerts_status.functions.php,
operation/agentes/exportdata.php, operation/agentes/networkmap.php,
operation/messages/message.php, general/ui/agents_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/agentes/massive_add_alerts.php,
godmode/agentes/massive_delete_agents.php,
godmode/agentes/massive_config.php,
godmode/agentes/massive_delete_action_alerts.php,
godmode/agentes/massive_delete_alerts.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/massive_delete_modules.php,
godmode/agentes/massive_add_action_alerts.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/configure_alert_action.php, godmode/setup/gis_step_2.php,
godmode/users/configure_user.php, godmode/gis_maps/configure_gis_map.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/visual_console_builder.data.php: changed the fields select
box of group to tree style select box for groups.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3009 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-07-15 17:20:43 +02:00
* @ param array Array with dropdown values . Example : $fields [ " value " ] = " label "
* @ param string Select form name
* @ param variant Current selected value . Can be a single value or an
2012-12-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/lib/libupdate_manager_client.php,
extensions/update_manager/lib/libupdate_manager.php,
operation/agentes/ver_agente.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_agente.php,
operation/integria_incidents/incident.php,
operation/reporting/reporting_xml.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.elements.php,
include/functions_visual_map.php,
include/functions_visual_map_editor.php: uploaded the changes of
source code style previous to my next commit for to make the next
commit more easy.
* godmode/reporting/visual_console_builder.php: set empty string
for the new visualmap.
* include/ajax/visual_console_builder.ajax.php: fixed the regular
expresion to extract the url for the graph.
* include/functions_html.php: fixed into the function
"html_print_select_groups" lost code for to show the selectbox.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7230 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-05 15:20:47 +01:00
* array of selected values ( in combination with multiple )
2010-07-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: added the function "print_select_groups" to
print the field select box for groups with tree style.
* include/functions_db.php: in function "get_user_groups" added test to
false value in parameter $privilege for get all groups without ACL test.
Fixed in function "get_user_groups_tree" the call to "get_user_groups" with
the correct parameters.
* operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/events/events.php, operation/agentes/status_monitor.php,
operation/agentes/estado_agente.php,
operation/agentes/alerts_status.functions.php,
operation/agentes/exportdata.php, operation/agentes/networkmap.php,
operation/messages/message.php, general/ui/agents_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/agentes/massive_add_alerts.php,
godmode/agentes/massive_delete_agents.php,
godmode/agentes/massive_config.php,
godmode/agentes/massive_delete_action_alerts.php,
godmode/agentes/massive_delete_alerts.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/massive_delete_modules.php,
godmode/agentes/massive_add_action_alerts.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/configure_alert_action.php, godmode/setup/gis_step_2.php,
godmode/users/configure_user.php, godmode/gis_maps/configure_gis_map.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/visual_console_builder.data.php: changed the fields select
box of group to tree style select box for groups.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3009 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-07-15 17:20:43 +02:00
* @ param string Javascript onChange code .
* @ param string Label when nothing is selected .
* @ param variant Value when nothing is selected
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
* @ param bool Set the input to allow multiple selections ( optional , single selection by default ) .
* @ param bool Whether to sort the options or not ( optional , unsorted by default ) .
2019-01-30 16:18:44 +01:00
* @ param string $style The string of style .
* @ param integer $id_group The id of node that must do not show the children and own .
* @ param string $keys_field The field of the group used in the array keys . By default ID
2010-07-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: added the function "print_select_groups" to
print the field select box for groups with tree style.
* include/functions_db.php: in function "get_user_groups" added test to
false value in parameter $privilege for get all groups without ACL test.
Fixed in function "get_user_groups_tree" the call to "get_user_groups" with
the correct parameters.
* operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/events/events.php, operation/agentes/status_monitor.php,
operation/agentes/estado_agente.php,
operation/agentes/alerts_status.functions.php,
operation/agentes/exportdata.php, operation/agentes/networkmap.php,
operation/messages/message.php, general/ui/agents_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/agentes/massive_add_alerts.php,
godmode/agentes/massive_delete_agents.php,
godmode/agentes/massive_config.php,
godmode/agentes/massive_delete_action_alerts.php,
godmode/agentes/massive_delete_alerts.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/massive_delete_modules.php,
godmode/agentes/massive_add_action_alerts.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/configure_alert_action.php, godmode/setup/gis_step_2.php,
godmode/users/configure_user.php, godmode/gis_maps/configure_gis_map.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/visual_console_builder.data.php: changed the fields select
box of group to tree style select box for groups.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3009 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-07-15 17:20:43 +02:00
*
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_select_groups (
$id_user = false ,
$privilege = 'AR' ,
$returnAllGroup = true ,
$name ,
$selected = '' ,
$script = '' ,
$nothing = '' ,
$nothing_value = 0 ,
$return = false ,
$multiple = false ,
$sort = true ,
$class = '' ,
$disabled = false ,
$style = false ,
$option_style = false ,
$id_group = false ,
$keys_field = 'id_grupo' ,
$strict_user = false ,
$delete_groups = false ,
$include_groups = false
) {
global $config ;
$fields = users_get_groups_for_select (
$id_user ,
$privilege ,
$returnAllGroup ,
true ,
$id_group ,
$keys_field
);
if ( $delete_groups && is_array ( $delete_groups )) {
foreach ( $delete_groups as $value ) {
unset ( $fields [ $value ]);
}
}
if ( is_array ( $include_groups )) {
$field = [];
foreach ( $include_groups as $value ) {
$field [ $value ] = $fields [ $value ];
}
$fields = array_intersect ( $fields , $field );
}
if ( $strict_user ) {
$fields = users_get_strict_mode_groups ( $config [ 'id_user' ], $returnAllGroup );
}
$output = html_print_select (
$fields ,
$name ,
$selected ,
$script ,
$nothing ,
$nothing_value ,
$return ,
$multiple ,
false ,
$class ,
$disabled ,
$style ,
$option_style
);
if ( $return ) {
return $output ;
} else {
echo $output ;
}
2010-07-15 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: added the function "print_select_groups" to
print the field select box for groups with tree style.
* include/functions_db.php: in function "get_user_groups" added test to
false value in parameter $privilege for get all groups without ACL test.
Fixed in function "get_user_groups_tree" the call to "get_user_groups" with
the correct parameters.
* operation/incidents/incident.php, operation/incidents/incident_detail.php,
operation/events/events.php, operation/agentes/status_monitor.php,
operation/agentes/estado_agente.php,
operation/agentes/alerts_status.functions.php,
operation/agentes/exportdata.php, operation/agentes/networkmap.php,
operation/messages/message.php, general/ui/agents_list.php,
godmode/groups/configure_group.php, godmode/groups/group_list.php,
godmode/agentes/massive_add_alerts.php,
godmode/agentes/massive_delete_agents.php,
godmode/agentes/massive_config.php,
godmode/agentes/massive_delete_action_alerts.php,
godmode/agentes/massive_delete_alerts.php,
godmode/agentes/modificar_agente.php,
godmode/agentes/massive_delete_modules.php,
godmode/agentes/massive_add_action_alerts.php,
godmode/agentes/planned_downtime.php,
godmode/agentes/manage_config_remote.php, godmode/agentes/agent_manager.php,
godmode/servers/manage_recontask_form.php,
godmode/alerts/configure_alert_compound.php,
godmode/alerts/alert_compounds.php,
godmode/alerts/configure_alert_template.php,
godmode/alerts/configure_alert_action.php, godmode/setup/gis_step_2.php,
godmode/users/configure_user.php, godmode/gis_maps/configure_gis_map.php,
godmode/reporting/graph_builder.main.php,
godmode/reporting/reporting_builder.main.php,
godmode/reporting/visual_console_builder.data.php: changed the fields select
box of group to tree style select box for groups.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3009 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2010-07-15 17:20:43 +02:00
}
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
2019-01-30 16:18:44 +01:00
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
/**
* Prints an array of fields in a popup menu of a form .
2019-01-30 16:18:44 +01:00
*
* Based on choose_from_menu () from Moodle
*
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
* @ param array Array with dropdown values . Example : $fields [ " value " ] = " label "
* @ param string Select form name
* @ param variant Current selected value . Can be a single value or an
2012-12-05 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/lib/libupdate_manager_client.php,
extensions/update_manager/lib/libupdate_manager.php,
operation/agentes/ver_agente.php,
operation/agentes/status_monitor.php,
operation/agentes/estado_ultimopaquete.php,
operation/agentes/estado_agente.php,
operation/integria_incidents/incident.php,
operation/reporting/reporting_xml.php,
godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.wizard.php,
godmode/reporting/visual_console_builder.elements.php,
include/functions_visual_map.php,
include/functions_visual_map_editor.php: uploaded the changes of
source code style previous to my next commit for to make the next
commit more easy.
* godmode/reporting/visual_console_builder.php: set empty string
for the new visualmap.
* include/ajax/visual_console_builder.ajax.php: fixed the regular
expresion to extract the url for the graph.
* include/functions_html.php: fixed into the function
"html_print_select_groups" lost code for to show the selectbox.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7230 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-12-05 15:20:47 +01:00
* array of selected values ( in combination with multiple )
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
* @ param string Javascript onChange code .
* @ param string Label when nothing is selected .
* @ param variant Value when nothing is selected
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
* @ param bool Set the input to allow multiple selections ( optional , single selection by default ) .
* @ param bool Whether to sort the options or not ( optional , unsorted by default ) .
2019-01-30 16:18:44 +01:00
* @ param string $style The string of style .
* @ param mixed $size Max elements showed in the select or default ( size = 10 ) .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_print_select (
$fields ,
$name ,
$selected = '' ,
$script = '' ,
$nothing = '' ,
$nothing_value = 0 ,
$return = false ,
$multiple = false ,
$sort = true ,
$class = '' ,
$disabled = false ,
$style = false ,
$option_style = false ,
$size = false ,
$modal = false ,
$message = '' ,
$select_all = false
) {
$output = " \n " ;
static $idcounter = [];
// If duplicate names exist, it will start numbering. Otherwise it won't
if ( isset ( $idcounter [ $name ])) {
$idcounter [ $name ] ++ ;
} else {
$idcounter [ $name ] = 0 ;
}
$id = preg_replace ( '/[^a-z0-9\:\;\-\_]/i' , '' , $name . ( $idcounter [ $name ] ? $idcounter [ $name ] : '' ));
$attributes = '' ;
if ( ! empty ( $script )) {
$attributes .= ' onchange="' . $script . '"' ;
}
if ( ! empty ( $multiple )) {
if ( $size !== false ) {
$attributes .= ' multiple="multiple" size="' . $size . '"' ;
} else {
$attributes .= ' multiple="multiple" size="10"' ;
}
}
if ( ! empty ( $class )) {
$attributes .= ' class="' . $class . '"' ;
}
if ( ! empty ( $disabled )) {
$attributes .= ' disabled="disabled"' ;
}
if ( $style === false ) {
$styleText = 'style=""' ;
} else {
$styleText = 'style="' . $style . '"' ;
}
$output .= '<select id="' . $id . '" name="' . $name . '"' . $attributes . ' ' . $styleText . '>' ;
if ( $nothing != '' || empty ( $fields )) {
if ( $nothing == '' ) {
$nothing = __ ( 'None' );
}
$output .= '<option value="' . $nothing_value . '"' ;
if ( $nothing_value == $selected ) {
$output .= ' selected="selected"' ;
} else if ( is_array ( $selected )) {
if ( in_array ( $nothing_value , $selected )) {
$output .= ' selected="selected"' ;
}
}
$output .= '>' . $nothing . '</option>' ;
}
if ( is_array ( $fields ) && ! empty ( $fields )) {
if ( $sort !== false ) {
// Sorting the fields in natural way and case insensitive preserving keys
$first_elem = reset ( $fields );
if ( ! is_array ( $first_elem )) {
uasort ( $fields , 'strnatcasecmp' );
}
}
$lastopttype = '' ;
foreach ( $fields as $value => $label ) {
$optlabel = $label ;
if ( is_array ( $label )) {
if ( isset ( $label [ 'optgroup' ])) {
if ( $label [ 'optgroup' ] != $lastopttype ) {
if ( $lastopttype != '' ) {
$output .= '</optgroup>' ;
}
$output .= '<optgroup label="' . $label [ 'optgroup' ] . '">' ;
$lastopttype = $label [ 'optgroup' ];
}
}
$optlabel = $label [ 'name' ];
}
$output .= '<option ' ;
if ( $select_all ) {
$output .= 'selected ' ;
}
$output .= 'value="' . $value . '"' ;
if ( is_array ( $selected ) && in_array ( $value , $selected )) {
$output .= ' selected="selected"' ;
} else if ( is_numeric ( $value ) && is_numeric ( $selected )
&& $value == $selected
) {
// This fixes string ($value) to int ($selected) comparisons
$output .= ' selected="selected"' ;
} else if ( $value === $selected ) {
// Needs type comparison otherwise if $selected = 0 and $value = "string" this would evaluate to true
$output .= ' selected="selected"' ;
}
if ( is_array ( $option_style )
&& in_array ( $value , array_keys ( $option_style ))
) {
$output .= ' style="' . $option_style [ $value ] . '"' ;
}
if ( $optlabel === '' ) {
$output .= '>' . $value . '</option>' ;
} else {
$output .= '>' . $optlabel . '</option>' ;
}
}
if ( is_array ( $label )) {
$output .= '</optgroup>' ;
}
}
$output .= '</select>' ;
if ( $modal && ! enterprise_installed ()) {
$output .= "
2016-09-28 18:16:01 +02:00
< div id = '".$message."' class = 'publienterprise' title = 'Community version' style = 'display:inline;position:relative;top:10px;left:0px;margin-top: -2px !important; margin-left: 2px !important;' >< img data - title = 'Enterprise version' class = 'img_help forced_title' data - use_title_for_force_title = '1' src = 'images/alert_enterprise.png' ></ div >
2016-09-19 16:20:18 +02:00
" ;
2019-01-30 16:18:44 +01:00
}
if ( $return ) {
return $output ;
}
echo $output ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
/**
* Prints an array of fields in a popup menu of a form based on a SQL query .
* The first and second columns of the query will be used .
2019-01-30 16:18:44 +01:00
*
2008-12-16 11:20:33 +01:00
* The element will have an id like : " password- $value " . Based on choose_from_menu () from Moodle .
2019-01-30 16:18:44 +01:00
*
* @ param string $sql SQL sentence , the first field will be the identifier of the option .
* The second field will be the shown value in the dropdown .
* @ param string $name Select form name
* @ param string $selected Current selected value .
* @ param string $script Javascript onChange code .
* @ param string $nothing Label when nothing is selected .
* @ param string $nothing_value Value when nothing is selected
* @ param boolean $return Whether to return an output string or echo now ( optional , echo by default ) .
* @ param boolean $multiple Whether to allow multiple selections or not . Single by default
* @ param boolean $sort Whether to sort the options or not . Sorted by default .
* @ param boolean $disabled if it ' s true , disable the select .
* @ param string $style The string of style .
* @ param mixed $size Max elements showed in select or default ( size = 10 )
* @ param integer $truncante_size Truncate size of the element , by default is set to GENERIC_SIZE_TEXT constant
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_print_select_from_sql (
$sql ,
$name ,
$selected = '' ,
$script = '' ,
$nothing = '' ,
$nothing_value = '0' ,
$return = false ,
$multiple = false ,
$sort = true ,
$disabled = false ,
$style = false ,
$size = false ,
$trucate_size = GENERIC_SIZE_TEXT
) {
global $config ;
$fields = [];
$result = db_get_all_rows_sql ( $sql );
if ( $result === false ) {
$result = [];
}
foreach ( $result as $row ) {
$id = array_shift ( $row );
$value = array_shift ( $row );
$fields [ $id ] = ui_print_truncate_text (
$value ,
$trucate_size ,
false ,
true ,
false
);
}
return html_print_select (
$fields ,
$name ,
$selected ,
$script ,
$nothing ,
$nothing_value ,
$return ,
$multiple ,
$sort ,
'' ,
$disabled ,
$style ,
'' ,
$size
);
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
function html_print_extended_select_for_unit (
$name ,
$selected = '' ,
$script = '' ,
$nothing = '' ,
$nothing_value = '0' ,
$size = false ,
$return = false ,
$select_style = false ,
$unique_name = true ,
$disabled = false ,
$no_change = 0
) {
global $config ;
// $fields = post_process_get_custom_values();
$fields [ '_timeticks_' ] = 'Timeticks' ;
$fields [ 'none' ] = __ ( 'none' );
if ( $no_change != 0 ) {
$fields [ - 1 ] = __ ( 'No change' );
}
// $selected_float = (float)$selected;
// $found = false;
//
// if (array_key_exists($selected, $fields))
// $found = true;
//
// if (!$found) {
// $fields[$selected] = floatval($selected);
// }
if ( $unique_name === true ) {
$uniq_name = uniqid ( $name );
} else {
$uniq_name = $name ;
}
ob_start ();
echo '<div id="' . $uniq_name . '_default" style="width:100%;display:inline;">' ;
html_print_select (
$fields ,
$uniq_name . '_select' ,
$selected ,
'' . $script ,
$nothing ,
$nothing_value ,
false ,
false ,
false ,
'' ,
$disabled ,
'font-size: xx-small;' . $select_style
);
echo ' <a href="javascript:">' . html_print_image (
'images/pencil.png' ,
true ,
[
'class' => $uniq_name . '_toggler' ,
'alt' => __ ( 'Custom' ),
'title' => __ ( 'Custom' ),
'style' => 'width: 18px;' ,
]
) . '</a>' ;
echo '</div>' ;
echo '<div id="' . $uniq_name . '_manual" style="width:100%;display:inline;">' ;
html_print_input_text ( $uniq_name . '_text' , $selected , '' , 20 );
html_print_input_hidden ( $name , $selected , false , $uniq_name );
echo ' <a href="javascript:">' . html_print_image (
'images/default_list.png' ,
true ,
[
'class' => $uniq_name . '_toggler' ,
'alt' => __ ( 'List' ),
'title' => __ ( 'List' ),
'style' => 'width: 18px;' ,
]
) . '</a>' ;
echo '</div>' ;
echo " <script type='text/javascript'>
2017-09-14 12:10:41 +02:00
$ ( document ) . ready ( function () {
post_process_select_init_unit ( '$uniq_name' , '$selected' );
post_process_select_events_unit ( '$uniq_name' , '$selected' );
});
</ script > " ;
2018-07-31 15:25:44 +02:00
2019-01-30 16:18:44 +01:00
$returnString = ob_get_clean ();
2018-07-31 15:25:44 +02:00
2019-01-30 16:18:44 +01:00
if ( $return ) {
return $returnString ;
} else {
echo $returnString ;
}
}
2017-06-30 14:18:23 +02:00
2018-07-31 15:25:44 +02:00
2019-01-30 16:18:44 +01:00
function html_print_extended_select_for_post_process (
$name ,
$selected = '' ,
$script = '' ,
$nothing = '' ,
$nothing_value = '0' ,
$size = false ,
$return = false ,
$select_style = false ,
$unique_name = true ,
$disabled = false ,
$no_change = 0
) {
global $config ;
include_once $config [ 'homedir' ] . '/include/functions_post_process.php' ;
$fields = post_process_get_custom_values ();
if ( $no_change != 0 ) {
$fields [ - 1 ] = __ ( 'No change' );
}
$selected_float = ( float ) $selected ;
$found = false ;
if ( $selected ) {
if ( array_key_exists ( number_format ( $selected , 14 , '.' , ',' ), $fields )) {
$found = true ;
}
}
if ( ! $found ) {
$fields [ $selected ] = floatval ( $selected );
}
if ( $unique_name === true ) {
$uniq_name = uniqid ( $name );
} else {
$uniq_name = $name ;
}
ob_start ();
echo '<div id="' . $uniq_name . '_default" style="width:100%;display:inline;">' ;
html_print_select (
$fields ,
$uniq_name . '_select' ,
$selected ,
'' . $script ,
$nothing ,
$nothing_value ,
false ,
false ,
false ,
'' ,
$disabled ,
'font-size: xx-small;' . $select_style
);
echo ' <a href="javascript:">' . html_print_image (
'images/pencil.png' ,
true ,
[
'class' => $uniq_name . '_toggler' ,
'alt' => __ ( 'Custom' ),
'title' => __ ( 'Custom' ),
'style' => 'width: 18px;' ,
]
) . '</a>' ;
echo '</div>' ;
echo '<div id="' . $uniq_name . '_manual" style="width:100%;display:inline;">' ;
html_print_input_text ( $uniq_name . '_text' , $selected , '' , 20 );
html_print_input_hidden ( $name , $selected , false , $uniq_name );
echo ' <a href="javascript:">' . html_print_image (
'images/default_list.png' ,
true ,
[
'class' => $uniq_name . '_toggler' ,
'alt' => __ ( 'List' ),
'title' => __ ( 'List' ),
'style' => 'width: 18px;' ,
]
) . '</a>' ;
echo '</div>' ;
echo " <script type='text/javascript'>
2015-02-09 19:34:36 +01:00
$ ( document ) . ready ( function () {
post_process_select_init ( '$uniq_name' );
post_process_select_events ( '$uniq_name' );
});
2018-07-31 15:25:44 +02:00
2015-02-09 19:34:36 +01:00
</ script > " ;
2018-07-31 15:25:44 +02:00
2019-01-30 16:18:44 +01:00
$returnString = ob_get_clean ();
2018-07-31 15:25:44 +02:00
2019-01-30 16:18:44 +01:00
if ( $return ) {
return $returnString ;
} else {
echo $returnString ;
}
2015-02-09 19:34:36 +01:00
}
2019-01-30 16:18:44 +01:00
2009-10-06 20:50:48 +02:00
/**
* Render a pair of select for times and text box for set the time more fine .
2019-01-30 16:18:44 +01:00
*
2009-10-06 20:50:48 +02:00
* @ param string Select form name
* @ param variant Current selected value . Can be a single value or an
* array of selected values ( in combination with multiple )
* @ param string Javascript onChange ( select ) code .
* @ param string Label when nothing is selected .
* @ param variant Value when nothing is selected
2019-01-30 16:18:44 +01:00
* @ param integer $size Size of the input .
2009-10-06 20:50:48 +02:00
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
2012-07-05 11:16:57 +02:00
* @ param bool Wherter to assign to combo a unique name ( to have more than one on same page , like dashboard )
2019-01-30 16:18:44 +01:00
*
2009-10-06 20:50:48 +02:00
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_extended_select_for_time (
$name ,
$selected = '' ,
$script = '' ,
$nothing = '' ,
$nothing_value = '0' ,
$size = false ,
$return = false ,
$select_style = false ,
$unique_name = true ,
$class = '' ,
$readonly = false ,
$custom_fields = false ,
$style_icon = '' ,
$no_change = false
) {
global $config ;
$admin = is_user_admin ( $config [ 'id_user' ]);
if ( $custom_fields ) {
$fields = $custom_fields ;
} else {
$fields = get_periods ();
}
if ( $no_change ) {
$fields [ '-2' ] = __ ( 'No change' );
}
if ( ! $selected ) {
foreach ( $fields as $t_key => $t_value ) {
if ( $t_key != - 1 ) {
if ( $nothing == '' ) {
// -1 means 'custom'
$selected = $t_key ;
break ;
} else {
$selected = $nothing ;
break ;
}
}
}
}
if (( $selected !== false ) && ( ! isset ( $fields [ $selected ]) && $selected != 0 )) {
$fields [ $selected ] = human_time_description_raw ( $selected , true );
}
$units = [
1 => __ ( 'seconds' ),
SECONDS_1MINUTE => __ ( 'minutes' ),
SECONDS_1HOUR => __ ( 'hours' ),
SECONDS_1DAY => __ ( 'days' ),
SECONDS_1WEEK => __ ( 'weeks' ),
SECONDS_1MONTH => __ ( 'months' ),
SECONDS_1YEAR => __ ( 'years' ),
];
if ( $unique_name === true ) {
$uniq_name = uniqid ( $name );
} else {
$uniq_name = $name ;
}
if ( $readonly ) {
$readonly = true ;
}
ob_start ();
// Use the no_meta parameter because this image is only in the base console
echo '<div id="' . $uniq_name . '_default" style="width:100%;display:inline;">' ;
html_print_select (
$fields ,
$uniq_name . '_select' ,
$selected ,
'' . $script ,
$nothing ,
$nothing_value ,
false ,
false ,
false ,
$class ,
$readonly ,
'font-size: xx-small;' . $select_style
);
// The advanced control is only for admins
if ( $admin ) {
echo ' <a href="javascript:">' . html_print_image (
'images/pencil.png' ,
true ,
[
'class' => $uniq_name . '_toggler' ,
'alt' => __ ( 'Custom' ),
'title' => __ ( 'Custom' ),
'style' => 'width: 18px;' . $style_icon ,
],
false ,
false ,
true
) . '</a>' ;
}
echo '</div>' ;
echo '<div id="' . $uniq_name . '_manual" style="width:100%;display:inline;">' ;
html_print_input_text ( $uniq_name . '_text' , $selected , '' , $size , 255 , false , $readonly , false , '' , $class );
html_print_input_hidden ( $name , $selected , false , $uniq_name );
html_print_select (
$units ,
$uniq_name . '_units' ,
1 ,
'' . $script ,
$nothing ,
$nothing_value ,
false ,
false ,
false ,
$class ,
$readonly ,
'font-size: xx-small;' . $select_style
);
echo ' <a href="javascript:">' . html_print_image (
'images/default_list.png' ,
true ,
[
'class' => $uniq_name . '_toggler' ,
'alt' => __ ( 'List' ),
'title' => __ ( 'List' ),
'style' => 'width: 18px;' . $style_icon ,
]
) . '</a>' ;
echo '</div>' ;
echo " <script type='text/javascript'>
2012-03-16 10:23:09 +01:00
$ ( document ) . ready ( function () {
2012-03-22 12:22:07 +01:00
period_select_init ( '$uniq_name' );
2012-03-16 13:03:59 +01:00
period_select_events ( '$uniq_name' );
2012-03-16 10:23:09 +01:00
});
2012-07-05 11:16:57 +02:00
function period_select_ " . $name . " _update ( seconds ) {
$ ( '#text-".$uniq_name."_text' ) . val ( seconds );
adjustTextUnits ( '".$uniq_name."' );
calculateSeconds ( '".$uniq_name."' );
$ ( '#".$uniq_name."_manual' ) . show ();
$ ( '#".$uniq_name."_default' ) . hide ();
}
</ script > " ;
2019-01-30 16:18:44 +01:00
$returnString = ob_get_clean ();
if ( $return ) {
return $returnString ;
} else {
echo $returnString ;
}
2009-10-06 20:50:48 +02:00
}
2019-01-30 16:18:44 +01:00
2012-10-23 Ramon Novoa <rnovoa@artica.es>
* include/functions_cron.php: Added to repository. Cron related
functions.
* include/functions_html.php, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor.php: Added support for remote
cron modules.
* godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php,
operation/netflow/nf_view.php,
include/functions_netflow.php: Added a description to report items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7083 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-10-23 12:45:25 +02:00
/**
* Print selects to configure the cron of a module .
2019-01-30 16:18:44 +01:00
*
2012-10-23 Ramon Novoa <rnovoa@artica.es>
* include/functions_cron.php: Added to repository. Cron related
functions.
* include/functions_html.php, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor.php: Added support for remote
cron modules.
* godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php,
operation/netflow/nf_view.php,
include/functions_netflow.php: Added a description to report items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7083 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-10-23 12:45:25 +02:00
* @ param string Run hour .
* @ param string Run minute .
* @ param string Run day of the month .
* @ param string Run month .
* @ param string Run day of the week .
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
2016-02-05 09:53:45 +01:00
* @ param bool Print cron grayed
2019-01-30 16:18:44 +01:00
*
2012-10-23 Ramon Novoa <rnovoa@artica.es>
* include/functions_cron.php: Added to repository. Cron related
functions.
* include/functions_html.php, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor.php: Added support for remote
cron modules.
* godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php,
operation/netflow/nf_view.php,
include/functions_netflow.php: Added a description to report items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7083 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-10-23 12:45:25 +02:00
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_extended_select_for_cron ( $hour = '*' , $minute = '*' , $mday = '*' , $month = '*' , $wday = '*' , $return = false , $disabled = false , $to = false )
{
// Hours
for ( $i = 0 ; $i < 24 ; $i ++ ) {
$hours [ $i ] = $i ;
}
// Minutes
for ( $i = 0 ; $i < 60 ; $i += 5 ) {
$minutes [ $i ] = $i ;
}
// Month days
for ( $i = 0 ; $i < 31 ; $i ++ ) {
$mdays [ $i ] = $i ;
}
// Months
for ( $i = 1 ; $i <= 12 ; $i ++ ) {
$months [ $i ] = date ( 'F' , mktime ( 0 , 0 , 0 , $i , 1 ));
}
// Days of the week
$wdays = [
__ ( 'Sunday' ),
__ ( 'Monday' ),
__ ( 'Tuesday' ),
__ ( 'Wednesday' ),
__ ( 'Thursday' ),
__ ( 'Friday' ),
__ ( 'Saturday' ),
];
// Print selectors
$table = new stdClass ();
$table -> id = 'cron' ;
$table -> width = '100%' ;
$table -> class = 'databox data' ;
$table -> head [ 0 ] = __ ( 'Hour' );
$table -> head [ 1 ] = __ ( 'Minute' );
$table -> head [ 2 ] = __ ( 'Month day' );
$table -> head [ 3 ] = __ ( 'Month' );
$table -> head [ 4 ] = __ ( 'Week day' );
if ( $to ) {
$table -> data [ 0 ][ 0 ] = html_print_select ( $hours , 'hour_to' , $hour , '' , __ ( 'Any' ), '*' , true , false , false , '' , $disabled );
$table -> data [ 0 ][ 1 ] = html_print_select ( $minutes , 'minute_to' , $minute , '' , __ ( 'Any' ), '*' , true , false , false , '' , $disabled );
$table -> data [ 0 ][ 2 ] = html_print_select ( $mdays , 'mday_to' , $mday , '' , __ ( 'Any' ), '*' , true , false , false , '' , $disabled );
$table -> data [ 0 ][ 3 ] = html_print_select ( $months , 'month_to' , $month , '' , __ ( 'Any' ), '*' , true , false , false , '' , $disabled );
$table -> data [ 0 ][ 4 ] = html_print_select ( $wdays , 'wday_to' , $wday , '' , __ ( 'Any' ), '*' , true , false , false , '' , $disabled );
} else {
$table -> data [ 0 ][ 0 ] = html_print_select ( $hours , 'hour_from' , $hour , '' , __ ( 'Any' ), '*' , true , false , false , '' , $disabled );
$table -> data [ 0 ][ 1 ] = html_print_select ( $minutes , 'minute_from' , $minute , '' , __ ( 'Any' ), '*' , true , false , false , '' , $disabled );
$table -> data [ 0 ][ 2 ] = html_print_select ( $mdays , 'mday_from' , $mday , '' , __ ( 'Any' ), '*' , true , false , false , '' , $disabled );
$table -> data [ 0 ][ 3 ] = html_print_select ( $months , 'month_from' , $month , '' , __ ( 'Any' ), '*' , true , false , false , '' , $disabled );
$table -> data [ 0 ][ 4 ] = html_print_select ( $wdays , 'wday_from' , $wday , '' , __ ( 'Any' ), '*' , true , false , false , '' , $disabled );
}
return html_print_table ( $table , $return );
2012-10-23 Ramon Novoa <rnovoa@artica.es>
* include/functions_cron.php: Added to repository. Cron related
functions.
* include/functions_html.php, pandoradb.sql,
pandoradb.postgreSQL.sql, pandoradb.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql,
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,
godmode/agentes/module_manager_editor_common.php,
godmode/agentes/configurar_agente.php,
godmode/agentes/module_manager_editor.php: Added support for remote
cron modules.
* godmode/netflow/nf_item_list.php,
godmode/netflow/nf_report_item.php,
operation/netflow/nf_view.php,
include/functions_netflow.php: Added a description to report items.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7083 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2012-10-23 12:45:25 +02:00
}
2019-01-30 16:18:44 +01:00
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
/**
2011-04-27 15:43:31 +02:00
* Render an input text element . Extended version , use html_print_input_text () to simplify .
2019-01-30 16:18:44 +01:00
*
* @ param string $name Input name .
* @ param string $value Input value .
* @ param string $id Input HTML id .
* @ param string $alt Do not use , invalid for text and password . Use html_print_input_image
* @ param integer $size Size of the input .
* @ param integer $maxlength Maximum length allowed .
* @ param boolean $disabled Disable the button ( optional , button enabled by default ) .
* @ param mixed $script JavaScript to attach to this . It is array the index is event to set a script , it is only string for " onkeyup " event .
* @ param mixed $attributes Attributes to add to this tag . Should be an array for correction .
* @ param boolean $return Whether to return an output string or echo now ( optional , echo by default ) .
* @ param boolean $password Whether it is a password input or not . Not password by default .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_print_input_text_extended ( $name , $value , $id , $alt , $size , $maxlength , $disabled , $script , $attributes , $return = false , $password = false , $function = '' )
{
static $idcounter = 0 ;
if ( $maxlength == 0 ) {
$maxlength = 255 ;
}
if ( $size == 0 ) {
$size = 10 ;
}
++ $idcounter ;
$valid_attrs = [
'accept' ,
'disabled' ,
'maxlength' ,
'name' ,
'readonly' ,
'placeholder' ,
'size' ,
'value' ,
'accesskey' ,
'class' ,
'dir' ,
'id' ,
'lang' ,
'style' ,
'tabindex' ,
'title' ,
'xml:lang' ,
'onfocus' ,
'onblur' ,
'onselect' ,
'onchange' ,
'onclick' ,
'ondblclick' ,
'onmousedown' ,
'onmouseup' ,
'onmouseover' ,
'onmousemove' ,
'onmouseout' ,
'onkeypress' ,
'onkeydown' ,
'onkeyup' ,
'required' ,
'autocomplete' ,
];
$output = '<input ' . ( $password ? 'type="password" autocomplete="off" ' : 'type="text" ' );
if ( $disabled && ( ! is_array ( $attributes ) || ! array_key_exists ( 'disabled' , $attributes ))) {
$output .= 'readonly="readonly" ' ;
}
if ( is_array ( $attributes )) {
foreach ( $attributes as $attribute => $attr_value ) {
if ( ! in_array ( $attribute , $valid_attrs )) {
continue ;
}
$output .= $attribute . '="' . $attr_value . '" ' ;
}
} else {
$output .= trim ( $attributes ) . ' ' ;
$attributes = [];
}
if ( ! empty ( $alt )) {
$output .= 'alt="' . $alt . '" ' ;
}
// Attributes specified by function call
$attrs = [
'name' => 'unnamed' ,
'value' => '' ,
'id' => 'text-' . sprintf ( '%04d' , $idcounter ),
'size' => '' ,
'maxlength' => '' ,
];
foreach ( $attrs as $attribute => $default ) {
if ( array_key_exists ( $attribute , $attributes )) {
continue ;
} //end if
/*
* Remember , this next code have a $ $ that for example there is a var as
* $a = 'john' then $$a is a var $john .
*
* In this case is use for example for $name and $atribute = 'name' .
*
*/
// Exact operator because we want to show "0" on the value
if ( $attribute !== '' ) {
$output .= $attribute . '="' . $$attribute . '" ' ;
} else if ( $default != '' ) {
$output .= $attribute . '="' . $default . '" ' ;
}
}
if ( ! empty ( $script )) {
if ( is_string ( $script )) {
$code = $script ;
$script = [];
$script [ 'onkeyup' ] = $code ;
}
foreach ( $script as $event => $code ) {
$output .= ' ' . $event . '="' . $code . '" ' ;
}
}
$output .= $function . '/>' ;
if ( ! $return ) {
echo $output ;
}
return $output ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
2013-02-26 17:10:02 +01:00
/**
* Render an input password element .
*
* The element will have an id like : " password- $name "
2019-01-30 16:18:44 +01:00
*
2013-02-26 17:10:02 +01:00
* @ param mixed parameters :
2019-01-30 16:18:44 +01:00
* - id : string
* - style : string
* - hidden : boolean
* - content : string
2013-02-26 17:10:02 +01:00
* @ param bool return or echo flag
*
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_div ( $options , $return = false )
{
$output = '<div' ;
// Valid attributes (invalid attributes get skipped)
$attrs = [
'id' ,
'style' ,
'class' ,
];
if ( isset ( $options [ 'hidden' ])) {
if ( isset ( $options [ 'style' ])) {
$options [ 'style' ] .= 'display:none;' ;
} else {
$options [ 'style' ] = 'display:none;' ;
}
}
foreach ( $attrs as $attribute ) {
if ( isset ( $options [ $attribute ])) {
$output .= ' ' . $attribute . '="' . io_safe_input_html ( $options [ $attribute ]) . '"' ;
}
}
$output .= '>' ;
$output .= isset ( $options [ 'content' ]) ? $options [ 'content' ] : '' ;
$output .= '</div>' ;
if ( $return ) {
return $output ;
} else {
echo $output ;
}
2013-02-26 17:10:02 +01:00
}
2008-08-21 23:07:20 +02:00
/**
2008-08-21 23:57:11 +02:00
* Render an input password element .
2008-12-16 11:20:33 +01:00
*
* The element will have an id like : " password- $name "
2019-01-30 16:18:44 +01:00
*
* @ param string $name Input name .
* @ param string $value Input value .
* @ param string $alt Alternative HTML string ( optional ) .
* @ param integer $size Size of the input ( optional ) .
* @ param integer $maxlength Maximum length allowed ( optional ) .
* @ param boolean $return Whether to return an output string or echo now ( optional , echo by default ) .
* @ param boolean $disabled Disable the button ( optional , button enabled by default ) .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-08-21 23:07:20 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_print_input_password (
$name ,
$value ,
$alt = '' ,
$size = 50 ,
$maxlength = 255 ,
$return = false ,
$disabled = false ,
$required = false ,
$class = ''
) {
if ( $maxlength == 0 ) {
$maxlength = 255 ;
}
if ( $size == 0 ) {
$size = 10 ;
}
$attr = [];
if ( $required ) {
$attr [ 'required' ] = 'required' ;
}
if ( $class ) {
$attr [ 'class' ] = $class ;
}
return html_print_input_text_extended ( $name , $value , 'password-' . $name , $alt , $size , $maxlength , $disabled , '' , $attr , $return , true );
2008-08-21 23:07:20 +02:00
}
2019-01-30 16:18:44 +01:00
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
/**
2008-12-16 11:20:33 +01:00
* Render an input text element .
*
* The element will have an id like : " text- $name "
2019-01-30 16:18:44 +01:00
*
* @ param string $name Input name .
* @ param string $value Input value .
* @ param string $alt Alternative HTML string ( invalid - not used ) .
* @ param integer $size Size of the input ( optional ) .
* @ param integer $maxlength Maximum length allowed ( optional ) .
* @ param boolean $return Whether to return an output string or echo now ( optional , echo by default ) .
* @ param boolean $disabled Disable the button ( optional , button enabled by default ) .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_print_input_text ( $name , $value , $alt = '' , $size = 50 , $maxlength = 255 , $return = false , $disabled = false , $required = false , $function = '' , $class = '' , $onChange = '' , $autocomplete = '' )
{
if ( $maxlength == 0 ) {
$maxlength = 255 ;
}
if ( $size == 0 ) {
$size = 10 ;
}
$attr = [];
if ( $required ) {
$attr [ 'required' ] = 'required' ;
}
if ( $class != '' ) {
$attr [ 'class' ] = $class ;
}
if ( $onChange != '' ) {
$attr [ 'onchange' ] = $onChange ;
}
if ( $autocomplete !== '' ) {
$attr [ 'autocomplete' ] = $autocomplete ;
}
return html_print_input_text_extended ( $name , $value , 'text-' . $name , $alt , $size , $maxlength , $disabled , '' , $attr , $return , false , $function );
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
2008-10-22 14:01:36 +02:00
/**
* Render an input image element .
2008-12-16 11:20:33 +01:00
*
* The element will have an id like : " image- $name "
2019-01-30 16:18:44 +01:00
*
* @ param string $name Input name .
* @ param string $src Image source .
* @ param string $value Input value .
* @ param string $style HTML style property .
* @ param boolean $return Whether to return an output string or echo now ( optional , echo by default ) .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-10-22 14:01:36 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_print_input_image ( $name , $src , $value , $style = '' , $return = false , $options = false )
{
global $config ;
static $idcounter = 0 ;
++ $idcounter ;
// Checks if user's skin is available
$isFunctionSkins = enterprise_include_once ( 'include/functions_skins.php' );
if ( $isFunctionSkins !== ENTERPRISE_NOT_HOOK ) {
$skin_path = enterprise_hook ( 'skins_get_image_path' , [ $src ]);
if ( $skin_path ) {
$src = $skin_path ;
}
}
// If metaconsole is activated and image doesn't exists try to search on normal console
if ( is_metaconsole ()) {
if ( false === @ file_get_contents ( $src , 0 , null , 0 , 1 )) {
$src = '../../' . $src ;
}
}
// path to image
$src = ui_get_full_url ( $src );
$output = '<input id="image-' . $name . $idcounter . '" src="' . $src . '" style="' . $style . '" name="' . $name . '" type="image"' ;
// Valid attributes (invalid attributes get skipped)
$attrs = [
'alt' ,
'accesskey' ,
'lang' ,
'tabindex' ,
'title' ,
'xml:lang' ,
'onclick' ,
'ondblclick' ,
'onmousedown' ,
'onmouseup' ,
'onmouseover' ,
'onmousemove' ,
'onmouseout' ,
'onkeypress' ,
'onkeydown' ,
'onkeyup' ,
];
foreach ( $attrs as $attribute ) {
if ( isset ( $options [ $attribute ])) {
$output .= ' ' . $attribute . '="' . io_safe_input_html ( $options [ $attribute ]) . '"' ;
}
}
$output .= ' value="' . $value . '" />' ;
if ( $return ) {
return $output ;
}
echo $output ;
2008-10-22 14:01:36 +02:00
}
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
2019-01-30 16:18:44 +01:00
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
/**
* Render an input hidden element .
2008-12-16 11:20:33 +01:00
*
* The element will have an id like : " hidden- $name "
2019-01-30 16:18:44 +01:00
*
* @ param string $name Input name .
* @ param string $value Input value .
* @ param boolean $return Whether to return an output string or echo now ( optional , echo by default ) .
* @ param string $class Set the class of input .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_print_input_hidden ( $name , $value , $return = false , $class = false )
{
if ( $class !== false ) {
$classText = 'class="' . $class . '"' ;
} else {
$classText = '' ;
}
$separator = '"' ;
if ( is_string ( $value )) {
if ( strstr ( $value , '"' )) {
$separator = " ' " ;
}
}
$output = '<input id="hidden-' . $name . '" ' . 'name="' . $name . '" ' . 'type="hidden" ' . $classText . ' ' . 'value=' . $separator . $value . $separator . ' />' ;
if ( $return ) {
return $output ;
}
echo $output ;
2012-09-12 17:53:58 +02:00
}
2019-01-30 16:18:44 +01:00
2012-09-12 17:53:58 +02:00
/**
* Render an input hidden element . Extended version , use html_print_input_hidden () to simplify .
*
* The element will have an id like : " hidden- $name "
2019-01-30 16:18:44 +01:00
*
* @ param string $name Input name .
* @ param string $value Input value .
* @ param string $id Input value .
* @ param boolean $return Whether to return an output string or echo now ( optional , echo by default ) .
* @ param string $class Set the class of input .
2012-09-12 17:53:58 +02:00
*
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_input_hidden_extended ( $name , $value , $id , $return = false , $class = false )
{
if ( $class !== false ) {
$classText = 'class="' . $class . '"' ;
} else {
$classText = '' ;
}
if ( empty ( $id )) {
$ouput_id = 'hidden-' . $name ;
} else {
$ouput_id = $id ;
}
$output = '<input id="' . $ouput_id . '" name="' . $name . '" type="hidden" ' . $classText . ' value="' . $value . '" />' ;
if ( $return ) {
return $output ;
}
echo $output ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
2018-12-10 09:20:06 +01:00
/**
* Render a color input element .
*
* The element will have an id like : " hidden- $name "
2019-01-30 16:18:44 +01:00
*
* @ param string $name Input name .
* @ param integer $value Input value . Decimal representation of the color ' s hexadecimal value .
* @ param string $class Set the class of input .
* @ param boolean $return Whether to return an output string or echo now ( optional , echo by default ) .
2018-12-10 09:20:06 +01:00
*
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_input_color ( $name , $value , $class = false , $return = false )
{
$attr_type = 'type="color"' ;
$attr_id = 'id="color-' . htmlspecialchars ( $name , ENT_QUOTES ) . '"' ;
$attr_name = 'name="' . htmlspecialchars ( $name , ENT_QUOTES ) . '"' ;
$attr_value = 'value="' . htmlspecialchars ( $value , ENT_QUOTES ) . '"' ;
$attr_class = 'class="' . ( $class !== false ? htmlspecialchars ( $class , ENT_QUOTES ) : '' ) . '"' ;
$output = '<input ' . $attr_type . ' ' . $attr_id . ' ' . $attr_name . ' ' . $attr_value . ' ' . $attr_class . ' />' ;
if ( $return ) {
return $output ;
}
echo $output ;
2018-12-10 09:20:06 +01:00
}
2019-01-30 16:18:44 +01:00
2008-12-16 11:20:33 +01:00
/**
* Render an submit input button element .
*
* The element will have an id like : " submit- $name "
2019-01-30 16:18:44 +01:00
*
* @ param string $label Input label .
* @ param string $name Input name .
* @ param boolean $disabled Whether to disable by default or not . Enabled by default .
* @ param array $attributes Additional HTML attributes .
* @ param boolean $return Whether to return an output string or echo now ( optional , echo by default ) .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_submit_button ( $label = 'OK' , $name = '' , $disabled = false , $attributes = '' , $return = false )
{
if ( ! $name ) {
$name = 'unnamed' ;
}
if ( is_array ( $attributes )) {
$attr_array = $attributes ;
$attributes = '' ;
foreach ( $attr_array as $attribute => $value ) {
$attributes .= $attribute . '="' . $value . '" ' ;
}
}
$output = '<input type="submit" id="submit-' . $name . '" name="' . $name . '" value="' . $label . '" ' . $attributes ;
if ( $disabled ) {
$output .= ' disabled="disabled"' ;
}
$output .= ' />' ;
if ( ! $return ) {
echo $output ;
}
return $output ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
2008-12-16 11:20:33 +01:00
/**
* Render an submit input button element .
*
* The element will have an id like : " button- $name "
2019-01-30 16:18:44 +01:00
*
* @ param string $label Input label .
* @ param string $name Input name .
* @ param boolean $disabled Whether to disable by default or not . Enabled by default .
* @ param string $script JavaScript to attach
* @ param string $attributes Additional HTML attributes .
* @ param boolean $return Whether to return an output string or echo now ( optional , echo by default ) .
* @ param boolean $imageButton Set the button as a image button without text , by default is false .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_button ( $label = 'OK' , $name = '' , $disabled = false , $script = '' , $attributes = '' , $return = false , $imageButton = false , $modal = false , $message = '' )
{
$output = '' ;
$alt = $title = '' ;
if ( $imageButton ) {
$alt = $title = $label ;
$label = '' ;
}
$output .= '<input title="' . $title . '" alt="' . $alt . '" type="button" id="button-' . $name . '" name="' . $name . '" value="' . $label . '" onClick="' . $script . '" ' . $attributes ;
if ( $disabled ) {
$output .= ' disabled' ;
}
$output .= ' />' ;
if ( $modal && ! enterprise_installed ()) {
$output .= "
2016-09-28 18:16:01 +02:00
< div id = '".$message."' class = 'publienterprise' title = 'Community version' style = 'display:inline;position:relative;top:10px;left:0px;margin-top: -2px !important; margin-left: 2px !important;' >< img data - title = 'Enterprise version' class = 'img_help forced_title' data - use_title_for_force_title = '1' src = 'images/alert_enterprise.png' ></ div >
" ;
2019-01-30 16:18:44 +01:00
}
if ( $return ) {
return $output ;
}
echo $output ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
2008-12-16 11:20:33 +01:00
/**
* Render an input textarea element .
*
* The element will have an id like : " textarea_ $name "
2019-01-30 16:18:44 +01:00
*
* @ param string $name Input name .
* @ param integer $rows How many rows ( height )
* @ param integer $columns How many columns ( width )
* @ param string $value Text in the textarea
* @ param string $attributes Additional attributes
* @ param boolean $return Whether to return an output string or echo now ( optional , echo by default ) . *
2009-01-08 16:52:13 +01:00
*
2008-12-16 11:20:33 +01:00
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_textarea ( $name , $rows , $columns , $value = '' , $attributes = '' , $return = false , $class = '' )
{
$output = '<textarea id="textarea_' . $name . '" name="' . $name . '" cols="' . $columns . '" rows="' . $rows . '" ' . $attributes . '" ' . $class . '>' ;
// $output .= io_safe_input ($value);
$output .= ( $value );
$output .= '</textarea>' ;
if ( $return ) {
return $output ;
}
echo $output ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
2013-02-27 18:11:42 +01:00
/**
* Return a table parameters predefined
2019-01-30 16:18:44 +01:00
*
2013-02-27 18:11:42 +01:00
* @ param string model
2019-01-30 16:18:44 +01:00
* - Transparent : More basic template . No borders , all the columns with same width
2013-02-27 18:11:42 +01:00
* @ param int number of columns
2019-01-30 16:18:44 +01:00
*
* @ return object Table object
2013-02-27 18:11:42 +01:00
*/
2019-01-30 16:18:44 +01:00
function html_get_predefined_table ( $model = 'transparent' , $columns = 4 )
{
$width_percent = ( 100 / $columns );
switch ( $model ) {
case 'transparent' :
default :
$table = new stdClass ();
$table -> class = 'none' ;
$table -> cellpadding = 0 ;
$table -> cellspacing = 0 ;
$table -> head = [];
$table -> data = [];
$table -> style = array_fill ( 0 , 4 , 'text-align:center; width: ' . $width_percent . '%;' );
$table -> width = '100%' ;
}
return $table ;
2013-02-27 18:11:42 +01:00
}
2019-01-30 16:18:44 +01:00
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
/**
* Print a nicely formatted table . Code taken from moodle .
*
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
* @ param object Object with several properties :
2019-01-30 16:18:44 +01:00
* $table -> head - An array of heading names .
* $table -> head_colspan - An array of colspans of each head column .
* $table -> headstyle - An array of styles of each head column .
* $table -> align - An array of column alignments
* $table -> valign - An array of column alignments
* $table -> size - An array of column sizes
* $table -> wrap - An array of " nowrap " s or nothing
* $table -> style - An array of personalized style for each column .
* $table -> rowid - An array of personalized ids of each row .
* $table -> rowstyle - An array of personalized style of each row .
* $table -> rowclass - An array of personalized classes of each row ( odd - evens classes will be ignored ) .
* $table -> colspan - An array of colspans of each column .
* $table -> rowspan - An array of rowspans of each column .
* $table -> data [] - An array of arrays containing the data .
* $table -> width - A percentage of the page
* $table -> border - Border of the table .
* $table -> tablealign - Align the whole table ( float left or right )
* $table -> cellpadding - Padding on each cell
* $table -> cellspacing - Spacing between cells
* $table -> cellstyle - Style of a cell
* $table -> cellclass - Class of a cell
* $table -> class - CSS table class
* $table -> id - Table ID ( useful in JavaScript )
* $table -> headclass [] - An array of classes for each heading
* $table -> title - Title of the table is a single string that will be on top of the table in the head spanning the whole table
* $table -> titlestyle - Title style
* $table -> titleclass - Title class
* $table -> styleTable - Table style
2012-04-18 10:08:04 +02:00
* $table -> caption - Table title
2010-05-06 17:53:38 +02:00
* @ param bool Whether to return an output string or echo now
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_print_table ( & $table , $return = false )
{
$output = '' ;
static $table_count = 0 ;
$table_count ++ ;
if ( isset ( $table -> align )) {
foreach ( $table -> align as $key => $aa ) {
if ( $aa ) {
$align [ $key ] = ' text-align:' . $aa . ';' ;
} else {
$align [ $key ] = '' ;
}
}
}
if ( isset ( $table -> valign )) {
foreach ( $table -> valign as $key => $aa ) {
if ( $aa ) {
$valign [ $key ] = ' vertical-align:' . $aa . ';' ;
} else {
$valign [ $key ] = '' ;
}
}
}
if ( isset ( $table -> size )) {
foreach ( $table -> size as $key => $ss ) {
if ( $ss ) {
$size [ $key ] = ' width:' . $ss . ';' ;
} else {
$size [ $key ] = '' ;
}
}
}
if ( isset ( $table -> style )) {
foreach ( $table -> style as $key => $st ) {
if ( $st ) {
$style [ $key ] = ' ' . $st . ';' ;
} else {
$style [ $key ] = '' ;
}
}
}
$styleTable = '' ;
if ( isset ( $table -> styleTable )) {
$styleTable = $table -> styleTable ;
}
if ( isset ( $table -> rowid )) {
foreach ( $table -> rowid as $key => $id ) {
$rowid [ $key ] = $id ;
}
}
if ( isset ( $table -> rowstyle )) {
foreach ( $table -> rowstyle as $key => $st ) {
$rowstyle [ $key ] = ' ' . $st . ';' ;
}
}
if ( isset ( $table -> rowclass )) {
foreach ( $table -> rowclass as $key => $class ) {
$rowclass [ $key ] = $class ;
}
}
if ( isset ( $table -> colspan )) {
foreach ( $table -> colspan as $keyrow => $cspan ) {
foreach ( $cspan as $key => $span ) {
$colspan [ $keyrow ][ $key ] = ' colspan="' . $span . '"' ;
}
}
}
if ( isset ( $table -> cellstyle )) {
foreach ( $table -> cellstyle as $keyrow => $cstyle ) {
foreach ( $cstyle as $key => $cst ) {
$cellstyle [ $keyrow ][ $key ] = $cst ;
}
}
}
if ( isset ( $table -> cellclass )) {
foreach ( $table -> cellclass as $keyrow => $cclass ) {
foreach ( $cclass as $key => $ccl ) {
$cellclass [ $keyrow ][ $key ] = $ccl ;
}
}
}
if ( isset ( $table -> rowspan )) {
foreach ( $table -> rowspan as $keyrow => $rspan ) {
foreach ( $rspan as $key => $span ) {
$rowspan [ $keyrow ][ $key ] = ' rowspan="' . $span . '"' ;
}
}
}
if ( empty ( $table -> width )) {
// $table->width = '80%';
}
if ( empty ( $table -> border )) {
if ( empty ( $table )) {
$table = new stdClass ();
}
$table -> border = '0' ;
}
if ( empty ( $table -> tablealign ) || (( $table -> tablealign != 'left' ) && ( $table -> tablealign != 'right' ))) {
$table -> tablealign = '"' ;
} else {
$table -> tablealign = 'float:' . $table -> tablealign . ';"' ;
// Align is deprecated. Use float instead
}
if ( ! isset ( $table -> cellpadding )) {
$table -> cellpadding = '4' ;
}
if ( ! isset ( $table -> cellspacing )) {
$table -> cellspacing = '4' ;
}
if ( empty ( $table -> class )) {
$table -> class = 'databox' ;
}
if ( empty ( $table -> titlestyle )) {
$table -> titlestyle = 'text-align:center;' ;
}
$tableid = empty ( $table -> id ) ? 'table' . $table_count : $table -> id ;
if ( ! empty ( $table -> width )) {
$output .= '<table style="width:' . $table -> width . '; ' . $styleTable . ' ' . $table -> tablealign ;
} else {
$output .= '<table style="' . $styleTable . ' ' . $table -> tablealign ;
}
$output .= ' cellpadding="' . $table -> cellpadding . '" cellspacing="' . $table -> cellspacing . '"' ;
$output .= ' border="' . $table -> border . '" class="' . $table -> class . '" id="' . $tableid . '">' ;
$countcols = 0 ;
if ( ! empty ( $table -> caption )) {
$output .= '<caption style="text-align: left"><h4>' . $table -> caption . '</h4></caption>' ;
}
if ( ! empty ( $table -> head )) {
$countcols = count ( $table -> head );
$output .= '<thead><tr>' ;
if ( isset ( $table -> title )) {
$output .= '<th colspan="' . $countcols . '"' ;
if ( isset ( $table -> titlestyle )) {
$output .= ' style="' . $table -> titlestyle . '"' ;
}
if ( isset ( $table -> titleclass )) {
$output .= ' class="' . $table -> titleclass . '"' ;
}
$output .= '>' . $table -> title . '</th></tr><tr>' ;
}
foreach ( $table -> head as $key => $heading ) {
if ( ! isset ( $size [ $key ])) {
$size [ $key ] = '' ;
}
if ( ! isset ( $align [ $key ])) {
$align [ $key ] = '' ;
}
if ( ! isset ( $table -> headclass [ $key ])) {
$table -> headclass [ $key ] = 'header c' . $key ;
}
if ( isset ( $table -> head_colspan [ $key ])) {
$headColspan = 'colspan = "' . $table -> head_colspan [ $key ] . '"' ;
} else {
$headColspan = '' ;
}
if ( isset ( $table -> headstyle [ $key ])) {
$headStyle = ' style = "' . $table -> headstyle [ $key ] . '" ' ;
} else {
$headStyle = '' ;
}
$output .= '<th class="' . $table -> headclass [ $key ] . '" ' . $headColspan . $headStyle . ' scope="col">' . $heading . '</th>' ;
}
$output .= '</tr></thead>' . " \n " ;
}
$output .= '<tbody>' . " \n " ;
if ( ! empty ( $table -> data )) {
$oddeven = 1 ;
foreach ( $table -> data as $keyrow => $row ) {
if ( ! isset ( $rowstyle [ $keyrow ])) {
$rowstyle [ $keyrow ] = '' ;
}
if ( ! isset ( $rowid [ $keyrow ])) {
$rowid [ $keyrow ] = $tableid . '-' . $keyrow ;
}
$oddeven = $oddeven ? 0 : 1 ;
$class = 'datos' . ( $oddeven ? '' : '2' );
if ( isset ( $rowclass [ $keyrow ])) {
$class = $rowclass [ $keyrow ];
}
$output .= '<tr id="' . $rowid [ $keyrow ] . '" style="' . $rowstyle [ $keyrow ] . '" class="' . $class . '">' . " \n " ;
// Special separator rows
if ( $row == 'hr' and $countcols ) {
$output .= '<td colspan="' . $countcols . '"><div class="tabledivider"></div></td>' ;
continue ;
}
if ( ! is_array ( $row )) {
$row = ( array ) $row ;
}
// It's a normal row
foreach ( $row as $key => $item ) {
if ( ! isset ( $size [ $key ])) {
$size [ $key ] = '' ;
}
if ( ! isset ( $cellstyle [ $keyrow ][ $key ])) {
$cellstyle [ $keyrow ][ $key ] = '' ;
}
if ( ! isset ( $cellclass [ $keyrow ][ $key ])) {
$cellclass [ $keyrow ][ $key ] = '' ;
}
if ( ! isset ( $colspan [ $keyrow ][ $key ])) {
$colspan [ $keyrow ][ $key ] = '' ;
}
if ( ! isset ( $rowspan [ $keyrow ][ $key ])) {
$rowspan [ $keyrow ][ $key ] = '' ;
}
if ( ! isset ( $align [ $key ])) {
$align [ $key ] = '' ;
}
if ( ! isset ( $valign [ $key ])) {
$valign [ $key ] = '' ;
}
if ( ! isset ( $wrap [ $key ])) {
$wrap [ $key ] = '' ;
}
if ( ! isset ( $style [ $key ])) {
$style [ $key ] = '' ;
}
$output .= '<td id="' . $tableid . '-' . $keyrow . '-' . $key . '" style="' . $cellstyle [ $keyrow ][ $key ] . $style [ $key ] . $valign [ $key ] . $align [ $key ] . $size [ $key ] . $wrap [ $key ] . '" ' . $colspan [ $keyrow ][ $key ] . ' ' . $rowspan [ $keyrow ][ $key ] . ' class="' . $class . ' ' . $cellclass [ $keyrow ][ $key ] . '">' . $item . '</td>' . " \n " ;
}
$output .= '</tr>' . " \n " ;
}
}
$output .= '</tbody></table>' . " \n " ;
if ( $return ) {
return $output ;
}
echo $output ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2010-02-15 14:07:52 +01:00
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
/**
2011-04-27 15:43:31 +02:00
* Render a radio button input . Extended version , use html_print_radio_button () to simplify .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*
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
* @ param string Input name .
* @ param string Input value .
* @ param string Set the button to be marked ( optional , unmarked by default ) .
* @ param bool Disable the button ( optional , button enabled by default ) .
* @ param string Script to execute when onClick event is triggered ( optional ) .
2019-01-30 16:18:44 +01:00
* @ param string Optional HTML attributes . It ' s a free string which will be
inserted into the HTML tag , use it carefully ( optional ) .
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
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*/
2019-01-30 16:18:44 +01:00
/*
Hello there ! : )
We added some of what seems to be " buggy " messages to the openSource version recently . This is not to force open - source users to move to the enterprise version , this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support . This does not imply open - source version is limited in any way . If you check the recently added code , it contains only warnings and messages , no limitations except one : we removed the option to add custom logo in header . In the Update Manager section , it warns about the 'danger’ of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that' s why someone using a Pandora with 8000 agents should consider asking for support . It ' s not a joke , we know of many setups with a huge number of agents , and we hate to hear that “its becoming unstable and slow” : (
You can of course remove the warnings , that 's why we include the source and do not use any kind of trick. And that' s why we added here this comment , to let you know this does not reflect any change in our opensource mentality of does the last 14 years .
*/
function html_print_radio_button_extended ( $name , $value , $label , $checkedvalue , $disabled , $script , $attributes , $return = false , $modal = false , $message = 'visualmodal' )
{
static $idcounter = 0 ;
$output = '' ;
$output = '<input type="radio" name="' . $name . '" value="' . $value . '"' ;
$htmlid = 'radiobtn' . sprintf ( '%04d' , ++ $idcounter );
$output .= ' id="' . $htmlid . '"' ;
if ( $value == $checkedvalue ) {
$output .= ' checked="checked"' ;
}
if ( $disabled ) {
$output .= ' disabled="disabled"' ;
}
if ( $script != '' ) {
$output .= ' onClick="' . $script . '"' ;
}
$output .= ' ' . $attributes ;
$output .= ' />' ;
if ( $label != '' ) {
$output .= '<label for="' . $htmlid . '">' . $label . '</label>' . " \n " ;
}
if ( $modal && ! enterprise_installed ()) {
$output .= "
2016-09-28 18:16:01 +02:00
< div id = '".$message."' class = 'publienterprise' title = 'Community version' style = 'display:inline;position:relative;top:10px;left:0px;margin-top: -2px !important; margin-left: 2px !important;' >< img data - title = 'Enterprise version' class = 'img_help forced_title' data - use_title_for_force_title = '1' src = 'images/alert_enterprise.png' ></ div >
" ;
2019-01-30 16:18:44 +01:00
}
if ( $return ) {
return $output ;
}
echo $output ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
/**
* Render a radio button input .
*
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
* @ param string Input name .
* @ param string Input value .
* @ param string Label to add after the radio button ( optional ) .
2019-01-30 16:18:44 +01:00
* @ param string Checked and selected value , the button will be selected if it matches $value ( optional ) .
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
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_print_radio_button ( $name , $value , $label = '' , $checkedvalue = '' , $return = false , $disabled = false )
{
$output = html_print_radio_button_extended ( $name , $value , $label , $checkedvalue , $disabled , '' , '' , true );
if ( $return ) {
return $output ;
}
echo $output ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
/**
2011-04-27 15:43:31 +02:00
* Render a checkbox button input . Extended version , use html_print_checkbox () to simplify .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*
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
* @ param string Input name .
* @ param string Input value .
* @ param string Set the button to be marked ( optional , unmarked by default ) .
* @ param bool Disable the button ( optional , button enabled by default ) .
* @ param string Script to execute when onClick event is triggered ( optional ) .
2019-01-30 16:18:44 +01:00
* @ param string Optional HTML attributes . It ' s a free string which will be
inserted into the HTML tag , use it carefully ( optional ) .
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
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_print_checkbox_extended ( $name , $value , $checked , $disabled , $script , $attributes , $return = false , $id = '' )
{
static $idcounter = [];
// If duplicate names exist, it will start numbering. Otherwise it won't
if ( isset ( $idcounter [ $name ])) {
$idcounter [ $name ] ++ ;
} else {
$idcounter [ $name ] = 0 ;
}
$id_aux = preg_replace ( '/[^a-z0-9\:\;\-\_]/i' , '' , $name . ( $idcounter [ $name ] ? $idcounter [ $name ] : '' ));
$output = '<input name="' . $name . '" type="checkbox" value="' . $value . '" ' . ( $checked ? 'checked="checked"' : '' );
if ( $id == '' ) {
$output .= ' id="checkbox-' . $id_aux . '"' ;
} else {
$output .= ' ' . $id . '"' ;
}
if ( $script != '' ) {
$output .= ' onclick="' . $script . '"' ;
}
if ( $disabled ) {
$output .= ' disabled="disabled"' ;
}
$output .= ' ' . $attributes ;
$output .= ' />' ;
$output .= " \n " ;
if ( $return === false ) {
echo $output ;
}
return $output ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
/**
* Render a checkbox button input .
*
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
* @ param string Input name .
* @ param string Input value .
* @ param string Set the button to be marked ( optional , unmarked by default ) .
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
2019-01-30 16:18:44 +01:00
* @ param boolean $disabled Disable the button ( optional , button enabled by default ) .
2008-12-16 11:20:33 +01:00
*
* @ return string HTML code if return parameter is true .
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
*/
2019-01-30 16:18:44 +01:00
function html_print_checkbox ( $name , $value , $checked = false , $return = false , $disabled = false , $script = '' , $disabled_hidden = false )
{
$output = html_print_checkbox_extended ( $name , $value , ( bool ) $checked , $disabled , $script , '' , true );
if ( ! $disabled_hidden ) {
$output .= html_print_input_hidden ( $name . '_sent' , 1 , true );
}
if ( $return === false ) {
echo $output ;
}
return $output ;
2008-06-15 Esteban Sanchez <estebans@artica.es>
* include/functions_html.php: Added to repository. Implements HTML
functions.
* reporting/fgraph.php: Many style correction fixes, including those
regardings tabs and blank spaces, variable names and indentation
levels for checkings. Improved dame_fecha(). Added date support to
graphic_combined_module(), grafico_modulo_sparse(). The selection of
the graphic to show based on parameters has been replaced by a switch.
The parameters are parsed with get_parameter()
* include/functions_db.php: Style correction of tabs and blanks
spaces. Use Pandora database functions on simple querying functions
such as dame_perfil(), give_disabled_group(), dame_grupo(),
give_note_author(), dame_agente_id(), dame_agente_modulo_id() and many
more, there are a lot more to change. Function comprueba_admin()
renamed to check_admin (wrap created for old function). Added some
checks to get_db_value(), get_db_row() so the SQL is build based on
the parameter types. Added get_db_all_rows_sqlfree(),
get_db_all_rows_in_table(), get_db_all_rows_field_filter(),
get_db_all_fields_in_table(). Added date support to
return_moduledata_avg_value(), return_moduledata_max_value(),
return_moduledata_min_value(). Added function
return_moduledata_sum_value() to get the sum of the values in a
module.
* include/functions.php: If input is numeric on safe_input, do not
clean it, since it's safe by itself. Use mysql_escape_string() on
salida_sql(). Added get_report_types(), get_report_name(),
get_report_type_data_source() relatives to reports. Added also
is_module_data(), is_module_proc(), is_module_inc(),
is_module_data_string() to know if a module is from a type. Replaced
form_priority() with get_event_types() so the caller of this function
will print the select (using print_select).
* operation/events/events.php: Replaced form_priorit() with
get_event_types().
* ChangeLog: Tab style correction with previous commit.
git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@863 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2008-06-16 12:45:08 +02:00
}
2019-01-30 16:18:44 +01:00
2019-01-17 17:28:23 +01:00
/**
2019-02-26 12:04:18 +01:00
* Render a checkbox button input switch type . Extended version , use html_print_checkbox_switch () to simplify .
2019-01-17 17:28:23 +01:00
*
* @ param string Input name .
* @ param string Input value .
* @ param string Set the button to be marked ( optional , unmarked by default ) .
* @ param bool Disable the button ( optional , button enabled by default ) .
* @ param string Script to execute when onClick event is triggered ( optional ) .
2019-02-06 16:11:46 +01:00
* @ param string Optional HTML attributes . It ' s a free string which will be
2019-01-17 17:28:23 +01:00
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
*
* @ return string HTML code if return parameter is true .
*/
2019-02-06 16:11:46 +01:00
2019-02-26 12:04:18 +01:00
function html_print_checkbox_switch_extended ( $name , $value , $checked , $disabled , $script , $attributes , $return = false , $id = '' )
2019-02-06 16:11:46 +01:00
{
static $idcounter = [];
// If duplicate names exist, it will start numbering. Otherwise it won't
if ( isset ( $idcounter [ $name ])) {
$idcounter [ $name ] ++ ;
} else {
$idcounter [ $name ] = 0 ;
}
$id_aux = preg_replace ( '/[^a-z0-9\:\;\-\_]/i' , '' , $name . ( $idcounter [ $name ] ? $idcounter [ $name ] : '' ));
2019-02-26 12:04:18 +01:00
$output = '<label class="p-switch"><input name="' . $name . '" type="checkbox" value="' . $value . '" ' . ( $checked ? 'checked="checked"' : '' );
2019-02-06 16:11:46 +01:00
if ( $id == '' ) {
$output .= ' id="checkbox-' . $id_aux . '"' ;
} else {
$output .= ' ' . $id . '"' ;
}
if ( $script != '' ) {
$output .= ' onclick="' . $script . '"' ;
}
if ( $disabled ) {
$output .= ' disabled="disabled"' ;
}
$output .= ' ' . $attributes ;
2019-02-26 12:04:18 +01:00
$output .= ' /><span class="p-slider"></span></label>' ;
2019-02-06 16:11:46 +01:00
$output .= " \n " ;
if ( $return === false ) {
echo $output ;
}
return $output ;
2019-01-17 17:28:23 +01:00
}
2019-02-06 16:11:46 +01:00
2019-01-17 17:28:23 +01:00
/**
2019-02-26 12:04:18 +01:00
* Render a checkbox button input switch type .
2019-01-17 17:28:23 +01:00
*
* @ param string Input name .
* @ param string Input value .
* @ param string Set the button to be marked ( optional , unmarked by default ) .
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
2019-02-06 16:11:46 +01:00
* @ param boolean $disabled Disable the button ( optional , button enabled by default ) .
2019-01-17 17:28:23 +01:00
*
* @ return string HTML code if return parameter is true .
*/
2019-02-06 16:11:46 +01:00
2019-02-26 12:04:18 +01:00
function html_print_checkbox_switch ( $name , $value , $checked = false , $return = false , $disabled = false , $script = '' , $disabled_hidden = false )
2019-02-06 16:11:46 +01:00
{
2019-02-26 12:04:18 +01:00
$output = html_print_checkbox_switch_extended ( $name , $value , ( bool ) $checked , $disabled , $script , '' , true );
2019-02-06 16:11:46 +01:00
if ( ! $disabled_hidden ) {
$output .= html_print_input_hidden ( $name . '_sent' , 1 , true );
}
if ( $return === false ) {
echo $output ;
}
return $output ;
2019-01-17 17:28:23 +01:00
}
2019-02-06 16:11:46 +01:00
2008-12-16 11:20:33 +01:00
/**
* Prints an image HTML element .
*
2019-03-07 15:10:38 +01:00
* @ param string $src Image source filename .
* @ param boolean $return Whether to return or print .
* @ param array $options Array with optional HTML options to set .
* At this moment , the following options are supported :
* align , border , hspace , ismap , vspace , style , title , height ,
* longdesc , usemap , width , id , class , lang , xml : lang , onclick ,
* ondblclick , onmousedown , onmouseup , onmouseover , onmousemove ,
* onmouseout , onkeypress , onkeydown , onkeyup , pos_tree , alt .
* @ param boolean $return_src Whether to return src field of image
* ( 'images/*.*' ) or complete html img tag ( '<img src="..." alt="...">' ) .
* @ param boolean $relative Whether to use relative path to image or not
* ( i . e . $relative = true : / pandora /< img_src > ) .
* @ param boolean $no_in_meta Do not show on metaconsole folder at first . Go
* directly to the node .
* @ param boolean $isExternalLink Do not shearch for images in Pandora .
2019-01-30 16:18:44 +01:00
*
2008-12-16 11:20:33 +01:00
* @ return string HTML code if return parameter is true .
*/
2019-01-30 16:18:44 +01:00
function html_print_image (
$src ,
$return = false ,
$options = false ,
$return_src = false ,
$relative = false ,
$no_in_meta = false ,
$isExternalLink = false
) {
global $config ;
2019-03-07 15:10:38 +01:00
// If metaconsole is in use then don't use skins.
2019-01-30 16:18:44 +01:00
if ( ! is_metaconsole ()) {
2019-03-07 15:10:38 +01:00
// Checks if user's skin is available.
2019-01-30 16:18:44 +01:00
$isFunctionSkins = enterprise_include_once ( 'include/functions_skins.php' );
if ( $isFunctionSkins !== ENTERPRISE_NOT_HOOK ) {
$skin_path = enterprise_hook ( 'skins_get_image_path' , [ $src ]);
if ( $skin_path ) {
$src = $skin_path ;
}
}
}
2019-03-07 15:10:38 +01:00
// If metaconsole is activated and image doesn't exists try to search on normal console.
2019-01-30 16:18:44 +01:00
if ( is_metaconsole ()) {
if ( ! $relative ) {
$working_dir = str_replace ( '\\' , '/' , getcwd ());
2019-03-07 15:10:38 +01:00
// Windows compatibility.
2019-01-30 16:18:44 +01:00
if ( $no_in_meta ) {
$src = '../../' . $src ;
} else if ( strstr ( $working_dir , 'enterprise/meta' ) === false ) {
if ( $src [ 0 ] !== '/' ) {
$src = '/' . $src ;
}
if ( ! is_readable ( $working_dir . '/enterprise/meta' . $src )) {
if ( $isExternalLink ) {
$src = ui_get_full_url ( $src );
} else {
$src = ui_get_full_url ( '../..' . $src );
}
} else {
$src = ui_get_full_url ( $src );
}
} else {
if ( $src [ 0 ] !== '/' ) {
$src = '/' . $src ;
}
if ( is_readable ( $working_dir . $src )) {
$src = ui_get_full_url ( $src );
} else if ( ! is_readable ( $src )) {
$src = ui_get_full_url ( '../../' . $src );
}
}
} else {
$src = '../../' . $src ;
}
} else {
if ( ! $relative ) {
$src_tmp = $src ;
$src = ui_get_full_url ( $src );
}
}
2019-03-07 15:10:38 +01:00
// Only return src field of image.
2019-01-30 16:18:44 +01:00
if ( $return_src ) {
if ( ! $return ) {
echo io_safe_input ( $src );
2019-03-07 15:10:38 +01:00
return null ;
2019-01-30 16:18:44 +01:00
}
return io_safe_input ( $src );
}
$output = '<img src="' . $src . '" ' ;
2019-03-07 15:10:38 +01:00
// Dont use safe_input here or the performance will dead.
2019-01-30 16:18:44 +01:00
$style = '' ;
if ( ! empty ( $options )) {
2019-03-07 15:10:38 +01:00
// Deprecated or value-less attributes.
2019-01-30 16:18:44 +01:00
if ( isset ( $options [ 'align' ])) {
$style .= 'align:' . $options [ 'align' ] . ';' ;
// Align is deprecated, use styles.
}
if ( isset ( $options [ 'border' ])) {
$style .= 'border:' . $options [ 'border' ] . 'px;' ;
2019-03-07 15:10:38 +01:00
// Border is deprecated, use styles.
2019-01-30 16:18:44 +01:00
}
if ( isset ( $options [ 'hspace' ])) {
$style .= 'margin-left:' . $options [ 'hspace' ] . 'px;' ;
2019-03-07 15:10:38 +01:00
// hspace is deprecated, use styles.
2019-01-30 16:18:44 +01:00
$style .= 'margin-right:' . $options [ 'hspace' ] . 'px;' ;
}
if ( isset ( $options [ 'ismap' ])) {
$output .= 'ismap="ismap" ' ;
2019-03-07 15:10:38 +01:00
// Defines the image as a server-side image map.
2019-01-30 16:18:44 +01:00
}
if ( isset ( $options [ 'vspace' ])) {
$style .= 'margin-top:' . $options [ 'vspace' ] . 'px;' ;
2019-03-07 15:10:38 +01:00
// hspace is deprecated, use styles.
2019-01-30 16:18:44 +01:00
$style .= 'margin-bottom:' . $options [ 'vspace' ] . 'px;' ;
}
if ( isset ( $options [ 'style' ])) {
$style .= $options [ 'style' ];
}
2019-03-07 15:10:38 +01:00
// If title is provided activate forced title.
2019-01-30 16:18:44 +01:00
if ( isset ( $options [ 'title' ]) && $options [ 'title' ] != '' ) {
if ( isset ( $options [ 'class' ])) {
$options [ 'class' ] .= ' forced_title' ;
} else {
$options [ 'class' ] = 'forced_title' ;
}
2019-03-07 15:10:38 +01:00
// New way to show the force_title (cleaner and better performance).
2019-01-30 16:18:44 +01:00
$output .= 'data-title="' . io_safe_input_html ( $options [ 'title' ]) . '" ' ;
$output .= 'data-use_title_for_force_title="1" ' ;
}
2019-03-07 15:10:38 +01:00
// Valid attributes (invalid attributes get skipped).
2019-01-30 16:18:44 +01:00
$attrs = [
'height' ,
'longdesc' ,
'usemap' ,
'width' ,
'id' ,
'class' ,
'lang' ,
'xml:lang' ,
'onclick' ,
'ondblclick' ,
'onmousedown' ,
'onmouseup' ,
'onmouseover' ,
'onmousemove' ,
'onmouseout' ,
'onkeypress' ,
'onkeydown' ,
'onkeyup' ,
'pos_tree' ,
];
foreach ( $attrs as $attribute ) {
if ( isset ( $options [ $attribute ])) {
$output .= $attribute . '="' . io_safe_input_html ( $options [ $attribute ]) . '" ' ;
}
}
} else {
$options = [];
}
if ( ! isset ( $options [ 'alt' ]) && isset ( $options [ 'title' ])) {
$options [ 'alt' ] = io_safe_input_html ( $options [ 'title' ]);
2019-03-07 15:10:38 +01:00
// Set alt to title if it's not set.
2019-01-30 16:18:44 +01:00
}
if ( ! empty ( $style )) {
$output .= 'style="' . $style . '" ' ;
}
if ( isset ( $options [ 'alt' ])) {
$output .= 'alt="' . io_safe_input_html ( $options [ 'alt' ]) . '" />' ;
} else {
$output .= '/>' ;
}
if ( ! $return ) {
echo $output ;
}
return $output ;
2008-12-16 11:20:33 +01:00
}
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
2019-01-30 16:18:44 +01:00
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
/**
2011-04-27 15:43:31 +02:00
* Render an input text element . Extended version , use html_print_input_text () to simplify .
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
*
* @ param string Input name .
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
2019-01-30 16:18:44 +01:00
* @ param array An array with optional HTML parameters .
* Key size : HTML size attribute .
* Key disabled : Whether to disable the input or not .
* Key class : HTML class
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
*/
2019-01-30 16:18:44 +01:00
function html_print_input_file ( $name , $return = false , $options = false )
{
$output = '' ;
$output .= '<input type="file" value="" name="' . $name . '" id="file-' . $name . '" ' ;
if ( $options ) {
if ( isset ( $options [ 'size' ])) {
$output .= 'size="' . $options [ 'size' ] . '"' ;
}
if ( isset ( $options [ 'disabled' ])) {
$output .= 'disabled="disabled"' ;
}
if ( isset ( $options [ 'class' ])) {
$output .= 'class="' . $options [ 'class' ] . '"' ;
}
}
$output .= ' />' ;
if ( $return ) {
return $output ;
}
echo $output ;
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
}
2019-01-30 16:18:44 +01:00
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
/**
* Render a label for a input elemennt .
*
* @ param string Label text .
* @ param string Input id to refer .
* @ param bool Whether to return an output string or echo now ( optional , echo by default ) .
2019-01-30 16:18:44 +01:00
* @ param array An array with optional HTML parameters .
* Key html : Extra HTML to add after the label .
* Key class : HTML class
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
*/
2019-01-30 16:18:44 +01:00
function html_print_label ( $text , $id , $return = false , $options = false )
{
$output = '' ;
$output .= '<label id="label-' . $id . '" ' ;
if ( $options ) {
if ( isset ( $options [ 'class' ])) {
$output .= 'class="' . $options [ 'class' ] . '" ' ;
}
if ( isset ( $options [ 'style' ])) {
$output .= 'style="' . $options [ 'style' ] . '" ' ;
}
}
$output .= 'for="' . $id . '" >' ;
$output .= $text ;
$output .= '</label>' ;
if ( $options ) {
if ( isset ( $options [ 'html' ])) {
$output .= $options [ 'html' ];
}
}
if ( $return ) {
return $output ;
}
echo $output ;
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
}
2010-08-12 13:09:45 +02:00
2019-01-30 16:18:44 +01:00
2010-08-12 13:09:45 +02:00
/**
* Convert a html color like #FF00FF into the rgb values like (255,0,255).
*
* @ param string color in format #FFFFFF, FFFFFF, #FFF or FFF
*/
2011-04-27 15:43:31 +02:00
function html_html2rgb ( $htmlcolor )
2010-08-12 13:09:45 +02:00
{
2019-01-30 16:18:44 +01:00
if ( $htmlcolor [ 0 ] == '#' ) {
$htmlcolor = substr ( $htmlcolor , 1 );
}
if ( strlen ( $htmlcolor ) == 6 ) {
$r = hexdec ( $htmlcolor [ 0 ] . $htmlcolor [ 1 ]);
$g = hexdec ( $htmlcolor [ 2 ] . $htmlcolor [ 3 ]);
$b = hexdec ( $htmlcolor [ 4 ] . $htmlcolor [ 5 ]);
return [
$r ,
$g ,
$b ,
];
} else if ( strlen ( $htmlcolor ) == 3 ) {
$r = hexdec ( $htmlcolor [ 0 ] . $htmlcolor [ 0 ]);
$g = hexdec ( $htmlcolor [ 1 ] . $htmlcolor [ 1 ]);
$b = hexdec ( $htmlcolor [ 2 ] . $htmlcolor [ 2 ]);
return [
$r ,
$g ,
$b ,
];
} else {
return false ;
}
2010-08-12 13:09:45 +02:00
}
2010-11-03 18:45:39 +01:00
2019-01-30 16:18:44 +01:00
2010-11-03 18:45:39 +01:00
/**
* Print a magic - ajax control to select the module .
2019-01-30 16:18:44 +01:00
*
* @ param string $name The name of ajax control , by default is " module " .
* @ param string $default The default value to show in the ajax control .
* @ param array $id_agents The array list of id agents as array ( 1 , 2 , 3 ), by default is false and the function use all agents ( if the ACL desactive ) .
* @ param boolean $ACL Filter the agents by the ACL list of user .
* @ param string $scriptResult The source code of script to call , by default is
* empty . And the example is :
* function ( e , data , formatted ) {
* ...
* }
*
* And the formatted is the select item as string .
*
* @ param array $filter Other filter of modules .
* @ param boolean $return If it is true return a string with the output instead to echo the output .
*
2010-11-03 18:45:39 +01:00
* @ return mixed If the $return is true , return the output as string .
*/
2019-01-30 16:18:44 +01:00
function html_print_autocomplete_modules (
$name = 'module' ,
$default = '' ,
$id_agents = false ,
$ACL = true ,
$scriptResult = '' ,
$filter = [],
$return = false ,
$id_agent_module = 0
) {
global $config ;
if ( $id_agents === false ) {
$groups = [];
if ( $ACL ) {
$groups = users_get_groups ( $config [ 'id_user' ], 'AW' , false );
$groups = array_keys ( $groups );
if ( empty ( $groups )) {
$id_groups = 0 ;
} else {
$id_groups = implode ( ',' , $groups );
}
$agents = db_get_all_rows_sql (
' SELECT id_agente
2014-04-03 16:50:03 +02:00
FROM tagente
2019-01-30 16:18:44 +01:00
WHERE id_grupo IN ( '.$id_groups.' ) '
);
} else {
$agents = db_get_all_rows_sql (
' SELECT id_agente
FROM tagente '
);
}
if ( $agents === false ) {
$agents = [];
}
$id_agents = [];
foreach ( $agents as $agent ) {
$id_agents [] = $agent [ 'id_agente' ];
}
} else {
if ( $ACL ) {
$groups = users_get_groups ( $config [ 'id_user' ], 'AW' , false );
$groups = array_keys ( $groups );
$agents = db_get_all_rows_sql ( 'SELECT id_agente FROM tagente WHERE id_grupo IN (' . implode ( ',' , $groups ) . ')' );
if ( $agents === false ) {
$agents = [];
}
$id_agentsACL = [];
foreach ( $agents as $agent ) {
if ( array_search ( $agent [ 'id_agente' ], $id_agents ) !== false ) {
$id_agentsACL [] = $agent [ 'id_agente' ];
}
}
$id_agents = $id_agentsACL ;
}
}
ob_start ();
html_print_input_text_extended (
$name ,
$default ,
'text-' . $name ,
'' ,
30 ,
100 ,
false ,
'' ,
[ 'style' => 'background: url(images/search_module.png) no-repeat right;' ]
);
html_print_input_hidden ( $name . '_hidden' , $id_agent_module );
ui_print_help_tip ( __ ( 'Type at least two characters to search the module.' ), false );
$javascript_ajax_page = ui_get_full_url ( 'ajax.php' , false , false , false , false );
?>
< script type = " text/javascript " >
function escapeHTML ( str )
{
var div = document . createElement ( 'div' );
var text = document . createTextNode ( str );
div . appendChild ( text );
return div . innerHTML ;
}
$ ( document ) . ready ( function () {
$ ( " #text-<?php echo $name ; ?> " ) . autocomplete ({
minLength : 2 ,
source : function ( request , response ) {
var term = request . term ; //Word to search
data_params = {
page : " include/ajax/module " ,
q : term ,
search_modules : 1 ,
id_agents : '<?php echo json_encode($id_agents); ?>' ,
other_filter : '<?php echo json_encode($filter); ?>'
};
jQuery . ajax ({
data : data_params ,
async : false ,
type : " POST " ,
url : action = " <?php echo $javascript_ajax_page ; ?> " ,
timeout : 10000 ,
dataType : " json " ,
success : function ( data ) {
temp = [];
$ . each ( data , function ( id , module ) {
temp . push ({
'value' : id ,
'label' : module });
});
response ( temp );
}
});
},
change : function ( event , ui ) {
if ( ! ui . item )
$ ( " input[name='<?php echo $name ; ?>_hidden'] " )
. val ( 0 );
return false ;
},
select : function ( event , ui ) {
$ ( " input[name='<?php echo $name ; ?>_hidden'] " )
. val ( ui . item . value );
$ ( " #text-<?php echo $name ; ?> " ) . val ( ui . item . label );
return false ;
}
}
);
});
</ script >
< ? php
$output = ob_get_clean ();
if ( $return ) {
return $output ;
} else {
echo $output ;
}
2010-11-03 18:45:39 +01:00
}
2018-04-30 15:34:18 +02:00
2019-01-30 16:18:44 +01:00
2018-04-30 15:34:18 +02:00
/**
* @ param string Select form name
* @ param string Current selected value
*
* @ return string HTML code
*/
2019-01-30 16:18:44 +01:00
function html_print_timezone_select ( $name , $selected = '' )
{
$timezones = [
'Pacific/Midway' => '(GMT-11:00) ' . __ ( 'Midway Island' ),
'US/Samoa' => '(GMT-11:00) ' . __ ( 'Samoa' ),
'US/Hawaii' => '(GMT-10:00) ' . __ ( 'Hawaii' ),
'US/Alaska' => '(GMT-09:00) ' . __ ( 'Alaska' ),
'US/Pacific' => '(GMT-08:00) ' . __ ( 'Pacific Time (US & Canada)' ),
'America/Tijuana' => '(GMT-08:00) ' . __ ( 'Tijuana' ),
'US/Arizona' => '(GMT-07:00) ' . __ ( 'Arizona' ),
'US/Mountain' => '(GMT-07:00) ' . __ ( 'Mountain Time (US & Canada)' ),
'America/Chihuahua' => '(GMT-07:00) ' . __ ( 'Chihuahua' ),
'America/Mazatlan' => '(GMT-07:00) ' . __ ( 'Mazatlan' ),
'America/Mexico_City' => '(GMT-06:00) ' . __ ( 'Mexico City' ),
'America/Monterrey' => '(GMT-06:00) ' . __ ( 'Monterrey' ),
'Canada/Saskatchewan' => '(GMT-06:00) ' . __ ( 'Saskatchewan' ),
'US/Central' => '(GMT-06:00) ' . __ ( 'Central Time (US & Canada)' ),
'US/Eastern' => '(GMT-05:00) ' . __ ( 'Eastern Time (US & Canada)' ),
'US/East-Indiana' => '(GMT-05:00) ' . __ ( 'Indiana (East)' ),
'America/Bogota' => '(GMT-05:00) ' . __ ( 'Bogota' ),
'America/Lima' => '(GMT-05:00) ' . __ ( 'Lima' ),
'America/Caracas' => '(GMT-04:30) ' . __ ( 'Caracas' ),
'Canada/Atlantic' => '(GMT-04:00) ' . __ ( 'Atlantic Time (Canada)' ),
'America/La_Paz' => '(GMT-04:00) ' . __ ( 'La Paz' ),
'America/Santiago' => '(GMT-04:00) ' . __ ( 'Santiago' ),
'Canada/Newfoundland' => '(GMT-03:30) ' . __ ( 'Newfoundland' ),
'America/Buenos_Aires' => '(GMT-03:00) ' . __ ( 'Buenos Aires' ),
" Greenland' " => '(GMT-03:00) ' . __ ( 'Greenland' ),
'Atlantic/Stanley' => '(GMT-02:00) ' . __ ( 'Stanley' ),
'Atlantic/Azores' => '(GMT-01:00) ' . __ ( 'Azores' ),
'Atlantic/Cape_Verde' => '(GMT-01:00) ' . __ ( 'Cape Verde Is.' ),
'Africa/Casablanca' => '(GMT+00:00) ' . __ ( 'Casablanca' ),
'Europe/Dublin' => '(GMT+00:00) ' . __ ( 'Dublin' ),
'Europe/Lisbon' => '(GMT+00:00) ' . __ ( 'Lisbon' ),
'Europe/London' => '(GMT+00:00) ' . __ ( 'London' ),
'Africa/Monrovia' => '(GMT+00:00) ' . __ ( 'Monrovia' ),
'Europe/Amsterdam' => '(GMT+01:00) ' . __ ( 'Amsterdam' ),
'Europe/Belgrade' => '(GMT+01:00) ' . __ ( 'Belgrade' ),
'Europe/Berlin' => '(GMT+01:00) ' . __ ( 'Berlin' ),
'Europe/Bratislava' => '(GMT+01:00) ' . __ ( 'Bratislava' ),
'Europe/Brussels' => '(GMT+01:00) ' . __ ( 'Brussels' ),
'Europe/Budapest' => '(GMT+01:00) ' . __ ( 'Budapest' ),
'Europe/Copenhagen' => '(GMT+01:00) ' . __ ( 'Copenhagen' ),
'Europe/Ljubljana' => '(GMT+01:00) ' . __ ( 'Ljubljana' ),
'Europe/Madrid' => '(GMT+01:00) ' . __ ( 'Madrid' ),
'Europe/Paris' => '(GMT+01:00) ' . __ ( 'Paris' ),
'Europe/Prague' => '(GMT+01:00) ' . __ ( 'Prague' ),
'Europe/Rome' => '(GMT+01:00) ' . __ ( 'Rome' ),
'Europe/Sarajevo' => '(GMT+01:00) ' . __ ( 'Sarajevo' ),
'Europe/Skopje' => '(GMT+01:00) ' . __ ( 'Skopje' ),
'Europe/Stockholm' => '(GMT+01:00) ' . __ ( 'Stockholm' ),
'Europe/Vienna' => '(GMT+01:00) ' . __ ( 'Vienna' ),
'Europe/Warsaw' => '(GMT+01:00) ' . __ ( 'Warsaw' ),
'Europe/Zagreb' => '(GMT+01:00) ' . __ ( 'Zagreb' ),
'Europe/Athens' => '(GMT+02:00) ' . __ ( 'Athens' ),
'Europe/Bucharest' => '(GMT+02:00) ' . __ ( 'Bucharest' ),
'Africa/Cairo' => '(GMT+02:00) ' . __ ( 'Cairo' ),
'Africa/Harare' => '(GMT+02:00) ' . __ ( 'Harare' ),
'Europe/Helsinki' => '(GMT+02:00) ' . __ ( 'Helsinki' ),
'Europe/Istanbul' => '(GMT+02:00) ' . __ ( 'Istanbul' ),
'Asia/Jerusalem' => '(GMT+02:00) ' . __ ( 'Jerusalem' ),
'Europe/Kiev' => '(GMT+02:00) ' . __ ( 'Kyiv' ),
'Europe/Minsk' => '(GMT+02:00) ' . __ ( 'Minsk' ),
'Europe/Riga' => '(GMT+02:00) ' . __ ( 'Riga' ),
'Europe/Sofia' => '(GMT+02:00) ' . __ ( 'Sofia' ),
'Europe/Tallinn' => '(GMT+02:00) ' . __ ( 'Tallinn' ),
'Europe/Vilnius' => '(GMT+02:00) ' . __ ( 'Vilnius' ),
'Asia/Baghdad' => '(GMT+03:00) ' . __ ( 'Baghdad' ),
'Asia/Kuwait' => '(GMT+03:00) ' . __ ( 'Kuwait' ),
'Africa/Nairobi' => '(GMT+03:00) ' . __ ( 'Nairobi' ),
'Asia/Riyadh' => '(GMT+03:00) ' . __ ( 'Riyadh' ),
'Europe/Moscow' => '(GMT+03:00) ' . __ ( 'Moscow' ),
'Asia/Tehran' => '(GMT+03:30) ' . __ ( 'Tehran' ),
'Asia/Baku' => '(GMT+04:00) ' . __ ( 'Baku' ),
'Europe/Volgograd' => '(GMT+04:00) ' . __ ( 'Volgograd' ),
'Asia/Muscat' => '(GMT+04:00) ' . __ ( 'Muscat' ),
'Asia/Tbilisi' => '(GMT+04:00) ' . __ ( 'Tbilisi' ),
'Asia/Yerevan' => '(GMT+04:00) ' . __ ( 'Yerevan' ),
'Asia/Kabul' => '(GMT+04:30) ' . __ ( 'Kabul' ),
'Asia/Karachi' => '(GMT+05:00) ' . __ ( 'Karachi' ),
'Asia/Tashkent' => '(GMT+05:00) ' . __ ( 'Tashkent' ),
'Asia/Kolkata' => '(GMT+05:30) ' . __ ( 'Kolkata' ),
'Asia/Kathmandu' => '(GMT+05:45) ' . __ ( 'Kathmandu' ),
'Asia/Yekaterinburg' => '(GMT+06:00) ' . __ ( 'Ekaterinburg' ),
'Asia/Almaty' => '(GMT+06:00) ' . __ ( 'Almaty' ),
'Asia/Dhaka' => '(GMT+06:00) ' . __ ( 'Dhaka' ),
'Asia/Novosibirsk' => '(GMT+07:00) ' . __ ( 'Novosibirsk' ),
'Asia/Bangkok' => '(GMT+07:00) ' . __ ( 'Bangkok' ),
'Asia/Jakarta' => '(GMT+07:00) ' . __ ( 'Jakarta' ),
'Asia/Krasnoyarsk' => '(GMT+08:00) ' . __ ( 'Krasnoyarsk' ),
'Asia/Chongqing' => '(GMT+08:00) ' . __ ( 'Chongqing' ),
'Asia/Hong_Kong' => '(GMT+08:00) ' . __ ( 'Hong Kong' ),
'Asia/Kuala_Lumpur' => '(GMT+08:00) ' . __ ( 'Kuala Lumpur' ),
'Australia/Perth' => '(GMT+08:00) ' . __ ( 'Perth' ),
'Asia/Singapore' => '(GMT+08:00) ' . __ ( 'Singapore' ),
'Asia/Taipei' => '(GMT+08:00) ' . __ ( 'Taipei' ),
'Asia/Ulaanbaatar' => '(GMT+08:00) ' . __ ( 'Ulaan Bataar' ),
'Asia/Urumqi' => '(GMT+08:00) ' . __ ( 'Urumqi' ),
'Asia/Irkutsk' => '(GMT+09:00) ' . __ ( 'Irkutsk' ),
'Asia/Seoul' => '(GMT+09:00) ' . __ ( 'Seoul' ),
'Asia/Tokyo' => '(GMT+09:00) ' . __ ( 'Tokyo' ),
'Australia/Adelaide' => '(GMT+09:30) ' . __ ( 'Adelaide' ),
'Australia/Darwin' => '(GMT+09:30) ' . __ ( 'Darwin' ),
'Asia/Yakutsk' => '(GMT+10:00) ' . __ ( 'Yakutsk' ),
'Australia/Brisbane' => '(GMT+10:00) ' . __ ( 'Brisbane' ),
'Australia/Canberra' => '(GMT+10:00) ' . __ ( 'Canberra' ),
'Pacific/Guam' => '(GMT+10:00) ' . __ ( 'Guam' ),
'Australia/Hobart' => '(GMT+10:00) ' . __ ( 'Hobart' ),
'Australia/Melbourne' => '(GMT+10:00) ' . __ ( 'Melbourne' ),
'Pacific/Port_Moresby' => '(GMT+10:00) ' . __ ( 'Port Moresby' ),
'Australia/Sydney' => '(GMT+10:00) ' . __ ( 'Sydney' ),
'Asia/Vladivostok' => '(GMT+11:00) ' . __ ( 'Vladivostok' ),
'Asia/Magadan' => '(GMT+12:00) ' . __ ( 'Magadan' ),
'Pacific/Auckland' => '(GMT+12:00) ' . __ ( 'Auckland' ),
'Pacific/Fiji' => '(GMT+12:00) ' . __ ( 'Fiji' ),
];
return html_print_select ( $timezones , $name , $selected , '' , __ ( 'None' ), '' , true , false , false );
2018-04-30 15:34:18 +02:00
}
2019-01-30 16:18:44 +01:00
2018-08-13 12:41:09 +02:00
/**
* Enclose a text into a result_div
*
* @ param string Text to enclose
*
* @ return string Text inside the result_div
*/
2019-01-30 16:18:44 +01:00
function html_print_result_div ( $text )
{
$text = preg_replace ( '/</' , '<' , $text );
$text = preg_replace ( '/>/' , '>' , $text );
$text = preg_replace ( '/\n/i' , '<br>' , $text );
$text = preg_replace ( '/\s/i' , ' ' , $text );
$enclose = " <div id='result_div' style='width: 100%; height: 100%; overflow: auto; padding: 10px; font-size: 14px; line-height: 16px; font-family: mono,monospace; text-align: left'> " ;
$enclose .= $text ;
$enclose .= '</div>' ;
return $enclose ;
2018-08-13 12:41:09 +02:00
}
2019-01-30 16:18:44 +01:00
2018-08-14 10:40:56 +02:00
/**
* Print order arrows links
*
* @ param array Base tags to build url
* @ param string Order key to add to URL
* @ param string Value to sort ascendent
* @ param string Value to sort descendent
*
* @ return string HTML code to display both arrows .
*/
2019-01-30 16:18:44 +01:00
function html_print_sort_arrows ( $params , $order_tag , $up = 'up' , $down = 'down' )
{
// Build the queries
$params [ $order_tag ] = $up ;
$url_up = 'index.php?' . http_build_query ( $params , '' , '&' );
$params [ $order_tag ] = $down ;
$url_down = 'index.php?' . http_build_query ( $params , '' , '&' );
// Build the links
return ' ' . '<a href="' . $url_up . '">' . html_print_image ( 'images/sort_up.png' , true ) . '</a>' . '<a href="' . $url_down . '">' . html_print_image ( 'images/sort_down.png' , true ) . '</a>' ;
2018-08-14 10:40:56 +02:00
}
2018-09-13 15:19:08 +02:00
2019-01-30 16:18:44 +01:00
2018-09-13 15:19:08 +02:00
/**
* Print an input hidden with a new csrf token generated
*/
2019-01-30 16:18:44 +01:00
function html_print_csrf_hidden ()
{
html_print_input_hidden ( 'csrf_code' , generate_csrf_code ());
2018-09-13 15:19:08 +02:00
}
2019-01-30 16:18:44 +01:00
2018-09-13 15:19:08 +02:00
/**
* Print an error if csrf is incorrect
*/
2019-01-30 16:18:44 +01:00
function html_print_csrf_error ()
{
if ( validate_csrf_code ()) {
return false ;
}
ui_print_error_message (
__ (
'%s cannot verify the origin of the request. Try again, please.' ,
get_product_name ()
)
);
return true ;
2018-09-13 15:19:08 +02:00
}
2019-02-26 12:04:18 +01:00
/**
* Print an swith button
*
* @ param array $atributes . Valid params :
* name : Usefull to handle in forms
* value : If is checked or not
* disabled : Disabled . Cannot be pressed .
* id : Optional id for the switch .
* class : Additional classes ( string ) .
* @ return string with HTML of button
*/
function html_print_switch ( $attributes = [])
{
$html_expand = '' ;
// Check the load values on status.
$html_expand .= ( bool ) $attributes [ 'value' ] ? ' checked' : '' ;
$html_expand .= ( bool ) $attributes [ 'disabled' ] ? ' disabled' : '' ;
// Only load the valid attributes.
$valid_attrs = [
'id' ,
'class' ,
'name' ,
'onclick' ,
];
foreach ( $valid_attrs as $va ) {
if ( ! isset ( $attributes [ $va ])) {
continue ;
}
$html_expand .= ' ' . $va . '="' . $attributes [ $va ] . '"' ;
}
return " <label class='p-switch'>
< input type = 'checkbox' $html_expand >
< span class = 'p-slider' ></ span >
</ label > " ;
}
2019-03-05 10:08:07 +01:00
/**
* Print a link with post params . The component is really a form with a button
* with some inputs hidden .
*
* @ param string $text Text to show .
* @ param array $params Params to be written like inputs hidden .
2019-03-07 15:10:38 +01:00
* @ param string $text Text of image .
2019-03-05 10:08:07 +01:00
*
* @ return string With HTML code .
*/
2019-03-07 15:10:38 +01:00
function html_print_link_with_params ( $text , $params = [], $type = 'text' )
2019-03-05 10:08:07 +01:00
{
$html = '<form method=post>' ;
2019-03-07 15:10:38 +01:00
switch ( $type ) {
case 'image' :
$html .= html_print_input_image ( $text , $text , $text , '' , true );
break ;
case 'text' :
default :
$html .= html_print_submit_button ( $text , $text , false , 'class="button-as-link"' , true );
break ;
}
2019-03-05 10:08:07 +01:00
foreach ( $params as $param => $value ) {
$html .= html_print_input_hidden ( $param , $value , true );
}
$html .= '</form>' ;
return $html ;
}