コード例 #1
0
ファイル: charts.php プロジェクト: rennhak/zabbix
    $rst_icon = new CDiv(SPACE, 'iconreset');
    $rst_icon->addOption('title', S_RESET);
    $rst_icon->addAction('onclick', new CScript("javascript: graphload(SCROLL_BAR.dom_graphs, " . (time() + 100000000) . ", 3600, false);"));
}
$charts_hat = create_hat(S_GRAPHS_BIG, $p_elements, array($icon, $rst_icon, $fs_icon), 'hat_charts', get_profile('web.charts.hats.hat_charts.state', 1));
$charts_hat->show();
if ($_REQUEST['graphid'] > 0) {
    // NAV BAR
    $stime = get_min_itemclock_by_graphid($_REQUEST['graphid']);
    $stime = is_null($stime) ? 0 : $stime;
    $bstime = time() - $effectiveperiod;
    if (isset($_REQUEST['stime'])) {
        $bstime = $_REQUEST['stime'];
        $bstime = mktime(substr($bstime, 8, 2), substr($bstime, 10, 2), 0, substr($bstime, 4, 2), substr($bstime, 6, 2), substr($bstime, 0, 4));
    }
    $script = 'scrollinit(0,' . $effectiveperiod . ',' . $stime . ',0,' . $bstime . '); showgraphmenu("graph");';
    if ($graphtype == GRAPH_TYPE_NORMAL || $graphtype == GRAPH_TYPE_STACKED) {
        $script .= 'graph_zoom_init("' . $dom_graph_id . '",' . $bstime . ',' . $effectiveperiod . ',ZBX_G_WIDTH,' . $graph_height . ',true);';
    }
    zbx_add_post_js($script);
    $scroll_div = new CDiv();
    $scroll_div->addOption('id', 'scroll_cntnr');
    $scroll_div->addOption('style', 'border: 0px #CC0000 solid; height: 25px; width: 800px;');
    $scroll_div->show();
    //		navigation_bar('charts.php',array('groupid','hostid','graphid'));
    //-------------
}
include_once 'include/page_footer.php';
?>

コード例 #2
0
ファイル: tr_events.php プロジェクト: rennhak/zabbix
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) {
    exit;
}
//--------
if (!check_right_on_trigger_by_triggerid(PERM_READ_ONLY, $_REQUEST["triggerid"])) {
    access_deny();
}
$trigger_data = DBfetch(DBselect('SELECT h.host, t.* ' . ' FROM hosts h, items i, functions f, triggers t ' . ' WHERE i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid ' . ' AND t.triggerid=' . $_REQUEST["triggerid"] . ' AND h.hostid=i.hostid ' . ' AND ' . DBin_node('t.triggerid')));
$p_elements = array();
//Header
$trigger_data['exp_expr'] = explode_exp($trigger_data["expression"], 1);
$trigger_data['exp_desc'] = expand_trigger_description_by_data($trigger_data);
$text = array(S_EVENTS_BIG . ': "' . $trigger_data['exp_desc'] . '"');
$url = '?fullscreen=' . ($_REQUEST['fullscreen'] ? '0' : '1') . url_param('triggerid') . url_param('eventid');
$fs_icon = new CDiv(SPACE, 'fullscreen');
$fs_icon->addOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN);
$fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';"));
//-------
$left_tab = new CTable();
$left_tab->setCellPadding(3);
$left_tab->setCellSpacing(3);
$left_tab->addOption('border', 0);
$left_tab->addRow(create_hat(S_EVENT . SPACE . S_SOURCE . SPACE . S_DETAILS, make_trigger_details($_REQUEST['triggerid'], $trigger_data), null, 'hat_triggerdetails'));
$left_tab->addRow(create_hat(S_EVENT_DETAILS, make_event_details($_REQUEST['eventid']), null, 'hat_eventdetails'));
$right_tab = new CTable();
$right_tab->setCellPadding(3);
$right_tab->setCellSpacing(3);
$right_tab->addOption('border', 0);
$right_tab->addRow(create_hat(S_ACKNOWLEDGES, make_acktab_by_eventid($_REQUEST['eventid']), null, 'hat_eventack', get_profile('web.tr_events.hats.hat_eventack.state', 1)));
$right_tab->addRow(create_hat(S_MESSAGE_ACTIONS, get_action_msgs_for_event($_REQUEST['eventid']), null, 'hat_eventactionmsgs', get_profile('web.tr_events.hats.hat_eventactionmsgs.state', 1)));
$right_tab->addRow(create_hat(S_COMMAND_ACTIONS, get_action_cmds_for_event($_REQUEST['eventid']), null, 'hat_eventactioncmds', get_profile('web.tr_events.hats.hat_eventactioncmds.state', 1)));
コード例 #3
0
ファイル: forms.inc.php プロジェクト: rennhak/zabbix
function insert_mass_update_trigger_form()
{
    //$elements_array_name){
    global $USER_DETAILS;
    $visible = get_request('visible', array());
    $priority = get_request('priority', '');
    $dependencies = get_request('dependencies', array());
    $original_templates = array();
    asort($dependencies);
    $frmMTrig = new CFormTable(S_TRIGGERS_MASSUPDATE, 'triggers.php');
    $frmMTrig->addVar('massupdate', get_request('massupdate', 1));
    $frmMTrig->addOption('id', 'massupdate');
    $triggers = $_REQUEST['g_triggerid'];
    foreach ($triggers as $id => $triggerid) {
        $frmMTrig->addVar('g_triggerid[' . $triggerid . ']', $triggerid);
    }
    $cmbPrior = new CComboBox("priority", $priority);
    for ($i = 0; $i <= 5; $i++) {
        $cmbPrior->addItem($i, get_severity_description($i));
    }
    $frmMTrig->addRow(array(new CVisibilityBox('visible[priority]', isset($visible['priority']), 'priority', S_ORIGINAL), S_SEVERITY), $cmbPrior);
    /* fependencies */
    $dep_el = array();
    foreach ($dependencies as $val) {
        array_push($dep_el, array(new CCheckBox("rem_dependence[]", 'no', null, strval($val)), expand_trigger_description($val)), BR());
        $frmMTrig->addVar("dependencies[]", strval($val));
    }
    if (count($dep_el) == 0) {
        $dep_el[] = S_NO_DEPENDENCES_DEFINED;
    } else {
        $dep_el[] = new CButton('del_dependence', 'delete selected');
    }
    //		$frmMTrig->addRow(S_THE_TRIGGER_DEPENDS_ON,$dep_el);
    /* end dependencies */
    /* new dependence */
    //$frmMTrig->addVar('new_dependence','0');
    $btnSelect = new CButton('btn1', S_ADD, "return PopUp('popup.php?dstfrm=massupdate&dstact=add_dependence" . "&dstfld1=new_dependence[]&srctbl=triggers&objname=triggers&srcfld1=1&multiselect=1" . "',600,450);", 'T');
    array_push($dep_el, array(br(), $btnSelect));
    $dep_div = new CDiv($dep_el);
    $dep_div->addOption('id', 'dependency_box');
    $frmMTrig->addRow(array(new CVisibilityBox('visible[dependencies]', isset($visible['dependencies']), 'dependency_box', S_ORIGINAL), S_TRIGGER_DEPENDENCIES), $dep_div);
    /* end new dependence */
    $frmMTrig->addItemToBottomRow(new CButton('mass_save', S_SAVE));
    $frmMTrig->addItemToBottomRow(SPACE);
    $frmMTrig->addItemToBottomRow(new CButtonCancel(url_param('config') . url_param('groupid')));
    $frmMTrig->Show();
}
コード例 #4
0
ファイル: html.inc.php プロジェクト: rennhak/zabbix
function create_filter($col_l, $col_r, $items, $id = 'zbx_filter', $state = 1)
{
    if (isset($_REQUEST['print'])) {
        $state = 0;
    }
    $table = new CTable();
    $table->addOption('width', '100%');
    $table->setCellPadding(0);
    $table->setCellSpacing(0);
    $table->addOption('border', 0);
    $icon = new CDiv(SPACE, $state ? 'filteropened' : 'filterclosed');
    $icon->addAction('onclick', new CScript("javascript: change_filter_state(this,'" . $id . "');"));
    $icon->addOption('title', S_MAXIMIZE . '/' . S_MINIMIZE);
    $icon->addAction('id', 'filter_icon');
    $td_icon = new CCol($icon);
    $td_icon->addOption('valign', 'bottom');
    $icons_row = array($td_icon, SPACE);
    $icons_row[] = $col_l;
    $icon_tab = new CTable();
    $icon_tab->setCellSpacing(0);
    $icon_tab->setCellPadding(0);
    $icon_tab->addRow($icons_row);
    $table->addRow(get_thin_table_header($icon_tab, $col_r));
    $div = new CDiv($items);
    $div->addOption('id', $id);
    if (!$state) {
        $div->addOption('style', 'display: none;');
    }
    $tab = new CTable();
    $tab->addRow($div);
    //		$table->addRow($tab);
    $table->addRow($div);
    return $table;
}
コード例 #5
0
ファイル: config.inc.php プロジェクト: rennhak/zabbix
function show_messages($bool = TRUE, $okmsg = NULL, $errmsg = NULL)
{
    global $page, $ZBX_MESSAGES;
    if (!defined('PAGE_HEADER_LOADED')) {
        return;
    }
    if (!isset($page["type"])) {
        $page["type"] = PAGE_TYPE_HTML;
    }
    $message = array();
    $width = 0;
    $height = 0;
    $img_space = null;
    if (!$bool && !is_null($errmsg)) {
        $msg = 'ERROR: ' . $errmsg;
    } else {
        if ($bool && !is_null($okmsg)) {
            $msg = $okmsg;
        }
    }
    if (isset($msg)) {
        switch ($page['type']) {
            case PAGE_TYPE_IMAGE:
                array_push($message, array('text' => $msg, 'color' => !$bool ? array('R' => 255, 'G' => 0, 'B' => 0) : array('R' => 34, 'G' => 51, 'B' => 68), 'font' => 2));
                $width = max($width, ImageFontWidth(2) * strlen($msg) + 1);
                $height += imagefontheight(2) + 1;
                break;
            case PAGE_TYPE_XML:
                echo htmlspecialchars($msg) . "\n";
                break;
            case PAGE_TYPE_HTML:
            default:
                $msg_tab = new CTable($msg, $bool ? 'msgok' : 'msgerr');
                $msg_tab->setCellPadding(0);
                $msg_tab->setCellSpacing(0);
                $msg_col = new CCol(bold($msg), 'msg_main msg');
                $msg_col->addOption('id', 'page_msg');
                $msg_details = SPACE;
                if (isset($ZBX_MESSAGES) && !empty($ZBX_MESSAGES)) {
                    $msg_details = new CDiv(array(S_DETAILS), 'pointer');
                    $msg_details->addAction('onclick', new CScript("javascript: ShowHide('msg_messages', IE?'block':'table');"));
                    $msg_details->addOption('title', S_MAXIMIZE . '/' . S_MINIMIZE);
                }
                $msg_tab->addRow(array(new CCol($msg_details, 'clr'), $msg_col));
                $msg_tab->Show();
                $img_space = new CImg('images/general/tree/zero.gif', 'space', '100', '2');
                break;
        }
    }
    if (isset($ZBX_MESSAGES)) {
        if ($page['type'] == PAGE_TYPE_IMAGE) {
            $msg_font = 2;
            foreach ($ZBX_MESSAGES as $msg) {
                if ($msg['type'] == 'error') {
                    array_push($message, array('text' => $msg['message'], 'color' => array('R' => 255, 'G' => 55, 'B' => 55), 'font' => $msg_font));
                } else {
                    array_push($message, array('text' => $msg['message'], 'color' => array('R' => 155, 'G' => 155, 'B' => 55), 'font' => $msg_font));
                }
                $width = max($width, imagefontwidth($msg_font) * strlen($msg['message']) + 1);
                $height += imagefontheight($msg_font) + 1;
            }
        } else {
            if ($page['type'] == PAGE_TYPE_XML) {
                foreach ($ZBX_MESSAGES as $msg) {
                    echo '[' . $msg['type'] . '] ' . $msg['message'] . "\n";
                }
            } else {
                $lst_error = new CList(null, 'messages');
                foreach ($ZBX_MESSAGES as $msg) {
                    $lst_error->addItem($msg['message'], $msg['type']);
                    $bool = $bool && 'error' != strtolower($msg['type']);
                }
                //message scroll if needed
                $msg_show = 6;
                $msg_count = count($ZBX_MESSAGES);
                if ($msg_count > $msg_show) {
                    $msg_count = $msg_show;
                    $msg_count = $msg_count * 16;
                    $lst_error->addOption('style', 'height: ' . $msg_count . 'px;');
                }
                $tab = new CTable(null, $bool ? 'msgok' : 'msgerr');
                $tab->setCellPadding(0);
                $tab->setCellSpacing(0);
                $tab->addOption('id', 'msg_messages');
                $tab->addOption('style', 'width: 100%;');
                if (isset($msg_tab) && $bool) {
                    $tab->addOption('style', 'display: none;');
                }
                $tab->addRow(new CCol($lst_error, 'msg'));
                $tab->Show();
                //---
            }
        }
        $ZBX_MESSAGES = null;
    }
    if (!is_null($img_space)) {
        print unpack_object($img_space);
    }
    if ($page['type'] == PAGE_TYPE_IMAGE && count($message) > 0) {
        $width += 2;
        $height += 2;
        $canvas = imagecreate($width, $height);
        imagefilledrectangle($canvas, 0, 0, $width, $height, imagecolorallocate($canvas, 255, 255, 255));
        foreach ($message as $id => $msg) {
            $message[$id]['y'] = 1 + (isset($previd) ? $message[$previd]['y'] + $message[$previd]['h'] : 0);
            $message[$id]['h'] = imagefontheight($msg['font']);
            imagestring($canvas, $msg['font'], 1, $message[$id]['y'], $msg['text'], imagecolorallocate($canvas, $msg['color']['R'], $msg['color']['G'], $msg['color']['B']));
            $previd = $id;
        }
        imageOut($canvas);
        imagedestroy($canvas);
    }
}
コード例 #6
0
ファイル: page_header.php プロジェクト: rennhak/zabbix
        $sub_menu_div->addAction('onmouseout', 'javascript: MMenu.mouseOut();');
        if (isset($page['menu']) && $page['menu'] == $label) {
            $menu_selected = true;
            $sub_menu_div->addOption('style', 'display: block;');
            insert_js('MMenu.def_label = ' . zbx_jsvalue($label));
        } else {
            $sub_menu_div->addOption('style', 'display: none;');
        }
        $page_menu->addItem($sub_menu_div);
    }
    $sub_menu_table = new CTable(NULL, 'sub_menu');
    $sub_menu_table->setCellSpacing(0);
    $sub_menu_table->setCellPadding(5);
    $sub_menu_table->addRow(SPACE);
    $sub_menu_div = new CDiv($sub_menu_table);
    $sub_menu_div->addOption('id', 'sub_empty');
    $sub_menu_div->addOption('style', 'display: ' . ($menu_selected ? 'none;' : 'block;'));
    $page_menu->addItem($sub_menu_div);
    $page_menu->show();
}
//------------------------------------- <HISTORY> ---------------------------------------
if (isset($page['hist_arg']) && $USER_DETAILS['alias'] != ZBX_GUEST_USER && $page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) {
    $table = new CTable();
    $table->setClass('history');
    $table->setCellSpacing(0);
    $table->setCellPadding(0);
    $history = get_user_history();
    $tr = new CRow(new CCol('History:', 'caption'));
    $tr->addItem($history);
    $table->addRow($tr);
    $table->Show();
コード例 #7
0
ファイル: screens.inc.php プロジェクト: rennhak/zabbix
function get_screen($screenid, $editmode, $effectiveperiod = NULL)
{
    global $USER_DETAILS;
    if (!screen_accessible($screenid, $editmode == 1 ? PERM_READ_WRITE : PERM_READ_ONLY)) {
        access_deny();
    }
    if (is_null($effectiveperiod)) {
        $effectiveperiod = ZBX_MIN_PERIOD;
    }
    $result = DBselect('SELECT name,hsize,vsize FROM screens WHERE screenid=' . $screenid);
    $row = DBfetch($result);
    if (!$row) {
        return new CTableInfo(S_NO_SCREENS_DEFINED);
    }
    for ($r = 0; $r < $row['vsize']; $r++) {
        for ($c = 0; $c < $row['hsize']; $c++) {
            if (isset($skip_field[$r][$c])) {
                continue;
            }
            $sql = 'SELECT * FROM screens_items WHERE screenid=' . $screenid . ' AND x=' . $c . ' AND y=' . $r;
            $iresult = DBSelect($sql);
            $irow = DBfetch($iresult);
            if ($irow) {
                $colspan = $irow['colspan'];
                $rowspan = $irow['rowspan'];
            } else {
                $colspan = 0;
                $rowspan = 0;
            }
            for ($i = 0; $i < $rowspan || $i == 0; $i++) {
                for ($j = 0; $j < $colspan || $j == 0; $j++) {
                    if ($i != 0 || $j != 0) {
                        $skip_field[$r + $i][$c + $j] = 1;
                    }
                }
            }
        }
    }
    $table = new CTable(new CLink('No rows in screen ' . $row['name'], 'screenconf.php?config=0&form=update&screenid=' . $screenid), $editmode == 0 || $editmode == 2 ? 'screen_view' : 'screen_edit');
    $table->addOption('id', 'iframe');
    if ($editmode == 1) {
        $add_col_link = 'screenedit.php?config=1&screenid=' . $screenid . '&add_col=';
        $new_cols = array(new Ccol(new Cimg('images/general/zero.gif', 'zero', 1, 1)));
        for ($c = 0; $c < $row['hsize'] + 1; $c++) {
            array_push($new_cols, new Ccol(new Clink(new Cimg('images/general/closed.gif'), $add_col_link . $c)));
        }
        $table->addRow($new_cols);
    }
    $empty_screen_col = array();
    for ($r = 0; $r < $row['vsize']; $r++) {
        $new_cols = array();
        $empty_screen_row = true;
        if ($editmode == 1) {
            $add_row_link = 'screenedit.php?config=1&screenid=' . $screenid . '&add_row=';
            array_push($new_cols, new Ccol(new Clink(new Cimg('images/general/closed.gif'), $add_row_link . $r)));
        }
        for ($c = 0; $c < $row['hsize']; $c++) {
            $item = array();
            if (isset($skip_field[$r][$c])) {
                continue;
            }
            $item_form = false;
            $iresult = DBSelect('SELECT * FROM screens_items WHERE screenid=' . $screenid . ' AND x=' . $c . ' AND y=' . $r);
            $irow = DBfetch($iresult);
            if ($irow) {
                $screenitemid = $irow['screenitemid'];
                $resourcetype = $irow['resourcetype'];
                $resourceid = $irow['resourceid'];
                $width = $irow['width'];
                $height = $irow['height'];
                $colspan = $irow['colspan'];
                $rowspan = $irow['rowspan'];
                $elements = $irow['elements'];
                $valign = $irow['valign'];
                $halign = $irow['halign'];
                $style = $irow['style'];
                $url = $irow['url'];
                $dynamic = $irow['dynamic'];
            } else {
                $screenitemid = 0;
                $resourcetype = 0;
                $resourceid = 0;
                $width = 0;
                $height = 0;
                $colspan = 0;
                $rowspan = 0;
                $elements = 0;
                $valign = VALIGN_DEFAULT;
                $halign = HALIGN_DEFAULT;
                $style = 0;
                $url = '';
                $dynamic = 0;
            }
            if ($screenitemid > 0) {
                $empty_screen_row = false;
                $empty_screen_col[$c] = 1;
            }
            if ($editmode == 1 && $screenitemid != 0) {
                $onclick_action = "ZBX_SCREENS['" . $_REQUEST['screenid'] . "'].screen.element_onclick('screenedit.php?form=update" . url_param('screenid') . '&screenitemid=' . $screenitemid . "#form');";
                $action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitemid . '#form';
            } else {
                if ($editmode == 1 && $screenitemid == 0) {
                    $onclick_action = "ZBX_SCREENS['" . $_REQUEST['screenid'] . "'].screen.element_onclick('screenedit.php?form=update" . url_param('screenid') . '&x=' . $c . '&y=' . $r . "#form');";
                    $action = 'screenedit.php?form=update' . url_param('screenid') . '&x=' . $c . '&y=' . $r . '#form';
                } else {
                    $action = NULL;
                }
            }
            if ($editmode == 1 && isset($_REQUEST['form']) && isset($_REQUEST['x']) && $_REQUEST['x'] == $c && isset($_REQUEST['y']) && $_REQUEST['y'] == $r) {
                // click on empty field
                $item = get_screen_item_form();
                $item_form = true;
            } else {
                if ($editmode == 1 && isset($_REQUEST['form']) && isset($_REQUEST['screenitemid']) && bccomp($_REQUEST['screenitemid'], $screenitemid) == 0) {
                    // click on element
                    $item = get_screen_item_form();
                    $item_form = true;
                } else {
                    if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_GRAPH) {
                        if ($editmode == 0) {
                            $action = 'charts.php?graphid=' . $resourceid . url_param('period') . url_param('stime');
                        }
                        $graphid = null;
                        $graphtype = GRAPH_TYPE_NORMAL;
                        $yaxis = 0;
                        // GRAPH & ZOOM features
                        $sql = 'SELECT MAX(g.graphid) as graphid, MAX(g.graphtype) as graphtype, MIN(gi.yaxisside) as yaxissidel, MAX(gi.yaxisside) as yaxissider,' . ' MAX(g.show_legend) as legend, MAX(g.show_3d) as show3d ' . ' FROM graphs g, graphs_items gi ' . ' WHERE g.graphid=' . $resourceid . ' AND gi.graphid=g.graphid ';
                        $res = DBselect($sql);
                        while ($graph = DBfetch($res)) {
                            $graphid = $graph['graphid'];
                            $graphtype = $graph['graphtype'];
                            $yaxis = $graph['yaxissider'];
                            $yaxis = $graph['yaxissidel'] == $yaxis ? $yaxis : 2;
                            $legend = $graph['legend'];
                            $graph3d = $graph['show3d'];
                        }
                        if ($yaxis == 2) {
                            $shiftXleft = 60;
                            $shiftXright = 60;
                        } else {
                            if ($yaxis == 0) {
                                $shiftXleft = 60;
                                $shiftXright = 20;
                            } else {
                                $shiftXleft = 10;
                                $shiftXright = 60;
                            }
                        }
                        //-------------
                        // Host feature
                        if ($dynamic == SCREEN_DYNAMIC_ITEM && isset($_REQUEST['hostid']) && $_REQUEST['hostid'] > 0) {
                            $def_items = array();
                            $di_res = get_graphitems_by_graphid($resourceid);
                            while ($gitem = DBfetch($di_res)) {
                                $def_items[] = $gitem;
                            }
                            $url = '';
                            if ($new_items = get_same_graphitems_for_host($def_items, $_REQUEST['hostid'])) {
                                $url .= make_url_from_gitems($new_items);
                            }
                            $url = make_url_from_graphid($resourceid, false) . $url;
                        }
                        //-------------
                        $default = false;
                        if ($graphtype == GRAPH_TYPE_PIE || $graphtype == GRAPH_TYPE_EXPLODED) {
                            if ($dynamic == SCREEN_SIMPLE_ITEM || empty($url)) {
                                $url = 'chart6.php?graphid=' . $resourceid;
                                $default = true;
                            }
                            $g_img = new CImg($url . '&width=' . $width . '&height=' . $height . '&period=' . $effectiveperiod . url_param('stime') . '&legend=' . $legend . '&graph3d=' . $graph3d);
                        } else {
                            if ($dynamic == SCREEN_SIMPLE_ITEM || empty($url)) {
                                $url = 'chart2.php?graphid=' . $resourceid;
                                $default = true;
                            }
                            $dom_graph_id = 'graph_' . $screenitemid . '_' . $resourceid;
                            $g_img = new CImg($url . '&width=' . $width . '&height=' . $height . '&period=' . $effectiveperiod . url_param('stime'));
                            $g_img->addOption('id', $dom_graph_id);
                            if (!is_null($graphid) && $editmode != 1) {
                                insert_js('	A_SBOX["' . $dom_graph_id . '"] = new Object;' . 'A_SBOX["' . $dom_graph_id . '"].shiftT = 17;' . 'A_SBOX["' . $dom_graph_id . '"].shiftL = ' . $shiftXleft . ';');
                                if (isset($_REQUEST['stime'])) {
                                    $stime = $_REQUEST['stime'];
                                    $stime = mktime(substr($stime, 8, 2), substr($stime, 10, 2), 0, substr($stime, 4, 2), substr($stime, 6, 2), substr($stime, 0, 4));
                                } else {
                                    $stime = 'null';
                                }
                                global $page;
                                if ($page['type'] == PAGE_TYPE_HTML) {
                                    zbx_add_post_js('graph_zoom_init("' . $dom_graph_id . '",' . $stime . ',' . $effectiveperiod . ',' . $width . ',' . $height . ', false);');
                                } else {
                                    $g_img->addOption('onload', 'javascript: graph_zoom_init("' . $dom_graph_id . '",' . $stime . ',' . $effectiveperiod . ',' . $width . ',' . $height . ', false);');
                                    //								insert_js('graph_zoom_init("'.$dom_graph_id.'",'.$stime.','.$effectiveperiod.','.$width.','.$height.', false);');
                                }
                            }
                        }
                        if ($default && $editmode == 0) {
                            $item = new CLink($g_img, $action);
                        } else {
                            $item =& $g_img;
                        }
                    } else {
                        if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SIMPLE_GRAPH) {
                            if ($editmode == 0) {
                                $action = "history.php?action=showgraph&itemid={$resourceid}" . url_param("period") . url_param("inc") . url_param("dec");
                            }
                            // Host feature
                            if ($dynamic == SCREEN_DYNAMIC_ITEM && isset($_REQUEST['hostid']) && $_REQUEST['hostid'] > 0) {
                                if ($newitemid = get_same_item_for_host($resourceid, $_REQUEST['hostid'])) {
                                    $resourceid = $newitemid;
                                } else {
                                    $resourceid = '';
                                }
                            }
                            //-------------
                            $url = empty($resourceid) ? 'chart3.php?' : "chart.php?itemid={$resourceid}&";
                            $item = new CLink(new CImg($url . "width={$width}&height={$height}" . "&period={$effectiveperiod}" . url_param("stime")), $action);
                        } else {
                            if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_MAP) {
                                $image_map = new CImg("map.php?noedit=1&sysmapid={$resourceid}" . "&width={$width}&height={$height}");
                                if ($editmode == 0) {
                                    $action_map = get_action_map_by_sysmapid($resourceid);
                                    $image_map->SetMap($action_map->GetName());
                                    $item = array($action_map, $image_map);
                                } else {
                                    $item = $image_map;
                                    //						$item = new CLink($image_map, $action);
                                }
                            } else {
                                if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_PLAIN_TEXT) {
                                    // Host feature
                                    if ($dynamic == SCREEN_DYNAMIC_ITEM && isset($_REQUEST['hostid']) && $_REQUEST['hostid'] > 0) {
                                        if ($newitemid = get_same_item_for_host($resourceid, $_REQUEST['hostid'])) {
                                            $resourceid = $newitemid;
                                        } else {
                                            $resourceid = 0;
                                        }
                                    }
                                    //-------------
                                    $item = array(get_screen_plaintext($resourceid, $elements, $style));
                                    if ($editmode == 1) {
                                        array_push($item, new CLink(S_CHANGE, $action));
                                    }
                                } else {
                                    if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_STATUS_OF_TRIGGERS) {
                                        $params = array();
                                        $params['groupid'] = get_request('tr_groupid', get_profile('web.screens.tr_groupid', 0));
                                        $params['hostid'] = get_request('tr_hostid', get_profile('web.screens.tr_hostid', 0));
                                        $params['limit'] = $elements;
                                        update_profile('web.screens.tr_groupid', $params['groupid'], PROFILE_TYPE_ID);
                                        update_profile('web.screens.tr_hostid', $params['hostid'], PROFILE_TYPE_ID);
                                        $tr_form = new CForm();
                                        $cmbGroup = new CComboBox('tr_groupid', $params['groupid'], 'submit()');
                                        $cmbHosts = new CComboBox('tr_hostid', $params['hostid'], 'submit()');
                                        $cmbGroup->addItem(0, S_ALL_SMALL);
                                        $cmbHosts->addItem(0, S_ALL_SMALL);
                                        $available_groups = get_accessible_groups_by_user($USER_DETAILS, PERM_READ_ONLY);
                                        $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY);
                                        $available_triggers = get_accessible_triggers(PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
                                        $sql = 'SELECT DISTINCT g.groupid,g.name ' . ' FROM groups g, hosts_groups hg, hosts h ' . ' WHERE ' . DBcondition('g.groupid', $available_groups) . ' AND hg.groupid=g.groupid ' . ' AND h.hostid=hg.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND EXISTS(SELECT i.itemid FROM items i WHERE i.status=' . ITEM_STATUS_ACTIVE . ' AND i.hostid=h.hostid ) ' . ' ORDER BY g.name';
                                        $tresult = DBselect($sql);
                                        while ($tr_row = DBfetch($tresult)) {
                                            $cmbGroup->addItem($tr_row['groupid'], get_node_name_by_elid($tr_row['groupid']) . $tr_row['name']);
                                        }
                                        $tr_form->addItem(array(S_GROUP . SPACE, $cmbGroup));
                                        $sql_from = '';
                                        $sql_where = '';
                                        if ($params['groupid'] > 0) {
                                            $sql_from .= ',hosts_groups hg ';
                                            $sql_where .= ' AND hg.hostid=h.hostid AND hg.groupid=' . $params['groupid'];
                                        }
                                        $sql = 'SELECT DISTINCT h.hostid,h.host ' . ' FROM hosts h, items i, functions f, triggers t ' . $sql_from . ' WHERE h.status=' . HOST_STATUS_MONITORED . $sql_where . ' AND h.hostid=i.hostid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid ' . ' AND t.status=' . TRIGGER_STATUS_ENABLED . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' ORDER BY h.host';
                                        $tresult = DBselect($sql);
                                        while ($tr_row = DBfetch($tresult)) {
                                            $cmbHosts->addItem($tr_row['hostid'], get_node_name_by_elid($tr_row['hostid']) . $tr_row['host']);
                                        }
                                        $tr_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
                                        $item = array(get_table_header(array(S_STATUS_OF_TRIGGERS_BIG, SPACE, date('[H:i:s]', time())), $tr_form));
                                        //*/
                                        //					$item = array();
                                        $item[] = make_latest_issues($params);
                                        if ($editmode == 1) {
                                            array_push($item, new CLink(S_CHANGE, $action));
                                        }
                                    } else {
                                        if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SYSTEM_STATUS) {
                                            $item = array(get_table_header(array(S_SYSTEM_STATUSBIG, SPACE, date('[H:i:s]', time()))));
                                            $item[] = make_system_summary();
                                            if ($editmode == 1) {
                                                array_push($item, new CLink(S_CHANGE, $action));
                                            }
                                        } else {
                                            if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_HOSTS_INFO) {
                                                $item = array(new CHostsInfo($resourceid, $style));
                                                if ($editmode == 1) {
                                                    array_push($item, new CLink(S_CHANGE, $action));
                                                }
                                            } else {
                                                if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_TRIGGERS_INFO) {
                                                    $item = new CTriggersInfo($style);
                                                    if ($resourceid > 0) {
                                                        $item->set_host_group($resourceid);
                                                    }
                                                    $item = array($item);
                                                    if ($editmode == 1) {
                                                        array_push($item, new CLink(S_CHANGE, $action));
                                                    }
                                                } else {
                                                    if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SERVER_INFO) {
                                                        //					$item = array(get_table_header(S_STATUS_OF_ZABBIX_BIG),make_status_of_zbx());
                                                        $item = array(new CServerInfo());
                                                        if ($editmode == 1) {
                                                            array_push($item, new CLink(S_CHANGE, $action));
                                                        }
                                                    } else {
                                                        if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_CLOCK) {
                                                            $item = new CFlashClock($width, $height, $style, $action);
                                                        } else {
                                                            if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_SCREEN) {
                                                                $item = array(get_screen($resourceid, 2, $effectiveperiod));
                                                                if ($editmode == 1) {
                                                                    array_push($item, new CLink(S_CHANGE, $action));
                                                                }
                                                            } else {
                                                                if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_TRIGGERS_OVERVIEW) {
                                                                    $hostids = array();
                                                                    $res = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . $resourceid);
                                                                    while ($tmp_host = DBfetch($res)) {
                                                                        $hostids[$tmp_host['hostid']] = $tmp_host['hostid'];
                                                                    }
                                                                    $item = array(get_triggers_overview($hostids, $style));
                                                                    if ($editmode == 1) {
                                                                        array_push($item, new CLink(S_CHANGE, $action));
                                                                    }
                                                                } else {
                                                                    if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_DATA_OVERVIEW) {
                                                                        $hostids = array();
                                                                        $res = DBselect('SELECT DISTINCT hg.hostid FROM hosts_groups hg WHERE hg.groupid=' . $resourceid);
                                                                        while ($tmp_host = DBfetch($res)) {
                                                                            $hostids[$tmp_host['hostid']] = $tmp_host['hostid'];
                                                                        }
                                                                        $item = array(get_items_data_overview($hostids, $style));
                                                                        if ($editmode == 1) {
                                                                            array_push($item, new CLink(S_CHANGE, $action));
                                                                        }
                                                                    } else {
                                                                        if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_URL) {
                                                                            $item = array(new CIFrame($url, $width, $height, "auto"));
                                                                            if ($editmode == 1) {
                                                                                array_push($item, BR(), new CLink(S_CHANGE, $action));
                                                                            }
                                                                        } else {
                                                                            if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_ACTIONS) {
                                                                                $item = array(get_history_of_actions(0, $elements));
                                                                                if ($editmode == 1) {
                                                                                    array_push($item, new CLink(S_CHANGE, $action));
                                                                                }
                                                                            } else {
                                                                                if ($screenitemid != 0 && $resourcetype == SCREEN_RESOURCE_EVENTS) {
                                                                                    $item = array(get_history_of_triggers_events(0, $elements));
                                                                                    if ($editmode == 1) {
                                                                                        array_push($item, new CLink(S_CHANGE, $action));
                                                                                    }
                                                                                } else {
                                                                                    $item = array(SPACE);
                                                                                    if ($editmode == 1) {
                                                                                        array_push($item, BR(), new CLink(S_CHANGE, $action));
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            $str_halign = 'def';
            if ($halign == HALIGN_CENTER) {
                $str_halign = 'cntr';
            }
            if ($halign == HALIGN_LEFT) {
                $str_halign = 'left';
            }
            if ($halign == HALIGN_RIGHT) {
                $str_halign = 'right';
            }
            $str_valign = 'def';
            if ($valign == VALIGN_MIDDLE) {
                $str_valign = 'mdl';
            }
            if ($valign == VALIGN_TOP) {
                $str_valign = 'top';
            }
            if ($valign == VALIGN_BOTTOM) {
                $str_valign = 'bttm';
            }
            if ($editmode == 1 && !$item_form) {
                $item = new CDiv($item, 'draggable');
                $item->addOption('id', 'position_' . $r . '_' . $c);
                if ($editmode == 1) {
                    $item->addOption('onclick', 'javascript: ' . $onclick_action);
                }
            }
            $new_col = new CCol($item, $str_halign . '_' . $str_valign);
            if ($colspan) {
                $new_col->SetColSpan($colspan);
            }
            if ($rowspan) {
                $new_col->SetRowSpan($rowspan);
            }
            array_push($new_cols, $new_col);
        }
        if ($editmode == 1) {
            $rmv_icon = new Cimg('images/general/opened.gif');
            if ($empty_screen_row) {
                $rmv_row_link = 'javascript: location.href = ' . "'screenedit.php?config=1&screenid=" . $screenid . '&rmv_row=' . $r . "';";
            } else {
                $rmv_row_link = "javascript: if(Confirm('This screen-row is not empty. Delete it?')){" . " location.href = 'screenedit.php?config=1&screenid=" . $screenid . "&rmv_row=" . $r . "';}";
            }
            $rmv_icon->addAction('onclick', $rmv_row_link);
            array_push($new_cols, new Ccol($rmv_icon));
        }
        $table->AddRow(new CRow($new_cols));
    }
    if ($editmode == 1) {
        $add_row_link = 'screenedit.php?config=1&screenid=' . $screenid . '&add_row=';
        $new_cols = array(new Ccol(new Clink(new Cimg('images/general/closed.gif'), $add_row_link . $row['vsize'])));
        for ($c = 0; $c < $row['hsize']; $c++) {
            $rmv_icon = new Cimg('images/general/opened.gif');
            if (isset($empty_screen_col[$c])) {
                $rmv_col_link = "javascript: if(Confirm('This screen-column is not empty. Delete it?')){" . " location.href = 'screenedit.php?config=1&screenid=" . $screenid . "&rmv_col=" . $c . "';}";
            } else {
                $rmv_col_link = "javascript: location.href = 'screenedit.php?config=1&screenid=" . $screenid . "&rmv_col=" . $c . "';";
            }
            $rmv_icon->addAction('onclick', $rmv_col_link);
            array_push($new_cols, new Ccol($rmv_icon));
        }
        array_push($new_cols, new Ccol(new Cimg('images/general/zero.gif', 'zero', 1, 1)));
        $table->addRow($new_cols);
    }
    return $table;
}
コード例 #8
0
ファイル: dashboard.php プロジェクト: rennhak/zabbix
$refresh_menu->addOption('title', S_MENU);
$right_tab->addRow(create_hat(S_STATUS_OF_ZABBIX, new CSpan(S_LOADING_P, 'textcolorstyles'), array($refresh_menu), 'hat_stszbx', get_profile('web.dashboard.hats.hat_stszbx.state', 1)));
$refresh_menu = new CDiv(SPACE, 'iconmenu');
$refresh_menu->addAction('onclick', 'javascript: create_page_menu(event,"hat_lastiss");');
$refresh_menu->addOption('title', S_MENU);
$right_tab->addRow(create_hat(S_LAST_20_ISSUES, new CSpan(S_LOADING_P, 'textcolorstyles'), array($refresh_menu), 'hat_lastiss', get_profile('web.dashboard.hats.hat_lastiss.state', 1)));
$refresh_menu = new CDiv(SPACE, 'iconmenu');
$refresh_menu->addAction('onclick', 'javascript: create_page_menu(event,"hat_webovr");');
$refresh_menu->addOption('title', S_MENU);
$right_tab->addRow(create_hat(S_WEB_MONITORING, new CSpan(S_LOADING_P, 'textcolorstyles'), array($refresh_menu), 'hat_webovr', get_profile('web.dashboard.hats.hat_webovr.state', 1)));
$drules = DBfetch(DBselect('SELECT COUNT(d.druleid) as cnt FROM drules d WHERE ' . DBin_node('d.druleid') . ' AND d.status=' . DRULE_STATUS_ACTIVE));
if ($drules['cnt'] > 0 && check_right_on_discovery(PERM_READ_ONLY)) {
    $refresh_tab[] = array('id' => 'hat_dscvry', 'frequency' => get_profile('web.dahsboard.rf_rate.hat_dscvry', 60));
    $refresh_menu = new CDiv(SPACE, 'iconmenu');
    $refresh_menu->addAction('onclick', 'javascript: create_page_menu(event,"hat_dscvry");');
    $refresh_menu->addOption('title', S_MENU);
    $right_tab->addRow(create_hat(S_DISCOVERY_STATUS, new CSpan(S_LOADING_P, 'textcolorstyles'), array($refresh_menu), 'hat_dscvry', get_profile('web.dashboard.hats.hat_dscvry.state', 1)));
}
add_doll_objects($refresh_tab);
/*		
	$right_tab->addRow(create_hat(
			S_GRAPH,
			null,//make_webmon_overview(),
			null,
			'hat_custom',
			get_profile('web.dashboard.hats.hat_custom.state',1)
		));
*/
$td_l = new CCol($left_tab);
$td_l->addOption('valign', 'top');
$td_r = new CCol($right_tab);
コード例 #9
0
ファイル: tr_status.php プロジェクト: rennhak/zabbix
    $cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
}
foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) {
    $cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name);
}
$r_form->addItem(array(S_GROUP . SPACE, $cmbGroups));
$r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$p_elemetns = array();
$text = array(S_STATUS_OF_TRIGGERS_BIG, SPACE);
$url = 'tr_status.php' . ($_REQUEST['fullscreen'] ? '' : '?fullscreen=1');
$fs_icon = new CDiv(SPACE, 'fullscreen');
$fs_icon->addOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN);
$fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';"));
$mute_icon = new CDiv(SPACE, $mute ? 'iconmute' : 'iconsound');
$mute_icon->addOption('title', S_SOUND . ' ' . S_ON . '/' . S_OFF);
$mute_icon->addAction('onclick', new CScript("javascript: switch_mute(this);"));
$tr_numrows = new CSpan(null, 'info');
$tr_numrows->addOption('name', 'tr_numrows');
$p_elements[] = get_table_header(array(S_TRIGGERS, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $tr_numrows, SPACE . SPACE . SPACE . S_UPDATED . ': ', new CSpan(date(S_DATE_FORMAT_YMDHMS), 'info')), $r_form);
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable(S_FILTER);
//,'tr_status.php?filter_set=1','POST',null,'sform');
$filterForm->addOption('name', 'zbx_filter');
$filterForm->addOption('id', 'zbx_filter');
$filterForm->SetMethod('post');
$filterForm->addVar('fullscreen', $_REQUEST['fullscreen']);
$filterForm->addVar('groupid', $_REQUEST['groupid']);
$filterForm->addVar('hostid', $_REQUEST['hostid']);
$tr_select = new CComboBox('show_triggers', $show_triggers, 'javasctipt: submit();');