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


PHP CTable::SetHeader方法代码示例

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


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

示例1: insert_map_link_form

function insert_map_link_form()
{
    $frmCnct = new CFormTable('New connector', 'sysmap.php');
    $frmCnct->SetHelp('web.sysmap.connector.php');
    $frmCnct->addVar('sysmapid', $_REQUEST['sysmapid']);
    if (isset($_REQUEST['linkid']) && !isset($_REQUEST['form_refresh'])) {
        $frmCnct->addVar('linkid', $_REQUEST['linkid']);
        $db_links = DBselect('SELECT * FROM sysmaps_links WHERE linkid=' . $_REQUEST['linkid']);
        $db_link = DBfetch($db_links);
        $selementid1 = $db_link['selementid1'];
        $selementid2 = $db_link['selementid2'];
        $triggers = array();
        $drawtype = $db_link['drawtype'];
        $color = $db_link['color'];
        $res = DBselect('SELECT * FROM sysmaps_link_triggers WHERE linkid=' . $_REQUEST['linkid']);
        while ($rows = DBfetch($res)) {
            $triggers[] = $rows;
        }
    } else {
        if (isset($_REQUEST['linkid'])) {
            $frmCnct->addVar('linkid', $_REQUEST['linkid']);
        }
        $selementid1 = get_request('selementid1', 0);
        $selementid2 = get_request('selementid2', 0);
        $triggers = get_request('triggers', array());
        $drawtype = get_request('drawtype', 0);
        $color = get_request('color', 0);
    }
    /* START comboboxes preparations */
    $cmbElements1 = new CComboBox('selementid1', $selementid1);
    $cmbElements2 = new CComboBox('selementid2', $selementid2);
    $db_selements = DBselect('SELECT selementid,label,elementid,elementtype ' . ' FROM sysmaps_elements ' . ' WHERE sysmapid=' . $_REQUEST['sysmapid']);
    while ($db_selement = DBfetch($db_selements)) {
        $label = $db_selement['label'];
        if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST) {
            $db_host = get_host_by_hostid($db_selement['elementid']);
            $label .= ':' . $db_host['host'];
        } else {
            if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_MAP) {
                $db_map = get_sysmap_by_sysmapid($db_selement['elementid']);
                $label .= ':' . $db_map['name'];
            } else {
                if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_TRIGGER) {
                    if ($db_selement['elementid'] > 0) {
                        $label .= ':' . expand_trigger_description($db_selement['elementid']);
                    }
                } else {
                    if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST_GROUP) {
                        if ($db_selement['elementid'] > 0) {
                            $db_group = DBfetch(DBselect('SELECT name FROM groups WHERE groupid=' . $db_selement['elementid']));
                            $label .= ':' . $db_group['name'];
                        }
                    }
                }
            }
        }
        $cmbElements1->addItem($db_selement['selementid'], $label);
        $cmbElements2->addItem($db_selement['selementid'], $label);
    }
    $cmbType = new CComboBox('drawtype', $drawtype);
    foreach (map_link_drawtypes() as $i) {
        $value = map_link_drawtype2str($i);
        $cmbType->addItem($i, $value);
    }
    /* END preparation */
    $frmCnct->addRow(S_ELEMENT_1, $cmbElements1);
    $frmCnct->addRow(S_ELEMENT_2, $cmbElements2);
    //trigger links
    foreach ($triggers as $id => $trigger) {
        if (isset($trigger['triggerid'])) {
            $triggers[$id]['description'] = expand_trigger_description($trigger['triggerid']);
        }
    }
    $table = new CTable();
    $table->SetClass('tableinfo');
    $table->setOddRowClass('even_row');
    $table->setEvenRowClass('even_row');
    $table->options['cellpadding'] = 3;
    $table->options['cellspacing'] = 1;
    $table->headerClass = 'header';
    $table->footerClass = 'footer';
    $table->SetHeader(array(new CCheckBox('all_triggers', null, "CheckAll('" . $frmCnct->GetName() . "','all_triggers','triggers');"), S_TRIGGERS, S_TYPE, S_COLOR));
    $table->addOption('id', 'link_triggers');
    foreach ($triggers as $id => $trigger) {
        if (!isset($trigger['triggerid'])) {
            continue;
        }
        $colorbox = new CSpan(SPACE . SPACE . SPACE);
        $colorbox->addOption('style', 'text-decoration: none; outline-color: black; outline-style: solid; outline-width: 1px; background-color: #' . $trigger['color'] . ';');
        $table->addRow(array(array(new CCheckBox('triggers[' . $trigger['triggerid'] . '][triggerid]', null, null, $trigger['triggerid']), new CVar('triggers[' . $trigger['triggerid'] . '][triggerid]', $trigger['triggerid'])), array(new CLink($trigger['description'], "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . "&triggerid=" . $trigger['triggerid'] . url_param('linkid') . "','ZBX_Link_Indicator',560,260,'scrollbars=1, toolbar=0, menubar=0, resizable=0');"), new CVar('triggers[' . $trigger['triggerid'] . '][description]', $trigger['description'])), array(map_link_drawtype2str($trigger['drawtype']), new CVar('triggers[' . $trigger['triggerid'] . '][drawtype]', $trigger['drawtype'])), array($colorbox, new CVar('triggers[' . $trigger['triggerid'] . '][color]', $trigger['color']))));
    }
    $btnadd = new CButton('btn1', S_ADD, "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . url_param('linkid') . "','ZBX_Link_Indicator',560,180,'scrollbars=1, toolbar=0, menubar=0, resizable=0');", 'T');
    $btnRemove = new CButton('btn1', S_REMOVE, "javascript: remove_childs('" . $frmCnct->GetName() . "','triggers','tr');", 'T');
    $btnadd->SetType('button');
    $frmCnct->addRow(S_LINK_STATUS_INDICATORS, array($table, BR(), $btnadd, $btnRemove));
    //----------
    $frmCnct->addRow(S_TYPE . ' (' . S_OK_BIG . ')', $cmbType);
    $frmCnct->addRow(S_COLOR . ' (' . S_OK_BIG . ')', new CColor('color', $color));
    $frmCnct->addItemToBottomRow(new CButton("save_link", S_SAVE));
    if (isset($_REQUEST["linkid"])) {
//.........这里部分代码省略.........
开发者ID:rennhak,项目名称:zabbix,代码行数:101,代码来源:forms.inc.php

示例2: get_rights_of_elements_table

function get_rights_of_elements_table($rights = array(), $user_type = USER_TYPE_ZABBIX_USER)
{
    global $ZBX_LOCALNODEID;
    $table = new CTable('S_NO_ACCESSIBLE_RESOURCES', 'right_table');
    $table->SetHeader(array(SPACE, S_READ_WRITE, S_READ_ONLY, S_DENY), 'header');
    if (ZBX_DISTRIBUTED) {
        $lst['node']['label'] = S_NODES;
        $lst['node']['read_write'] = new CListBox('nodes_write', null, 10);
        $lst['node']['read_only'] = new CListBox('nodes_read', null, 10);
        $lst['node']['deny'] = new CListBox('nodes_deny', null, 10);
        $nodes = get_accessible_nodes_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY);
        foreach ($nodes as $node) {
            switch ($node['permission']) {
                case PERM_READ_ONLY:
                    $list_name = 'read_only';
                    break;
                case PERM_READ_WRITE:
                    $list_name = 'read_write';
                    break;
                default:
                    $list_name = 'deny';
                    break;
            }
            $lst['node'][$list_name]->addItem($node['nodeid'], $node['name']);
        }
        unset($nodes);
    }
    $lst['group']['label'] = S_HOST_GROUPS;
    $lst['group']['read_write'] = new CListBox('groups_write', null, 15);
    $lst['group']['read_only'] = new CListBox('groups_read', null, 15);
    $lst['group']['deny'] = new CListBox('groups_deny', null, 15);
    $groups = get_accessible_groups_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY, get_current_nodeid(true));
    foreach ($groups as $group) {
        switch ($group['permission']) {
            case PERM_READ_ONLY:
                $list_name = 'read_only';
                break;
            case PERM_READ_WRITE:
                $list_name = 'read_write';
                break;
            default:
                $list_name = 'deny';
        }
        $lst['group'][$list_name]->addItem($group['groupid'], $group['node_name'] . ':' . $group['name']);
    }
    unset($groups);
    $lst['host']['label'] = S_HOSTS;
    $lst['host']['read_write'] = new CListBox('hosts_write', null, 15);
    $lst['host']['read_only'] = new CListBox('hosts_read', null, 15);
    $lst['host']['deny'] = new CListBox('hosts_deny', null, 15);
    $hosts = get_accessible_hosts_by_rights($rights, $user_type, PERM_DENY, PERM_RES_DATA_ARRAY, get_current_nodeid(true));
    foreach ($hosts as $host) {
        switch ($host['permission']) {
            case PERM_READ_ONLY:
                $list_name = 'read_only';
                break;
            case PERM_READ_WRITE:
                $list_name = 'read_write';
                break;
            default:
                $list_name = 'deny';
                break;
        }
        $lst['host'][$list_name]->addItem($host['hostid'], $host['node_name'] . ':' . $host['host']);
    }
    unset($hosts);
    foreach ($lst as $name => $lists) {
        $row = new CRow();
        foreach ($lists as $class => $list_obj) {
            $row->addItem(new CCol($list_obj, $class));
        }
        $table->addRow($row);
    }
    unset($lst);
    return $table;
}
开发者ID:phedders,项目名称:zabbix,代码行数:76,代码来源:forms.inc.php

示例3: DBstart

if ($config == 1) {
    if (isset($_FILES['import_file'])) {
        include_once "include/import.inc.php";
        DBstart();
        $importer = new CZabbixXMLImport();
        $importer->setRules($rules['host'], $rules['template'], $rules['item'], $rules['trigger'], $rules['graph']);
        $result = $importer->Parse($_FILES['import_file']['tmp_name']);
        unset($importer);
        $result = DBend($result);
        show_messages($result, S_IMPORTED . SPACE . S_SUCCESSEFULLY_SMALL, S_IMPORT . SPACE . S_FAILED_SMALL);
    }
    $form = new CFormTable($frm_title, null, "post", "multipart/form-data");
    $form->AddVar('config', $config);
    $form->AddRow(S_IMPORT_FILE, new CFile('import_file'));
    $table = new CTable();
    $table->SetHeader(array(S_ELEMENT, S_EXISTING, S_MISSING), 'bold');
    foreach (array('host' => S_HOST, 'template' => S_TEMPLATE, 'item' => S_ITEM, 'trigger' => S_TRIGGER, 'graph' => S_GRAPH) as $key => $title) {
        $cmbExist = new CComboBox('rules[' . $key . '][exist]', $rules[$key]['exist']);
        $cmbExist->AddItem(0, S_UPDATE);
        $cmbExist->AddItem(1, S_SKIP);
        $cmbMissed = new CComboBox('rules[' . $key . '][missed]', $rules[$key]['missed']);
        $key == 'template' ? '' : $cmbMissed->AddItem(0, S_ADD);
        $cmbMissed->AddItem(1, S_SKIP);
        $table->AddRow(array($title, $cmbExist, $cmbMissed));
    }
    $form->AddRow(S_RULES, $table);
    $form->AddItemToBottomRow(new CButton('import', S_IMPORT));
    $form->Show();
} else {
    echo SBR;
    if ($preview) {
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:exp_imp.php

示例4: array

$refresh_rate = 30;
//seconds
$fields = array("warning_msg" => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), "message" => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL), "retry" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), "cancel" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL));
check_fields($fields, false);
if (isset($_REQUEST['cancel'])) {
    zbx_unsetcookie('ZBX_CONFIG');
    redirect('index.php');
    exit;
}
//	clear_messages();
$USER_DETAILS["refresh"] = $refresh_rate;
include_once "include/page_header.php";
unset($USER_DETAILS);
insert_showhint_javascript();
$table = new CTable(null, 'warning');
$table->SetAlign('center');
$table->AddOption('style', 'width: 480px; margin-top: 100px;');
$table->SetHeader(array(new CCol(S_ZABBIX_VER, 'left'), SPACE), 'header');
$table->AddRow(SPACE);
$warning_msg = isset($_REQUEST['warning_msg']) ? $_REQUEST['warning_msg'] : S_ZABBIX_IS_UNAVAILABLE . '!';
$img = new CImg('./images/general/warning16r.gif', 'warning', 16, 16, 'img');
$img->addOption('style', 'border-width: 0px; vertical-align: bottom;');
$msg = new CSpan(bold(SPACE . $warning_msg));
$msg->AddOption('style', 'line-height: 20px; vertical-align: top;');
$table->AddRow(new CCol(array($img, $msg), 'center'));
$table->AddRow(SPACE);
$table->SetFooter(new CCol(new CButton('retry', S_RETRY, 'javascript: document.location.reload();'), 'left'), 'footer');
$table->Show();
zbx_add_post_js('setTimeout("document.location.reload();",' . $refresh_rate * 1000 . ');');
echo SBR;
include_once "include/page_footer.php";
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:warning.php


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