本文整理汇总了PHP中getPageSortField函数的典型用法代码示例。如果您正苦于以下问题:PHP getPageSortField函数的具体用法?PHP getPageSortField怎么用?PHP getPageSortField使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPageSortField函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
} else {
$data['pageFilter'] = $pageFilter;
$data['showDisabled'] = $showDisabled;
$data['showAllApps'] = $showAllApps;
$data['db_apps'] = array();
$db_app_result = DBselect('SELECT DISTINCT h.name AS hostname,a.*' . ' FROM applications a,hosts h' . ' WHERE a.hostid=h.hostid' . ($data['hostid'] > 0 ? ' AND h.hostid=' . $data['hostid'] : '') . ' AND ' . dbConditionInt('h.hostid', $pageFilter->hostsSelected ? array_keys($pageFilter->hosts) : array()));
while ($db_app = DBfetch($db_app_result)) {
$db_app['scenarios_cnt'] = 0;
$data['db_apps'][$db_app['applicationid']] = $db_app;
}
// get http tests
$data['db_httptests'] = array();
$dbHttpTests_result = DBselect('SELECT wt.*,a.name AS application,h.name AS hostname,h.hostid' . ' FROM httptest wt,applications a,hosts h' . ' WHERE wt.applicationid=a.applicationid' . ' AND a.hostid=h.hostid' . ' AND ' . dbConditionInt('a.applicationid', array_keys($data['db_apps'])) . ($showDisabled == 0 ? ' AND wt.status=' . HTTPTEST_STATUS_ACTIVE : ''));
while ($httptest_data = DBfetch($dbHttpTests_result)) {
$data['db_apps'][$httptest_data['applicationid']]['scenarios_cnt']++;
$httptest_data['step_count'] = null;
$data['db_httptests'][$httptest_data['httptestid']] = $httptest_data;
}
// get http steps
$httpstep_res = DBselect('SELECT hs.httptestid,COUNT(hs.httpstepid) AS cnt' . ' FROM httpstep hs' . ' WHERE ' . dbConditionInt('hs.httptestid', array_keys($data['db_httptests'])) . ' GROUP BY hs.httptestid');
while ($step_count = DBfetch($httpstep_res)) {
$data['db_httptests'][$step_count['httptestid']]['step_count'] = $step_count['cnt'];
}
order_result($data['db_httptests'], getPageSortField('host'), getPageSortOrder());
$data['paging'] = getPagingLine($data['db_httptests']);
// render view
$httpView = new CView('configuration.httpconf.list', $data);
$httpView->render();
$httpView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例2: foreach
if ($data['copy_type'] == 0) {
if (empty($data['copy_groupid'])) {
foreach ($data['groups'] as $group) {
$data['copy_groupid'] = $group['groupid'];
}
}
$data['hosts'] = API::Host()->get(array('output' => API_OUTPUT_EXTEND, 'groupids' => $data['copy_groupid'], 'templated_hosts' => true));
order_result($data['hosts'], 'name');
}
}
// render view
$itemView = new CView('configuration.item.copy', $data);
$itemView->render();
$itemView->show();
} else {
$data = array('form' => get_request('form', null), 'sortfield' => getPageSortField('name'));
if (isset($hostid)) {
$data['form_hostid'] = get_request('form_hostid', $hostid);
$data['hostid'] = $hostid;
}
// items
$options = array('search' => array(), 'output' => API_OUTPUT_EXTEND, 'editable' => true, 'selectHosts' => API_OUTPUT_EXTEND, 'selectTriggers' => API_OUTPUT_REFER, 'selectApplications' => API_OUTPUT_EXTEND, 'selectDiscoveryRule' => API_OUTPUT_EXTEND, 'selectItemDiscovery' => array('ts_delete'), 'sortfield' => $data['sortfield'], 'limit' => $config['search_limit'] + 1);
$preFilter = count($options, COUNT_RECURSIVE);
if (!empty($data['hostid'])) {
$options['hostids'] = $hostid;
}
if (isset($_REQUEST['filter_group']) && !zbx_empty($_REQUEST['filter_group'])) {
$options['group'] = $_REQUEST['filter_group'];
}
if (isset($_REQUEST['filter_hostname']) && !zbx_empty($_REQUEST['filter_hostname'])) {
$options['name'] = $_REQUEST['filter_hostname'];
示例3: validate_sort_and_sortorder
/**
* Get the sort and sort order parameters for the current page and save it into profiles.
*
* @param string $sort
* @param string $sortorder
*
* @retur void
*/
function validate_sort_and_sortorder($sort = null, $sortorder = ZBX_SORT_UP)
{
global $page;
$_REQUEST['sort'] = getPageSortField($sort);
$_REQUEST['sortorder'] = getPageSortOrder($sortorder);
if (!is_null($_REQUEST['sort'])) {
$_REQUEST['sort'] = preg_replace('/[^a-z\\.\\_]/i', '', $_REQUEST['sort']);
CProfile::update('web.' . $page['file'] . '.sort', $_REQUEST['sort'], PROFILE_TYPE_STR);
}
if (!str_in_array($_REQUEST['sortorder'], array(ZBX_SORT_DOWN, ZBX_SORT_UP))) {
$_REQUEST['sortorder'] = ZBX_SORT_UP;
}
CProfile::update('web.' . $page['file'] . '.sortorder', $_REQUEST['sortorder'], PROFILE_TYPE_STR);
}
示例4: DBselect
$db_slides = DBselect('SELECT s.* FROM slides s WHERE s.slideshowid=' . zbx_dbstr($data['slideshowid']) . ' ORDER BY s.step');
while ($slide = DBfetch($db_slides)) {
$data['slides'][$slide['step']] = array('slideid' => $slide['slideid'], 'screenid' => $slide['screenid'], 'delay' => $slide['delay']);
}
}
// get slides without delay
$data['slides_without_delay'] = $data['slides'];
for ($i = 0, $size = count($data['slides_without_delay']); $i < $size; $i++) {
unset($data['slides_without_delay'][$i]['delay']);
}
// render view
$slideshowView = new CView('configuration.slideconf.edit', $data);
$slideshowView->render();
$slideshowView->show();
} else {
$data['slides'] = DBfetchArray(DBselect('SELECT s.slideshowid,s.name,s.delay,COUNT(sl.slideshowid) AS cnt' . ' FROM slideshows s' . ' LEFT JOIN slides sl ON sl.slideshowid=s.slideshowid' . whereDbNode('s.slideshowid') . ' GROUP BY s.slideshowid,s.name,s.delay'));
order_result($data['slides'], getPageSortField('name'), getPageSortOrder());
$data['paging'] = getPagingLine($data['slides'], array('slideshowid'));
// nodes
if ($data['displayNodes'] = is_array(get_current_nodeid())) {
foreach ($data['slides'] as &$slide) {
$slide['nodename'] = get_node_name_by_elid($slide['slideshowid'], true);
}
unset($slide);
}
// render view
$slideshowView = new CView('configuration.slideconf.list', $data);
$slideshowView->render();
$slideshowView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例5: foreach
foreach ($data['drule']['dchecks'] as $id => $dcheck) {
$data['drule']['dchecks'][$id]['name'] = discovery_check2str($dcheck['type'], isset($dcheck['key_']) ? $dcheck['key_'] : '', isset($dcheck['ports']) ? $dcheck['ports'] : '');
}
order_result($data['drule']['dchecks'], 'name');
}
// get proxies
$data['proxies'] = API::Proxy()->get(array('output' => API_OUTPUT_EXTEND));
order_result($data['proxies'], 'host');
// render view
$discoveryView = new CView('configuration.discovery.edit', $data);
$discoveryView->render();
$discoveryView->show();
} else {
$data = array();
// get drules
$data['drules'] = API::DRule()->get(array('output' => API_OUTPUT_EXTEND, 'sortfield' => getPageSortField('name'), 'selectDChecks' => API_OUTPUT_EXTEND, 'editable' => true));
if (!empty($data['drules'])) {
foreach ($data['drules'] as $druleid => $drule) {
// checks
$checks = array();
foreach ($drule['dchecks'] as $check) {
$checks[$check['type']] = discovery_check_type2str($check['type']);
}
order_result($checks);
$data['drules'][$druleid]['checks'] = $checks;
// description
$data['drules'][$druleid]['description'] = array();
if (!empty($drule['proxy_hostid'])) {
$proxy = get_host_by_hostid($drule['proxy_hostid']);
array_push($data['drules'][$druleid]['description'], $proxy['host'] . NAME_DELIMITER);
}
示例6: show_messages
show_messages($goResult, _('Discovery rules deleted'), _('Cannot delete discovery rules'));
clearCookies($goResult, $_REQUEST['hostid']);
}
/*
* Display
*/
if (isset($_REQUEST['form'])) {
$data = getItemFormData(array('is_discovery_rule' => true));
$data['page_header'] = _('CONFIGURATION OF DISCOVERY RULES');
// render view
$itemView = new CView('configuration.item.edit', $data);
$itemView->render();
$itemView->show();
} else {
$data = array('hostid' => get_request('hostid', 0), 'host' => $host, 'showErrorColumn' => $host['status'] != HOST_STATUS_TEMPLATE);
$sortfield = getPageSortField('name');
// discoveries
$data['discoveries'] = API::DiscoveryRule()->get(array('hostids' => $data['hostid'], 'output' => API_OUTPUT_EXTEND, 'editable' => true, 'selectItems' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT, 'selectTriggers' => API_OUTPUT_COUNT, 'selectHostPrototypes' => API_OUTPUT_COUNT, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1));
$data['discoveries'] = CMacrosResolverHelper::resolveItemNames($data['discoveries']);
if ($sortfield === 'status') {
orderItemsByStatus($data['discoveries'], getPageSortOrder());
} else {
order_result($data['discoveries'], $sortfield, getPageSortOrder());
}
// paging
$data['paging'] = getPagingLine($data['discoveries'], array('itemid'), array('hostid' => get_request('hostid')));
// render view
$discoveryView = new CView('configuration.host.discovery.list', $data);
$discoveryView->render();
$discoveryView->show();
}
示例7: get_history_of_actions
function get_history_of_actions($limit, &$last_clock = null, $sql_cond = '')
{
validate_sort_and_sortorder('clock', ZBX_SORT_DOWN);
$available_triggers = get_accessible_triggers(PERM_READ_ONLY, array());
$alerts = array();
$clock = array();
$table = new CTableInfo(S_NO_ACTIONS_FOUND);
$table->setHeader(array(is_show_all_nodes() ? make_sorting_header(S_NODES, 'a.alertid') : null, make_sorting_header(S_TIME, 'clock'), make_sorting_header(S_TYPE, 'description'), make_sorting_header(S_STATUS, 'status'), make_sorting_header(S_RETRIES_LEFT, 'retries'), make_sorting_header(S_RECIPIENTS, 'sendto'), S_MESSAGE, S_ERROR));
$sql = 'SELECT a.alertid,a.clock,mt.description,a.sendto,a.subject,a.message,a.status,a.retries,a.error ' . ' FROM events e, alerts a ' . ' LEFT JOIN media_type mt ON mt.mediatypeid=a.mediatypeid ' . ' WHERE e.eventid = a.eventid ' . ' AND alerttype IN (' . ALERT_TYPE_MESSAGE . ') ' . $sql_cond . ' AND ' . DBcondition('e.objectid', $available_triggers) . ' AND ' . DBin_node('a.alertid') . ' ORDER BY a.clock DESC';
$result = DBselect($sql, $limit);
while ($row = DBfetch($result)) {
$alerts[] = $row;
$clock[] = $row['clock'];
}
$last_clock = !empty($clock) ? min($clock) : null;
$sortfield = getPageSortField('clock');
$sortorder = getPageSortOrder();
order_result($alerts, $sortfield, $sortorder);
foreach ($alerts as $num => $row) {
$time = zbx_date2str(S_HISTORY_OF_ACTIONS_DATE_FORMAT, $row['clock']);
if ($row['status'] == ALERT_STATUS_SENT) {
$status = new CSpan(S_SENT, 'green');
$retries = new CSpan(SPACE, 'green');
} else {
if ($row['status'] == ALERT_STATUS_NOT_SENT) {
$status = new CSpan(S_IN_PROGRESS, 'orange');
$retries = new CSpan(ALERT_MAX_RETRIES - $row['retries'], 'orange');
} else {
$status = new CSpan(S_NOT_SENT, 'red');
$retries = new CSpan(0, 'red');
}
}
$sendto = $row['sendto'];
$message = array(bold(S_SUBJECT . ': '), br(), $row['subject'], br(), br(), bold(S_MESSAGE . ': '), br(), $row['message']);
if (empty($row['error'])) {
$error = new CSpan(SPACE, 'off');
} else {
$error = new CSpan($row['error'], 'on');
}
$table->addRow(array(get_node_name_by_elid($row['alertid']), new CCol($time, 'top'), new CCol($row['description'], 'top'), new CCol($status, 'top'), new CCol($retries, 'top'), new CCol($sendto, 'top'), new CCol($message, 'top'), new CCol($error, 'wraptext top')));
}
return $table;
}
示例8: array
$cmbDRules->addItem(0, S_ALL_SMALL);
$options = array('filter' => array('status' => DRULE_STATUS_ACTIVE), 'output' => API_OUTPUT_EXTEND);
$drules = CDRule::get($options);
order_result($drules, 'name');
foreach ($drules as $dnum => $drule) {
$cmbDRules->addItem($drule['druleid'], get_node_name_by_elid($drule['druleid'], null, ': ') . $drule['name']);
}
$r_form->addVar('fullscreen', $fullscreen);
$r_form->addItem(array(S_DISCOVERY_RULE . SPACE, $cmbDRules));
// $dscvry_wdgt->addHeader(array(S_FOUND.': ',$numrows), $r_form);
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');
$dscvry_wdgt->addHeader(S_DISCOVERY_RULES_BIG, $r_form);
// $dscvry_wdgt->addHeader($numrows);
//-------------
$sortfield = getPageSortField('ip');
$sortorder = getPageSortOrder();
$options = array('selectHosts' => array('hostid', 'host', 'status'), 'output' => API_OUTPUT_EXTEND, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limitSelects' => 1);
if ($druleid > 0) {
$options['druleids'] = $druleid;
} else {
$options['druleids'] = zbx_objectValues($drules, 'druleid');
}
$dservices = CDService::get($options);
$gMacros = CUserMacro::get(array('output' => API_OUTPUT_EXTEND, 'globalmacro' => 1));
$gMacros = zbx_toHash($gMacros, 'macro');
$services = array();
foreach ($dservices as $dsnum => $dservice) {
$key_ = $dservice['key_'];
if (!zbx_empty($key_)) {
if (isset($gMacros[$key_])) {
示例9: foreach
if (empty($data['copy_groupid'])) {
foreach ($data['groups'] as $group) {
$data['copy_groupid'] = $group['groupid'];
}
}
$data['hosts'] = API::Host()->get(array('output' => API_OUTPUT_EXTEND, 'groupids' => $data['copy_groupid'], 'templated_hosts' => true));
order_result($data['hosts'], 'name');
}
}
// render view
$itemView = new CView('configuration.item.copy', $data);
$itemView->render();
$itemView->show();
} else {
$_REQUEST['hostid'] = empty($_REQUEST['filter_hostid']) ? null : $_REQUEST['filter_hostid'];
$data = array('form' => get_request('form'), 'hostid' => get_request('hostid'), 'sortfield' => getPageSortField('name'), 'displayNodes' => is_array(get_current_nodeid()) && empty($_REQUEST['filter_groupid']) && empty($_REQUEST['filter_hostid']));
// items
$options = array('hostids' => $data['hostid'], 'search' => array(), 'output' => API_OUTPUT_EXTEND, 'editable' => true, 'selectHosts' => API_OUTPUT_EXTEND, 'selectTriggers' => API_OUTPUT_REFER, 'selectApplications' => API_OUTPUT_EXTEND, 'selectDiscoveryRule' => API_OUTPUT_EXTEND, 'selectItemDiscovery' => array('ts_delete'), 'sortfield' => $data['sortfield'], 'limit' => $config['search_limit'] + 1);
$preFilter = count($options, COUNT_RECURSIVE);
if (isset($_REQUEST['filter_groupid']) && !empty($_REQUEST['filter_groupid'])) {
$options['groupids'] = $_REQUEST['filter_groupid'];
}
if (isset($_REQUEST['filter_hostid']) && !empty($_REQUEST['filter_hostid'])) {
$data['filter_hostid'] = $_REQUEST['filter_hostid'];
}
if (isset($_REQUEST['filter_application']) && !zbx_empty($_REQUEST['filter_application'])) {
$options['application'] = $_REQUEST['filter_application'];
}
if (isset($_REQUEST['filter_name']) && !zbx_empty($_REQUEST['filter_name'])) {
$options['search']['name'] = $_REQUEST['filter_name'];
}
示例10: array
// get media types
$options = array('output' => API_OUTPUT_EXTEND, 'preservekeys' => 1, 'editable' => true, 'limit' => $config['search_limit'] + 1);
$data['mediatypes'] = API::Mediatype()->get($options);
// get media types used in actions
$options = array('mediatypeids' => zbx_objectValues($data['mediatypes'], 'mediatypeid'), 'output' => array('actionid', 'name'), 'preservekeys' => 1);
$actions = API::Action()->get($options);
foreach ($data['mediatypes'] as $number => $mediatype) {
$data['mediatypes'][$number]['listOfActions'] = array();
foreach ($actions as $actionid => $action) {
if (!empty($action['mediatypeids'])) {
foreach ($action['mediatypeids'] as $actionMediaTypeId) {
if ($mediatype['mediatypeid'] == $actionMediaTypeId) {
$data['mediatypes'][$number]['listOfActions'][$actionid] = array('actionid' => $actionid, 'name' => $action['name']);
}
}
}
}
$data['mediatypes'][$number]['usedInActions'] = !isset($mediatype['listOfActions']);
// allow sort by mediatype name
$data['mediatypes'][$number]['typeid'] = $data['mediatypes'][$number]['type'];
$data['mediatypes'][$number]['type'] = media_type2str($data['mediatypes'][$number]['type']);
}
// sort data
order_result($data['mediatypes'], getPageSortField('description'), getPageSortOrder());
$data['paging'] = getPagingLine($data['mediatypes']);
// render view
$mediaTypeView = new CView('administration.mediatypes.list', $data);
$mediaTypeView->render();
$mediaTypeView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例11: array
*/
$data = array('fullscreen' => $_REQUEST['fullscreen'], 'druleid' => get_request('druleid', 0), 'sort' => get_request('sort'), 'sortorder' => get_request('sortorder'), 'services' => array(), 'drules' => array());
$data['pageFilter'] = new CPageFilter(array('drules' => array('filter' => array('status' => DRULE_STATUS_ACTIVE)), 'druleid' => get_request('druleid', null)));
if ($data['pageFilter']->drulesSelected) {
// discovery rules
$options = array('filter' => array('status' => DRULE_STATUS_ACTIVE), 'selectDHosts' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND);
if ($data['pageFilter']->druleid > 0) {
$options['druleids'] = $data['pageFilter']->druleid;
// set selected discovery rule id
}
$data['drules'] = API::DRule()->get($options);
if (!empty($data['drules'])) {
order_result($data['drules'], 'name');
}
// discovery services
$options = array('selectHosts' => array('hostid', 'name', 'status'), 'output' => API_OUTPUT_EXTEND, 'sortfield' => getPageSortField('ip'), 'sortorder' => getPageSortOrder(), 'limitSelects' => 1);
if (!empty($data['druleid'])) {
$options['druleids'] = $data['druleid'];
} else {
$options['druleids'] = zbx_objectValues($data['drules'], 'druleid');
}
$dservices = API::DService()->get($options);
// user macros
$data['macros'] = API::UserMacro()->get(array('output' => API_OUTPUT_EXTEND, 'globalmacro' => true));
$data['macros'] = zbx_toHash($data['macros'], 'macro');
// services
$data['services'] = array();
foreach ($dservices as $dservice) {
$key_ = $dservice['key_'];
if (!zbx_empty($key_)) {
if (isset($data['macros'][$key_])) {
示例12: CDiv
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');
$user_wdgt->addHeader(S_USERS_BIG, $form);
$user_wdgt->addHeader($numrows);
$form = new CForm(null, 'post');
$form->setName('users');
$table = new CTableInfo(S_NO_USERS_DEFINED);
$table->setHeader(array(new CCheckBox('all_users', NULL, "checkAll('" . $form->getName() . "','all_users','group_userid');"), make_sorting_header(S_ALIAS, 'alias'), make_sorting_header(S_NAME, 'name'), make_sorting_header(S_SURNAME, 'surname'), make_sorting_header(S_USER_TYPE, 'type'), S_GROUPS, S_IS_ONLINE_Q, S_LOGIN, S_GUI_ACCESS, S_API_ACCESS, S_DEBUG_MODE, S_STATUS));
// User table
$options = array('output' => API_OUTPUT_EXTEND, 'select_usrgrps' => API_OUTPUT_EXTEND, 'get_access' => 1, 'limit' => $config['search_limit'] + 1);
if ($_REQUEST['filter_usrgrpid'] > 0) {
$options['usrgrpids'] = $_REQUEST['filter_usrgrpid'];
}
$users = CUser::get($options);
// sorting
order_result($users, getPageSortField('alias'), getPageSortOrder());
$paging = getPagingLine($users);
//---------
// set default lastaccess time to 0.
foreach ($users as $unum => $user) {
$usessions[$user['userid']] = array('lastaccess' => 0);
}
$userids = zbx_objectValues($users, 'userid');
$sql = 'SELECT s.userid, MAX(s.lastaccess) as lastaccess, s.status ' . ' FROM sessions s' . ' WHERE ' . DBcondition('s.userid', $userids) . ' GROUP BY s.userid, s.status';
$db_sessions = DBselect($sql);
while ($session = DBfetch($db_sessions)) {
if ($usessions[$session['userid']]['lastaccess'] < $session['lastaccess']) {
$usessions[$session['userid']] = $session;
}
}
foreach ($users as $unum => $user) {
示例13: get_request
$data['userid'] = $userId;
$data['form'] = get_request('form');
$data['form_refresh'] = get_request('form_refresh', 0);
// render view
$usersView = new CView('administration.users.edit', $data);
$usersView->render();
$usersView->show();
} else {
$data = array('displayNodes' => is_array(get_current_nodeid()));
// get user groups
$data['userGroups'] = API::UserGroup()->get(array('output' => API_OUTPUT_EXTEND));
order_result($data['userGroups'], 'name');
// get users
$data['users'] = API::User()->get(array('usrgrpids' => $_REQUEST['filter_usrgrpid'] > 0 ? $_REQUEST['filter_usrgrpid'] : null, 'output' => API_OUTPUT_EXTEND, 'selectUsrgrps' => API_OUTPUT_EXTEND, 'getAccess' => 1, 'limit' => $config['search_limit'] + 1));
// sorting & apging
order_result($data['users'], getPageSortField('alias'), getPageSortOrder());
$data['paging'] = getPagingLine($data['users'], array('userid'));
foreach ($data['users'] as $key => $user) {
// nodes
$data['users'][$key]['nodename'] = $data['displayNodes'] ? get_node_name_by_elid($user['userid'], true) : '';
// set default lastaccess time to 0
$data['usersSessions'][$user['userid']] = array('lastaccess' => 0);
}
$dbSessions = DBselect('SELECT s.userid,MAX(s.lastaccess) AS lastaccess,s.status' . ' FROM sessions s' . ' WHERE ' . dbConditionInt('s.userid', zbx_objectValues($data['users'], 'userid')) . ' GROUP BY s.userid,s.status');
while ($session = DBfetch($dbSessions)) {
if ($data['usersSessions'][$session['userid']]['lastaccess'] < $session['lastaccess']) {
$data['usersSessions'][$session['userid']] = $session;
}
}
// render view
$usersView = new CView('administration.users.list', $data);
示例14: is_array
$_REQUEST['hostid'] = $pageFilter->hostid;
$displayNodes = is_array(get_current_nodeid()) && $pageFilter->groupid == 0 && $pageFilter->hostid == 0;
$r_form = new CForm('get');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$r_form->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
$r_form->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true)));
$httpmon_wdgt = new CWidget();
$httpmon_wdgt->addPageHeader(_('STATUS OF WEB MONITORING'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
$httpmon_wdgt->addHeader(_('Web scenarios'), $r_form);
$httpmon_wdgt->addHeaderRowNumber();
// TABLE
$table = new CTableInfo(_('No web scenarios found.'));
$table->SetHeader(array($displayNodes ? _('Node') : null, $_REQUEST['hostid'] == 0 ? make_sorting_header(_('Host'), 'hostname') : null, make_sorting_header(_('Name'), 'name'), _('Number of steps'), _('Last check'), _('Status')));
$paging = null;
if ($pageFilter->hostsSelected) {
$sortfield = getPageSortField('hostname');
$sortorder = getPageSortOrder();
$options = array('output' => array('httptestid', 'name', 'hostid'), 'selectHosts' => array('name', 'status'), 'selectSteps' => API_OUTPUT_COUNT, 'templated' => false, 'preservekeys' => true, 'filter' => array('status' => HTTPTEST_STATUS_ACTIVE), 'limit' => $config['search_limit'] + 1);
if ($pageFilter->hostid > 0) {
$options['hostids'] = $pageFilter->hostid;
} elseif ($pageFilter->groupid > 0) {
$options['groupids'] = $pageFilter->groupid;
}
$httpTests = API::HttpTest()->get($options);
foreach ($httpTests as &$httpTest) {
$httpTest['host'] = reset($httpTest['hosts']);
$httpTest['hostname'] = $httpTest['host']['name'];
unset($httpTest['hosts']);
}
unset($httpTest);
order_result($httpTests, $sortfield, $sortorder);
示例15: CTableInfo
$hostinvent_wdgt->addItem(BR());
$table = new CTableInfo(_('No hosts defined.'));
$table->setHeader(array(make_sorting_header($groupFieldTitle === '' ? _('Field') : $groupFieldTitle, 'inventory_field'), make_sorting_header(_('Host count'), 'host_count')));
// to show a report, we will need a host group and a field to aggregate
if ($pageFilter->groupsSelected && $groupFieldTitle !== '') {
$options = array('output' => array('hostid', 'name'), 'selectInventory' => array($_REQUEST['groupby']), 'withInventory' => true);
if ($pageFilter->groupid > 0) {
$options['groupids'] = $pageFilter->groupid;
}
$hosts = API::Host()->get($options);
// aggregating data by chosen field value
$report = array();
foreach ($hosts as $host) {
if ($host['inventory'][$_REQUEST['groupby']] !== '') {
$lowerValue = zbx_strtolower($host['inventory'][$_REQUEST['groupby']]);
if (!isset($report[$lowerValue])) {
$report[$lowerValue] = array('inventory_field' => $host['inventory'][$_REQUEST['groupby']], 'host_count' => 1);
} else {
$report[$lowerValue]['host_count'] += 1;
}
}
}
order_result($report, getPageSortField('host_count'), getPageSortOrder());
foreach ($report as $rep) {
$row = array(new CSpan($rep['inventory_field'], 'pre'), new CLink($rep['host_count'], 'hostinventories.php?filter_field=' . $_REQUEST['groupby'] . '&filter_field_value=' . urlencode($rep['inventory_field']) . '&filter_set=1&filter_exact=1' . url_param('groupid')));
$table->addRow($row);
}
}
$hostinvent_wdgt->addItem($table);
$hostinvent_wdgt->show();
require_once dirname(__FILE__) . '/include/page_footer.php';