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


PHP CMap::get方法代码示例

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


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

示例1: sysmapIdents

function sysmapIdents($sysmapids)
{
    $idents = array();
    $options = array('sysmapids' => $sysmapids, 'output' => API_OUTPUT_EXTEND, 'nodeids' => get_current_nodeid(true));
    $sysmaps = CMap::get($options);
    foreach ($sysmaps as $snum => $sysmap) {
        $idents[$sysmap['sysmapid']] = array('node' => get_node_name_by_elid($sysmap['sysmapid'], true), 'name' => $sysmap['name']);
    }
    return $idents;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:10,代码来源:ident.inc.php

示例2: CForm

            $map_wdgt->addItem(insert_map_form());
        }
    }
} else {
    $form = new CForm();
    $form->setName('frm_maps');
    $numrows = new CDiv();
    $numrows->setAttribute('name', 'numrows');
    $map_wdgt->addHeader(S_MAPS_BIG);
    $map_wdgt->addHeader($numrows);
    $table = new CTableInfo(S_NO_MAPS_DEFINED);
    $table->setHeader(array(new CCheckBox('all_maps', NULL, "checkAll('" . $form->getName() . "','all_maps','maps');"), make_sorting_header(S_NAME, 'name'), make_sorting_header(S_WIDTH, 'width'), make_sorting_header(S_HEIGHT, 'height'), S_EDIT));
    $sortfield = getPageSortField('name');
    $sortorder = getPageSortOrder();
    $options = array('editable' => 1, 'extendoutput' => 1, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1);
    $maps = CMap::get($options);
    // sorting
    order_result($maps, $sortfield, $sortorder);
    $paging = getPagingLine($maps);
    //-------
    foreach ($maps as $mnum => $map) {
        $table->addRow(array(new CCheckBox('maps[' . $map['sysmapid'] . ']', NULL, NULL, $map['sysmapid']), new CLink($map['name'], 'sysmap.php?sysmapid=' . $map['sysmapid']), $map['width'], $map['height'], new CLink(S_EDIT, 'sysmaps.php?form=update&sysmapid=' . $map['sysmapid'] . '#form')));
    }
    // goBox
    $goBox = new CComboBox('go');
    $goBox->addItem('export', S_EXPORT_SELECTED);
    $goOption = new CComboItem('delete', S_DELETE_SELECTED);
    $goOption->setAttribute('confirm', S_DELETE_SELECTED_MAPS_Q);
    $goBox->addItem($goOption);
    // goButton name is necessary!!!
    $goButton = new CButton('goButton', S_GO);
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:sysmaps.php

示例3: get_screen

function get_screen($screenid, $editmode, $effectiveperiod = NULL)
{
    global $USER_DETAILS;
    if ($screenid == 0) {
        return new CTableInfo(S_NO_SCREENS_DEFINED);
    }
    $r = CScreen::get(array('screenids' => $screenid, 'editable' => $editmode == 1 ? 1 : null, 'output' => API_OUTPUT_SHORTEN));
    if (empty($r)) {
        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);
    }
    $sql = 'SELECT * FROM screens_items WHERE screenid=' . $screenid;
    $iresult = DBSelect($sql);
    $skip_field = array();
    $irows = array();
    while ($irow = DBfetch($iresult)) {
        $irows[] = $irow;
        for ($i = 0; $i < $irow['rowspan'] || $i == 0; $i++) {
            for ($j = 0; $j < $irow['colspan'] || $j == 0; $j++) {
                if ($i != 0 || $j != 0) {
                    if (!isset($skip_field[$irow['y'] + $i])) {
                        $skip_field[$irow['y'] + $i] = array();
                    }
                    $skip_field[$irow['y'] + $i][$irow['x'] + $j] = 1;
                }
            }
        }
    }
    $table = new CTable(new CLink(S_NO_ROWS_IN_SCREEN . SPACE . $row['name'], 'screenconf.php?config=0&form=update&screenid=' . $screenid), $editmode == 0 || $editmode == 2 ? 'screen_view' : 'screen_edit');
    $table->setAttribute('id', 'iframe');
    if ($editmode == 1) {
        $new_cols = array(new Ccol(new Cimg('images/general/zero.gif', 'zero', 1, 1)));
        for ($c = 0; $c < $row['hsize'] + 1; $c++) {
            $add_icon = new Cimg('images/general/closed.gif', NULL, NULL, NULL, 'pointer');
            $add_icon->addAction('onclick', "javascript: location.href = 'screenedit.php?config=1&screenid={$screenid}&add_col={$c}';");
            array_push($new_cols, new Ccol($add_icon));
        }
        $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_icon = new Cimg('images/general/closed.gif', NULL, NULL, NULL, 'pointer');
            $add_icon->addAction('onclick', "javascript: location.href = 'screenedit.php?config=1&screenid={$screenid}&add_row={$r}';");
            array_push($new_cols, new Ccol($add_icon));
        }
        for ($c = 0; $c < $row['hsize']; $c++) {
            $item = array();
            if (isset($skip_field[$r][$c])) {
                continue;
            }
            $item_form = false;
            $irow = false;
            foreach ($irows as $tmprow) {
                if ($tmprow['x'] == $c && $tmprow['y'] == $r) {
                    $irow = $tmprow;
                    break;
                }
            }
            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;
//.........这里部分代码省略.........
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:screens.inc.php

示例4: make_sysmap_submenu

function make_sysmap_submenu()
{
    $fav_sysmaps = get_favorites('web.favorite.sysmapids');
    $favMaps = array();
    $sysmapids = array();
    foreach ($fav_sysmaps as $key => $favorite) {
        $sysmapids[$favorite['value']] = $favorite['value'];
    }
    $options = array('sysmapids' => $sysmapids, 'output' => API_OUTPUT_EXTEND);
    $sysmaps = CMap::get($options);
    foreach ($sysmaps as $snum => $sysmap) {
        $favMaps[] = array('name' => $sysmap['name'], 'favobj' => 'sysmapid', 'favid' => $sysmap['sysmapid'], 'action' => 'remove');
    }
    if (!empty($favMaps)) {
        $favMaps[] = array('name' => S_REMOVE . SPACE . S_ALL_S . SPACE . S_MAPS, 'favobj' => 'sysmapid', 'favid' => 0, 'action' => 'remove');
    }
    return $favMaps;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:18,代码来源:blocks.inc.php

示例5: checkItems

 protected static function checkItems($screenitems)
 {
     $hostgroups = array();
     $hosts = array();
     $graphs = array();
     $items = array();
     $maps = array();
     $screens = array();
     $resources = array(SCREEN_RESOURCE_GRAPH, SCREEN_RESOURCE_SIMPLE_GRAPH, SCREEN_RESOURCE_PLAIN_TEXT, SCREEN_RESOURCE_MAP, SCREEN_RESOURCE_SCREEN, SCREEN_RESOURCE_TRIGGERS_OVERVIEW, SCREEN_RESOURCE_DATA_OVERVIEW);
     foreach ($screenitems as $item) {
         if (isset($item['resourcetype']) && !isset($item['resourceid']) || !isset($item['resourcetype']) && isset($item['resourceid'])) {
             self::exception(ZBX_API_ERROR_PERMISSIONS, S_NO_PERMISSION);
         }
         if (isset($item['resourceid']) && $item['resourceid'] == 0) {
             if (uint_in_array($item['resourcetype'], $resources)) {
                 throw new Exception(S_INCORRECT_RESOURCE_PROVIDED_FOR_SCREEN_ITEM);
             } else {
                 continue;
             }
         }
         switch ($item['resourcetype']) {
             case SCREEN_RESOURCE_HOSTS_INFO:
             case SCREEN_RESOURCE_TRIGGERS_INFO:
             case SCREEN_RESOURCE_TRIGGERS_OVERVIEW:
             case SCREEN_RESOURCE_DATA_OVERVIEW:
             case SCREEN_RESOURCE_HOSTGROUP_TRIGGERS:
                 $hostgroups[] = $item['resourceid'];
                 break;
             case SCREEN_RESOURCE_HOST_TRIGGERS:
                 $hosts[] = $item['resourceid'];
                 break;
             case SCREEN_RESOURCE_GRAPH:
                 $graphs[] = $item['resourceid'];
                 break;
             case SCREEN_RESOURCE_SIMPLE_GRAPH:
             case SCREEN_RESOURCE_PLAIN_TEXT:
                 $items[] = $item['resourceid'];
                 break;
             case SCREEN_RESOURCE_MAP:
                 $maps[] = $item['resourceid'];
                 break;
             case SCREEN_RESOURCE_SCREEN:
                 $screens[] = $item['resourceid'];
                 break;
         }
     }
     if (!empty($hostgroups)) {
         $result = CHostGroup::get(array('groupids' => $hostgroups, 'output' => API_OUTPUT_SHORTEN, 'preservekeys' => 1));
         foreach ($hostgroups as $id) {
             if (!isset($result[$id])) {
                 self::exception(ZBX_API_ERROR_PERMISSIONS, 'Incorrect Host group identity "' . $id . '" provided for Screens item resource');
             }
         }
     }
     if (!empty($hosts)) {
         $result = CHost::get(array('hostids' => $hosts, 'output' => API_OUTPUT_SHORTEN, 'preservekeys' => 1));
         foreach ($hosts as $id) {
             if (!isset($result[$id])) {
                 self::exception(ZBX_API_ERROR_PERMISSIONS, 'Incorrect Host identity "' . $id . '" provided for Screens item resource');
             }
         }
     }
     if (!empty($graphs)) {
         $result = CGraph::get(array('graphids' => $graphs, 'output' => API_OUTPUT_SHORTEN, 'preservekeys' => 1));
         foreach ($graphs as $id) {
             if (!isset($result[$id])) {
                 self::exception(ZBX_API_ERROR_PERMISSIONS, 'Incorrect Graph identity "' . $id . '" provided for Screens item resource');
             }
         }
     }
     if (!empty($items)) {
         $result = CItem::get(array('itemids' => $items, 'output' => API_OUTPUT_SHORTEN, 'preservekeys' => 1, 'webitems' => 1));
         foreach ($items as $id) {
             if (!isset($result[$id])) {
                 self::exception(ZBX_API_ERROR_PERMISSIONS, 'Incorrect Item identity "' . $id . '" provided for Screens item resource');
             }
         }
     }
     if (!empty($maps)) {
         $result = CMap::get(array('sysmapids' => $maps, 'output' => API_OUTPUT_SHORTEN, 'preservekeys' => 1));
         foreach ($maps as $id) {
             if (!isset($result[$id])) {
                 self::exception(ZBX_API_ERROR_PERMISSIONS, 'Incorrect Map identity "' . $id . '" provided for Screens item resource');
             }
         }
     }
     if (!empty($screens)) {
         $result = self::get(array('screenids' => $screens, 'output' => API_OUTPUT_SHORTEN, 'preservekeys' => 1));
         foreach ($screens as $id) {
             if (!isset($result[$id])) {
                 self::exception(ZBX_API_ERROR_PERMISSIONS, 'Incorrect Screen identity "' . $id . '" provided for Screens item resource');
             }
         }
     }
 }
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:95,代码来源:class.cscreen.php

示例6: getSelementsInfo

function getSelementsInfo($sysmap)
{
    $config = select_config();
    $show_unack = $config['event_ack_enable'] ? $sysmap['show_unack'] : EXTACK_OPTION_ALL;
    $triggers_map = array();
    $triggers_map_submaps = array();
    $hostgroups_map = array();
    $hosts_map = array();
    $selements = zbx_toHash($sysmap['selements'], 'selementid');
    foreach ($selements as $selementid => $selement) {
        $selements[$selementid]['hosts'] = array();
        $selements[$selementid]['triggers'] = array();
        switch ($selement['elementtype']) {
            case SYSMAP_ELEMENT_TYPE_MAP:
                $mapids = array($selement['elementid']);
                while (!empty($mapids)) {
                    $options = array('sysmapids' => $mapids, 'output' => API_OUTPUT_EXTEND, 'select_selements' => API_OUTPUT_EXTEND, 'nopermissions' => 1, 'nodeids' => get_current_nodeid(true));
                    $maps = CMap::get($options);
                    $mapids = array();
                    foreach ($maps as $map) {
                        foreach ($map['selements'] as $sel) {
                            switch ($sel['elementtype']) {
                                case SYSMAP_ELEMENT_TYPE_MAP:
                                    $mapids[] = $sel['elementid'];
                                    break;
                                case SYSMAP_ELEMENT_TYPE_HOST_GROUP:
                                    $hostgroups_map[$sel['elementid']][$selementid] = $selementid;
                                    break;
                                case SYSMAP_ELEMENT_TYPE_HOST:
                                    $hosts_map[$sel['elementid']][$selementid] = $selementid;
                                    break;
                                case SYSMAP_ELEMENT_TYPE_TRIGGER:
                                    $triggers_map_submaps[$sel['elementid']][$selementid] = $selementid;
                                    break;
                            }
                        }
                    }
                }
                break;
            case SYSMAP_ELEMENT_TYPE_HOST_GROUP:
                $hostgroups_map[$selement['elementid']][$selement['selementid']] = $selement['selementid'];
                break;
            case SYSMAP_ELEMENT_TYPE_HOST:
                $hosts_map[$selement['elementid']][$selement['selementid']] = $selement['selementid'];
                break;
            case SYSMAP_ELEMENT_TYPE_TRIGGER:
                $triggers_map[$selement['elementid']][$selement['selementid']] = $selement['selementid'];
                break;
        }
    }
    // get hosts data {{{
    $all_hosts = array();
    if (!empty($hosts_map)) {
        $options = array('hostids' => array_keys($hosts_map), 'output' => API_OUTPUT_EXTEND, 'nopermissions' => 1, 'nodeids' => get_current_nodeid(true));
        $hosts = CHost::get($options);
        $all_hosts = array_merge($all_hosts, $hosts);
        foreach ($hosts as $host) {
            foreach ($hosts_map[$host['hostid']] as $belongs_to_sel) {
                $selements[$belongs_to_sel]['hosts'][$host['hostid']] = $host['hostid'];
            }
        }
    }
    if (!empty($hostgroups_map)) {
        $options = array('groupids' => array_keys($hostgroups_map), 'output' => API_OUTPUT_EXTEND, 'nopermissions' => 1, 'nodeids' => get_current_nodeid(true));
        $hosts = CHost::get($options);
        $all_hosts = array_merge($all_hosts, $hosts);
        foreach ($hosts as $host) {
            foreach ($host['groups'] as $group) {
                foreach ($hostgroups_map[$group['groupid']] as $belongs_to_sel) {
                    $selements[$belongs_to_sel]['hosts'][$host['hostid']] = $host['hostid'];
                    // add hosts to hosts_map for trigger selection;
                    if (!isset($hosts_map[$host['hostid']])) {
                        $hosts_map[$host['hostid']] = array();
                    }
                    $hosts_map[$host['hostid']][$belongs_to_sel] = $belongs_to_sel;
                }
            }
        }
    }
    $all_hosts = zbx_toHash($all_hosts, 'hostid');
    $monitored_hostids = array();
    foreach ($all_hosts as $hostid => $host) {
        if ($host['status'] == HOST_STATUS_MONITORED) {
            $monitored_hostids[$hostid] = $hostid;
        }
    }
    // }}}
    // get triggers data {{{
    $all_triggers = array();
    // triggers from current map, select all
    if (!empty($triggers_map)) {
        $options = array('nodeids' => get_current_nodeid(true), 'triggerids' => array_keys($triggers_map), 'output' => API_OUTPUT_EXTEND, 'nopermissions' => 1);
        $triggers = CTrigger::get($options);
        $all_triggers = array_merge($all_triggers, $triggers);
        foreach ($triggers as $trigger) {
            foreach ($triggers_map[$trigger['triggerid']] as $belongs_to_sel) {
                $selements[$belongs_to_sel]['triggers'][$trigger['triggerid']] = $trigger['triggerid'];
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:maps.inc.php

示例7: insert_map_form

function insert_map_form()
{
    $frm_title = 'New system map';
    if (isset($_REQUEST['sysmapid'])) {
        $options = array('sysmapids' => $_REQUEST['sysmapid'], 'output' => API_OUTPUT_EXTEND);
        $sysmaps = CMap::get($options);
        $row = reset($sysmaps);
        $frm_title = 'System map: "' . $row['name'] . '"';
    }
    if (isset($_REQUEST['sysmapid']) && !isset($_REQUEST['form_refresh'])) {
        $name = $row['name'];
        $width = $row['width'];
        $height = $row['height'];
        $backgroundid = $row['backgroundid'];
        $label_type = $row['label_type'];
        $label_location = $row['label_location'];
        $highlight = $row['highlight'];
        $markelements = $row['markelements'];
        $expandproblem = $row['expandproblem'];
        $show_unack = $row['show_unack'];
    } else {
        $name = get_request('name', '');
        $width = get_request('width', 800);
        $height = get_request('height', 600);
        $backgroundid = get_request('backgroundid', 0);
        $label_type = get_request('label_type', 0);
        $label_location = get_request('label_location', 0);
        $highlight = get_request('highlight', 0);
        $markelements = get_request('markelements', 0);
        $expandproblem = get_request('expandproblem', 0);
        $show_unack = get_request('show_unack', 0);
    }
    $frmMap = new CFormTable($frm_title, 'sysmaps.php');
    $frmMap->setHelp('web.sysmaps.map.php');
    if (isset($_REQUEST['sysmapid'])) {
        $frmMap->addVar('sysmapid', $_REQUEST['sysmapid']);
    }
    $frmMap->addRow(S_NAME, new CTextBox('name', $name, 32));
    $frmMap->addRow(S_WIDTH, new CNumericBox('width', $width, 5));
    $frmMap->addRow(S_HEIGHT, new CNumericBox('height', $height, 5));
    $cmbImg = new CComboBox('backgroundid', $backgroundid);
    $cmbImg->addItem(0, S_NO_IMAGE . '...');
    $result = DBselect('SELECT * FROM images WHERE imagetype=2 AND ' . DBin_node('imageid') . ' order by name');
    while ($row = DBfetch($result)) {
        $cmbImg->addItem($row['imageid'], get_node_name_by_elid($row['imageid'], null, ': ') . $row['name']);
    }
    $frmMap->addRow(S_BACKGROUND_IMAGE, $cmbImg);
    $frmMap->addRow(S_ICON_HIGHLIGHTING, new CCheckBox('highlight', $highlight, null, 1));
    $frmMap->addRow(S_MARK_ELEMENTS_ON_TRIGGER_STATUS_CHANGE, new CCheckBox('markelements', $markelements, null, 1));
    $frmMap->addRow(S_EXPAND_SINGLE_PROBLEM, new CCheckBox('expandproblem', $expandproblem, null, 1));
    $cmbLabel = new CComboBox('label_type', $label_type);
    $cmbLabel->addItem(0, S_LABEL);
    $cmbLabel->addItem(1, S_IP_ADDRESS);
    $cmbLabel->addItem(2, S_ELEMENT_NAME);
    $cmbLabel->addItem(3, S_STATUS_ONLY);
    $cmbLabel->addItem(4, S_NOTHING);
    $frmMap->addRow(S_ICON_LABEL_TYPE, $cmbLabel);
    $cmbLocation = new CComboBox('label_location', $label_location);
    $cmbLocation->addItem(0, S_BOTTOM);
    $cmbLocation->addItem(1, S_LEFT);
    $cmbLocation->addItem(2, S_RIGHT);
    $cmbLocation->addItem(3, S_TOP);
    $frmMap->addRow(S_ICON_LABEL_LOCATION, $cmbLocation);
    $config = select_config();
    $cb = new CComboBox('show_unack', $show_unack);
    $cb->addItems(array(EXTACK_OPTION_ALL => S_O_ALL, EXTACK_OPTION_BOTH => S_O_SEPARATED, EXTACK_OPTION_UNACK => S_O_UNACKNOWLEDGED_ONLY));
    $cb->setEnabled($config['event_ack_enable']);
    if (!$config['event_ack_enable']) {
        $cb->setAttribute('title', S_EVENT_ACKNOWLEDGING_DISABLED);
    }
    $frmMap->addRow(S_PROBLEM_DISPLAY, $cb);
    $frmMap->addItemToBottomRow(new CButton('save', S_SAVE));
    if (isset($_REQUEST['sysmapid'])) {
        $frmMap->addItemToBottomRow(SPACE);
        $frmMap->addItemToBottomRow(new CButtonDelete(S_DELETE_SYSTEM_MAP_Q, url_param('form') . url_param('sysmapid')));
    }
    $frmMap->addItemToBottomRow(SPACE);
    $frmMap->addItemToBottomRow(new CButtonCancel());
    return $frmMap;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:80,代码来源:forms.inc.php


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