本文整理汇总了PHP中CProfile::getArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CProfile::getArray方法的具体用法?PHP CProfile::getArray怎么用?PHP CProfile::getArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CProfile
的用法示例。
在下文中一共展示了CProfile::getArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRequest
CProfile::update('web.latest.filter.show_without_data', getRequest('show_without_data', 0), PROFILE_TYPE_INT);
CProfile::update('web.latest.filter.show_details', getRequest('show_details', 0), PROFILE_TYPE_INT);
CProfile::update('web.latest.filter.application', getRequest('application', ''), PROFILE_TYPE_STR);
CProfile::updateArray('web.latest.filter.groupids', getRequest('groupids', array()), PROFILE_TYPE_STR);
CProfile::updateArray('web.latest.filter.hostids', getRequest('hostids', array()), PROFILE_TYPE_STR);
} elseif (hasRequest('filter_rst')) {
DBStart();
CProfile::delete('web.latest.filter.select');
CProfile::delete('web.latest.filter.show_without_data');
CProfile::delete('web.latest.filter.show_details');
CProfile::delete('web.latest.filter.application');
CProfile::deleteIdx('web.latest.filter.groupids');
CProfile::deleteIdx('web.latest.filter.hostids');
DBend();
}
$filter = array('select' => CProfile::get('web.latest.filter.select', ''), 'showWithoutData' => CProfile::get('web.latest.filter.show_without_data', 1), 'showDetails' => CProfile::get('web.latest.filter.show_details'), 'application' => CProfile::get('web.latest.filter.application', ''), 'groupids' => CProfile::getArray('web.latest.filter.groupids'), 'hostids' => CProfile::getArray('web.latest.filter.hostids'));
// we'll need to hide the host column if only one host is selected
$singleHostSelected = count($filter['hostids']) == 1;
$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);
$applications = $items = $hostScripts = array();
// we'll only display the values if the filter is set
$filterSet = $filter['select'] !== '' || $filter['application'] !== '' || $filter['groupids'] || $filter['hostids'];
if ($filterSet) {
$hosts = API::Host()->get(array('output' => array('name', 'hostid', 'status'), 'hostids' => $filter['hostids'], 'groupids' => $filter['groupids'], 'selectGraphs' => API_OUTPUT_COUNT, 'with_monitored_items' => true, 'preservekeys' => true));
} else {
$hosts = array();
}
if ($hosts) {
示例2: CPageFilter
$showTriggers = TRIGGERS_OPTION_ALL;
} else {
$showTriggers = CProfile::get('web.overview.filter.show_triggers', TRIGGERS_OPTION_RECENT_PROBLEM);
}
/*
* Display
*/
$data = ['fullscreen' => $_REQUEST['fullscreen'], 'type' => $type, 'view_style' => $viewStyle, 'config' => $config];
$data['pageFilter'] = new CPageFilter(['groups' => [$data['type'] == SHOW_TRIGGERS ? 'with_monitored_triggers' : 'with_monitored_items' => true], 'hosts' => ['monitored_hosts' => true, $data['type'] == SHOW_TRIGGERS ? 'with_monitored_triggers' : 'with_monitored_items' => true], 'hostid' => getRequest('hostid'), 'groupid' => getRequest('groupid')]);
$data['groupid'] = $data['pageFilter']->groupid;
$data['hostid'] = $data['pageFilter']->hostid;
// fetch trigger data
if ($type == SHOW_TRIGGERS) {
// filter data
$filter = ['showTriggers' => $showTriggers, 'ackStatus' => CProfile::get('web.overview.filter.ack_status', 0), 'showSeverity' => CProfile::get('web.overview.filter.show_severity', TRIGGER_SEVERITY_NOT_CLASSIFIED), 'statusChange' => CProfile::get('web.overview.filter.status_change', 0), 'statusChangeDays' => CProfile::get('web.overview.filter.status_change_days', 14), 'txtSelect' => CProfile::get('web.overview.filter.txt_select', ''), 'application' => CProfile::get('web.overview.filter.application', ''), 'showMaintenance' => CProfile::get('web.overview.filter.show_maintenance', 1), 'inventory' => []];
foreach (CProfile::getArray('web.overview.filter.inventory.field', []) as $i => $field) {
$filter['inventory'][] = ['field' => $field, 'value' => CProfile::get('web.overview.filter.inventory.value', null, $i)];
}
// fetch hosts
$inventoryFilter = [];
foreach ($filter['inventory'] as $field) {
$inventoryFilter[$field['field']][] = $field['value'];
}
$hosts = API::Host()->get(['output' => ['hostid', 'status'], 'selectGraphs' => $viewStyle == STYLE_LEFT ? API_OUTPUT_COUNT : null, 'selectScreens' => $viewStyle == STYLE_LEFT ? API_OUTPUT_COUNT : null, 'groupids' => $data['pageFilter']->groupid != 0 ? $data['pageFilter']->groupid : null, 'searchInventory' => $inventoryFilter ? $inventoryFilter : null, 'preservekeys' => true]);
$hostIds = array_keys($hosts);
$options = ['output' => ['description', 'expression', 'priority', 'url', 'value', 'triggerid', 'lastchange', 'flags'], 'selectHosts' => ['hostid', 'name', 'status'], 'selectItems' => ['itemid', 'hostid', 'name', 'key_', 'value_type'], 'hostids' => $hostIds, 'search' => $filter['txtSelect'] !== '' ? ['description' => $filter['txtSelect']] : null, 'only_true' => $filter['showTriggers'] == TRIGGERS_OPTION_RECENT_PROBLEM ? true : null, 'withUnacknowledgedEvents' => $filter['ackStatus'] == ZBX_ACK_STS_WITH_UNACK ? true : null, 'withLastEventUnacknowledged' => $filter['ackStatus'] == ZBX_ACK_STS_WITH_LAST_UNACK ? true : null, 'min_severity' => $filter['showSeverity'] > TRIGGER_SEVERITY_NOT_CLASSIFIED ? $filter['showSeverity'] : null, 'lastChangeSince' => $filter['statusChange'] ? time() - $filter['statusChangeDays'] * SEC_PER_DAY : null, 'maintenance' => !$filter['showMaintenance'] ? false : null, 'monitored' => true, 'skipDependent' => true, 'sortfield' => 'description', 'preservekeys' => true];
// trigger status filter
if ($filter['showTriggers'] == TRIGGERS_OPTION_RECENT_PROBLEM) {
$options['only_true'] = true;
} elseif ($filter['showTriggers'] == TRIGGERS_OPTION_IN_PROBLEM) {
$options['filter']['value'] = TRIGGER_VALUE_TRUE;
示例3: array
}
$showDetails = CProfile::get('web.tr_status.filter.show_details', 0);
$showMaintenance = CProfile::get('web.tr_status.filter.show_maintenance', 1);
$showSeverity = CProfile::get('web.tr_status.filter.show_severity', TRIGGER_SEVERITY_NOT_CLASSIFIED);
$txtSelect = CProfile::get('web.tr_status.filter.txt_select', '');
$showChange = CProfile::get('web.tr_status.filter.status_change', 0);
$statusChangeBydays = CProfile::get('web.tr_status.filter.status_change_days', 14);
$ackStatus = $config['event_ack_enable'] == EVENT_ACK_DISABLED ? ZBX_ACK_STS_ANY : CProfile::get('web.tr_status.filter.ack_status', ZBX_ACK_STS_ANY);
$showEvents = CProfile::get('web.tr_status.filter.show_events', EVENTS_OPTION_NOEVENT);
// check event acknowledges
if ($config['event_ack_enable'] == EVENT_ACK_DISABLED && $showEvents == EVENTS_OPTION_NOT_ACK) {
$showEvents = EVENTS_OPTION_NOEVENT;
}
// fetch filter from profiles
$filter = array('application' => CProfile::get('web.tr_status.filter.application', ''), 'inventory' => array());
foreach (CProfile::getArray('web.tr_status.filter.inventory.field', array()) as $i => $field) {
$filter['inventory'][] = array('field' => $field, 'value' => CProfile::get('web.tr_status.filter.inventory.value', null, $i));
}
/*
* Page sorting
*/
$sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'lastchange'));
$sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_DOWN));
CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR);
CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR);
/*
* Display
*/
$triggerWidget = new CWidget();
$rightForm = new CForm('get');
$rightForm->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB()));
示例4: DBstart
DBstart();
CProfile::deleteIdx('web.toptriggers.filter.severities');
CProfile::deleteIdx('web.toptriggers.filter.groupids');
CProfile::deleteIdx('web.toptriggers.filter.hostids');
CProfile::delete('web.toptriggers.filter.from');
CProfile::delete('web.toptriggers.filter.till');
DBend();
}
if (!hasRequest('filter_set')) {
for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) {
$defaultSeverities[$severity] = $severity;
}
} else {
$defaultSeverities = [];
}
$data['filter'] = ['severities' => CProfile::getArray('web.toptriggers.filter.severities', $defaultSeverities), 'groupids' => CProfile::getArray('web.toptriggers.filter.groupids'), 'hostids' => CProfile::getArray('web.toptriggers.filter.hostids'), 'filter_from' => CProfile::get('web.toptriggers.filter.from', $today), 'filter_till' => CProfile::get('web.toptriggers.filter.till', $tomorrow)];
// multiselect host groups
$data['multiSelectHostGroupData'] = [];
if ($data['filter']['groupids'] !== null) {
$filterGroups = API::HostGroup()->get(['output' => ['groupid', 'name'], 'groupids' => $data['filter']['groupids']]);
foreach ($filterGroups as $filterGroup) {
$data['multiSelectHostGroupData'][] = ['id' => $filterGroup['groupid'], 'name' => $filterGroup['name']];
}
}
// multiselect hosts
$data['multiSelectHostData'] = [];
if ($data['filter']['hostids']) {
$filterHosts = API::Host()->get(['output' => ['hostid', 'name'], 'hostids' => $data['filter']['hostids']]);
foreach ($filterHosts as $filterHost) {
$data['multiSelectHostData'][] = ['id' => $filterHost['hostid'], 'name' => $filterHost['name']];
}