本文整理汇总了PHP中getPagingLine函数的典型用法代码示例。如果您正苦于以下问题:PHP getPagingLine函数的具体用法?PHP getPagingLine怎么用?PHP getPagingLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPagingLine函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doAction
protected function doAction()
{
$sortField = $this->getInput('sort', CProfile::get('web.proxies.php.sort', 'host'));
$sortOrder = $this->getInput('sortorder', CProfile::get('web.proxies.php.sortorder', ZBX_SORT_UP));
CProfile::update('web.proxies.php.sort', $sortField, PROFILE_TYPE_STR);
CProfile::update('web.proxies.php.sortorder', $sortOrder, PROFILE_TYPE_STR);
$config = select_config();
$data = ['uncheck' => $this->hasInput('uncheck'), 'sort' => $sortField, 'sortorder' => $sortOrder, 'config' => ['max_in_table' => $config['max_in_table']]];
$data['proxies'] = API::Proxy()->get(['output' => ['proxyid', 'host', 'status', 'lastaccess', 'tls_connect', 'tls_accept'], 'selectHosts' => ['hostid', 'name', 'status'], 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1, 'editable' => true, 'preservekeys' => true]);
// sorting & paging
order_result($data['proxies'], $sortField, $sortOrder);
$url = (new CUrl('zabbix.php'))->setArgument('action', 'proxy.list');
$data['paging'] = getPagingLine($data['proxies'], $sortOrder, $url);
foreach ($data['proxies'] as &$proxy) {
order_result($proxy['hosts'], 'name');
}
unset($proxy);
// get proxy IDs for a *selected* page
$proxyIds = array_keys($data['proxies']);
if ($proxyIds) {
// calculate performance
$dbPerformance = DBselect('SELECT h.proxy_hostid,SUM(1.0/i.delay) AS qps' . ' FROM hosts h,items i' . ' WHERE h.hostid=i.hostid' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.status=' . ITEM_STATUS_ACTIVE . ' AND i.delay<>0' . ' AND i.flags<>' . ZBX_FLAG_DISCOVERY_PROTOTYPE . ' AND ' . dbConditionInt('h.proxy_hostid', $proxyIds) . ' GROUP BY h.proxy_hostid');
while ($performance = DBfetch($dbPerformance)) {
$data['proxies'][$performance['proxy_hostid']]['perf'] = round($performance['qps'], 2);
}
// get items
$items = API::Item()->get(['proxyids' => $proxyIds, 'groupCount' => true, 'countOutput' => true, 'webitems' => true, 'monitored' => true]);
foreach ($items as $item) {
$data['proxies'][$item['proxy_hostid']]['item_count'] = $item['rowscount'];
}
}
$response = new CControllerResponseData($data);
$response->setTitle(_('Configuration of proxies'));
$this->setResponse($response);
}
示例2: doAction
protected function doAction()
{
$sortField = $this->getInput('sort', CProfile::get('web.media_types.php.sort', 'description'));
$sortOrder = $this->getInput('sortorder', CProfile::get('web.media_types.php.sortorder', ZBX_SORT_UP));
CProfile::update('web.media_type.php.sort', $sortField, PROFILE_TYPE_STR);
CProfile::update('web.media_types.php.sortorder', $sortOrder, PROFILE_TYPE_STR);
$config = select_config();
$data = ['uncheck' => $this->hasInput('uncheck'), 'sort' => $sortField, 'sortorder' => $sortOrder];
// get media types
$data['mediatypes'] = API::Mediatype()->get(['output' => ['mediatypeid', 'description', 'type', 'smtp_server', 'smtp_helo', 'smtp_email', 'exec_path', 'gsm_modem', 'username', 'status'], 'limit' => $config['search_limit'] + 1, 'editable' => true, 'preservekeys' => true]);
if ($data['mediatypes']) {
// get media types used in actions
$actions = API::Action()->get(['output' => ['actionid', 'name'], 'selectOperations' => ['operationtype', 'opmessage'], 'mediatypeids' => array_keys($data['mediatypes'])]);
foreach ($data['mediatypes'] as &$mediaType) {
$mediaType['typeid'] = $mediaType['type'];
$mediaType['type'] = media_type2str($mediaType['type']);
$mediaType['listOfActions'] = [];
foreach ($actions as $action) {
foreach ($action['operations'] as $operation) {
if ($operation['operationtype'] == OPERATION_TYPE_MESSAGE && $operation['opmessage']['mediatypeid'] == $mediaType['mediatypeid']) {
$mediaType['listOfActions'][$action['actionid']] = ['actionid' => $action['actionid'], 'name' => $action['name']];
}
}
}
order_result($mediaType['listOfActions'], 'name');
}
unset($mediaType);
order_result($data['mediatypes'], $sortField, $sortOrder);
}
$url = (new CUrl('zabbix.php'))->setArgument('action', 'mediatype.list');
$data['paging'] = getPagingLine($data['mediatypes'], $sortOrder, $url);
$response = new CControllerResponseData($data);
$response->setTitle(_('Configuration of media types'));
$this->setResponse($response);
}
示例3: doAction
protected function doAction()
{
$sortField = $this->getInput('sort', CProfile::get('web.scripts.php.sort', 'name'));
$sortOrder = $this->getInput('sortorder', CProfile::get('web.scripts.php.sortorder', ZBX_SORT_UP));
CProfile::update('web.scripts.php.sort', $sortField, PROFILE_TYPE_STR);
CProfile::update('web.scripts.php.sortorder', $sortOrder, PROFILE_TYPE_STR);
$config = select_config();
$data = ['uncheck' => $this->hasInput('uncheck'), 'sort' => $sortField, 'sortorder' => $sortOrder];
// list of scripts
$data['scripts'] = API::Script()->get(['output' => ['scriptid', 'name', 'command', 'host_access', 'usrgrpid', 'groupid', 'type', 'execute_on'], 'editable' => true, 'limit' => $config['search_limit'] + 1]);
// sorting & paging
order_result($data['scripts'], $sortField, $sortOrder);
$url = (new CUrl('zabbix.php'))->setArgument('action', 'script.list');
$data['paging'] = getPagingLine($data['scripts'], $sortOrder, $url);
// find script host group name and user group name. set to '' if all host/user groups used.
$usrgrpids = [];
$groupids = [];
foreach ($data['scripts'] as &$script) {
$script['userGroupName'] = null;
// all user groups
$script['hostGroupName'] = null;
// all host groups
if ($script['usrgrpid'] != 0) {
$usrgrpids[] = $script['usrgrpid'];
}
if ($script['groupid'] != 0) {
$groupids[] = $script['groupid'];
}
}
unset($script);
if ($usrgrpids) {
$userGroups = API::UserGroup()->get(['output' => ['name'], 'usrgrpids' => $usrgrpids, 'preservekeys' => true]);
foreach ($data['scripts'] as &$script) {
if ($script['usrgrpid'] != 0 && array_key_exists($script['usrgrpid'], $userGroups)) {
$script['userGroupName'] = $userGroups[$script['usrgrpid']]['name'];
}
unset($script['usrgrpid']);
}
unset($script);
}
if ($groupids) {
$hostGroups = API::HostGroup()->get(['output' => ['name'], 'groupids' => $groupids, 'preservekeys' => true]);
foreach ($data['scripts'] as &$script) {
if ($script['groupid'] != 0 && array_key_exists($script['groupid'], $hostGroups)) {
$script['hostGroupName'] = $hostGroups[$script['groupid']]['name'];
}
unset($script['groupid']);
}
unset($script);
}
$response = new CControllerResponseData($data);
$response->setTitle(_('Configuration of scripts'));
$this->setResponse($response);
}
示例4: CView
$maintenanceView = new CView('configuration.maintenance.edit', $data);
$maintenanceView->render();
$maintenanceView->show();
} else {
$sortfield = getPageSortField('name');
$sortorder = getPageSortOrder();
// get only maintenance IDs for paging
$options = array('output' => array('maintenanceid', $sortfield), 'editable' => true, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1);
if ($pageFilter->groupsSelected && $pageFilter->groupid > 0) {
$options['groupids'] = $pageFilter->groupid;
} else {
$options['groupids'] = $config['dropdown_first_entry'] ? null : array();
}
$data['maintenances'] = API::Maintenance()->get($options);
order_result($data['maintenances'], $sortfield, $sortorder);
$data['paging'] = getPagingLine($data['maintenances'], array('maintenanceid'));
// get list of maintenances
$data['maintenances'] = API::Maintenance()->get(array('maintenanceids' => zbx_objectValues($data['maintenances'], 'maintenanceid'), 'output' => API_OUTPUT_EXTEND));
foreach ($data['maintenances'] as $number => $maintenance) {
if ($maintenance['active_till'] < time()) {
$data['maintenances'][$number]['status'] = MAINTENANCE_STATUS_EXPIRED;
} elseif ($maintenance['active_since'] > time()) {
$data['maintenances'][$number]['status'] = MAINTENANCE_STATUS_APPROACH;
} else {
$data['maintenances'][$number]['status'] = MAINTENANCE_STATUS_ACTIVE;
}
}
order_result($data['maintenances'], $sortfield, $sortorder);
$data['pageFilter'] = $pageFilter;
// nodes
if ($data['displayNodes']) {
示例5: array
$data = array('sort' => $sortField, 'sortorder' => $sortOrder);
// list of scripts
$data['scripts'] = API::Script()->get(array('output' => array('scriptid', 'name', 'command', 'host_access', 'usrgrpid', 'groupid', 'type', 'execute_on'), 'editable' => true, 'selectGroups' => API_OUTPUT_EXTEND));
// find script host group name and user group name. set to '' if all host/user groups used.
foreach ($data['scripts'] as $key => $script) {
$scriptId = $script['scriptid'];
if ($script['usrgrpid'] > 0) {
$userGroup = API::UserGroup()->get(array('usrgrpids' => $script['usrgrpid'], 'output' => API_OUTPUT_EXTEND));
$userGroup = reset($userGroup);
$data['scripts'][$key]['userGroupName'] = $userGroup['name'];
} else {
$data['scripts'][$key]['userGroupName'] = '';
// all user groups
}
if ($script['groupid'] > 0) {
$group = array_pop($script['groups']);
$data['scripts'][$key]['hostGroupName'] = $group['name'];
} else {
$data['scripts'][$key]['hostGroupName'] = '';
// all host groups
}
}
// sorting & paging
order_result($data['scripts'], $sortField, $sortOrder);
$data['paging'] = getPagingLine($data['scripts']);
// render view
$scriptView = new CView('administration.script.list', $data);
$scriptView->render();
$scriptView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例6: zbx_objectValues
$data['mediatypes'] = API::Mediatype()->get(array('output' => API_OUTPUT_EXTEND, 'preservekeys' => true, 'editable' => true, 'limit' => $config['search_limit'] + 1));
if ($data['mediatypes']) {
// get media types used in actions
$actions = API::Action()->get(array('mediatypeids' => zbx_objectValues($data['mediatypes'], 'mediatypeid'), 'output' => array('actionid', 'name'), 'selectOperations' => array('operationtype', 'opmessage'), 'preservekeys' => true));
foreach ($data['mediatypes'] as $key => $mediaType) {
$data['mediatypes'][$key]['typeid'] = $data['mediatypes'][$key]['type'];
$data['mediatypes'][$key]['type'] = media_type2str($data['mediatypes'][$key]['type']);
$data['mediatypes'][$key]['listOfActions'] = array();
if ($actions) {
foreach ($actions as $actionId => $action) {
foreach ($action['operations'] as $operation) {
if ($operation['operationtype'] == OPERATION_TYPE_MESSAGE && $operation['opmessage']['mediatypeid'] == $mediaType['mediatypeid']) {
$data['mediatypes'][$key]['listOfActions'][$actionId] = array('actionid' => $actionId, 'name' => $action['name']);
}
}
}
order_result($data['mediatypes'][$key]['listOfActions'], 'name');
}
}
order_result($data['mediatypes'], $sortField, $sortOrder);
$data['paging'] = getPagingLine($data['mediatypes'], $sortOrder);
} else {
$arr = array();
$data['paging'] = getPagingLine($arr, $sortOrder);
}
// render view
$mediaTypeView = new CView('administration.mediatypes.list', $data);
$mediaTypeView->render();
$mediaTypeView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例7: 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';
示例8: mb_strtolower
$haystack = mb_strtolower($data['hosts'][$num]['inventory'][$data['filterField']]);
if ($haystack !== $needle) {
unset($data['hosts'][$num]);
}
}
}
$sort_fields = ['pr_name' => 'name', 'pr_type' => 'type', 'pr_os' => 'os', 'pr_serialno_a' => 'serialno_a', 'pr_tag' => 'tag', 'pr_macaddress_a' => 'macaddress_a'];
if (array_key_exists($sortField, $sort_fields)) {
// copying an inventory field into the upper array level for sorting
foreach ($data['hosts'] as &$host) {
$host[$sortField] = $host['inventory'][$sort_fields[$sortField]];
}
unset($host);
}
$limit = $data['config']['search_limit'] + 1;
order_result($data['hosts'], $sortField, $sortOrder);
if ($sortOrder == ZBX_SORT_UP) {
$data['hosts'] = array_slice($data['hosts'], 0, $limit);
} else {
$data['hosts'] = array_slice($data['hosts'], -$limit, $limit);
}
order_result($data['hosts'], $sortField, $sortOrder);
}
}
$url = (new CUrl('hostinventories.php'))->setArgument('groupid', $data['pageFilter']->groupid);
$data['paging'] = getPagingLine($data['hosts'], $sortOrder, $url);
$hostinventoriesView = new CView('inventory.host.list', $data);
$hostinventoriesView->render();
$hostinventoriesView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例9: time
if ($ack_status == ZBX_ACK_STS_WITH_UNACK) {
$options['withUnacknowledgedEvents'] = 1;
}
if ($ack_status == ZBX_ACK_STS_WITH_LAST_UNACK) {
$options['withLastEventUnacknowledged'] = 1;
}
if ($show_severity > -1) {
$options['min_severity'] = $show_severity;
}
if ($_REQUEST['status_change']) {
$options['lastChangeSince'] = time() - $_REQUEST['status_change_days'] * 86400;
}
$triggers = CTrigger::get($options);
// sorting && paging
order_result($triggers, $sortfield, $sortorder);
$paging = getPagingLine($triggers);
$options = array('nodeids' => get_current_nodeid(), 'triggerids' => zbx_objectValues($triggers, 'triggerid'), 'output' => API_OUTPUT_EXTEND, 'select_hosts' => array('hostid', 'host', 'maintenance_status', 'maintenance_type', 'maintenanceid'), 'select_items' => API_OUTPUT_EXTEND, 'select_dependencies' => API_OUTPUT_EXTEND);
$triggers = CTrigger::get($options);
$triggers = zbx_toHash($triggers, 'triggerid');
order_result($triggers, $sortfield, $sortorder);
//---------
if ($config['event_ack_enable']) {
foreach ($triggers as $tnum => $trigger) {
$options = array('countOutput' => 1, 'triggerids' => $trigger['triggerid'], 'object' => EVENT_OBJECT_TRIGGER, 'acknowledged' => 0, 'value' => TRIGGER_VALUE_TRUE, 'nopermissions' => 1);
$triggers[$tnum]['event_count'] = CEvent::get($options);
}
}
$tr_hostids = array();
foreach ($triggers as $tnum => $trigger) {
$triggers[$tnum]['events'] = array();
//getting all host ids and names
示例10: array
// 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();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例11: array
if ($pageFilter->groupid > 0) {
$trigOpt['groupids'] = $pageFilter->groupid;
}
}
}
$triggers = CTrigger::get($trigOpt);
}
$options = array('nodeids' => get_current_nodeid(), 'object' => EVENT_OBJECT_TRIGGER, 'time_from' => $from, 'time_till' => $till, 'output' => API_OUTPUT_SHORTEN, 'sortfield' => 'clock', 'sortorder' => ZBX_SORT_DOWN, 'limit' => $config['search_limit'] + 1);
if ($_REQUEST['hide_unknown']) {
$options['hide_unknown'] = 1;
}
if (!empty($triggers)) {
$options['triggerids'] = zbx_objectValues($triggers, 'triggerid');
}
$events = CEvent::get($options);
$paging = getPagingLine($events);
$options = array('nodeids' => get_current_nodeid(), 'eventids' => zbx_objectValues($events, 'eventid'), 'output' => API_OUTPUT_EXTEND, 'sortfield' => 'eventid', 'sortorder' => ZBX_SORT_DOWN, 'nopermissions' => 1);
$events = CEvent::get($options);
order_result($events, 'clock', ZBX_SORT_DOWN);
$triggersOptions = array('triggerids' => zbx_objectValues($events, 'objectid'), 'select_hosts' => API_OUTPUT_EXTEND, 'select_triggers' => API_OUTPUT_EXTEND, 'select_items' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND);
$triggers = CTrigger::get($triggersOptions);
$triggers = zbx_toHash($triggers, 'triggerid');
foreach ($events as $enum => $event) {
$trigger = $triggers[$event['objectid']];
$host = reset($trigger['hosts']);
$items = array();
foreach ($trigger['items'] as $inum => $item) {
$i = array();
$i['itemid'] = $item['itemid'];
$i['value_type'] = $item['value_type'];
//ZBX-3059: So it would be possible to show different caption for history for chars and numbers (KB)
示例12: getRequest
$usersView->render();
$usersView->show();
} else {
$sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'alias'));
$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('config' => $config, 'sort' => $sortField, 'sortorder' => $sortOrder);
// 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 & paging
order_result($data['users'], $sortField, $sortOrder);
$data['paging'] = getPagingLine($data['users'], $sortOrder);
// set default lastaccess time to 0
foreach ($data['users'] as $user) {
$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);
$usersView->render();
$usersView->show();
}
示例13: elseif
$triggersView->render();
$triggersView->show();
} elseif (isset($_REQUEST['form'])) {
$triggersView = new CView('configuration.triggers.edit', getTriggerFormData($exprAction));
$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('parent_discoveryid' => getRequest('parent_discoveryid'), 'showInfoColumn' => false, 'discovery_rule' => $discovery_rule, 'hostid' => getRequest('hostid'), 'showdisabled' => getRequest('showdisabled', 1), 'triggers' => array(), 'sort' => $sortField, 'sortorder' => $sortOrder);
CProfile::update('web.triggers.showdisabled', $data['showdisabled'], PROFILE_TYPE_INT);
// get triggers
$options = array('editable' => true, 'output' => array('triggerid'), 'discoveryids' => $data['parent_discoveryid'], 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1);
if (empty($data['showdisabled'])) {
$options['filter']['status'] = TRIGGER_STATUS_ENABLED;
}
$data['triggers'] = API::TriggerPrototype()->get($options);
// paging
$data['paging'] = getPagingLine($data['triggers']);
$data['triggers'] = API::TriggerPrototype()->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));
order_result($data['triggers'], $sortField, $sortOrder);
// get real hosts
$data['realHosts'] = getParentHostsByTriggers($data['triggers']);
// render view
$triggersView = new CView('configuration.triggers.list', $data);
$triggersView->render();
$triggersView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例14: array
$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'] . ':');
}
}
order_result($data['drules'], getPageSortOrder());
}
// get paging
$data['paging'] = getPagingLine($data['drules']);
// render view
$discoveryView = new CView('configuration.discovery.list', $data);
$discoveryView->render();
$discoveryView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例15: CForm
$dscry_wdgt->addHeader(S_DISCOVERY_BIG);
$dscry_wdgt->addHeader($numrows);
/* table */
$form = new CForm();
$form->setName('frmdrules');
$tblDiscovery = new CTableInfo(S_NO_DISCOVERY_RULES_DEFINED);
$tblDiscovery->setHeader(array(new CCheckBox('all_drules', null, "checkAll('" . $form->GetName() . "','all_drules','g_druleid');"), make_sorting_header(S_NAME, 'd.name'), make_sorting_header(S_IP_RANGE, 'd.iprange'), make_sorting_header(S_DELAY, 'd.delay'), S_CHECKS, S_STATUS));
$sql = 'SELECT d.* ' . ' FROM drules d' . ' WHERE ' . DBin_node('druleid') . order_by('d.name,d.iprange,d.delay', 'd.druleid');
$db_rules = DBselect($sql);
// Discovery rules will be gathered here, so we can feed this array to pagination function
$rules_arr = array();
while ($rule_data = DBfetch($db_rules)) {
$rules_arr[] = $rule_data;
}
// getting paging element
$paging = getPagingLine($rules_arr);
foreach ($rules_arr as $rule_data) {
$checks = array();
$sql = 'SELECT type FROM dchecks WHERE druleid=' . $rule_data['druleid'] . ' ORDER BY type, ports';
$db_checks = DBselect($sql);
while ($check_data = DBfetch($db_checks)) {
if (!isset($checks[$check_data['type']])) {
$checks[$check_data['type']] = discovery_check_type2str($check_data['type']);
}
}
order_result($checks);
$status = new CCol(new CLink(discovery_status2str($rule_data["status"]), '?g_druleid%5B%5D=' . $rule_data['druleid'] . ($rule_data["status"] == DRULE_STATUS_ACTIVE ? '&go=disable' : '&go=activate'), discovery_status2style($rule_data['status'])));
$description = array();
if ($rule_data["proxy_hostid"]) {
$proxy = get_host_by_hostid($rule_data["proxy_hostid"]);
array_push($description, $proxy["host"], ":");