本文整理汇总了PHP中CForm::GetName方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::GetName方法的具体用法?PHP CForm::GetName怎么用?PHP CForm::GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CCol
$table->setFooter(new CCol($form));
$table->showEnd();
} else {
/* table HOSTS */
$form = new CForm(null, 'post');
$form->SetName('hosts');
$form->AddVar('config', $config);
$form->AddVar('update', true);
$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);
}
$header = get_table_header(S_HOSTS_BIG, array(S_GROUP . SPACE, $cmbGroups));
$form->addItem($header);
$table = new CTableInfo(S_NO_HOSTS_DEFINED);
$table->setHeader(array(array(new CCheckBox("all_hosts", true, "CheckAll('" . $form->GetName() . "','all_hosts','hosts');"), make_sorting_link(S_NAME, 'h.host')), make_sorting_link(S_DNS, 'h.dns'), make_sorting_link(S_IP, 'h.ip'), make_sorting_link(S_PORT, 'h.port'), make_sorting_link(S_STATUS, 'h.status'), array(new CCheckBox("all_templates", true, "CheckAll('" . $form->GetName() . "','all_templates','templates');"), S_TEMPLATES), array(new CCheckBox("all_items", true, "CheckAll('" . $form->GetName() . "','all_items','items');"), S_ITEMS), array(new CCheckBox("all_triggers", true, "CheckAll('" . $form->GetName() . "','all_triggers','triggers');"), S_TRIGGERS), array(new CCheckBox("all_graphs", true, "CheckAll('" . $form->GetName() . "','all_graphs','graphs');"), S_GRAPHS)));
$sql_from = '';
$sql_where = '';
if ($_REQUEST['groupid'] > 0) {
$sql_from .= ' ,hosts_groups hg ';
$sql_where .= ' AND hg.groupid=' . $_REQUEST['groupid'] . ' AND hg.hostid=h.hostid ';
}
$hosts = array();
$hostids = array();
$sql = 'SELECT DISTINCT h.* ' . ' FROM hosts h ' . $sql_from . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . $sql_where . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ',' . HOST_STATUS_TEMPLATE . ')' . order_by('h.host,h.dns,h.ip,h.port,h.status');
$result = DBselect($sql);
while ($host = DBfetch($result)) {
$hosts[$host['hostid']] = $host;
$hostids[$host['hostid']] = $host['hostid'];
}
// templates
示例2: CTriggersInfo
* Form
*/
if ($_REQUEST['fullscreen']) {
$triggerInfo = new CTriggersInfo($_REQUEST['groupid'], $_REQUEST['hostid']);
$triggerInfo->hideHeader();
$triggerInfo->show();
}
$triggerForm = new CForm('get', 'acknow.php');
$triggerForm->setName('tr_status');
$triggerForm->addVar('backurl', $page['file']);
/*
* Table
*/
$showEventColumn = $config['event_ack_enable'] && $_REQUEST['show_events'] != EVENTS_OPTION_NOEVENT;
$switcherName = 'trigger_switchers';
$headerCheckBox = $showEventColumn ? new CCheckBox('all_events', false, "checkAll('" . $triggerForm->GetName() . "', 'all_events', 'events');") : new CCheckBox('all_triggers', false, "checkAll('" . $triggerForm->GetName() . "', 'all_triggers', 'triggers');");
if ($showEvents != EVENTS_OPTION_NOEVENT) {
$showHideAllDiv = new CDiv(SPACE, 'filterclosed');
$showHideAllDiv->setAttribute('id', $switcherName);
} else {
$showHideAllDiv = null;
}
$triggerTable = new CTableInfo(_('No triggers found.'));
$triggerTable->setHeader(array($showHideAllDiv, $config['event_ack_enable'] ? $headerCheckBox : null, make_sorting_header(_('Severity'), 'priority'), _('Status'), _('Info'), make_sorting_header(_('Last change'), 'lastchange'), _('Age'), $showEventColumn ? _('Duration') : null, $config['event_ack_enable'] ? _('Acknowledged') : null, $displayNodes ? _('Node') : null, _('Host'), make_sorting_header(_('Name'), 'description'), _('Comments')));
// get triggers
$sortfield = getPageSortField('description');
$sortorder = getPageSortOrder();
$options = array('output' => array('triggerid', $sortfield), 'nodeids' => get_current_nodeid(), 'monitored' => true, 'skipDependent' => true, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1);
if ($pageFilter->hostsSelected) {
if ($pageFilter->hostid > 0) {
$options['hostids'] = $pageFilter->hostid;
示例3: array
$params = array('hostids' => $hosts_linked_to, 'templated_hosts' => 1, 'editable' => 1, 'extendoutput' => 1);
$db_hosts = CHost::get($params);
order_result($db_hosts, 'host');
foreach ($db_hosts as $hnum => $db_host) {
$host_tb->addItem($db_host['hostid'], $db_host['host']);
}
$template_tbl->addRow(array(S_HOSTS . '|' . S_TEMPLATES, $host_tb->Get(S_IN, array(S_OTHER . SPACE . '|' . SPACE . S_GROUP . SPACE, $cmbGroups))));
// FORM ITEM : linked Template table
$tpl_table = new CTable();
$tpl_table->setCellPadding(0);
$tpl_table->setCellSpacing(0);
foreach ($templates as $tid => $tname) {
$frmHost->addVar('templates[' . $tid . ']', $tname);
$tpl_table->addRow(array($tname, new CButton('unlink[' . $tid . ']', S_UNLINK), isset($original_templates[$tid]) ? new CButton('unlink_and_clear[' . $tid . ']', S_UNLINK_AND_CLEAR) : SPACE));
}
$template_tbl->addRow(array(S_LINK_WITH_TEMPLATE, array($tpl_table, new CButton('add_template', S_ADD, 'return PopUp("popup.php?dstfrm=' . $frmHost->GetName() . '&dstfld1=new_template&srctbl=templates&srcfld1=hostid&srcfld2=host&excludeids[' . $templateid . ']=' . $templateid . url_param($templates, false, "existed_templates") . '",450,450)', 'T'))));
// FULL CLONE {
if ($_REQUEST['form'] == 'full_clone') {
// FORM ITEM : Template items
$items_lbx = new CListBox('items', null, 8);
$items_lbx->setAttribute('disabled', 'disabled');
$options = array('editable' => 1, 'hostids' => $templateid, 'output' => API_OUTPUT_EXTEND);
$template_items = CItem::get($options);
if (empty($template_items)) {
$items_lbx->setAttribute('style', 'width: 200px;');
} else {
foreach ($template_items as $inum => $titem) {
$item_description = item_description($titem);
$items_lbx->addItem($titem['itemid'], $item_description);
}
}
示例4: CSpan
$available = new CSpan(S_UNKNOWN, 'unknown');
}
}
}
$tbl_header_host = new CTableInfo();
$tbl_header_host->addRow(array(new CLink(bold(S_HOST_LIST), 'hosts.php?hostid=' . $header_host['hostid'] . url_param('groupid')), $description, $items, $graphs, array(bold(S_DNS . ': '), $dns), array(bold(S_IP . ': '), $ip), array(bold(S_PORT . ': '), $port), array(bold(S_STATUS . ': '), $status), array(bold(S_AVAILABILITY . ': '), $available)));
$tbl_header_host->setClass('infobox');
$tbl_header_host->show();
}
// --->>> SELECTED HOST HEADER INFORMATION <<<---
$form = new CForm('triggers.php');
$form->setName('triggers');
$form->setMethod('post');
$form->addVar('hostid', $_REQUEST['hostid']);
$table = new CTableInfo(S_NO_TRIGGERS_DEFINED);
$table->setHeader(array(new CCheckBox('all_triggers', NULL, "checkAll('" . $form->GetName() . "','all_triggers','g_triggerid');"), make_sorting_link(S_SEVERITY, 't.priority'), make_sorting_link(S_STATUS, 't.status'), $_REQUEST['hostid'] > 0 ? NULL : make_sorting_link(S_HOST, 'h.host'), make_sorting_link(S_NAME, 't.description'), S_EXPRESSION, S_ERROR));
$options = array('select_hosts' => 1, 'editable' => 1, 'extendoutput' => 1);
if ($showdisabled == 0) {
$options += array('status' => TRIGGER_STATUS_ENABLED);
}
if ($PAGE_HOSTS['selected'] > 0) {
$options += array('hostids' => $PAGE_HOSTS['selected']);
} else {
if ($PAGE_GROUPS['selected'] > 0) {
$options += array('groupids' => $PAGE_GROUPS['selected']);
}
}
$triggers = CTrigger::get($options);
foreach ($triggers as $triggerid => $trigger) {
$description = array();
if ($trigger['templateid'] > 0) {
示例5: DBcondition
} 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: CButtonCancel
}
$frmHostG->addItemToBottomRow($dltButton);
}
$frmHostG->addItemToBottomRow(SPACE);
$frmHostG->addItemToBottomRow(new CButtonCancel(url_param('config')));
$frmHostG->show();
} else {
$config = select_config();
$numrows = new CSpan(null, 'info');
$numrows->setAttribute('name', 'numrows');
$header = get_table_header(array(S_HOST_GROUPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
show_table_header($header);
$form = new CForm('hostgroups.php');
$form->setName('form_groups');
$table = new CTableInfo(S_NO_HOST_GROUPS_DEFINED);
$table->setHeader(array(new CCheckBox('all_groups', NULL, "checkAll('" . $form->GetName() . "','all_groups','groups');"), make_sorting_link(S_NAME, 'g.name'), ' # ', S_MEMBERS));
$groups = CHostGroup::get(array('order' => 'name', 'editable' => 1, 'extendoutput' => 1, 'select_hosts' => 1));
foreach ($groups as $groupid => $group) {
$tpl_count = 0;
$host_count = 0;
$i = 0;
$hosts_output = array();
foreach ($group['hosts'] as $hostid => $host) {
$i++;
if ($i > $config['max_in_table']) {
$hosts_output[] = '...';
$hosts_output[] = '//empty for array_pop';
break;
}
switch ($host['status']) {
case HOST_STATUS_NOT_MONITORED:
示例7: 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')));
示例8: CTriggersInfo
$filterForm->addItemToBottomRow($reset);
$trigg_wdgt->addFlicker($filterForm, get_profile('web.tr_status.filter.state', 0));
/*************** FILTER END ******************/
if ($_REQUEST['fullscreen']) {
$triggerInfo = new CTriggersInfo();
$triggerInfo->HideHeader();
$triggerInfo->show();
}
$m_form = new CForm('acknow.php');
$m_form->setName('tr_status');
$admin_links = $USER_DETAILS['type'] == USER_TYPE_ZABBIX_ADMIN || $USER_DETAILS['type'] == USER_TYPE_SUPER_ADMIN;
$table = new CTableInfo();
$table->showStart();
$header = array();
$show_event_col = $config['event_ack_enable'] && $show_events != EVENTS_OPTION_NOEVENT;
$table->setHeader(array($show_event_col ? new CCheckBox('all_events', false, "checkAll('" . $m_form->GetName() . "','all_events','events');") : NULL, make_sorting_link(S_SEVERITY, 't.priority'), S_STATUS, make_sorting_link(S_LAST_CHANGE, 't.lastchange'), is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, $_REQUEST['hostid'] > 0 ? null : make_sorting_link(S_HOST, 'h.host'), make_sorting_link(S_NAME, 't.description'), $_REQUEST['show_actions'] ? S_ACTIONS : NULL, $show_event_col ? S_ACKNOWLEDGED : NULL, S_COMMENTS));
$cond = $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] . ' ' : '';
switch ($show_triggers) {
case TRIGGERS_OPTION_ALL:
$cond .= '';
break;
case TRIGGERS_OPTION_NOFALSEFORB:
$cond .= '';
break;
case TRIGGERS_OPTION_ONLYTRUE:
default:
$cond .= ' AND ((t.value=' . TRIGGER_VALUE_TRUE . ') OR ((t.value=' . TRIGGER_VALUE_FALSE . ') AND ((' . time() . '-t.lastchange)<' . TRIGGER_FALSE_PERIOD . ')))';
break;
}
if ($show_severity > -1) {
$cond .= ' AND t.priority>=' . $show_severity;
示例9: CForm
$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);
示例10: while
while ($exp = DBfetch($db_exps)) {
if (!isset($expressions[$exp['regexpid']])) {
$count[$exp['regexpid']] = 1;
} else {
$count[$exp['regexpid']]++;
}
if (!isset($expressions[$exp['regexpid']])) {
$expressions[$exp['regexpid']] = new CTable();
}
$expressions[$exp['regexpid']]->addRow(array($count[$exp['regexpid']], ' » ', $exp['expression'], ' [' . expression_type2str($exp['expression_type']) . ']'));
$regexp[$exp['regexpid']]['expressions'][$exp['expressionid']] = $exp;
}
$form = new CForm(null, 'post');
$form->setName('regexp');
$table = new CTableInfo();
$table->setHeader(array(array(new CCheckBox('all_regexps', NULL, "CheckAll('" . $form->GetName() . "','all_regexps','group_regexpid');"), S_NAME), S_EXPRESSIONS));
foreach ($regexps as $regexpid => $regexp) {
$table->addRow(array(array(new CCheckBox('regexpids[' . $regexp['regexpid'] . ']', NULL, NULL, $regexp['regexpid']), new CLink($regexp['name'], 'config.php?form=update' . url_param('config') . '®expid=' . $regexp['regexpid'] . '#form', 'action')), isset($expressions[$regexpid]) ? $expressions[$regexpid] : '-'));
}
// $table->SetFooter(new CCol(new CButtonQMessage('delete_selected',S_DELETE_SELECTED,S_DELETE_SELECTED_USERS_Q)));
$table->SetFooter(new CCol(array(new CButtonQMessage('delete', S_DELETE_SELECTED, S_DELETE_SELECTED_REGULAR_EXPRESSIONS_Q))));
$form->AddItem($table);
$form->show();
}
}
}
}
}
}
}
include_once 'include/page_footer.php';
示例11: CComboBox
$l_header->AddVar('mark_color', $_REQUEST['mark_color']);
}
$cmbLogList = new CComboBox('cmbloglist');
if (is_array($_REQUEST['itemid'])) {
$cmbLogList->AddItem(0, $main_header);
foreach ($_REQUEST['itemid'] as $itemid) {
if (!($item = get_item_by_itemid($itemid)) || $item['value_type'] != ITEM_VALUE_TYPE_LOG) {
invalid_url();
}
$host = get_host_by_hostid($item['hostid']);
$cmbLogList->AddItem($itemid, $host['host'] . ': ' . item_description($item));
}
} else {
$cmbLogList->AddItem($_REQUEST['itemid'], $main_header);
}
$l_header->AddItem(array("Log files list", SPACE, $cmbLogList, SPACE, new CButton("add_log", "Add", "return PopUp('popup.php?" . "dstfrm=" . $l_header->GetName() . "&srctbl=logitems&dstfld1=itemid&srcfld1=itemid');"), SPACE, $cmbLogList->ItemsCount() > 1 ? new CButton("remove_log", "Remove selected") : null));
}
$form = new CForm();
$form->SetMethod('get');
$form->AddVar("itemid", $_REQUEST["itemid"]);
if (isset($_REQUEST["filter_task"])) {
$form->AddVar("filter_task", $_REQUEST["filter_task"]);
}
if (isset($_REQUEST["filter"])) {
$form->AddVar("filter", $_REQUEST["filter"]);
}
if (isset($_REQUEST["mark_color"])) {
$form->AddVar("mark_color", $_REQUEST["mark_color"]);
}
$cmbAction = new CComboBox("action", $_REQUEST["action"], "submit()");
if (str_in_array($item_type, array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64))) {
示例12: array
$items = array();
} else {
$items = CItem::get($options);
}
// Header Host
if ($hostid > 0) {
$tbl_header_host = get_header_host_table($hostid, array('triggers', 'applications', 'graphs'));
$items_wdgt->addItem($tbl_header_host);
$show_host = false;
}
$form = new CForm();
$form->setName('items');
$form->addVar('hostid', $hostid);
$table = new CTableInfo();
// Table Header //
$table->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $form->GetName() . "','all_items','group_itemid');"), S_WIZARD, $show_host ? S_HOST : null, make_sorting_header(S_DESCRIPTION, 'description'), S_TRIGGERS, make_sorting_header(S_KEY, 'key_'), make_sorting_header(S_INTERVAL, 'delay'), make_sorting_header(S_HISTORY, 'history'), make_sorting_header(S_TRENDS, 'trends'), make_sorting_header(S_TYPE, 'type'), make_sorting_header(S_STATUS, 'status'), S_APPLICATIONS, S_ERROR));
// SET VALUES FOR SUBFILTERS {
// if any of subfilters = false then item shouldnt be shown
foreach ($items as $num => $item) {
$item['hostids'] = zbx_objectValues($item['hosts'], 'hostid');
$item['subfilters'] = array();
$item['subfilters']['subfilter_hosts'] = empty($_REQUEST['subfilter_hosts']) || (bool) array_intersect($_REQUEST['subfilter_hosts'], $item['hostids']);
$item['subfilters']['subfilter_apps'] = false;
if (empty($_REQUEST['subfilter_apps'])) {
$item['subfilters']['subfilter_apps'] = true;
} else {
foreach ($item['applications'] as $app) {
if (str_in_array($app['name'], $_REQUEST['subfilter_apps'])) {
$item['subfilters']['subfilter_apps'] = true;
break;
}
示例13: CButton
$cmbConf->addItem('users.php', S_USERS);
$frmForm->addItem(array($cmbConf, SPACE, new CButton('form', S_CREATE_GROUP)));
$usrgroup_wdgt = new CWidget();
$usrgroup_wdgt->addPageHeader(S_CONFIGURATION_OF_USERS_AND_USER_GROUPS, $frmForm);
if (isset($_REQUEST['form'])) {
$usrgroup_wdgt->addItem(insert_usergroups_form());
} else {
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');
$usrgroup_wdgt->addHeader(S_USER_GROUPS_BIG);
$usrgroup_wdgt->addHeader($numrows);
// Groups table
$form = new CForm();
$form->setName('usrgrp_form');
$table = new CTableInfo(S_NO_USER_GROUPS_DEFINED);
$table->setHeader(array(new CCheckBox('all_groups', NULL, "checkAll('" . $form->GetName() . "','all_groups','group_groupid');"), make_sorting_header(S_NAME, 'name'), '#', S_MEMBERS, S_USERS_STATUS, S_GUI_ACCESS, S_API_ACCESS, S_DEBUG_MODE));
$sortfield = getPageSortField('name');
$sortorder = getPageSortOrder();
$options = array('output' => API_OUTPUT_EXTEND, 'select_users' => API_OUTPUT_EXTEND, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1);
$usrgrps = CUserGroup::get($options);
// sorting
order_result($usrgrps, $sortfield, $sortorder);
$paging = getPagingLine($usrgrps);
//---------
foreach ($usrgrps as $ugnum => $usrgrp) {
$usrgrpid = $usrgrp['usrgrpid'];
$api_access = $usrgrp['api_access'] == GROUP_API_ACCESS_ENABLED ? new CLink(S_ENABLED, 'usergrps.php?go=disable_api&usrgrpid=' . $usrgrpid, 'orange') : new CLink(S_DISABLED, 'usergrps.php?go=enable_api&usrgrpid=' . $usrgrpid, 'enabled');
$debug_mode = $usrgrp['debug_mode'] == GROUP_DEBUG_MODE_ENABLED ? new CLink(S_ENABLED, 'usergrps.php?go=disable_debug&usrgrpid=' . $usrgrpid, 'orange') : new CLink(S_DISABLED, 'usergrps.php?go=enable_debug&usrgrpid=' . $usrgrpid, 'enabled');
$gui_access = user_auth_type2str($usrgrp['gui_access']);
$gui_access_style = 'enabled';
if (GROUP_GUI_ACCESS_INTERNAL == $usrgrp['gui_access']) {
示例14: CButton
$frmHostG->addItemToBottomRow(new CButton('save', S_SAVE));
if ($_REQUEST['hostid'] > 0) {
$frmHostG->addItemToBottomRow(array(SPACE, new CButton('clone', S_CLONE), SPACE, new CButtonDelete(S_DELETE_SELECTED_PROXY_Q, url_param('form') . url_param('hostid')), SPACE));
}
$frmHostG->addItemToBottomRow(new CButtonCancel());
$proxies_wdgt->addItem($frmHostG);
$proxies_wdgt->show();
} else {
$numrows = new CDiv();
$numrows->setAttribute('name', 'numrows');
$proxies_wdgt->addHeader(S_PROXIES_BIG);
$proxies_wdgt->addHeader($numrows);
$form = new CForm('proxies.php', 'get');
$form->setName('hosts');
$table = new CTableInfo(S_NO_PROXIES_DEFINED);
$table->setHeader(array(new CCheckBox('all_hosts', NULL, "checkAll('" . $form->GetName() . "','all_hosts','hosts');"), make_sorting_header(S_NAME, 'host'), S_MODE, S_LASTSEEN_AGE, S_HOST_COUNT, S_ITEM_COUNT, S_REQUIRED_PERFORMANCE, S_HOSTS));
$sortfield = getPageSortField('host');
$sortorder = getPageSortOrder();
$options = array('editable' => 1, 'select_hosts' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1);
$proxies = CProxy::get($options);
$proxies = zbx_toHash($proxies, 'proxyid');
// ordering && paging
order_result($proxies, $sortfield, $sortorder);
$paging = getPagingLine($proxies);
// --
// CALCULATE PERFORMANCE {{{
$proxyids = array_keys($proxies);
$sql = '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 ' . DBcondition('h.proxy_hostid', $proxyids) . ' GROUP BY h.proxy_hostid';
$db_perf = DBselect($sql);
while ($perf = DBfetch($db_perf)) {
$proxies[$perf['proxy_hostid']]['perf'] = round($perf['qps'], 2);
示例15: 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']);