当前位置: 首页>>代码示例>>PHP>>正文


PHP CTableInfo::AddRow方法代码示例

本文整理汇总了PHP中CTableInfo::AddRow方法的典型用法代码示例。如果您正苦于以下问题:PHP CTableInfo::AddRow方法的具体用法?PHP CTableInfo::AddRow怎么用?PHP CTableInfo::AddRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTableInfo的用法示例。


在下文中一共展示了CTableInfo::AddRow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: make_acktab_by_eventid

function make_acktab_by_eventid($eventid)
{
    $table = new CTableInfo();
    $table->SetHeader(array(S_TIME, S_USER, S_COMMENTS));
    $acks = get_acknowledges_by_eventid($eventid);
    while ($ack = DBfetch($acks)) {
        $user = get_user_by_userid($ack['userid']);
        $table->AddRow(array(date('d-m-Y h:i:s A', $ack['clock']), $user['alias'], new CCol(zbx_nl2br($ack['message']), 'wraptext')));
    }
    return $table;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:11,代码来源:acknow.inc.php

示例2: CLink

                continue;
            }
            $table->AddRow(array(new CLink($row["name"], "?config=0&form=update&screenid=" . $row["screenid"], 'action'), $row["hsize"] . " x " . $row["vsize"], new CLink(S_EDIT, "screenedit.php?screenid=" . $row["screenid"])));
            $row_count++;
        }
        $table->Show();
    }
} else {
    if (isset($_REQUEST["form"])) {
        insert_slideshow_form();
    } else {
        $row_count = 0;
        $numrows = new CSpan(null, 'info');
        $numrows->addOption('name', 'numrows');
        $header = get_table_header(array(S_SLIDESHOWS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
        show_table_header($header);
        $table = new CTableInfo(S_NO_SLIDESHOWS_DEFINED);
        $table->SetHeader(array(make_sorting_link(S_NAME, 's.name'), make_sorting_link(S_DELAY, 's.delay'), make_sorting_link(S_COUNT_OF_SLIDES, 'cnt')));
        $db_slides = DBselect('SELECT s.slideshowid, s.name, s.delay, count(*) as cnt ' . ' FROM slideshows s ' . ' left join slides sl on sl.slideshowid=s.slideshowid ' . ' WHERE ' . DBin_node('s.slideshowid') . ' GROUP BY s.slideshowid,s.name,s.delay ' . order_by('s.name,s.delay,cnt', 's.slideshowid'));
        while ($slide_data = DBfetch($db_slides)) {
            if (!slideshow_accessible($slide_data['slideshowid'], PERM_READ_WRITE)) {
                continue;
            }
            $table->AddRow(array(new CLink($slide_data['name'], '?config=1&form=update&slideshowid=' . $slide_data['slideshowid'], 'action'), $slide_data['delay'], $slide_data['cnt']));
            $row_count++;
        }
        $table->Show();
    }
}
zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");');
include_once "include/page_footer.php";
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:screenconf.php

示例3: CForm

        insert_slideshow_form();
    } else {
        $form = new CForm();
        $form->setName('frm_shows');
        $numrows = new CSpan(null, 'info');
        $numrows->setAttribute('name', 'numrows');
        $header = get_table_header(array(S_SLIDESHOWS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
        show_table_header($header);
        $table = new CTableInfo(S_NO_SLIDESHOWS_DEFINED);
        $table->SetHeader(array(new CCheckBox('all_shows', NULL, "checkAll('" . $form->getName() . "','all_shows','shows');"), make_sorting_link(S_NAME, 's.name'), make_sorting_link(S_DELAY, 's.delay'), make_sorting_link(S_COUNT_OF_SLIDES, 'cnt')));
        $db_slides = DBselect('SELECT s.slideshowid, s.name, s.delay, count(*) as cnt ' . ' FROM slideshows s ' . ' left join slides sl on sl.slideshowid=s.slideshowid ' . ' WHERE ' . DBin_node('s.slideshowid') . ' GROUP BY s.slideshowid,s.name,s.delay ' . order_by('s.name,s.delay,cnt', 's.slideshowid'));
        while ($slide_data = DBfetch($db_slides)) {
            if (!slideshow_accessible($slide_data['slideshowid'], PERM_READ_WRITE)) {
                continue;
            }
            $table->AddRow(array(new CCheckBox('shows[' . $slide_data['slideshowid'] . ']', NULL, NULL, $slide_data['slideshowid']), new CLink($slide_data['name'], '?config=1&form=update&slideshowid=' . $slide_data['slideshowid'], 'action'), $slide_data['delay'], $slide_data['cnt']));
        }
        //----- GO ------
        $goBox = new CComboBox('go');
        $goBox->addItem('delete', S_DELETE_SELECTED);
        // goButton name is necessary!!!
        $goButton = new CButton('goButton', S_GO . ' (0)');
        $goButton->setAttribute('id', 'goButton');
        zbx_add_post_js('chkbxRange.pageGoName = "shows";');
        $table->setFooter(new CCol(array($goBox, $goButton)));
        $form->addItem($table);
        $form->show();
    }
}
if (isset($table)) {
    zbx_add_post_js('insert_in_element("numrows","' . $table->getNumRows() . '");');
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:screenconf.php

示例4: make_event_details

function make_event_details($eventid)
{
    $config = select_config();
    $event = get_tr_event_by_eventid($eventid);
    $table = new CTableInfo();
    $table->AddRow(array(S_EVENT, expand_trigger_description($event['triggerid'])));
    $table->AddRow(array(S_TIME, zbx_date2str(S_EVENTS_EVENT_DETAILS_DATE_FORMAT, $event['clock'])));
    $duration = zbx_date2age($event['clock']);
    if ($next_event = get_next_event($event)) {
        $duration = zbx_date2age($event['clock'], $next_event['clock']);
    }
    if ($event['value'] == TRIGGER_VALUE_FALSE) {
        $value = new CCol(S_OK_BIG, 'off');
    } elseif ($event['value'] == TRIGGER_VALUE_TRUE) {
        $value = new CCol(S_PROBLEM_BIG, 'on');
    } else {
        $value = new CCol(S_UNKNOWN_BIG, 'unknown');
    }
    $table->addRow(array(S_STATUS, $value));
    $table->addRow(array(S_DURATION, $duration));
    if ($config['event_ack_enable']) {
        global $page;
        $backurl = urlencode(urlencode($page['file'] . '?eventid=' . $eventid . '&triggerid=' . $event['triggerid']));
        if ($event['acknowledged'] == 1) {
            $rows = 0;
            $db_acks = get_acknowledges_by_eventid($event["eventid"]);
            while ($a = DBfetch($db_acks)) {
                $rows++;
            }
            $ack = array(new CLink(S_YES, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $backurl, 'off'), ' (' . $rows . ')');
        } else {
            $ack = array(new CLink(S_NO, 'acknow.php?eventid=' . $event['eventid'] . '&backurl=' . $backurl, 'on'));
        }
        $table->addRow(array(S_ACKNOWLEDGED, $ack));
    }
    return $table;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:37,代码来源:events.inc.php

示例5: CForm

if (isset($_REQUEST["form"])) {
    insert_map_form();
} else {
    $form = new CForm();
    $form->setName('frm_maps');
    $numrows = new CSpan(null, 'info');
    $numrows->setAttribute('name', 'numrows');
    $header = get_table_header(array(S_MAPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $table = new CTableInfo(S_NO_MAPS_DEFINED);
    $table->SetHeader(array(new CCheckBox('all_maps', NULL, "checkAll('" . $form->getName() . "','all_maps','maps');"), make_sorting_link(S_NAME, 'sm.name'), make_sorting_link(S_WIDTH, 'sm.width'), make_sorting_link(S_HEIGHT, 'sm.height'), S_MAP));
    $result = DBselect('SELECT sm.sysmapid,sm.name,sm.width,sm.height ' . ' FROM sysmaps sm' . ' WHERE ' . DBin_node('sm.sysmapid') . order_by('sm.name,sm.width,sm.height', 'sm.sysmapid'));
    while ($row = DBfetch($result)) {
        if (!sysmap_accessible($row["sysmapid"], PERM_READ_WRITE)) {
            continue;
        }
        $table->AddRow(array(new CCheckBox('maps[' . $row['sysmapid'] . ']', NULL, NULL, $row['sysmapid']), new CLink($row["name"], "sysmaps.php?form=update" . "&sysmapid=" . $row["sysmapid"] . "#form", 'action'), $row["width"], $row["height"], new CLink(S_EDIT, "sysmap.php?sysmapid=" . $row["sysmapid"])));
    }
    //----- GO ------
    $goBox = new CComboBox('go');
    $goBox->addItem('delete', S_DELETE_SELECTED);
    // goButton name is necessary!!!
    $goButton = new CButton('goButton', S_GO . ' (0)');
    $goButton->setAttribute('id', 'goButton');
    zbx_add_post_js('chkbxRange.pageGoName = "maps";');
    $table->setFooter(new CCol(array($goBox, $goButton)));
    $form->addItem($table);
    $form->show();
    zbx_add_post_js('insert_in_element("numrows","' . $table->getNumRows() . '");');
}
include_once "include/page_footer.php";
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:sysmaps.php

示例6: CLink

    if (!isset($tab_rows[$appid])) {
        continue;
    }
    $app_rows = $tab_rows[$appid];
    if (uint_in_array($db_app['applicationid'], $_REQUEST['applications']) || isset($show_all_apps)) {
        $url = '?close=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('fullscreen') . url_param('select');
        $link = new CLink(new CImg('images/general/opened.gif'), $url);
        //			$link = new CLink(new CImg('images/general/opened.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');");
    } else {
        $url = '?open=1&applicationid=' . $db_app['applicationid'] . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('fullscreen') . url_param('select');
        $link = new CLink(new CImg('images/general/closed.gif'), $url);
        //			$link = new CLink(new CImg('images/general/closed.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');");
    }
    $col = new CCol(array($link, SPACE, bold($db_app['name']), SPACE . '(' . $db_app['item_cnt'] . SPACE . S_ITEMS . ')'));
    $col->SetColSpan(5);
    $table->AddRow(array(get_node_name_by_elid($db_app['applicationid']), $_REQUEST['hostid'] > 0 ? NULL : $db_app['host'], $col));
    foreach ($app_rows as $row) {
        $table->AddRow($row);
    }
}
// OTHER ITEMS (which doesn't linked to application)
$db_hosts = array();
$db_hostids = array();
$sql = 'SELECT DISTINCT h.host,h.hostid ' . ' FROM hosts h' . $sql_from . ', items i ' . ' LEFT JOIN items_applications ia ON ia.itemid=i.itemid' . ' WHERE ia.itemid is NULL ' . $sql_where . ' AND h.hostid=i.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' ORDER BY h.host';
$db_host_res = DBselect($sql);
while ($db_host = DBfetch($db_host_res)) {
    $db_host['item_cnt'] = 0;
    $db_hosts[$db_host['hostid']] = $db_host;
    $db_hostids[$db_host['hostid']] = $db_host['hostid'];
}
$tab_rows = array();
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:latest.php

示例7: CForm

    /* form */
    insert_drule_form();
} else {
    show_table_header(S_DISCOVERY_BIG);
    /* table */
    $form = new CForm();
    $form->SetName('frmdrules');
    $tblDiscovery = new CTableInfo(S_NO_DISCOVERY_RULES_DEFINED);
    $tblDiscovery->SetHeader(array(array(new CCheckBox('all_drules', null, "CheckAll('" . $form->GetName() . "','all_drules');"), make_sorting_link(S_NAME, 'd.name')), make_sorting_link(S_IP_RANGE, 'd.iprange'), make_sorting_link(S_DELAY, 'd.delay'), S_CHECKS, S_STATUS));
    $db_rules = DBselect('SELECT d.* ' . ' FROM drules d' . ' WHERE ' . DBin_node('druleid') . order_by('d.name,d.iprange,d.delay', 'd.druleid'));
    while ($rule_data = DBfetch($db_rules)) {
        $cheks = array();
        $db_checks = DBselect("select * from dchecks where druleid=" . $rule_data["druleid"] . " order by type,druleid");
        while ($check_data = DBfetch($db_checks)) {
            $cheks[] = discovery_check_type2str($check_data['type']);
        }
        $status = new CCol(new CLink(discovery_status2str($rule_data["status"]), '?g_druleid%5B%5D=' . $rule_data['druleid'] . ($rule_data["status"] == DRULE_STATUS_ACTIVE ? '&group_disable=1' : '&group_enable=1'), discovery_status2style($rule_data["status"])));
        $description = array();
        if ($rule_data["proxy_hostid"]) {
            $proxy = get_host_by_hostid($rule_data["proxy_hostid"]);
            array_push($description, $proxy["host"], ":");
        }
        array_push($description, new CLink($rule_data['name'], "?form=update&druleid=" . $rule_data['druleid'], 'action'));
        $drule = new CCol(array(new CCheckBox('g_druleid[' . $rule_data["druleid"] . ']', null, null, $rule_data["druleid"]), SPACE, $description));
        $tblDiscovery->AddRow(array($drule, $rule_data['iprange'], $rule_data['delay'], implode(',', $cheks), $status));
    }
    $tblDiscovery->SetFooter(new CCol(array(new CButtonQMessage('group_enable', S_ENABLE_SELECTED, S_ENABLE_SELECTED_RULES_Q), SPACE, new CButtonQMessage('group_disable', S_DISABLE_SELECTED, S_DISABLE_SELECTED_RULES_Q), SPACE, new CButtonQMessage('group_delete', S_DELETE_SELECTED, S_DELETE_SELECTED_RULES_Q))));
    $form->AddItem($tblDiscovery);
    $form->Show();
}
include_once "include/page_footer.php";
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:discoveryconf.php

示例8: CCol

            $status['msg'] = S_FAIL . ' - ' . S_ERROR . ': ' . $httptest_data['error'];
            $status['style'] = 'disabled';
        }
    }
}
$table->AddRow(array(new CCol(S_TOTAL_BIG, 'bold'), new CCol(SPACE, 'bold'), new CCol(format_lastvalue($total_data[HTTPSTEP_ITEM_TYPE_TIME]), 'bold'), new CCol(SPACE, 'bold'), new CCol(new CSpan($status['msg'], $status['style']), 'bold')));
$table->Show();
echo SBR;
if (isset($_REQUEST['period']) && $_REQUEST['period'] != ZBX_MIN_PERIOD) {
    update_profile('web.httptest.period', $_REQUEST['period'], PROFILE_TYPE_INT, $_REQUEST['httptestid']);
}
$_REQUEST['period'] = get_profile('web.httptest.period', ZBX_PERIOD_DEFAULT, PROFILE_TYPE_INT, $_REQUEST['httptestid']);
show_table_header(array(S_HISTORY . ' "', bold($httptest_data['name']), '"'));
$form = new CTableInfo();
$form->AddOption('id', 'graph');
$form->AddRow(array(bold(S_SPEED), new CCol(get_dynamic_chart('graph_1', 'chart3.php?' . url_param('period') . url_param('from') . url_param($httptest_data['name'], false, 'name') . url_param(150, false, 'height') . url_param(get_request('stime', 0), false, 'stime') . url_param($items[HTTPSTEP_ITEM_TYPE_IN], false, 'items') . url_param(GRAPH_TYPE_STACKED, false, 'graphtype'), '-128'), 'center')));
$form->AddRow(array(bold(S_RESPONSE_TIME), new CCol(get_dynamic_chart('graph_2', 'chart3.php?' . url_param('period') . url_param('from') . url_param($httptest_data['name'], false, 'name') . url_param(150, false, 'height') . url_param(get_request('stime', 0), false, 'stime') . url_param($items[HTTPSTEP_ITEM_TYPE_TIME], false, 'items') . url_param(GRAPH_TYPE_STACKED, false, 'graphtype'), '-128'), 'center')));
$form->Show();
$period = get_request('period', 3600);
//SDI(get_min_itemclock_by_itemid($items[HTTPSTEP_ITEM_TYPE_IN][0]['itemid']));
$mstime = min(get_min_itemclock_by_itemid($items[HTTPSTEP_ITEM_TYPE_IN][0]['itemid']), get_min_itemclock_by_itemid($items[HTTPSTEP_ITEM_TYPE_TIME][0]['itemid']));
$stime = $mstime ? $mstime : 0;
$bstime = time() - $period;
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,' . $period . ',' . $stime . ',0,' . $bstime . ');
				showgraphmenu("graph");
				graph_zoom_init("graph_1",' . $bstime . ',' . $period . ',ZBX_G_WIDTH, 150, false);
				graph_zoom_init("graph_2",' . $bstime . ',' . $period . ',ZBX_G_WIDTH, 150, false);';
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:httpdetails.php

示例9: AND

        !empty($childs_str) ? $childs_str .= ',' : '';
        $query = 'SELECT DISTINCT s.* ' . ' FROM services s ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (s.triggerid IS NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' AND s.serviceid NOT IN (' . $childs_str . $service['serviceid'] . ') ' . ' ORDER BY s.sortorder,s.name';
    } else {
        $query = 'SELECT DISTINCT s.* ' . ' FROM services s ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (s.triggerid IS NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' ORDER BY s.sortorder,s.name';
    }
    $db_services = DBselect($query);
    while ($db_service_data = DBfetch($db_services)) {
        $prefix = null;
        $trigger = "-";
        $description = $db_service_data["name"];
        if (isset($db_service_data["triggerid"])) {
            $trigger = expand_trigger_description($db_service_data["triggerid"]);
        }
        $description = new CLink($description, '#', 'action');
        $description->SetAction('window.opener.add_child_service(' . zbx_jsvalue($db_service_data["name"]) . ',' . zbx_jsvalue($db_service_data["serviceid"]) . ',' . zbx_jsvalue($trigger) . ',' . zbx_jsvalue($db_service_data["triggerid"]) . '); self.close(); return false;');
        $table->AddRow(array(array($prefix, $description), algorithm2str($db_service_data["algorithm"]), $trigger));
    }
    $cb = new CButton('cancel', S_CANCEL);
    $cb->SetType('button');
    $cb->SetAction('javascript: self.close();');
    $td = new CCol($cb);
    $td->setAttribute('style', 'text-align:right;');
    $table->SetFooter($td);
    $form->AddItem($table);
    $form->Show();
}
//--------------------------------------------	</CHILD SERVICES LIST>  --------------------------------------------
//--------------------------------------------	<FORM>  --------------------------------------------
if (isset($_REQUEST['sform'])) {
    $frmService = new CFormTable(S_SERVICE, 'services_form.php', 'POST', null, 'sform');
    $frmService->SetHelp("web.services.service.php");
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:services_form.php

示例10: get_items_data_overview

function get_items_data_overview($hostids, $view_style = null)
{
    if (is_null($view_style)) {
        $view_style = get_profile('web.overview.view.style', STYLE_TOP);
    }
    $table = new CTableInfo(S_NO_ITEMS_DEFINED);
    COpt::profiling_start('prepare data');
    $result = DBselect('SELECT DISTINCT h.hostid, h.host,i.itemid, i.key_, i.value_type, i.lastvalue, i.units, ' . ' i.description, t.priority, i.valuemapid, t.value as tr_value, t.triggerid ' . ' FROM hosts h, items i ' . ' LEFT JOIN functions f on f.itemid=i.itemid ' . ' LEFT JOIN triggers t on t.triggerid=f.triggerid ' . ' WHERE ' . DBcondition('h.hostid', $hostids) . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND h.hostid=i.hostid ' . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' ORDER BY i.description,i.itemid');
    unset($items);
    unset($hosts);
    // get rid of warnings about $triggers undefined
    $items = array();
    while ($row = DBfetch($result)) {
        $descr = item_description($row);
        $row['host'] = get_node_name_by_elid($row['hostid']) . $row['host'];
        $hosts[strtolower($row['host'])] = $row['host'];
        // A little tricky check for attempt to overwrite active trigger (value=1) with
        // inactive or active trigger with lower priority.
        if (!isset($items[$descr][$row['host']]) || ($items[$descr][$row['host']]['tr_value'] == TRIGGER_VALUE_FALSE && $row['tr_value'] == TRIGGER_VALUE_TRUE || ($items[$descr][$row['host']]['tr_value'] == TRIGGER_VALUE_FALSE || $row['tr_value'] == TRIGGER_VALUE_TRUE) && $row['priority'] > $items[$descr][$row['host']]['severity'])) {
            $items[$descr][$row['host']] = array('itemid' => $row['itemid'], 'value_type' => $row['value_type'], 'lastvalue' => $row['lastvalue'], 'units' => $row['units'], 'description' => $row['description'], 'valuemapid' => $row['valuemapid'], 'severity' => $row['priority'], 'tr_value' => $row['tr_value'], 'triggerid' => $row['triggerid']);
        }
    }
    if (!isset($hosts)) {
        return $table;
    }
    ksort($hosts);
    COpt::profiling_stop('prepare data');
    COpt::profiling_start('prepare table');
    if ($view_style == STYLE_TOP) {
        $header = array(new CCol(S_ITEMS, 'center'));
        foreach ($hosts as $hostname) {
            $header = array_merge($header, array(new CImg('vtext.php?text=' . $hostname)));
        }
        $table->SetHeader($header, 'vertical_header');
        $curr_rime = time();
        foreach ($items as $descr => $ithosts) {
            $table_row = array(nbsp($descr));
            foreach ($hosts as $hostname) {
                $table_row = get_item_data_overview_cells($table_row, $ithosts, $hostname);
            }
            $table->AddRow($table_row);
        }
    } else {
        $header = array(new CCol(S_HOSTS, 'center'));
        foreach ($items as $descr => $ithosts) {
            $header = array_merge($header, array(new CImg('vtext.php?text=' . $descr)));
        }
        $table->SetHeader($header, 'vertical_header');
        $curr_rime = time();
        foreach ($hosts as $hostname) {
            $table_row = array(nbsp($hostname));
            foreach ($items as $descr => $ithosts) {
                $table_row = get_item_data_overview_cells($table_row, $ithosts, $hostname);
            }
            $table->AddRow($table_row);
        }
    }
    COpt::profiling_stop('prepare table');
    return $table;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:60,代码来源:items.inc.php

示例11: elseif

 } elseif ($_REQUEST['config'] == 6) {
     echo SBR;
     if (isset($_REQUEST['form'])) {
         insert_value_mapping_form();
     } else {
         show_table_header(S_VALUE_MAPPING_BIG);
         $table = new CTableInfo();
         $table->SetHeader(array(S_NAME, S_VALUE_MAP));
         $db_valuemaps = DBselect('SELECT * FROM valuemaps WHERE ' . DBin_node('valuemapid'));
         while ($db_valuemap = DBfetch($db_valuemaps)) {
             $mappings_row = array();
             $db_maps = DBselect('SELECT * FROM mappings' . ' WHERE valuemapid=' . $db_valuemap['valuemapid']);
             while ($db_map = DBfetch($db_maps)) {
                 array_push($mappings_row, $db_map['value'], SPACE . RARR . SPACE, $db_map['newvalue'], BR());
             }
             $table->AddRow(array(new CLink($db_valuemap['name'], 'config.php?form=update&' . 'valuemapid=' . $db_valuemap['valuemapid'] . url_param('config'), 'action'), empty($mappings_row) ? SPACE : $mappings_row));
         }
         $table->Show();
     }
 } else {
     if ($_REQUEST['config'] == 10) {
         if (isset($_REQUEST["form"])) {
             $frmRegExp = new CForm('config.php', 'post');
             $frmRegExp->setName(S_REGULAR_EXPRESSION);
             $frmRegExp->addVar('form', get_request('form', 1));
             $from_rfr = get_request('form_refresh', 0);
             $frmRegExp->addVar('form_refresh', $from_rfr + 1);
             $frmRegExp->addVar('config', get_request('config', 10));
             if (isset($_REQUEST['regexpid'])) {
                 $frmRegExp->addVar('regexpid', $_REQUEST['regexpid']);
             }
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:config.php

示例12: CComboBox

    $cmbTimeZone = new CComboBox('timezone', $timezone);
    for ($i = -12; $i <= 13; $i++) {
        $cmbTimeZone->addItem($i, 'GMT' . sprintf('%+03d:00', $i));
    }
    $frmNode->addRow(S_TIME_ZONE, $cmbTimeZone);
    $frmNode->addRow(S_IP, new CTextBox('ip', $ip, 15));
    $frmNode->addRow(S_PORT, new CNumericBox('port', $port, 5));
    $frmNode->addRow(S_DO_NOT_KEEP_HISTORY_OLDER_THAN, new CNumericBox('slave_history', $slave_history, 6));
    $frmNode->addRow(S_DO_NOT_KEEP_TRENDS_OLDER_THAN, new CNumericBox('slave_trends', $slave_trends, 6));
    $frmNode->addItemToBottomRow(new CButton('save', S_SAVE));
    if (isset($_REQUEST['nodeid']) && $node_type != ZBX_NODE_LOCAL) {
        $frmNode->addItemToBottomRow(SPACE);
        $frmNode->addItemToBottomRow(new CButtonDelete('Delete selected node?', url_param('form') . url_param('nodeid')));
    }
    $frmNode->addItemToBottomRow(SPACE);
    $frmNode->addItemToBottomRow(new CButtonCancel(url_param('config')));
    $frmNode->Show();
} else {
    show_table_header(S_NODES_BIG);
    $table = new CTableInfo(S_NO_NODES_DEFINED);
    $table->SetHeader(array(make_sorting_link(S_ID, 'n.nodeid'), make_sorting_link(S_NAME, 'n.name'), make_sorting_link(S_TYPE, 'n.nodetype'), make_sorting_link(S_TIME_ZONE, 'n.timezone'), make_sorting_link(S_IP . ':' . S_PORT, 'n.ip')));
    $sql = 'SELECT n.* ' . ' FROM nodes n' . ' WHERE ' . DBcondition('n.nodeid', $available_nodes) . order_by('n.nodeid,n.name,n.nodetype,n.timezone,n.ip', 'n.masterid');
    $db_nodes = DBselect($sql);
    while ($row = DBfetch($db_nodes)) {
        $node_type = detect_node_type($row);
        $node_type_name = node_type2str($node_type);
        $table->AddRow(array($row['nodeid'], array(get_node_path($row['masterid']), new CLink($row['nodetype'] ? new CSpan($row['name'], 'bold') : $row['name'], '?&form=update&nodeid=' . $row['nodeid'], 'action')), $node_type == ZBX_NODE_LOCAL ? new CSpan($node_type_name, 'bold') : $node_type_name, new CSpan('GMT' . sprintf('%+03d:00', $row['timezone']), $row['nodetype'] ? 'bold' : null), new CSpan($row['ip'] . ':' . $row['port'], $row['nodetype'] ? 'bold' : null)));
    }
    $table->Show();
}
include_once 'include/page_footer.php';
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:nodes.php

示例13: DBselect

     $db_dservices = DBselect('SELECT type,port,key_,status,lastup,lastdown FROM dservices ' . ' WHERE dhostid=' . $dhost['dhostid'] . ' order by status,type,port');
     while ($dservice = DBfetch($db_dservices)) {
         $class = 'active';
         $time = 'lastup';
         if (DSVC_STATUS_DISABLED == $dservice['status']) {
             $class = 'inactive';
             $time = 'lastdown';
         }
         $service_name = discovery_check_type2str($dservice['type']) . discovery_port2str($dservice['type'], $dservice['port']) . (empty($dservice['key_']) ? '' : ':' . $dservice['key_']);
         $discovery_info[$dhost['ip']]['services'][$service_name] = array('class' => $class, 'time' => $dservice[$time]);
     }
 }
 if ($druleid == 0 && !empty($discovery_info)) {
     $col = new CCol(array(bold($drule['name']), SPACE . "(" . count($discovery_info) . SPACE . S_ITEMS . ")"));
     $col->SetColSpan(count($services) + 2);
     $table->AddRow(array(get_node_name_by_elid($drule['druleid']), $col));
 }
 foreach ($discovery_info as $ip => $h_data) {
     $table_row = array(get_node_name_by_elid($h_data['druleid']), new CSpan($ip, $h_data['class']), new CSpan($h_data['time'] == 0 ? '' : convert_units(time() - $h_data['time'], 'uptime'), $h_data['class']));
     foreach ($services as $name => $foo) {
         $class = null;
         $time = SPACE;
         $hint = new CDiv(SPACE, $class);
         $hintTable = new CTableInfo();
         $hintTable->addOption('border', 0);
         if (isset($h_data['services'][$name])) {
             $class = $h_data['services'][$name]['class'];
             $time = $h_data['services'][$name]['time'];
             if ($class == 'active') {
                 $hintTable->setHeader(S_UP_TIME);
             } else {
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:discovery.php

示例14: get_history_of_triggers_events

function get_history_of_triggers_events($start, $num, $groupid = 0, $hostid = 0)
{
    global $USER_DETAILS;
    $config = select_config();
    $show_unknown = get_profile('web.events.filter.show_unknown', 0);
    $sql_from = $sql_cond = '';
    $available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_LIST);
    $available_triggers = get_accessible_triggers(PERM_READ_ONLY, array(), PERM_RES_DATA_ARRAY, get_current_nodeid());
    if ($hostid > 0) {
        $sql_cond = ' AND h.hostid=' . $hostid;
    } else {
        if ($groupid > 0) {
            $sql_from = ', hosts_groups hg ';
            $sql_cond = ' AND h.hostid=hg.hostid AND hg.groupid=' . $groupid;
        } else {
            $sql_from = '';
            $sql_cond = ' AND ' . DBcondition('h.hostid', $available_hosts);
        }
    }
    //---
    $triggers = array();
    $trigger_list = array();
    $sql = 'SELECT DISTINCT t.triggerid,t.priority,t.description,t.expression,h.host,t.type ' . ' FROM triggers t, functions f, items i, hosts h ' . $sql_from . ' WHERE ' . DBcondition('t.triggerid', $available_triggers) . ' AND t.triggerid=f.triggerid ' . ' AND f.itemid=i.itemid ' . ' AND i.hostid=h.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . $sql_cond;
    $rez = DBselect($sql);
    while ($rowz = DBfetch($rez)) {
        $triggers[$rowz['triggerid']] = $rowz;
        array_push($trigger_list, $rowz['triggerid']);
    }
    $sql_cond = $show_unknown == 0 ? ' AND e.value<>' . TRIGGER_VALUE_UNKNOWN . ' ' : '';
    $table = new CTableInfo(S_NO_EVENTS_FOUND);
    $table->SetHeader(array(S_TIME, is_show_all_nodes() ? S_NODE : null, $hostid == 0 ? S_HOST : null, S_DESCRIPTION, S_VALUE, S_SEVERITY));
    if (!empty($triggers)) {
        $sql = 'SELECT e.eventid, e.objectid as triggerid, e.clock, e.value, e.acknowledged ' . ' FROM events e ' . ' WHERE e.object=' . EVENT_OBJECT_TRIGGER . ' AND ' . DBcondition('e.objectid', $trigger_list) . $sql_cond . ' ORDER BY e.eventid DESC';
        $result = DBselect($sql, 10 * ($start + $num));
    }
    $col = 0;
    $skip = $start;
    while (!empty($triggers) && $col < $num && ($row = DBfetch($result))) {
        if ($skip > 0) {
            if ($show_unknown == 0 && $row['value'] == TRIGGER_VALUE_UNKNOWN) {
                continue;
            }
            $skip--;
            continue;
        }
        $value = new CCol(trigger_value2str($row['value']), get_trigger_value_style($row['value']));
        $row = array_merge($triggers[$row['triggerid']], $row);
        if (0 == $show_unknown && !event_initial_time($row, $show_unknown)) {
            continue;
        }
        $table->AddRow(array(date("Y.M.d H:i:s", $row["clock"]), get_node_name_by_elid($row['triggerid']), $hostid == 0 ? $row['host'] : null, new CLink(expand_trigger_description_by_data($row, ZBX_FLAG_EVENT), 'tr_events.php?triggerid=' . $row['triggerid'] . '&eventid=' . $row['eventid'], 'action'), $value, new CCol(get_severity_description($row["priority"]), get_severity_style($row["priority"]))));
        $col++;
    }
    return $table;
}
开发者ID:phedders,项目名称:zabbix,代码行数:55,代码来源:events.inc.php

示例15: get_history_of_discovery_events

function get_history_of_discovery_events($start, $end)
{
    $sql_cond = ' AND e.clock>' . $start;
    $sql_cond .= ' AND e.clock<' . $end;
    $sql = 'SELECT DISTINCT e.source,e.object,e.objectid,e.clock,e.value ' . ' FROM events e' . ' WHERE e.source=' . EVENT_SOURCE_DISCOVERY . $sql_cond . order_by('e.clock');
    $db_events = DBselect($sql);
    $table = new CTableInfo(S_NO_EVENTS_FOUND);
    $table->SetHeader(array(S_TIME, S_IP, S_DESCRIPTION, S_STATUS));
    $col = 0;
    while ($event_data = DBfetch($db_events)) {
        $value = new CCol(trigger_value2str($event_data['value']), get_trigger_value_style($event_data['value']));
        switch ($event_data['object']) {
            case EVENT_OBJECT_DHOST:
                $object_data = DBfetch(DBselect('SELECT ip FROM dhosts WHERE dhostid=' . $event_data['objectid']));
                $description = SPACE;
                break;
            case EVENT_OBJECT_DSERVICE:
                $object_data = DBfetch(DBselect('SELECT h.ip,s.type,s.port ' . ' FROM dhosts h,dservices s ' . ' WHERE h.dhostid=s.dhostid ' . ' AND s.dserviceid=' . $event_data['objectid']));
                $description = S_SERVICE . ': ' . discovery_check_type2str($object_data['type']) . '; ' . S_PORT . ': ' . $object_data['port'];
                break;
            default:
                continue;
        }
        if (!$object_data) {
            continue;
        }
        $table->AddRow(array(date('Y.M.d H:i:s', $event_data['clock']), $object_data['ip'], $description, $value));
        $col++;
    }
    return $table;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:events.inc.php


注:本文中的CTableInfo::AddRow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。