99)) - display last 99 events from all device * print_alert_log(array('pagesize' => 10, 'pageno' => 3, 'pagination' => TRUE)) - display 10 events from page 3 with pagination header * print_alert_log(array('pagesize' => 10, 'device' = 4)) - display last 10 events for device_id 4 * print_alert_log(array('short' => TRUE)) - show small block with last events * * @param array $vars * @return none * */ function print_alert_log($vars) { global $alert_rules, $config; // This should be set outside, but do it here if it isn't if (!is_array($alert_rules)) { $alert_rules = cache_alert_rules(); } // Get events array $events = get_alert_log($vars); if (!$events['count']) { if(!$vars['no_empty_message']) { // There have been no entries returned. Print the warning. print_message('
' . PHP_EOL; if ($events['short']) { $string .= ' | '; $string .= generate_tooltip_time($entry['timestamp']) . ' | ' . PHP_EOL; } else { $string .= ''; $string .= format_timestamp($entry['timestamp']) . ' | ' . PHP_EOL; } if ($list['device']) { $dev = device_by_id_cache($entry['device_id']); $device_vars = array('page' => 'device', 'device' => $entry['device_id'], 'tab' => 'logs', 'section' => 'alertlog'); $string .= '' . generate_device_link_short($dev, $device_vars) . ' | ' . PHP_EOL; } if ($list['alert_test_id']) { $string .= ''. escape_html($alert_rule['alert_name']). ' | '; } if ($list['entity']) { $string .= ''; if ($list['entity_type']) { $string .= ' '; } if($events['short']) { $string .= ' ' . generate_entity_link($entry['entity_type'], $entry['entity_id'], NULL, NULL, NULL, TRUE) . ' | ' . PHP_EOL; } else { $string .= ' ' . generate_entity_link($entry['entity_type'], $entry['entity_id']) . '' . PHP_EOL; } } $string .= '' . escape_html($entry['message']) . ' | ' . PHP_EOL; if (!$vars['short']) { $string .= '' . escape_html($entry['log_type']) . ' | ' . PHP_EOL; /* $string .= ''; if ($entry['notified']) { $string .= 'OK'; } else if (!stristr($entry['log_type'], 'notify')) { $string .= 'SKIP'; } else { $string .= 'NO'; } $string .= ' | ' . PHP_EOL; */ } $string .= '