本文整理汇总了PHP中make_sorting_link函数的典型用法代码示例。如果您正苦于以下问题:PHP make_sorting_link函数的具体用法?PHP make_sorting_link怎么用?PHP make_sorting_link使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了make_sorting_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zbx_dbstr
$where_case[] = 'i.logtimefmt=' . zbx_dbstr($_REQUEST['filter_logtimefmt']);
}
if (isset($_REQUEST['filter_delta']) && $_REQUEST['filter_delta'] != -1) {
$where_case[] = 'i.delta=' . $_REQUEST['filter_delta'];
}
if (isset($_REQUEST['filter_trapper_hosts'])) {
$where_case[] = 'i.trapper_hosts like ' . zbx_dbstr('%' . $_REQUEST['filter_trapper_hosts'] . '%');
}
$show_applications = 0;
}
//--------------------------
// TABLE
$form = new CForm();
$form->setName('items');
$table = new CTableInfo();
$table->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $form->GetName() . "','all_items','group_itemid');"), $show_host ? make_sorting_link(S_HOST, 'h.host') : null, make_sorting_link(S_DESCRIPTION, 'i.description'), make_sorting_link(S_KEY, 'i.key_'), make_sorting_link(S_INTERVAL, 'i.delay'), make_sorting_link(S_HISTORY, 'i.history'), make_sorting_link(S_TRENDS, 'i.trends'), make_sorting_link(S_TYPE, 'i.type'), make_sorting_link(S_STATUS, 'i.status'), $show_applications ? S_APPLICATIONS : null, S_ERROR));
$from_tables['i'] = 'items i';
/* NOTE: must be added as last element to use left join */
/*
$sql = 'SELECT DISTINCT th.host as template_host,th.hostid as template_hostid, h.host, h.hostid, hgg.groupid, i.* '.
' FROM '.implode(',', $from_tables).
' LEFT JOIN hosts_groups hgg ON hgg.hostid=i.hostid '.
' LEFT JOIN items ti ON i.templateid=ti.itemid '.
' LEFT JOIN hosts th ON ti.hostid=th.hostid '.
' WHERE '.implode(' AND ', $where_case).
order_by('h.host,i.description,i.key_,i.delay,i.history,i.trends,i.type,i.status','i.itemid');
//*/
//*
$sql = 'SELECT DISTINCT th.host as template_host,th.hostid as template_hostid, h.host, h.hostid, i.* ' . ' FROM ' . implode(',', $from_tables) . ' LEFT JOIN items ti ON i.templateid=ti.itemid ' . ' LEFT JOIN hosts th ON ti.hostid=th.hostid ' . ' WHERE ' . implode(' and ', $where_case) . order_by('h.host,i.description,i.key_,i.delay,i.history,i.trends,i.type,i.status', 'i.itemid');
//*/
$db_items = DBselect($sql);
示例2: while
/* limit opened application count */
while (count($_REQUEST['applications']) > 25) {
array_shift($_REQUEST['applications']);
}
update_profile('web.latest.applications', $_REQUEST['applications'], PROFILE_TYPE_ARRAY_ID);
if (isset($show_all_apps)) {
$url = '?close=1' . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select');
$link = new CLink(new CImg('images/general/opened.gif'), $url);
// $link = new CLink(new CImg('images/general/opened.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');");
} else {
$url = '?open=1' . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select');
$link = new CLink(new CImg('images/general/closed.gif'), $url);
// $link = new CLink(new CImg('images/general/closed.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');");
}
$table = new CTableInfo();
$table->SetHeader(array(is_show_subnodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, $_REQUEST['hostid'] == 0 ? make_sorting_link(S_HOST, 'h.host') : NULL, array($link, SPACE, make_sorting_link(S_DESCRIPTION, 'i.description')), make_sorting_link(S_LAST_CHECK, 'i.lastclock'), S_LAST_VALUE, S_CHANGE, S_HISTORY));
// $table->ShowStart();
$db_apps = array();
$db_appids = array();
$sql_where .= $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] : '';
$sql = 'SELECT DISTINCT h.host,h.hostid, a.* ' . ' FROM applications a, hosts h ' . $sql_from . ' WHERE a.hostid=h.hostid' . $sql_where . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' AND h.status=' . HOST_STATUS_MONITORED . order_by('h.host,h.hostid', 'a.name,a.applicationid');
//SDI($sql);
$db_app_res = DBselect($sql);
while ($db_app = DBfetch($db_app_res)) {
$db_app['item_cnt'] = 0;
$db_apps[$db_app['applicationid']] = $db_app;
$db_appids[$db_app['applicationid']] = $db_app['applicationid'];
}
$tab_rows = array();
$sql = 'SELECT DISTINCT i.*, ia.applicationid ' . ' FROM items i,items_applications ia' . ' WHERE ' . DBcondition('ia.applicationid', $db_appids) . ' AND i.itemid=ia.itemid AND i.lastvalue IS NOT NULL' . ' AND (i.status=' . ITEM_STATUS_ACTIVE . ' OR i.status=' . ITEM_STATUS_NOTSUPPORTED . ')' . order_by('i.description,i.itemid,i.lastclock');
//SDI($sql);
示例3: CForm
$form = new CForm();
$form->SetMethod('get');
$form->AddItem(new CButton("form", S_CREATE_MAP));
show_table_header(S_CONFIGURATION_OF_NETWORK_MAPS, $form);
echo SBR;
if (isset($_REQUEST["form"])) {
insert_map_form();
} else {
$form = new CForm();
$form->setName('frm_maps');
$numrows = new CSpan(null, 'info');
$numrows->setAttribute('name', 'numrows');
$header = get_table_header(array(S_MAPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
show_table_header($header);
$table = new CTableInfo(S_NO_MAPS_DEFINED);
$table->SetHeader(array(new CCheckBox('all_maps', NULL, "checkAll('" . $form->getName() . "','all_maps','maps');"), make_sorting_link(S_NAME, 'sm.name'), make_sorting_link(S_WIDTH, 'sm.width'), make_sorting_link(S_HEIGHT, 'sm.height'), S_MAP));
$result = DBselect('SELECT sm.sysmapid,sm.name,sm.width,sm.height ' . ' FROM sysmaps sm' . ' WHERE ' . DBin_node('sm.sysmapid') . order_by('sm.name,sm.width,sm.height', 'sm.sysmapid'));
while ($row = DBfetch($result)) {
if (!sysmap_accessible($row["sysmapid"], PERM_READ_WRITE)) {
continue;
}
$table->AddRow(array(new CCheckBox('maps[' . $row['sysmapid'] . ']', NULL, NULL, $row['sysmapid']), new CLink($row["name"], "sysmaps.php?form=update" . "&sysmapid=" . $row["sysmapid"] . "#form", 'action'), $row["width"], $row["height"], new CLink(S_EDIT, "sysmap.php?sysmapid=" . $row["sysmapid"])));
}
//----- GO ------
$goBox = new CComboBox('go');
$goBox->addItem('delete', S_DELETE_SELECTED);
// goButton name is necessary!!!
$goButton = new CButton('goButton', S_GO . ' (0)');
$goButton->setAttribute('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "maps";');
$table->setFooter(new CCol(array($goBox, $goButton)));
示例4: CButtonCancel
$frmScr->addItemToBottomRow(SPACE);
}
$frmScr->addItemToBottomRow(new CButtonCancel());
$frmScr->Show();
} else {
validate_sort_and_sortorder('s.name', ZBX_SORT_UP);
$form = new CForm();
$form->setName('scripts');
$form->setAttribute('id', 'scripts');
$form->addVar('action', '1');
$numrows = new CSpan(null, 'info');
$numrows->setAttribute('name', 'numrows');
$header = get_table_header(array(S_SCRIPTS, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
show_table_header($header);
$table = new CTableInfo(S_NO_SCRIPTS_DEFINED);
$table->setHeader(array(new CCheckBox('all_scripts', null, "checkAll('" . $form->getName() . "','all_scripts','scripts');"), make_sorting_link(S_NAME, 's.name'), make_sorting_link(S_COMMAND, 's.command'), S_USER_GROUP, S_HOST_GROUP, S_HOST_ACCESS));
$sql = 'SELECT s.* ' . ' FROM scripts s ' . ' WHERE ' . DBin_node('s.scriptid') . order_by('s.name,s.command');
$scripts = DBselect($sql);
while ($script = DBfetch($scripts)) {
$user_group_name = S_ALL_S;
if ($script['usrgrpid'] > 0) {
$user_group = get_group_by_usrgrpid($script['usrgrpid']);
$user_group_name = $user_group['name'];
}
$host_group_name = S_ALL_S;
if ($script['groupid'] > 0) {
$group = get_hostgroup_by_groupid($script['groupid']);
$host_group_name = $group['name'];
}
$table->addRow(array(new CCheckBox('scripts[' . $script['scriptid'] . ']', 'no', NULL, $script['scriptid']), new CLink($script['name'], 'scripts.php?form=1' . '&scriptid=' . $script['scriptid'] . '#form'), htmlspecialchars($script['command']), $user_group_name, $host_group_name, PERM_READ_WRITE == $script['host_access'] ? S_WRITE : S_READ));
$row_count++;
示例5: DBin_node
} else {
if ($config['dropdown_first_entry'] == ZBX_DROPDOWN_FIRST_ALL) {
$sqls[] = 'SELECT m.* ' . ' FROM maintenances m ' . ' WHERE ' . DBin_node('m.maintenanceid') . ' AND ' . DBcondition('m.maintenanceid', $available_maintenances) . ' ORDER BY m.name';
}
}
foreach ($sqls as $num => $sql) {
$db_maintenances = DBselect($sql);
while ($maintenance = DBfetch($db_maintenances)) {
$maintenances[$maintenance['maintenanceid']] = $maintenance;
$maintenanceids[$maintenance['maintenanceid']] = $maintenance['maintenanceid'];
}
}
$form = new CForm(null, 'post');
$form->setName('maintenances');
$table = new CTableInfo();
$table->setHeader(array(new CCheckBox('all_maintenances', NULL, "checkAll('" . $form->GetName() . "','all_maintenances','maintenanceids');"), make_sorting_link(S_NAME, 'm.name'), S_TYPE, S_STATUS, S_DESCRIPTION));
foreach ($maintenances as $maintenanceid => $maintenance) {
if ($maintenance['active_till'] < time()) {
$mnt_status = new CSpan(S_EXPIRED, 'red');
} else {
$mnt_status = new CSpan(S_ACTIVE, 'green');
}
$table->addRow(array(new CCheckBox('maintenanceids[' . $maintenance['maintenanceid'] . ']', NULL, NULL, $maintenance['maintenanceid']), new CLink($maintenance['name'], 'maintenance.php?form=update&maintenanceid=' . $maintenance['maintenanceid'] . '#form'), $maintenance['maintenance_type'] ? S_NO_DATA_PROCESSING : S_NORMAL_PROCESSING, $mnt_status, $maintenance['description']));
$row_count++;
}
// $table->setFooter(new CCol(new CButtonQMessage('delete_selected',S_DELETE_SELECTED,S_DELETE_SELECTED_USERS_Q)));
$goBox = new CComboBox('go');
$goBox->addItem('delete', S_DELETE_SELECTED);
// goButton name is necessary!!!
$goButton = new CButton('goButton', S_GO . ' (0)');
$goButton->setAttribute('id', 'goButton');
示例6: array
$sql_cond .= ' AND a.userid=' . $_REQUEST['userid'] . ' ';
}
if ($_REQUEST['action'] > -1 && $config == 0) {
$sql_cond .= ' AND a.action=' . $_REQUEST['action'] . ' ';
}
if ($_REQUEST['resourcetype'] > -1 && $config == 0) {
$sql_cond .= ' AND a.resourcetype=' . $_REQUEST['resourcetype'] . ' ';
}
$sql_cond .= ' AND a.clock>1000000000 AND a.clock<' . $time_end;
if (0 == $config) {
$count = 0;
$last_clock = null;
$actions = array();
$clock = array();
$table = new CTableInfo();
$table->setHeader(array(make_sorting_link(S_TIME, 'clock'), make_sorting_link(S_USER, 'alias'), make_sorting_link(S_IP, 'ip'), make_sorting_link(S_RESOURCE, 'resourcetype'), make_sorting_link(S_ACTION, 'action'), S_ID, S_DESCRIPTION, S_DETAILS));
$sql = 'SELECT a.auditid,a.clock,u.alias,a.ip,a.resourcetype,a.action,a.resourceid,a.resourcename,a.details ' . ' FROM auditlog a, users u ' . ' WHERE u.userid=a.userid ' . $sql_cond . ' AND ' . DBin_node('u.userid', get_current_nodeid(null, PERM_READ_ONLY)) . ' ORDER BY a.clock DESC';
$result = DBselect($sql, $limit);
while ($row = DBfetch($result)) {
switch ($row['action']) {
case AUDIT_ACTION_ADD:
$action = S_ADDED;
break;
case AUDIT_ACTION_UPDATE:
$action = S_UPDATED;
break;
case AUDIT_ACTION_DELETE:
$action = S_DELETED;
break;
case AUDIT_ACTION_LOGIN:
$action = S_LOGIN;
示例7: CComboBox
$form->setMethod('get');
$cmbSource = new CComboBox('eventsource', $_REQUEST['eventsource'], 'submit()');
$cmbSource->addItem(EVENT_SOURCE_TRIGGERS, S_TRIGGERS);
$cmbSource->addItem(EVENT_SOURCE_DISCOVERY, S_DISCOVERY);
$form->addItem(array(S_EVENT_SOURCE, SPACE, $cmbSource));
$row_count = 0;
$numrows = new CSpan(null, 'info');
$numrows->setAttribute('name', 'numrows');
$header = get_table_header(array(S_ACTIONS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
show_table_header($header, $form);
unset($form, $cmbSource);
/* table */
$form = new CForm();
$form->setName('actions');
$tblActions = new CTableInfo(S_NO_ACTIONS_DEFINED);
$tblActions->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $form->getName() . "','all_items','g_actionid');"), make_sorting_link(S_NAME, 'a.name'), S_CONDITIONS, S_OPERATIONS, make_sorting_link(S_STATUS, 'a.status')));
$db_actions = DBselect('SELECT a.* ' . ' FROM actions a' . ' WHERE a.eventsource=' . $_REQUEST['eventsource'] . ' AND ' . DBin_node('actionid') . order_by('a.name,a.status', 'a.actionid'));
while ($action_data = DBfetch($db_actions)) {
if (!action_accessible($action_data['actionid'], PERM_READ_WRITE)) {
continue;
}
$conditions = array();
$db_conditions = DBselect('select * from conditions where actionid=' . $action_data['actionid'] . ' order by conditiontype,conditionid');
while ($condition_data = DBfetch($db_conditions)) {
array_push($conditions, array(get_condition_desc($condition_data['conditiontype'], $condition_data['operator'], $condition_data['value']), BR()));
}
unset($db_conditions, $condition_data);
$operations = array();
$db_operations = DBselect('select * from operations where actionid=' . $action_data['actionid'] . ' order by operationtype,operationid');
while ($operation_data = DBfetch($db_operations)) {
array_push($operations, array(get_operation_desc(SHORT_DESCRITION, $operation_data), BR()));
示例8: CButton
$frmForm->addItem(SPACE . '|' . SPACE);
$frmForm->addItem($btnNew = new CButton('form', S_CREATE_USER));
show_table_header(S_CONFIGURATION_OF_USERS_AND_USER_GROUPS, $frmForm);
echo SBR;
$row_count = 0;
if (isset($_REQUEST['form'])) {
insert_user_form(get_request('userid', null));
} else {
$form = new CForm(null, 'post');
$form->setName('users');
$numrows = new CSpan(null, 'info');
$numrows->setAttribute('name', 'numrows');
$header = get_table_header(array(S_USERS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
show_table_header($header);
$table = new CTableInfo(S_NO_USERS_DEFINED);
$table->setHeader(array(new CCheckBox('all_users', NULL, "checkAll('" . $form->GetName() . "','all_users','group_userid');"), make_sorting_link(S_ALIAS, 'u.alias'), make_sorting_link(S_NAME, 'u.name'), make_sorting_link(S_SURNAME, 'u.surname'), make_sorting_link(S_USER_TYPE, 'u.type'), S_GROUPS, S_IS_ONLINE_Q, S_GUI_ACCESS, S_API_ACCESS, S_DEBUG_MODE, S_STATUS));
$cond_from = '';
$cond_where = '';
if ($_REQUEST['filter_usrgrpid'] > 0) {
$cond_from = ', users_groups ug, usrgrp ugrp ';
$cond_where = ' AND ug.userid = u.userid ' . ' AND ug.usrgrpid=' . $_REQUEST['filter_usrgrpid'];
}
$users = array();
$userids = array();
$db_users = DBselect('SELECT DISTINCT u.userid,u.alias,u.name,u.surname,u.type,u.autologout ' . ' FROM users u ' . $cond_from . ' WHERE ' . DBin_node('u.userid') . $cond_where . order_by('u.alias,u.name,u.surname,u.type', 'u.userid'));
while ($db_user = DBfetch($db_users)) {
$users[$db_user['userid']] = $db_user;
$userids[$db_user['userid']] = $db_user['userid'];
}
$users_sessions = array();
$sql = 'SELECT s.userid, MAX(s.lastaccess) as lastaccess, s.status ' . ' FROM sessions s, users u' . ' WHERE ' . DBcondition('s.userid', $userids) . ' AND s.userid=u.userid ' . ' GROUP BY s.userid,s.status';
示例9: CTableInfo
}
} else {
$table = new CTableInfo();
if ($prof_type) {
$table->setHeader(array(is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, make_sorting_link(S_HOST, 'h.host'), $_REQUEST['groupid'] > 0 ? null : make_sorting_link(S_GROUP, 'g.name'), make_sorting_link(S_DEVICE_OS_SHORT, 'hpe.device_os_short'), make_sorting_link(S_DEVICE_HW_ARCH, 'hpe.device_hw_arch'), make_sorting_link(S_DEVICE_TYPE, 'hpe.device_type'), make_sorting_link(S_DEVICE_STATUS, 'hpe.device_status')));
$sql_where = '';
if ($_REQUEST['groupid'] > 0) {
$sql_where = ' AND hg.groupid=' . $_REQUEST['groupid'];
}
$sql = 'SELECT DISTINCT g.name, h.hostid,h.host,hpe.device_os_short,hpe.device_hw_arch,hpe.device_type,hpe.device_status' . ' FROM hosts h,hosts_profiles_ext hpe,hosts_groups hg,groups g ' . ' WHERE h.hostid=hpe.hostid ' . ' AND h.hostid=hg.hostid ' . ' AND g.groupid=hg.groupid ' . ' AND ' . DBcondition('h.hostid', $PAGE_HOSTS['hostids']) . $sql_where . order_by('h.host,h.hostid,g.name,hpe.device_os_short,hpe.device_hw_arch,hpe.device_type,hpe.device_status');
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$table->AddRow(array(get_node_name_by_elid($row['hostid']), new CLink($row["host"], "?hostid=" . $row["hostid"] . url_param("groupid") . '&prof_type=' . $prof_type, "action"), $_REQUEST["groupid"] > 0 ? null : $row["name"], $row["device_os_short"], $row["device_hw_arch"], $row["device_type"], $row["device_status"]));
}
} else {
$table->setHeader(array(is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, make_sorting_link(S_HOST, 'h.host'), make_sorting_link(S_NAME, 'p.name'), make_sorting_link(S_OS, 'p.os'), make_sorting_link(S_SERIALNO, 'p.serialno'), make_sorting_link(S_TAG, 'p.tag'), make_sorting_link(S_MACADDRESS, 'p.macaddress')));
$sql_from = '';
$sql_where = '';
if ($_REQUEST['groupid'] > 0) {
$sql_from = ', hosts_groups hg ';
$sql_where = ' and h.hostid=hg.hostid AND hg.groupid=' . $_REQUEST['groupid'];
}
$sql = 'SELECT h.hostid,h.host,p.name,p.os,p.serialno,p.tag,p.macaddress' . ' FROM hosts h,hosts_profiles p ' . $sql_from . ' WHERE h.hostid=p.hostid' . ' and ' . DBcondition('h.hostid', $PAGE_HOSTS['hostids']) . $sql_where . order_by('h.host,h.hostid,p.name,p.os,p.serialno,p.tag,p.macaddress');
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$table->AddRow(array(get_node_name_by_elid($row['hostid']), new CLink($row["host"], '?hostid=' . $row['hostid'] . url_param('groupid') . '&prof_type=' . $prof_type, "action"), $row["name"], $row["os"], $row["serialno"], $row["tag"], $row["macaddress"]));
}
}
$table->show();
}
include_once "include/page_footer.php";
示例10: foreach
foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) {
$cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name);
}
$r_form->addItem(array(S_GROUP . SPACE, $cmbGroups));
$r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
$row_count = 0;
$numrows = new CSpan(null, 'info');
$numrows->addOption('name', 'numrows');
$header = get_table_header(array(S_GRAPHS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
show_table_header($header, $r_form);
/* TABLE */
$form = new CForm();
$form->setName('graphs');
$form->addVar('hostid', $_REQUEST['hostid']);
$table = new CTableInfo(S_NO_GRAPHS_DEFINED);
$table->setHeader(array($_REQUEST['hostid'] != 0 ? NULL : S_HOSTS, array(new CCheckBox('all_graphs', NULL, "CheckAll('" . $form->GetName() . "','all_graphs');"), make_sorting_link(S_NAME, 'g.name')), make_sorting_link(S_WIDTH, 'g.width'), make_sorting_link(S_HEIGHT, 'g.height'), make_sorting_link(S_GRAPH_TYPE, 'g.graphtype')));
$sql_from = '';
$sql_where = '';
if ($PAGE_HOSTS['selected'] > 0) {
$sql_where .= ' AND i.hostid=' . $PAGE_HOSTS['selected'];
}
$sql = 'SELECT DISTINCT g.* ' . ' FROM graphs g, graphs_items gi,items i ' . $sql_from . ' WHERE ' . DBcondition('g.graphid', $available_graphs) . ' AND gi.graphid=g.graphid ' . ' AND i.itemid=gi.itemid ' . $sql_where . order_by('g.name,g.width,g.height,g.graphtype', 'g.graphid');
$result = DBselect($sql);
while ($row = DBfetch($result)) {
if ($_REQUEST['hostid'] != 0) {
$host_list = NULL;
} else {
$host_list = array();
$db_hosts = get_hosts_by_graphid($row['graphid']);
while ($db_host = DBfetch($db_hosts)) {
array_push($host_list, $db_host['host']);
示例11: array
$r_form->addItem(array(S_DISCOVERY_RULE . SPACE, $cmbDRules));
$dscvry_wdgt->addHeader(SPACE, $r_form);
//-------------
$services = array();
$sql_where = '';
if ($druleid > 0) {
$sql_where = ' AND h.druleid=' . $druleid;
}
$sql = 'SELECT s.type,s.port,s.key_ ' . ' FROM dservices s,dhosts h,drules r ' . ' WHERE s.dhostid=h.dhostid' . ' AND h.druleid=r.druleid' . ' AND r.status=' . DRULE_STATUS_ACTIVE . $sql_where . ' AND ' . DBin_node('s.dserviceid');
$db_dservices = DBselect($sql);
while ($dservice = DBfetch($db_dservices)) {
$service_name = discovery_check_type2str($dservice['type']) . discovery_port2str($dservice['type'], $dservice['port']) . (empty($dservice['key_']) ? '' : ':' . $dservice['key_']);
$services[$service_name] = 1;
}
ksort($services);
$header = array(is_show_all_nodes() ? new CCol(S_NODE, 'center') : null, new CCol(make_sorting_link(S_DISCOVERED_DEVICE, 'ip'), 'center'), new CCol(S_MONITORED_HOST, 'center'), new CCol(array(S_UPTIME . '/', S_DOWNTIME), 'center'));
foreach ($services as $name => $foo) {
$header[] = new CImg('vtext.php?text=' . $name);
}
$table = new CTableInfo();
$table->setHeader($header, 'vertical_header');
$sql_where = '';
if ($druleid > 0) {
$sql_where = ' AND druleid=' . $druleid;
}
$sql = 'SELECT DISTINCT druleid,proxy_hostid,name ' . ' FROM drules ' . ' WHERE ' . DBin_node('druleid') . $sql_where . ' AND status=' . DRULE_STATUS_ACTIVE . ' ORDER BY name';
$db_drules = DBselect($sql);
while ($drule = DBfetch($db_drules)) {
$discovery_info = array();
$db_dhosts = DBselect('SELECT dh.dhostid,dh.druleid,dh.ip,dh.status,dh.lastup,dh.lastdown,h.host' . ' FROM dhosts dh' . ' LEFT JOIN hosts h ON h.ip=dh.ip and h.proxy_hostid=' . $drule['proxy_hostid'] . ' WHERE ' . DBin_node('dh.dhostid') . ' AND dh.druleid=' . $drule['druleid'] . order_by('dh.ip', 'dh.dhostid,dh.status'));
while ($dhost = DBfetch($db_dhosts)) {
示例12: CComboBox
$frmForm->addVar('config', $_REQUEST['config']);
$cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
$cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
}
$frmForm->addItem(array(S_GROUP . SPACE, $cmbGroups));
$numrows = new CSpan(null, 'info');
$numrows->setAttribute('name', 'numrows');
$header = get_table_header(array(S_HOSTS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
show_table_header($header, $frmForm);
/* table HOSTS */
$form = new CForm();
$form->setName('hosts');
$form->addVar('config', get_request('config', 0));
$table = new CTableInfo(S_NO_HOSTS_DEFINED);
$table->setHeader(array(new CCheckBox('all_hosts', NULL, "checkAll('" . $form->GetName() . "','all_hosts','hosts');"), make_sorting_link(S_NAME, 'h.host'), S_ITEMS, S_TRIGGERS, S_GRAPHS, make_sorting_link(S_DNS, 'h.dns'), make_sorting_link(S_IP, 'h.ip'), make_sorting_link(S_PORT, 'h.port'), S_TEMPLATES, make_sorting_link(S_STATUS, 'h.status'), make_sorting_link(S_AVAILABILITY, 'h.available'), S_ERROR));
$options = array('hostids' => $PAGE_HOSTS['hostids'], 'extendoutput' => 1, 'select_templates' => 1, 'select_items' => 1, 'select_triggers' => 1, 'select_graphs' => 1, 'editable' => 1, 'order' => 'host');
if ($_REQUEST['groupid'] > 0) {
$options['groupids'] = $PAGE_GROUPS['selected'];
}
$hosts = Chost::get($options);
foreach ($hosts as $hostid => $row) {
$description = array();
$items = array(new CLink(S_ITEMS, 'items.php?groupid=' . $PAGE_GROUPS['selected'] . '&hostid=' . $row['hostid']), ' (' . count($row['itemids']) . ')');
$triggers = array(new CLink(S_TRIGGERS, 'triggers.php?groupid=' . $PAGE_GROUPS['selected'] . '&hostid=' . $row['hostid']), ' (' . count($row['triggerids']) . ')');
$graphs = array(new CLink(S_GRAPHS, 'graphs.php?groupid=' . $PAGE_GROUPS['selected'] . '&hostid=' . $row['hostid']), ' (' . count($row['graphids']) . ')');
if ($row['proxy_hostid']) {
$proxy = get_host_by_hostid($row['proxy_hostid']);
array_push($description, $proxy['host'], ':');
}
array_push($description, new CLink($row['host'], 'hosts.php?form=update&hostid=' . $row['hostid'] . url_param('groupid')));
示例13: CForm
$r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
$httpmon_wdgt->addHeader(SPACE, $r_form);
// show_table_header(S_STATUS_OF_WEB_MONITORING_BIG, $r_form);
//-----------------
// TABLE
$form = new CForm();
$form->setMethod('get');
$form->setName('scenarios');
$form->addVar('hostid', $_REQUEST['hostid']);
if (isset($show_all_apps)) {
$link = new CLink(new CImg('images/general/opened.gif'), '?close=1' . url_param('groupid') . url_param('hostid'));
} else {
$link = new CLink(new CImg('images/general/closed.gif'), '?open=1' . url_param('groupid') . url_param('hostid'));
}
$table = new CTableInfo();
$table->SetHeader(array(is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, $_REQUEST['hostid'] == 0 ? make_sorting_link(S_HOST, 'h.host') : NULL, array($link, SPACE, make_sorting_link(S_NAME, 'wt.name')), S_NUMBER_OF_STEPS, S_STATE, S_LAST_CHECK, S_STATUS));
$any_app_exist = false;
$db_apps = array();
$db_appids = array();
$sql_where = '';
if ($_REQUEST['hostid'] > 0) {
$sql_where = ' AND h.hostid=' . $_REQUEST['hostid'];
}
$sql = 'SELECT DISTINCT h.host,h.hostid,a.* ' . ' FROM applications a,hosts h ' . ' WHERE a.hostid=h.hostid ' . $sql_where . ' AND ' . DBcondition('h.hostid', $available_hosts) . order_by('a.applicationid,h.host,h.hostid', 'a.name');
//SDI($sql);
$db_app_res = DBselect($sql);
while ($db_app = DBfetch($db_app_res)) {
$db_app['scenarios_cnt'] = 0;
$db_apps[$db_app['applicationid']] = $db_app;
$db_appids[$db_app['applicationid']] = $db_app['applicationid'];
}
示例14: CComboBox
$cmbTimeZone = new CComboBox('timezone', $timezone);
for ($i = -12; $i <= 13; $i++) {
$cmbTimeZone->addItem($i, 'GMT' . sprintf('%+03d:00', $i));
}
$frmNode->addRow(S_TIME_ZONE, $cmbTimeZone);
$frmNode->addRow(S_IP, new CTextBox('ip', $ip, 15));
$frmNode->addRow(S_PORT, new CNumericBox('port', $port, 5));
$frmNode->addRow(S_DO_NOT_KEEP_HISTORY_OLDER_THAN, new CNumericBox('slave_history', $slave_history, 6));
$frmNode->addRow(S_DO_NOT_KEEP_TRENDS_OLDER_THAN, new CNumericBox('slave_trends', $slave_trends, 6));
$frmNode->addItemToBottomRow(new CButton('save', S_SAVE));
if (isset($_REQUEST['nodeid']) && $node_type != ZBX_NODE_LOCAL) {
$frmNode->addItemToBottomRow(SPACE);
$frmNode->addItemToBottomRow(new CButtonDelete('Delete selected node?', url_param('form') . url_param('nodeid')));
}
$frmNode->addItemToBottomRow(SPACE);
$frmNode->addItemToBottomRow(new CButtonCancel(url_param('config')));
$frmNode->Show();
} else {
show_table_header(S_NODES_BIG);
$table = new CTableInfo(S_NO_NODES_DEFINED);
$table->SetHeader(array(make_sorting_link(S_ID, 'n.nodeid'), make_sorting_link(S_NAME, 'n.name'), make_sorting_link(S_TYPE, 'n.nodetype'), make_sorting_link(S_TIME_ZONE, 'n.timezone'), make_sorting_link(S_IP . ':' . S_PORT, 'n.ip')));
$sql = 'SELECT n.* ' . ' FROM nodes n' . ' WHERE ' . DBcondition('n.nodeid', $available_nodes) . order_by('n.nodeid,n.name,n.nodetype,n.timezone,n.ip', 'n.masterid');
$db_nodes = DBselect($sql);
while ($row = DBfetch($db_nodes)) {
$node_type = detect_node_type($row);
$node_type_name = node_type2str($node_type);
$table->AddRow(array($row['nodeid'], array(get_node_path($row['masterid']), new CLink($row['nodetype'] ? new CSpan($row['name'], 'bold') : $row['name'], '?&form=update&nodeid=' . $row['nodeid'], 'action')), $node_type == ZBX_NODE_LOCAL ? new CSpan($node_type_name, 'bold') : $node_type_name, new CSpan('GMT' . sprintf('%+03d:00', $row['timezone']), $row['nodetype'] ? 'bold' : null), new CSpan($row['ip'] . ':' . $row['port'], $row['nodetype'] ? 'bold' : null)));
}
$table->Show();
}
include_once 'include/page_footer.php';
示例15: array
$rowz['items'] = array();
$triggers[$rowz['triggerid']] = $rowz;
$triggerids[$rowz['triggerid']] = $rowz['triggerid'];
}
$sql = 'SELECT f.triggerid, i.* ' . ' FROM functions f, items i ' . ' WHERE ' . DBcondition('f.triggerid', $triggerids) . ' AND i.itemid=f.itemid';
$result = DBselect($sql);
while ($row = DBfetch($result)) {
$item['itemid'] = $row['itemid'];
$item['action'] = str_in_array($row['value_type'], array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64)) ? 'showgraph' : 'showvalues';
$item['description'] = item_description($row);
$triggers[$row['triggerid']]['items'][$row['itemid']] = $item;
}
$sql_cond = $show_unknown == 0 ? ' AND e.value<>' . TRIGGER_VALUE_UNKNOWN . ' ' : '';
$sql_cond .= ' AND e.clock<' . $time_end;
$table = new CTableInfo(S_NO_EVENTS_FOUND);
$table->setHeader(array(make_sorting_link(S_TIME, 'clock'), is_show_all_nodes() ? S_NODE : null, $_REQUEST['hostid'] == 0 ? S_HOST : null, make_sorting_link(S_DESCRIPTION, 'desc'), make_sorting_link(S_STATUS, 'status'), make_sorting_link(S_SEVERITY, 'priority'), S_DURATION, $config['event_ack_enable'] ? S_ACK : NULL, S_ACTIONS));
if (!empty($triggers)) {
$clock = array();
$events = array();
$sql = 'SELECT e.eventid, e.objectid as triggerid, e.clock, e.value, e.acknowledged ' . ' FROM events e ' . ' WHERE ' . DBcondition('e.objectid', $triggerids) . ' AND (e.object+0)=' . EVENT_OBJECT_TRIGGER . $sql_cond . ' ORDER BY e.clock DESC';
$result = DBselect($sql, 0 == $show_unknown ? $limit * 50 : $limit);
while (($row = DBfetch($result)) && $col < $limit) {
$row = array_merge($triggers[$row['triggerid']], $row);
if (0 == $show_unknown && !event_initial_time($row, $show_unknown)) {
continue;
}
$row['desc'] = expand_trigger_description_by_data($row, ZBX_FLAG_EVENT);
$row['duration'] = zbx_date2age($row['clock']);
if ($next_event = get_next_event($row, $show_unknown)) {
$row['duration'] = zbx_date2age($row['clock'], $next_event['clock']);
}