本文整理汇总了PHP中getPageSortOrder函数的典型用法代码示例。如果您正苦于以下问题:PHP getPageSortOrder函数的具体用法?PHP getPageSortOrder怎么用?PHP getPageSortOrder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPageSortOrder函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: foreach
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);
}
}
order_result($data['drules'], getPageSortOrder());
}
// get paging
$data['paging'] = getPagingLine($data['drules'], array('druleid'));
// nodes
if ($data['displayNodes'] = is_array(get_current_nodeid())) {
foreach ($data['drules'] as &$drule) {
$drule['nodename'] = get_node_name_by_elid($drule['druleid'], true);
}
unset($drule);
}
// render view
$discoveryView = new CView('configuration.discovery.list', $data);
$discoveryView->render();
$discoveryView->show();
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:discoveryconf.php
示例2: unset
$item['applications_list'] = '';
}
}
unset($item);
}
$data['flicker'] = getItemFilterForm($data['items']);
// remove subfiltered items
if (!empty($data['items'])) {
foreach ($data['items'] as $number => $item) {
foreach ($item['subfilters'] as $subfilter => $value) {
if (!$value) {
unset($data['items'][$number]);
break;
}
}
}
}
order_result($data['items'], $data['sortfield'], getPageSortOrder());
$data['paging'] = getPagingLine($data['items']);
$itemTriggerIds = array();
foreach ($data['items'] as $item) {
$itemTriggerIds = array_merge($itemTriggerIds, zbx_objectValues($item['triggers'], 'triggerid'));
}
$data['itemTriggers'] = API::Trigger()->get(array('triggerids' => $itemTriggerIds, 'output' => API_OUTPUT_EXTEND, 'selectHosts' => array('hostid', 'name', 'host'), 'selectFunctions' => API_OUTPUT_EXTEND, 'selectItems' => API_OUTPUT_EXTEND, 'preservekeys' => true));
$data['triggerRealHosts'] = getParentHostsByTriggers($data['itemTriggers']);
// render view
$itemView = new CView('configuration.item.list', $data);
$itemView->render();
$itemView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:items.php
示例3: getPagingLine
/**
* Returns paging line.
*
* @param array $items list of items
* @param array $removeUrlParams params to remove from URL
* @param array $urlParams params to add in URL
*
* @return CTable
*/
function getPagingLine(&$items, array $removeUrlParams = array(), array $urlParams = array())
{
global $page;
$config = select_config();
$searchLimit = '';
if ($config['search_limit'] < count($items)) {
if (getPageSortOrder() == ZBX_SORT_UP) {
array_pop($items);
} else {
array_shift($items);
}
$searchLimit = '+';
}
$rowsPerPage = CWebUser::$data['rows_per_page'];
$itemsCount = count($items);
$pagesCount = $itemsCount > 0 ? ceil($itemsCount / $rowsPerPage) : 1;
$currentPage = getPageNumber();
if ($currentPage < 1) {
$currentPage = 1;
}
if ($currentPage > $pagesCount) {
$currentPage = $pagesCount;
}
$start = ($currentPage - 1) * $rowsPerPage;
CProfile::update('web.paging.lastpage', $page['file'], PROFILE_TYPE_STR);
CProfile::update('web.paging.page', $currentPage, PROFILE_TYPE_INT);
// trim array with items to contain items for current page
$items = array_slice($items, $start, $rowsPerPage, true);
// viewed pages (better to use not odd)
$pagingNavRange = 11;
$endPage = $currentPage + floor($pagingNavRange / 2);
if ($endPage < $pagingNavRange) {
$endPage = $pagingNavRange;
}
if ($endPage > $pagesCount) {
$endPage = $pagesCount;
}
$startPage = $endPage > $pagingNavRange ? $endPage - $pagingNavRange + 1 : 1;
$pageLine = array();
$table = null;
if ($pagesCount > 1) {
$url = new Curl();
if (is_array($urlParams) && $urlParams) {
foreach ($urlParams as $key => $value) {
$url->setArgument($key, $value);
}
}
$removeUrlParams = array_merge($removeUrlParams, array('go', 'form', 'delete', 'cancel'));
foreach ($removeUrlParams as $param) {
$url->removeArgument($param);
}
if ($startPage > 1) {
$url->setArgument('page', 1);
$pageLine[] = new CLink('<< ' . _x('First', 'page navigation'), $url->getUrl(), null, null, true);
$pageLine[] = ' ';
}
if ($currentPage > 1) {
$url->setArgument('page', $currentPage - 1);
$pageLine[] = new CLink('< ' . _x('Previous', 'page navigation'), $url->getUrl(), null, null, true);
$pageLine[] = ' | ';
}
for ($p = $startPage; $p <= $pagesCount; $p++) {
if ($p > $endPage) {
break;
}
if ($p == $currentPage) {
$pagespan = new CSpan($p, 'bold textcolorstyles');
} else {
$url->setArgument('page', $p);
$pagespan = new CLink($p, $url->getUrl(), null, null, true);
}
$pageLine[] = $pagespan;
$pageLine[] = ' | ';
}
array_pop($pageLine);
if ($currentPage < $pagesCount) {
$pageLine[] = ' | ';
$url->setArgument('page', $currentPage + 1);
$pageLine[] = new CLink(_x('Next', 'page navigation') . ' >', $url->getUrl(), null, null, true);
}
if ($p < $pagesCount) {
$pageLine[] = ' ';
$url->setArgument('page', $pagesCount);
$pageLine[] = new CLink(_x('Last', 'page navigation') . ' >>', $url->getUrl(), null, null, true);
}
$table = new CTable(null, 'paging');
$table->addRow(new CCol($pageLine));
}
$viewFromPage = ($currentPage - 1) * $rowsPerPage + 1;
$viewTillPage = $currentPage * $rowsPerPage;
if ($viewTillPage > $itemsCount) {
//.........这里部分代码省略.........
开发者ID:davidmr001,项目名称:zatree-2.2,代码行数:101,代码来源:func.inc.php
示例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';
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:slideconf.php
示例5: 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';
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:hostinventoriesoverview.php
示例6: clearCookies
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();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:host_discovery.php
示例7: 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) {
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:users.php
示例8: get_request
$data['vsize'] = get_request('vsize', 1);
}
// render view
$screenView = new CView('configuration.screen.edit', $data);
$screenView->render();
$screenView->show();
} else {
$data = array('templateid' => get_request('templateid', null));
$sortfield = getPageSortField('name');
$options = array('editable' => true, 'output' => API_OUTPUT_EXTEND, 'templateids' => $data['templateid'], 'sortfield' => $sortfield, 'limit' => $config['search_limit']);
if (!empty($data['templateid'])) {
$data['screens'] = API::TemplateScreen()->get($options);
} else {
$data['screens'] = API::Screen()->get($options);
}
order_result($data['screens'], $sortfield, getPageSortOrder());
// paging
$data['paging'] = getPagingLine($data['screens'], array('screenid'), array('templateid' => get_request('templateid')));
// nodes
if ($data['displayNodes'] = is_array(get_current_nodeid())) {
foreach ($data['screens'] as &$screen) {
$screen['nodename'] = get_node_name_by_elid($screen['screenid'], true);
}
unset($screen);
}
// render view
$screenView = new CView('configuration.screen.list', $data);
$screenView->render();
$screenView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:itnihao,项目名称:Zabbix_,代码行数:31,代码来源:screenconf.php
示例9: foreach
foreach ($data['drules'] as $key => $drule) {
// checks
$checks = array();
foreach ($drule['dchecks'] as $check) {
$checks[$check['type']] = discovery_check_type2str($check['type']);
}
order_result($checks);
$data['drules'][$key]['checks'] = $checks;
// description
$data['drules'][$key]['description'] = array();
if ($drule['proxy_hostid']) {
$proxy = get_host_by_hostid($drule['proxy_hostid']);
array_push($data['drules'][$key]['description'], $proxy['host'] . NAME_DELIMITER);
}
}
order_result($data['drules'], $sortfield, getPageSortOrder());
}
// get paging
$data['paging'] = getPagingLine($data['drules'], array('druleid'));
// nodes
if ($data['displayNodes'] = is_array(get_current_nodeid())) {
foreach ($data['drules'] as &$drule) {
$drule['nodename'] = get_node_name_by_elid($drule['druleid'], true);
}
unset($drule);
}
// render view
$discoveryView = new CView('configuration.discovery.list', $data);
$discoveryView->render();
$discoveryView->show();
}
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:discoveryconf.php
示例10: DBfetchArray
}
// fetch available hosts, skip host prototypes
$data['dbHosts'] = DBfetchArray(DBselect('SELECT h.hostid,h.proxy_hostid,h.name,h.flags' . ' FROM hosts h' . ' WHERE h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . andDbNode('h.hostid') . ' AND h.flags<>' . ZBX_FLAG_DISCOVERY_PROTOTYPE));
order_result($data['dbHosts'], 'name');
// render view
$proxyView = new CView('administration.proxy.edit', $data);
$proxyView->render();
$proxyView->show();
} else {
$data = array('displayNodes' => is_array(get_current_nodeid()), 'config' => select_config());
$sortfield = getPageSortField('host');
$data['proxies'] = API::Proxy()->get(array('editable' => true, 'selectHosts' => array('hostid', 'host', 'name', 'status'), 'output' => API_OUTPUT_EXTEND, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1));
$data['proxies'] = zbx_toHash($data['proxies'], 'proxyid');
$proxyIds = array_keys($data['proxies']);
// sorting & paging
order_result($data['proxies'], $sortfield, getPageSortOrder());
$data['paging'] = getPagingLine($data['proxies'], array('proxyid'));
// nodes
foreach ($data['proxies'] as &$proxy) {
$proxy['nodename'] = $data['displayNodes'] ? get_node_name_by_elid($proxy['proxyid'], true) : '';
}
unset($proxy);
// calculate performance
$dbPerformance = DBselect('SELECT h.proxy_hostid,SUM(1.0/i.delay) AS qps' . ' FROM items i,hosts h' . ' WHERE i.status=' . ITEM_STATUS_ACTIVE . ' AND i.hostid=h.hostid' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.delay<>0' . ' AND ' . dbConditionInt('h.proxy_hostid', $proxyIds) . ' GROUP BY h.proxy_hostid');
while ($performance = DBfetch($dbPerformance)) {
if (isset($data['proxies'][$performance['proxy_hostid']])) {
$data['proxies'][$performance['proxy_hostid']]['perf'] = round($performance['qps'], 2);
}
}
// get items
$items = API::Item()->get(array('proxyids' => $proxyIds, 'groupCount' => true, 'countOutput' => true, 'webitems' => true, 'monitored' => true));
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:proxies.php
示例11: 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);
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:users.php
示例12: 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;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:43,代码来源:actions.inc.php
示例13: array
}
}
}
// order linked templates
CArrayHelper::sort($data['host_prototype']['templates'], array('name'));
// render view
$itemView = new CView('configuration.host.prototype.edit', $data);
$itemView->render();
$itemView->show();
} else {
$data = array('form' => get_request('form', null), 'parent_discoveryid' => get_request('parent_discoveryid', null), 'discovery_rule' => $discoveryRule);
// get items
$sortfield = getPageSortField('name');
$data['hostPrototypes'] = API::HostPrototype()->get(array('discoveryids' => $data['parent_discoveryid'], 'output' => API_OUTPUT_EXTEND, 'selectTemplates' => array('templateid', 'name'), 'editable' => true, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1));
if ($data['hostPrototypes']) {
order_result($data['hostPrototypes'], $sortfield, getPageSortOrder());
}
$data['paging'] = getPagingLine($data['hostPrototypes'], array('hostid'), array('parent_discoveryid' => get_request('parent_discoveryid')));
// fetch templates linked to the prototypes
$templateIds = array();
foreach ($data['hostPrototypes'] as $hostPrototype) {
$templateIds = array_merge($templateIds, zbx_objectValues($hostPrototype['templates'], 'templateid'));
}
$templateIds = array_unique($templateIds);
$linkedTemplates = API::Template()->get(array('templateids' => $templateIds, 'selectParentTemplates' => array('hostid', 'name')));
$data['linkedTemplates'] = zbx_toHash($linkedTemplates, 'templateid');
// fetch source templates and LLD rules
$hostPrototypeSourceIds = getHostPrototypeSourceParentIds(zbx_objectValues($data['hostPrototypes'], 'hostid'));
if ($hostPrototypeSourceIds) {
$hostPrototypeSourceTemplates = DBfetchArrayAssoc(DBSelect('SELECT h.hostid,h2.name,h2.hostid AS parent_hostid' . ' FROM hosts h,host_discovery hd,items i,hosts h2' . ' WHERE h.hostid=hd.hostid' . ' AND hd.parent_itemid=i.itemid' . ' AND i.hostid=h2.hostid' . ' AND ' . dbConditionInt('h.hostid', $hostPrototypeSourceIds)), 'hostid');
foreach ($data['hostPrototypes'] as &$hostPrototype) {
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:host_prototypes.php
示例14: array
}
// new operation
if (!empty($data['new_operation'])) {
if (!is_array($data['new_operation'])) {
$data['new_operation'] = array('action' => 'create', 'operationtype' => 0, 'esc_period' => 0, 'esc_step_from' => 1, 'esc_step_to' => 1, 'evaltype' => 0);
}
}
// render view
$actionView = new CView('configuration.action.edit', $data);
$actionView->render();
$actionView->show();
} else {
$data = array('eventsource' => getRequest('eventsource', CProfile::get('web.actionconf.eventsource', EVENT_SOURCE_TRIGGERS)), 'displayNodes' => is_array(get_current_nodeid()));
$sortfield = getPageSortField('name');
$data['actions'] = API::Action()->get(array('output' => API_OUTPUT_EXTEND, 'filter' => array('eventsource' => array($data['eventsource'])), 'selectConditions' => API_OUTPUT_EXTEND, 'selectOperations' => API_OUTPUT_EXTEND, 'editable' => true, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1));
// sorting && paging
order_result($data['actions'], $sortfield, getPageSortOrder());
$data['paging'] = getPagingLine($data['actions'], array('actionid'));
// nodes
if ($data['displayNodes']) {
foreach ($data['actions'] as &$action) {
$action['nodename'] = get_node_name_by_elid($action['actionid'], true);
}
unset($action);
}
// render view
$actionView = new CView('configuration.action.list', $data);
$actionView->render();
$actionView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:hujingguang,项目名称:work,代码行数:31,代码来源:actionconf.php
示例15: array
$options = array('editable' => true, 'output' => array('triggerid'), 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1);
if (empty($data['showdisabled'])) {
$options['filter']['status'] = TRIGGER_STATUS_ENABLED;
}
if ($data['pageFilter']->hostid > 0) {
$options['hostids'] = $data['pageFilter']->hostid;
} elseif ($data['pageFilter']->groupid > 0) {
$options['groupids'] = $data['pageFilter']->groupid;
}
$data['triggers'] = API::Trigger()->get($options);
}
$_REQUEST['hostid'] = get_request('hostid', $data['pageFilter']->hostid);
// paging
$data['paging'] = getPagingLine($data['triggers'], array('triggerid'), array('hostid' => $_REQUEST['hostid']));
$data['triggers'] = API::Trigger()->get(array('triggerids' => zbx_objectValues($data['triggers'], 'triggerid'), 'output' => API_OUTPUT_EXTEND, 'selectHosts' => API_OUTPUT_EXTEND, 'selectItems' => array('itemid', 'hostid', 'key_', 'type', 'flags', 'status'), 'selectFunctions' => API_OUTPUT_EXTEND, 'selectDependencies' => API_OUTPUT_EXTEND, 'selectDiscoveryRule' => API_OUTPUT_EXTEND));
order_result($data['triggers'], $sortfield, getPageSortOrder());
// get real hosts
$data['realHosts'] = getParentHostsByTriggers($data['triggers']);
// determine, show or not column of errors
$data['showErrorColumn'] = true;
if ($data['hostid'] > 0) {
$host = API::Host()->get(array('hostids' => $_REQUEST['hostid'], 'output' => array('status'), 'templated_hosts' => true, 'editable' => true));
$host = reset($host);
$data['showErrorColumn'] = !$host || $host['status'] != HOST_STATUS_TEMPLATE;
}
// nodes
if ($data['displayNodes']) {
foreach ($data['triggers'] as &$trigger) {
$trigger['nodename'] = get_node_name_by_elid($trigger['triggerid'], true);
}
unset($trigger);
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:triggers.php
示例16: 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);
}
开发者ID:itnihao,项目名称:Zabbix_,代码行数:22,代码来源:func.inc.php
示例17: 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';
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:media_types.php
示例18: 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';
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:httpconf.php
示例19: 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_])) {
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:discovery.php
示例20: CTableInfo
$m_form->setName('tr_status');
$m_form->addVar('backurl', $page['file']);
$admin_links = $USER_DETAILS['type'] == USER_TYPE_ZABBIX_ADMIN || $USER_DETAILS['type'] == USER_TYPE_SUPER_ADMIN;
$show_event_col = $config['event_ack_enable'] && $_REQUEST['show_events'] != EVENTS_OPTION_NOEVENT;
$table = new CTableInfo();
$switcherName = 'trigger_switchers';
$header_cb = $show_event_col ? new CCheckBox('all_events', false, "checkAll('" . $m_form->GetName() . "','all_events','events');") : new CCheckBox('all_triggers', false, "checkAll('" . $m_form->GetName() . "','all_triggers', 'triggers');");
if ($show_events != EVENTS_OPTION_NOEVENT) {
$whow_hide_all = new CDiv(SPACE, 'filterclosed');
$whow_hide_all->setAttribute('id', $switcherName);
} else {
$whow_hide_all = NULL;
}
$table->setHeader(array($whow_hide_all, $config['event_ack_enable'] ? $header_cb : null, make_sorting_header(S_SEVERITY, 'priority'), S_STATUS, make_sorting_header(S_LAST_CHANGE, 'lastchange'), S_AGE, $show_event_col ? S_DURATION : NULL, $config['event_ack_enable'] ? S_ACKNOWLEDGED : NULL, is_show_all_nodes() ? S_NODE : null, S_HOST, make_sorting_header(S_NAME, 'description'), S_COMMENTS));
$sortfield = getPageSortField('description');
$sortorder = getPageSortOrder();
$options = array('nodeids' => get_current_nodeid(), 'filter' => array(), 'monitored' => 1, 'output' => API_OUTPUT_EXTEND, 'skipDependent' => 1, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1);
// Filtering
if ($pageFilter->hostsSelected) {
if ($pageFilter->hostid > 0) {
$options['hostids'] = $pageFilter->hostid;
} else {
if ($pageFilter->groupid > 0) {
$options['groupids'] = $pageFilter->groupid;
|
请发表评论