Minos changes and improvements

(cherry picked from commit 970be457d6)

Conflicts resolved:
	pandora_console/godmode/agentes/planned_downtime.export_csv.php
This commit is contained in:
Alejandro Gallardo Escobar 2015-07-15 18:39:47 +02:00
parent 019f203213
commit 245b88d103
1 changed files with 61 additions and 111 deletions

View File

@ -20,6 +20,7 @@ require_once ("../../include/functions.php");
require_once ("../../include/functions_db.php");
require_once ("../../include/functions_users.php");
require_once ("../../include/functions_groups.php");
require_once ("../../include/functions_reporting.php");
$config["id_user"] = $_SESSION["id_usuario"];
if (! check_acl ($config['id_user'], 0, "AR")) {
@ -43,10 +44,11 @@ $module_name = !empty($module_id) ? (string) get_parameter('module_name') : "";
$separator = (string) get_parameter("separator", ";");
$items_separator = (string) get_parameter("items_separator", ",");
$groups = users_get_groups();
if (!empty($groups)) {
// SQL QUERY CREATION
$where_values = "1=1";
$groups = users_get_groups();
$groups_string = implode (",", array_keys ($groups));
$where_values .= " AND id_group IN ($groups_string)";
@ -115,6 +117,7 @@ $sql = "SELECT *
WHERE $where_values
ORDER BY type_execution DESC, date_from DESC";
$downtimes = @db_get_all_rows_sql($sql);
}
if (!empty($downtimes)) {
ob_clean();
@ -143,60 +146,7 @@ if (!empty($downtimes)) {
$type = ucfirst(io_safe_output($downtime['type_downtime']));
$execution_type = ucfirst(io_safe_output($downtime['type_execution']));
switch ($downtime['type_execution']) {
case 'once':
$execution_date = date ("Y-m-d H:i", $downtime['date_from']) .
" " . __('to') . " ".
date ("Y-m-d H:i", $downtime['date_to']);
break;
case 'periodically':
switch ($downtime['type_periodicity']) {
case 'weekly':
$execution_date = __('Weekly:');
$execution_date .= " ";
if ($downtime['monday']) {
$execution_date .= __('Mon');
$execution_date .= " ";
}
if ($downtime['tuesday']) {
$execution_date .= __('Tue');
$execution_date .= " ";
}
if ($downtime['wednesday']) {
$execution_date .= __('Wed');
$execution_date .= " ";
}
if ($downtime['thursday']) {
$execution_date .= __('Thu');
$execution_date .= " ";
}
if ($downtime['friday']) {
$execution_date .= __('Fri');
$execution_date .= " ";
}
if ($downtime['saturday']) {
$execution_date .= __('Sat');
$execution_date .= " ";
}
if ($downtime['sunday']) {
$execution_date .= __('Sun');
$execution_date .= " ";
}
$execution_date .= " (" . $downtime['periodically_time_from'];
$execution_date .= "-" . $downtime['periodically_time_to'] . ")";
break;
case 'monthly':
$execution_date = __('Monthly:');
$execution_date .= __('From day') . " " . $downtime['periodically_day_from'];
$execution_date .= "/" . __('To day') . " ";
$execution_date .= $downtime['periodically_day_to'];
$execution_date .= " (" . $downtime['periodically_time_from'];
$execution_date .= "-" . $downtime['periodically_time_to'] . ")";
break;
}
break;
}
$execution_date = io_safe_output($execution_date);
$execution_date = io_safe_output(reporting_format_planned_downtime_dates($downtime));
$affected_items = array();