$data['multiple_interface_types'] = count(array_unique($usedInterfacesTypes)) > 1; } } // item types $data['itemTypes'] = item_type2str(); unset($data['itemTypes'][ITEM_TYPE_HTTPTEST]); // valuemap $data['valuemaps'] = DBfetchArray(DBselect('SELECT v.valuemapid,v.name FROM valuemaps v')); order_result($data['valuemaps'], 'name'); // render view $itemView = new CView('configuration.item.massupdate', $data); $itemView->render(); $itemView->show(); } elseif (hasRequest('action') && getRequest('action') == 'item.masscopyto' && hasRequest('group_itemid')) { // render view $data = getCopyElementsFormData('group_itemid', _('CONFIGURATION OF ITEMS')); $data['action'] = 'item.masscopyto'; $graphView = new CView('configuration.copy.elements', $data); $graphView->render(); $graphView->show(); } else { $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'name')); $sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP)); CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR); CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR); $_REQUEST['hostid'] = empty($_REQUEST['filter_hostid']) ? null : $_REQUEST['filter_hostid']; $data = array('form' => getRequest('form'), 'hostid' => getRequest('hostid'), 'sort' => $sortField, 'sortorder' => $sortOrder); // items $options = array('hostids' => $data['hostid'], 'search' => array(), 'output' => array('itemid', 'type', 'hostid', 'name', 'key_', 'delay', 'history', 'trends', 'status', 'value_type', 'error', 'templateid', 'flags', 'state'), 'editable' => true, 'selectHosts' => API_OUTPUT_EXTEND, 'selectTriggers' => array('triggerid', 'description'), 'selectApplications' => API_OUTPUT_EXTEND, 'selectDiscoveryRule' => API_OUTPUT_EXTEND, 'selectItemDiscovery' => array('ts_delete'), 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1); $preFilter = count($options, COUNT_RECURSIVE); if (isset($_REQUEST['filter_groupid']) && !empty($_REQUEST['filter_groupid'])) {
} /* * Display */ $pageFilter = new CPageFilter(array('groups' => array('not_proxy_hosts' => true, 'editable' => true), 'hosts' => array('editable' => true, 'templated_hosts' => true), 'groupid' => get_request('groupid', null), 'hostid' => get_request('hostid', null))); if (empty($_REQUEST['parent_discoveryid'])) { if ($pageFilter->groupid > 0) { $_REQUEST['groupid'] = $pageFilter->groupid; } if ($pageFilter->hostid > 0) { $_REQUEST['hostid'] = $pageFilter->hostid; } } if ($_REQUEST['go'] == 'copy_to' && isset($_REQUEST['group_graphid'])) { // render view $graphView = new CView('configuration.copy.elements', getCopyElementsFormData('group_graphid')); $graphView->render(); $graphView->show(); } elseif (isset($_REQUEST['form'])) { $data = array('form' => get_request('form'), 'form_refresh' => get_request('form_refresh', 0), 'graphid' => get_request('graphid', 0), 'parent_discoveryid' => get_request('parent_discoveryid'), 'group_gid' => get_request('group_gid', array()), 'hostid' => get_request('hostid', 0), 'normal_only' => get_request('normal_only')); if (!empty($data['graphid']) && !isset($_REQUEST['form_refresh'])) { $options = array('graphids' => $data['graphid'], 'output' => API_OUTPUT_EXTEND, 'selectHosts' => array('hostid')); $graph = empty($data['parent_discoveryid']) ? API::Graph()->get($options) : API::GraphPrototype()->get($options); $graph = reset($graph); $data['name'] = $graph['name']; $data['width'] = $graph['width']; $data['height'] = $graph['height']; $data['ymin_type'] = $graph['ymin_type']; $data['ymax_type'] = $graph['ymax_type']; $data['yaxismin'] = $graph['yaxismin']; $data['yaxismax'] = $graph['yaxismax'];
show_messages($goResult, _('Triggers deleted'), _('Cannot delete triggers')); clearCookies($goResult, $_REQUEST['hostid']); } /* * Display */ if ($_REQUEST['go'] == 'massupdate' && isset($_REQUEST['g_triggerid'])) { $triggersView = new CView('configuration.triggers.massupdate', getTriggerMassupdateFormData()); $triggersView->render(); $triggersView->show(); } elseif (isset($_REQUEST['form'])) { $triggersView = new CView('configuration.triggers.edit', getTriggerFormData()); $triggersView->render(); $triggersView->show(); } elseif ($_REQUEST['go'] == 'copy_to' && isset($_REQUEST['g_triggerid'])) { $triggersView = new CView('configuration.copy.elements', getCopyElementsFormData('g_triggerid', _('CONFIGURATION OF TRIGGERS'))); $triggersView->render(); $triggersView->show(); } else { $data = array('showdisabled' => get_request('showdisabled', 1), 'parent_discoveryid' => null, 'triggers' => array(), 'displayNodes' => is_array(get_current_nodeid()) && empty($_REQUEST['groupid']) && empty($_REQUEST['hostid'])); CProfile::update('web.triggers.showdisabled', $data['showdisabled'], PROFILE_TYPE_INT); $data['pageFilter'] = new CPageFilter(array('groups' => array('not_proxy_hosts' => true, 'editable' => true), 'hosts' => array('templated_hosts' => true, 'editable' => true), 'triggers' => array('editable' => true), 'groupid' => get_request('groupid', null), 'hostid' => get_request('hostid', null), 'triggerid' => get_request('triggerid', null))); if ($data['pageFilter']->triggerid > 0) { $data['triggerid'] = $data['pageFilter']->triggerid; } $data['groupid'] = $data['pageFilter']->groupid; $data['hostid'] = $data['pageFilter']->hostid; // get triggers $sortfield = getPageSortField('description'); if ($data['pageFilter']->hostsSelected) { $options = array('editable' => true, 'output' => array('triggerid'), 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1);
} /* * Display */ if (hasRequest('action') && getRequest('action') == 'trigger.massupdateform' && hasRequest('g_triggerid')) { $data = getTriggerMassupdateFormData(); $data['action'] = 'trigger.massupdate'; $triggersView = new CView('configuration.triggers.massupdate', $data); $triggersView->render(); $triggersView->show(); } elseif (isset($_REQUEST['form'])) { $triggersView = new CView('configuration.triggers.edit', getTriggerFormData($exprAction)); $triggersView->render(); $triggersView->show(); } elseif (hasRequest('action') && getRequest('action') == 'trigger.masscopyto' && hasRequest('g_triggerid')) { $data = getCopyElementsFormData('g_triggerid', _('CONFIGURATION OF TRIGGERS')); $data['action'] = 'trigger.masscopyto'; $triggersView = new CView('configuration.copy.elements', $data); $triggersView->render(); $triggersView->show(); } else { $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'description')); $sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP)); CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR); CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR); $data = array('showdisabled' => getRequest('showdisabled', 1), 'parent_discoveryid' => null, 'triggers' => array(), 'sort' => $sortField, 'sortorder' => $sortOrder); CProfile::update('web.triggers.showdisabled', $data['showdisabled'], PROFILE_TYPE_INT); $data['pageFilter'] = new CPageFilter(array('groups' => array('with_hosts_and_templates' => true, 'editable' => true), 'hosts' => array('templated_hosts' => true, 'editable' => true), 'triggers' => array('editable' => true), 'groupid' => getRequest('groupid'), 'hostid' => getRequest('hostid'))); $data['groupid'] = $data['pageFilter']->groupid; $data['hostid'] = $data['pageFilter']->hostid; // get triggers
// item types $data['itemTypes'] = item_type2str(); unset($data['itemTypes'][ITEM_TYPE_HTTPTEST]); // valuemap $data['valuemaps'] = API::ValueMap()->get(['output' => ['valuemapid', 'name']]); CArrayHelper::sort($data['valuemaps'], ['name']); if (!$data['delay_flex']) { $data['delay_flex'][] = ['delay' => '', 'period' => '', 'type' => ITEM_DELAY_FLEX_TYPE_FLEXIBLE]; } // render view $itemView = new CView('configuration.item.massupdate', $data); $itemView->render(); $itemView->show(); } elseif (hasRequest('action') && getRequest('action') == 'item.masscopyto' && hasRequest('group_itemid')) { // render view $data = getCopyElementsFormData('group_itemid', _('Items')); $data['action'] = 'item.masscopyto'; $graphView = new CView('configuration.copy.elements', $data); $graphView->render(); $graphView->show(); } else { $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'name')); $sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP)); CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR); CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR); $_REQUEST['hostid'] = empty($_REQUEST['filter_hostid']) ? null : $_REQUEST['filter_hostid']; $config = select_config(); $data = ['form' => getRequest('form'), 'hostid' => getRequest('hostid'), 'sort' => $sortField, 'sortorder' => $sortOrder, 'config' => $config]; // items $options = ['hostids' => $data['hostid'], 'search' => [], 'output' => ['itemid', 'type', 'hostid', 'name', 'key_', 'delay', 'history', 'trends', 'status', 'value_type', 'error', 'templateid', 'flags', 'state'], 'editable' => true, 'selectHosts' => API_OUTPUT_EXTEND, 'selectTriggers' => ['triggerid', 'description'], 'selectApplications' => API_OUTPUT_EXTEND, 'selectDiscoveryRule' => API_OUTPUT_EXTEND, 'selectItemDiscovery' => ['ts_delete'], 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1]; $preFilter = count($options, COUNT_RECURSIVE);
} /* * Display */ $pageFilter = new CPageFilter(array('groups' => array('with_hosts_and_templates' => true, 'editable' => true), 'hosts' => array('editable' => true, 'templated_hosts' => true), 'groupid' => getRequest('groupid'), 'hostid' => getRequest('hostid'))); if (empty($_REQUEST['parent_discoveryid'])) { if ($pageFilter->groupid > 0) { $_REQUEST['groupid'] = $pageFilter->groupid; } if ($pageFilter->hostid > 0) { $_REQUEST['hostid'] = $pageFilter->hostid; } } if (hasRequest('action') && getRequest('action') == 'graph.masscopyto' && hasRequest('group_graphid')) { // render view $data = getCopyElementsFormData('group_graphid'); $data['action'] = 'graph.masscopyto'; $graphView = new CView('configuration.copy.elements', $data); $graphView->render(); $graphView->show(); } elseif (isset($_REQUEST['form'])) { $data = array('form' => getRequest('form'), 'form_refresh' => getRequest('form_refresh', 0), 'graphid' => getRequest('graphid', 0), 'parent_discoveryid' => getRequest('parent_discoveryid'), 'group_gid' => getRequest('group_gid', array()), 'hostid' => getRequest('hostid', 0), 'normal_only' => getRequest('normal_only')); if (!empty($data['graphid']) && !isset($_REQUEST['form_refresh'])) { $options = array('graphids' => $data['graphid'], 'output' => API_OUTPUT_EXTEND, 'selectHosts' => array('hostid')); $graph = empty($data['parent_discoveryid']) ? API::Graph()->get($options) : API::GraphPrototype()->get($options); $graph = reset($graph); $data['name'] = $graph['name']; $data['width'] = $graph['width']; $data['height'] = $graph['height']; $data['ymin_type'] = $graph['ymin_type']; $data['ymax_type'] = $graph['ymax_type'];