本文整理汇总了PHP中CForm::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::getName方法的具体用法?PHP CForm::getName怎么用?PHP CForm::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CForm
// header
$configForm = new CForm('get');
$configComboBox = new CComboBox('config', 'auditacts.php');
$configComboBox->setAttribute('onchange', 'javascript: redirect(this.options[this.selectedIndex].value);');
$configComboBox->addItem('auditlogs.php', _('Logs'));
$configComboBox->addItem('auditacts.php', _('Actions'));
$configForm->addItem($configComboBox);
$auditWidget->addPageHeader(_('AUDIT ACTIONS'), $configForm);
$auditWidget->addHeader(_('Actions'));
$auditWidget->addHeaderRowNumber();
// create filter
$filterForm = new CForm('get');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterTable = new CTable('', 'filter');
$filterTable->addRow(array(array(bold(_('Recipient')), SPACE, new CTextBox('alias', $this->data['alias'], 20), new CButton('btn1', _('Select'), 'return PopUp(\'popup.php?dstfrm=' . $filterForm->getName() . '&dstfld1=alias&srctbl=users&srcfld1=alias&real_hosts=1\');', 'T'))));
$filterButton = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true);");
$filterButton->useJQueryStyle('main');
$resetButton = new CButton('filter_rst', _('Reset'), 'javascript: var uri = new Curl(location.href); uri.setArgument("filter_rst", 1); location.href = uri.getUrl();');
$resetButton->useJQueryStyle();
$buttonsDiv = new CDiv(array($filterButton, SPACE, $resetButton));
$buttonsDiv->setAttribute('style', 'padding: 4px 0px;');
$filterTable->addRow(new CCol($buttonsDiv, 'controls'));
$filterForm->addItem($filterTable);
$auditWidget->addFlicker($filterForm, CProfile::get('web.auditacts.filter.state', 1));
$auditWidget->addFlicker(new CDiv(null, null, 'scrollbar_cntr'), CProfile::get('web.auditacts.filter.state', 1));
// create form
$auditForm = new CForm('get');
$auditForm->setName('auditForm');
// create table
$auditTable = new CTableInfo(_('No actions defined.'));
示例2: CSpan
$itemsWidget->addPageHeader(_('CONFIGURATION OF ITEM PROTOTYPES'), $createForm);
// header
$itemsWidget->addHeader(array(_('Item prototypes of') . SPACE, new CSpan($this->data['discovery_rule']['name'], 'parent-discovery')));
$itemsWidget->addHeaderRowNumber();
$itemsWidget->addItem(get_header_host_table('items', $this->data['hostid'], $this->data['parent_discoveryid']));
// create form
$itemForm = new CForm();
$itemForm->setName('items');
$itemForm->addVar('hostid', $this->data['hostid']);
$itemForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
// create table
$itemTable = new CTableInfo(_('No item prototypes found.'));
$sortLink = new CUrl();
$sortLink->setArgument('parent_discoveryid', $this->data['parent_discoveryid']);
$sortLink = $sortLink->getUrl();
$itemTable->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $itemForm->getName() . "', 'all_items', 'group_itemid');"), make_sorting_header(_('Name'), 'name', $sortLink), make_sorting_header(_('Key'), 'key_', $sortLink), make_sorting_header(_('Interval'), 'delay', $sortLink), make_sorting_header(_('History'), 'history', $sortLink), make_sorting_header(_('Trends'), 'trends', $sortLink), make_sorting_header(_('Type'), 'type', $sortLink), _('Applications'), make_sorting_header(_('Status'), 'status', $sortLink)));
foreach ($this->data['items'] as $item) {
$description = array();
if (!empty($item['templateid'])) {
$template_host = get_realhost_by_itemid($item['templateid']);
$templateDiscoveryRuleId = get_realrule_by_itemid_and_hostid($this->data['parent_discoveryid'], $template_host['hostid']);
$description[] = new CLink($template_host['name'], '?parent_discoveryid=' . $templateDiscoveryRuleId, 'unknown');
$description[] = NAME_DELIMITER;
}
$description[] = new CLink($item['name_expanded'], '?form=update&itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid']);
$status = new CLink(itemIndicator($item['status']), '?group_itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid'] . '&go=' . ($item['status'] ? 'activate' : 'disable'), itemIndicatorStyle($item['status']));
if (!empty($item['applications'])) {
order_result($item['applications'], 'name');
$applications = zbx_objectValues($item['applications'], 'name');
$applications = implode(', ', $applications);
if (empty($applications)) {
示例3: CWidget
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
$mediaTypeWidget = new CWidget();
// create new media type button
$createForm = new CForm('get');
$createForm->addItem(new CSubmit('form', _('Create media type')));
$mediaTypeWidget->addPageHeader(_('CONFIGURATION OF MEDIA TYPES'), $createForm);
$mediaTypeWidget->addHeader(_('Media types'));
$mediaTypeWidget->addHeaderRowNumber();
// create form
$mediaTypeForm = new CForm();
$mediaTypeForm->setName('mediaTypesForm');
// create table
$mediaTypeTable = new CTableInfo(_('No media types found.'));
$mediaTypeTable->setHeader(array(new CCheckBox('all_media_types', null, "checkAll('" . $mediaTypeForm->getName() . "', 'all_media_types', 'mediatypeids');"), $this->data['displayNodes'] ? _('Node') : null, make_sorting_header(_('Name'), 'description'), make_sorting_header(_('Type'), 'type'), _('Status'), _('Used in actions'), _('Details')));
foreach ($this->data['mediatypes'] as $mediaType) {
switch ($mediaType['typeid']) {
case MEDIA_TYPE_EMAIL:
$details = _('SMTP server') . NAME_DELIMITER . '"' . $mediaType['smtp_server'] . '", ' . _('SMTP helo') . NAME_DELIMITER . '"' . $mediaType['smtp_helo'] . '", ' . _('SMTP email') . NAME_DELIMITER . '"' . $mediaType['smtp_email'] . '"';
break;
case MEDIA_TYPE_EXEC:
$details = _('Script name') . NAME_DELIMITER . '"' . $mediaType['exec_path'] . '"';
break;
case MEDIA_TYPE_SMS:
$details = _('GSM modem') . NAME_DELIMITER . '"' . $mediaType['gsm_modem'] . '"';
break;
case MEDIA_TYPE_JABBER:
$details = _('Jabber identifier') . NAME_DELIMITER . '"' . $mediaType['username'] . '"';
break;
case MEDIA_TYPE_EZ_TEXTING:
示例4: CWidget
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
$proxyWidget = new CWidget();
// create new proxy button
$createForm = new CForm('get');
$createForm->cleanItems();
$createForm->addItem(new CSubmit('form', _('Create proxy')));
$proxyWidget->addPageHeader(_('CONFIGURATION OF PROXIES'), $createForm);
$proxyWidget->addHeader(_('Proxies'));
$proxyWidget->addHeaderRowNumber();
// create form
$proxyForm = new CForm('get');
$proxyForm->setName('proxyForm');
// create table
$proxyTable = new CTableInfo(_('No proxies found.'));
$proxyTable->setHeader(array(new CCheckBox('all_hosts', null, "checkAll('" . $proxyForm->getName() . "', 'all_hosts', 'hosts');"), make_sorting_header(_('Name'), 'host', $this->data['sort'], $this->data['sortorder']), _('Mode'), _('Last seen (age)'), _('Host count'), _('Item count'), _('Required performance (vps)'), _('Hosts')));
foreach ($this->data['proxies'] as $proxy) {
$hosts = array();
if (!empty($proxy['hosts'])) {
$i = 1;
foreach ($proxy['hosts'] as $host) {
if ($i > $this->data['config']['max_in_table']) {
$hosts[] = ' …';
break;
}
$i++;
if ($host['status'] == HOST_STATUS_MONITORED) {
$style = 'off';
} elseif ($host['status'] == HOST_STATUS_TEMPLATE) {
$style = 'unknown';
} else {
示例5: 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)));
示例6: dirname
**/
require_once dirname(__FILE__) . '/js/configuration.triggers.expression.js.php';
$expressionWidget = new CWidget();
// create form
$expressionForm = new CForm();
$expressionForm->setName('expression');
$expressionForm->addVar('dstfrm', $this->data['dstfrm']);
$expressionForm->addVar('dstfld1', $this->data['dstfld1']);
$expressionForm->addVar('itemid', $this->data['itemid']);
if (!empty($this->data['parent_discoveryid'])) {
$expressionForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
}
// create form list
$expressionFormList = new CFormList('expressionFormList');
// append item to form list
$item = array(new CTextBox('description', $this->data['description'], ZBX_TEXTBOX_STANDARD_SIZE, 'yes'), new CButton('select', _('Select'), 'return PopUp(\'popup.php?writeonly=1&dstfrm=' . $expressionForm->getName() . '&dstfld1=itemid&dstfld2=description&submitParent=1' . (!empty($this->data['parent_discoveryid']) ? '&normal_only=1' : '') . '&srctbl=items&srcfld1=itemid&srcfld2=name\', 0, 0, \'zbx_popup_item\');', 'formlist'));
if (!empty($this->data['parent_discoveryid'])) {
$item[] = new CButton('select', _('Select prototype'), 'return PopUp(\'popup.php?dstfrm=' . $expressionForm->getName() . '&dstfld1=itemid&dstfld2=description&submitParent=1' . url_param('parent_discoveryid', true) . '&srctbl=prototypes&srcfld1=itemid&srcfld2=name\', 0, 0, \'zbx_popup_item\');', 'formlist');
}
$expressionFormList->addRow(_('Item'), $item);
// append function to form list
$functionComboBox = new CComboBox('expr_type', $this->data['expr_type'], 'submit()');
$functionComboBox->addStyle('width: 605px;');
foreach ($this->data['functions'] as $id => $f) {
// if user has selected an item, we are filtering out the triggers that can't work with it
if (empty($this->data['itemValueType']) || !empty($f['allowed_types'][$this->data['itemValueType']])) {
$functionComboBox->addItem($id, $f['description']);
}
}
$expressionFormList->addRow(_('Function'), $functionComboBox);
if (isset($this->data['functions'][$this->data['function'] . '[' . $this->data['operator'] . ']']['params'])) {
示例7: CForm
// create new maintenance button
$createForm = new CForm('get');
$createForm->cleanItems();
$createForm->addItem(new CSubmit('form', _('Create maintenance period')));
$maintenanceWidget->addPageHeader(_('CONFIGURATION OF MAINTENANCE PERIODS'), $createForm);
// header
$filterForm = new CForm('get');
$filterForm->addItem(array(_('Group') . SPACE, $this->data['pageFilter']->getGroupsCB(true)));
$maintenanceWidget->addHeader(_('Maintenance periods'), $filterForm);
$maintenanceWidget->addHeaderRowNumber();
// create form
$maintenanceForm = new CForm();
$maintenanceForm->setName('maintenanceForm');
// create table
$maintenanceTable = new CTableInfo(_('No maintenance periods found.'));
$maintenanceTable->setHeader(array(new CCheckBox('all_maintenances', null, "checkAll('" . $maintenanceForm->getName() . "', 'all_maintenances', 'maintenanceids');"), $this->data['displayNodes'] ? _('Node') : null, make_sorting_header(_('Name'), 'name'), make_sorting_header(_('Type'), 'maintenance_type'), _('State'), _('Description')));
foreach ($this->data['maintenances'] as $maintenance) {
$maintenanceid = $maintenance['maintenanceid'];
switch ($maintenance['status']) {
case MAINTENANCE_STATUS_EXPIRED:
$maintenanceStatus = new CSpan(_x('Expired', 'maintenance status'), 'red');
break;
case MAINTENANCE_STATUS_APPROACH:
$maintenanceStatus = new CSpan(_x('Approaching', 'maintenance status'), 'blue');
break;
case MAINTENANCE_STATUS_ACTIVE:
$maintenanceStatus = new CSpan(_x('Active', 'maintenance status'), 'green');
break;
}
$maintenanceTable->addRow(array(new CCheckBox('maintenanceids[' . $maintenanceid . ']', null, null, $maintenanceid), $this->data['displayNodes'] ? $maintenance['nodename'] : null, new CLink($maintenance['name'], 'maintenance.php?form=update&maintenanceid=' . $maintenanceid), $maintenance['maintenance_type'] ? _('No data collection') : _('With data collection'), $maintenanceStatus, $maintenance['description']));
}
示例8: array
$caption = '';
$id = 0;
$graphs = API::Graph()->get(array('graphids' => $resourceId, 'selectHosts' => array('hostid', 'name', 'status'), 'output' => API_OUTPUT_EXTEND));
if (!empty($graphs)) {
$id = $resourceId;
$graph = reset($graphs);
order_result($graph['hosts'], 'name');
$graph['host'] = reset($graph['hosts']);
$caption = $graph['host']['name'] . NAME_DELIMITER . $graph['name'];
$nodeName = get_node_name_by_elid($graph['host']['hostid']);
if (!zbx_empty($nodeName)) {
$caption = '(' . $nodeName . ') ' . $caption;
}
}
if ($this->data['screen']['templateid']) {
$selectButton = new CButton('select', _('Select'), 'javascript: return PopUp("popup.php?srctbl=graphs&srcfld1=graphid&srcfld2=name' . '&dstfrm=' . $screenForm->getName() . '&dstfld1=resourceid&dstfld2=caption' . '&templated_hosts=1&only_hostid=' . $this->data['screen']['templateid'] . '&writeonly=1", 800, 450);', 'formlist');
} else {
$selectButton = new CButton('select', _('Select'), 'javascript: return PopUp("popup.php?srctbl=graphs&srcfld1=graphid&srcfld2=name' . '&dstfrm=' . $screenForm->getName() . '&dstfld1=resourceid&dstfld2=caption' . '&real_hosts=1&with_graphs=1&writeonly=1", 800, 450);', 'formlist');
}
$screenFormList->addVar('resourceid', $id);
$screenFormList->addRow(_('Graph name'), array(new CTextBox('caption', $caption, ZBX_TEXTBOX_STANDARD_SIZE, 'yes'), $selectButton));
} elseif ($resourceType == SCREEN_RESOURCE_SIMPLE_GRAPH) {
$caption = '';
$id = 0;
$items = API::Item()->get(array('itemids' => $resourceId, 'selectHosts' => array('name'), 'output' => array('itemid', 'hostid', 'key_', 'name')));
if ($items) {
$items = CMacrosResolverHelper::resolveItemNames($items);
$id = $resourceId;
$item = reset($items);
$item['host'] = reset($item['hosts']);
$caption = $item['host']['name'] . NAME_DELIMITER . $item['name_expanded'];
示例9: CButton
$createForm->addVar('templateid', $this->data['templateid']);
$screenWidget->addItem(get_header_host_table('screens', $this->data['templateid']));
} else {
$createForm->addItem(new CButton('form', _('Import'), 'redirect("conf.import.php?rules_preset=screen")'));
}
$screenWidget->addPageHeader(_('CONFIGURATION OF SCREENS'), $createForm);
// header
$screenWidget->addHeader(_('Screens'));
$screenWidget->addHeaderRowNumber();
// create form
$screenForm = new CForm();
$screenForm->setName('screenForm');
$screenForm->addVar('templateid', $this->data['templateid']);
// create table
$screenTable = new CTableInfo(_('No screens found.'));
$screenTable->setHeader(array(new CCheckBox('all_screens', null, "checkAll('" . $screenForm->getName() . "', 'all_screens', 'screens');"), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('Dimension (cols x rows)'), _('Screen')));
foreach ($this->data['screens'] as $screen) {
$screenTable->addRow(array(new CCheckBox('screens[' . $screen['screenid'] . ']', null, null, $screen['screenid']), new CLink($screen['name'], 'screenedit.php?screenid=' . $screen['screenid'] . url_param('templateid')), $screen['hsize'] . ' x ' . $screen['vsize'], new CLink(_('Edit'), '?form=update&screenid=' . $screen['screenid'] . url_param('templateid'))));
}
// create go button
$goComboBox = new CComboBox('action');
if (empty($this->data['templateid'])) {
$goComboBox->addItem('screen.export', _('Export selected'));
}
$goOption = new CComboItem('screen.massdelete', _('Delete selected'));
$goOption->setAttribute('confirm', _('Delete selected screens?'));
$goComboBox->addItem($goOption);
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
$goButton->setAttribute('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "screens";');
// append table to form
示例10: CWidget
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
$scriptsWidget = new CWidget();
$createForm = new CForm('get');
$createForm->addItem(new CSubmit('form', _('Create script')));
$scriptsWidget->addPageHeader(_('CONFIGURATION OF SCRIPTS'), $createForm);
$scriptsWidget->addHeader(_('Scripts'));
$scriptsWidget->addHeaderRowNumber();
$scriptsForm = new CForm();
$scriptsForm->setName('scriptsForm');
$scriptsForm->setAttribute('id', 'scripts');
$scriptsTable = new CTableInfo(_('No scripts found.'));
$scriptsTable->setHeader(array(new CCheckBox('all_scripts', null, "checkAll('" . $scriptsForm->getName() . "', 'all_scripts', 'scripts');"), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('Type'), _('Execute on'), make_sorting_header(_('Commands'), 'command', $this->data['sort'], $this->data['sortorder']), _('User group'), _('Host group'), _('Host access')));
foreach ($this->data['scripts'] as $script) {
switch ($script['type']) {
case ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT:
$scriptType = _('Script');
break;
case ZBX_SCRIPT_TYPE_IPMI:
$scriptType = _('IPMI');
break;
default:
$scriptType = '';
break;
}
if ($script['type'] == ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT) {
switch ($script['execute_on']) {
case ZBX_SCRIPT_EXECUTE_ON_AGENT:
示例11: CTextBox
if (!$data['is_profile']) {
$nameTextBox = new CTextBox('alias', $this->data['alias'], ZBX_TEXTBOX_STANDARD_SIZE);
$nameTextBox->attr('autofocus', 'autofocus');
$userFormList->addRow(_('Alias'), $nameTextBox);
$userFormList->addRow(_x('Name', 'user first name'), new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE));
$userFormList->addRow(_('Surname'), new CTextBox('surname', $this->data['surname'], ZBX_TEXTBOX_STANDARD_SIZE));
}
// append user groups to form list
if (!$this->data['is_profile']) {
$userForm->addVar('user_groups', $this->data['user_groups']);
$lstGroups = new CListBox('user_groups_to_del[]', null, 10);
$lstGroups->attributes['style'] = 'width: 320px';
foreach ($this->data['groups'] as $group) {
$lstGroups->addItem($group['usrgrpid'], $group['name']);
}
$userFormList->addRow(_('Groups'), array($lstGroups, new CButton('add_group', _('Add'), 'return PopUp("popup_usrgrp.php?dstfrm=' . $userForm->getName() . '&list_name=user_groups_to_del[]&var_name=user_groups", 450, 450);', 'formlist'), BR(), count($this->data['user_groups']) > 0 ? new CSubmit('del_user_group', _('Delete selected'), null, 'formlist') : null));
}
// append password to form list
if ($data['auth_type'] == ZBX_AUTH_INTERNAL) {
if (!$this->data['userid'] || isset($this->data['change_password'])) {
$userFormList->addRow(_('Password'), new CPassBox('password1', $this->data['password1'], ZBX_TEXTBOX_SMALL_SIZE));
$userFormList->addRow(_('Password (once again)'), new CPassBox('password2', $this->data['password2'], ZBX_TEXTBOX_SMALL_SIZE));
if (isset($this->data['change_password'])) {
$userForm->addVar('change_password', $this->data['change_password']);
}
} else {
$passwdButton = new CSubmit('change_password', _('Change password'), null, 'formlist');
if ($this->data['alias'] == ZBX_GUEST_USER) {
$passwdButton->setAttribute('disabled', 'disabled');
}
$userFormList->addRow(_('Password'), $passwdButton);
示例12: 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++;
示例13: CWidget
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
$dashconfWidget = new CWidget();
$dashconfWidget->setClass('header');
$dashconfWidget->addPageHeader(_('DASHBOARD CONFIGURATION'));
// create form
$dashconfForm = new CForm();
$dashconfForm->setName('dashconf');
$dashconfForm->setAttribute('id', 'dashform');
$dashconfForm->addVar('filterEnable', $this->data['isFilterEnable']);
// create form list
$dashconfFormList = new CFormList('dashconfFormList');
// append filter status to form list
if ($this->data['isFilterEnable']) {
$filterStatusSpan = new CSpan(_('Enabled'), 'green underline pointer');
$filterStatusSpan->setAttribute('onclick', "create_var('" . $dashconfForm->getName() . "', 'filterEnable', 0, true);");
} else {
$filterStatusSpan = new CSpan(_('Disabled'), 'red underline pointer');
$filterStatusSpan->setAttribute('onclick', "\$('dashform').enable(); create_var('" . $dashconfForm->getName() . "', 'filterEnable', 1, true);");
}
$dashconfFormList->addRow(_('Dashboard filter'), $filterStatusSpan);
// append host groups to form list
$hostGroupsComboBox = new CComboBox('grpswitch', $this->data['grpswitch'], 'submit();');
$hostGroupsComboBox->addItem(0, _('All'));
$hostGroupsComboBox->addItem(1, _('Selected'));
if (!$this->data['isFilterEnable']) {
$hostGroupsComboBox->setAttribute('disabled', 'disabled');
}
$dashconfFormList->addRow(_('Host groups'), $hostGroupsComboBox);
if ($this->data['grpswitch']) {
$dashconfFormList->addRow(_('Show selected groups'), new CMultiSelect(array('name' => 'groupids[]', 'objectName' => 'hostGroup', 'data' => $this->data['groups'], 'disabled' => !$this->data['isFilterEnable'], 'popup' => array('parameters' => 'srctbl=host_groups&dstfrm=' . $dashconfForm->getName() . '&dstfld1=groupids_' . '&srcfld1=groupid&multiselect=1', 'width' => 450, 'height' => 450))));
示例14: getRequest
$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);
$frmForm = new CForm();
$frmForm->cleanItems();
$frmForm->addItem(new CDiv(array(new CSubmit('form', _('Create template')), new CButton('form', _('Import'), 'redirect("conf.import.php?rules_preset=template")'))));
$frmForm->addItem(new CVar('groupid', $_REQUEST['groupid'], 'filter_groupid_id'));
$templateWidget->addPageHeader(_('CONFIGURATION OF TEMPLATES'), $frmForm);
$frmGroup = new CForm('get');
$frmGroup->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB()));
$templateWidget->addHeader(_('Templates'), $frmGroup);
$templateWidget->addHeaderRowNumber();
$form = new CForm();
$form->setName('templates');
$table = new CTableInfo(_('No templates found.'));
$table->setHeader(array(new CCheckBox('all_templates', null, "checkAll('" . $form->getName() . "', 'all_templates', 'templates');"), make_sorting_header(_('Templates'), 'name', $sortField, $sortOrder), _('Applications'), _('Items'), _('Triggers'), _('Graphs'), _('Screens'), _('Discovery'), _('Web'), _('Linked templates'), _('Linked to')));
// get templates
$templates = array();
if ($pageFilter->groupsSelected) {
$templates = API::Template()->get(array('output' => array('templateid', 'name'), 'groupids' => $pageFilter->groupid > 0 ? $pageFilter->groupid : null, 'editable' => true, 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1));
}
// sorting && paging
order_result($templates, $sortField, $sortOrder);
$paging = getPagingLine($templates);
$templates = API::Template()->get(array('templateids' => zbx_objectValues($templates, 'templateid'), 'editable' => true, 'output' => array('name', 'proxy_hostid'), 'selectHosts' => array('hostid', 'name', 'status'), 'selectTemplates' => array('hostid', 'name', 'status'), 'selectParentTemplates' => array('hostid', 'name', 'status'), 'selectItems' => API_OUTPUT_COUNT, 'selectTriggers' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT, 'selectApplications' => API_OUTPUT_COUNT, 'selectDiscoveries' => API_OUTPUT_COUNT, 'selectScreens' => API_OUTPUT_COUNT, 'selectHttpTests' => API_OUTPUT_COUNT, 'nopermissions' => true));
order_result($templates, $sortField, $sortOrder);
foreach ($templates as $template) {
$templatesOutput = array();
if ($template['proxy_hostid']) {
$proxy = get_host_by_hostid($template['proxy_hostid']);
$templatesOutput[] = $proxy['host'] . NAME_DELIMITER;
示例15: CTextBox
}
}
$nameTextBox = new CTextBox('name', $this->data['name'], ZBX_TEXTBOX_STANDARD_SIZE, $this->data['limited']);
$nameTextBox->attr('autofocus', 'autofocus');
$itemFormList->addRow(_('Name'), $nameTextBox);
// append type to form list
if ($this->data['limited']) {
$itemForm->addVar('type', $this->data['type']);
$itemFormList->addRow(_('Type'), new CTextBox('typename', item_type2str($this->data['type']), ZBX_TEXTBOX_STANDARD_SIZE, 'yes'));
} else {
$typeComboBox = new CComboBox('type', $this->data['type']);
$typeComboBox->addItems($this->data['types']);
$itemFormList->addRow(_('Type'), $typeComboBox);
}
// append key to form list
$itemFormList->addRow(_('Key'), array(new CTextBox('key', $this->data['key'], ZBX_TEXTBOX_STANDARD_SIZE, $this->data['limited']), !$this->data['limited'] && !$this->data['is_discovery_rule'] ? new CButton('keyButton', _('Select'), 'return PopUp("popup.php?srctbl=help_items&srcfld1=key' . '&dstfrm=' . $itemForm->getName() . '&dstfld1=key&itemtype="+jQuery("#type option:selected").val());', 'formlist') : null));
// append interfaces to form list
if (!empty($this->data['interfaces'])) {
$interfacesComboBox = new CComboBox('interfaceid', $this->data['interfaceid']);
// set up interface groups
$interfaceGroups = array();
foreach (zbx_objectValues($this->data['interfaces'], 'type') as $interfaceType) {
$interfaceGroups[$interfaceType] = new COptGroup(interfaceType2str($interfaceType));
}
// add interfaces to groups
foreach ($this->data['interfaces'] as $interface) {
$option = new CComboItem($interface['interfaceid'], $interface['useip'] ? $interface['ip'] . ' : ' . $interface['port'] : $interface['dns'] . ' : ' . $interface['port'], $interface['interfaceid'] == $this->data['interfaceid'] ? 'yes' : 'no');
$option->setAttribute('data-interfacetype', $interface['type']);
$interfaceGroups[$interface['type']]->addItem($option);
}
foreach ($interfaceGroups as $interfaceGroup) {