Exemple #1
0
    </div>		
    
    
    <!-- Suggestions -->
    <div class='suggestions_header sec_title'><?php 
echo _('Suggestions');
?>
</div>
    
    <div class='suggestions_content'>
    <?php 
$message = _("Currently no suggestions");
try {
    $status = new System_status();
    $filters = array('component_id' => Util::uuid_format($id), 'level' => 'info,warning,error', 'order_by' => $order, 'order_desc' => 'desc');
    list($message_list, $total) = $status->get_status_messages($filters);
} catch (Exception $e) {
    $total = 0;
    $message_list = array();
    $message = $e->getMessage();
}
if (!$total) {
    ?>
            <div class="no_suggestions"><?php 
    echo $message;
    ?>
</div>
            <?php 
} else {
    $i = 0;
    foreach ($message_list as $msg) {
/**
 * @param object $conn  DataBase access object
 *
 * @return array
 */
function calc_sensors_status($conn)
{
    // Get component list
    $avc_list = Av_center::get_avc_list($conn);
    $total = count($avc_list['data']);
    $up = $total;
    $down = 0;
    // Get notifications list
    $filters = array('level' => 'notification', 'message_id' => 11);
    $pagination = array('page' => 1, 'page_rows' => $total);
    $status = new System_status();
    list($notification_list, $total_notifications) = $status->get_status_messages($filters, $pagination);
    if ($total_notifications > 0) {
        $notification_components = array();
        foreach ($notification_list as $notification) {
            $notification_components[$notification['component_id']] = 1;
        }
        foreach ($avc_list['data'] as $avc_data) {
            if (preg_match('/sensor/i', $avc_data['profile'])) {
                if (isset($notification_components[Util::uuid_format($avc_data['system_id'])])) {
                    $down++;
                    $up--;
                }
            }
        }
    }
    return array($total, $up, $down);
}
Exemple #3
0
        $level = 'info,warning,error';
        break;
    case 2:
        $level = 'warning,error';
        break;
    case 3:
        $level = 'error';
        break;
}
$page = intval($from / $maxrows) + ($from % $maxrows == 0 ? 1 : 0);
// Call API
try {
    $filters = array('level' => $level, 'order_by' => $order, 'order_desc' => $torder);
    $pagination = array('page' => $page, 'page_rows' => $maxrows);
    $status = new System_status();
    list($message_list, $total) = $status->get_status_messages($filters, $pagination);
} catch (Exception $e) {
    $response['sEcho'] = $sec;
    $response['iTotalRecords'] = 0;
    $response['iTotalDisplayRecords'] = 0;
    $response['error'] = $e->getMessage();
    $response['aaData'] = array();
    echo json_encode($response);
    exit;
}
$data = array();
foreach ($message_list as $message) {
    $res = array();
    $res['DT_RowId'] = $message['message_id'] . '_' . $message['component_id'];
    $res['viewed'] = $message['viewed'];
    $res['ctime'] = gmdate("Y-m-d H:i:s", strtotime($message['creation_time']));