public function addItem($value, $caption = '', $selected = null, $enabled = true, $class = null) { if ($value instanceof CComboItem || $value instanceof COptGroup) { parent::addItem($value); } else { if (is_null($selected)) { $selected = 'no'; if (is_array($this->value)) { if (str_in_array($value, $this->value)) { $selected = 'yes'; } } elseif (strcmp($value, $this->value) == 0) { $selected = 'yes'; } } else { $selected = 'yes'; } $citem = new CComboItem($value, $caption, $selected, $enabled); if ($class !== null) { $citem->addClass($class); } parent::addItem($citem); } return $this; }
public function addItem($value, $caption = '', $selected = null, $enabled = 'yes') { if ($value instanceof CComboItem || $value instanceof COptGroup) { parent::addItem($value); } else { $title = false; // if caption is too long ( > 44 symbols), we add new class - 'selectShorten', // so that the select box would not stretch if (zbx_strlen($caption) > 44 && !$this->hasClass('selectShorten')) { $this->setAttribute('class', $this->getAttribute('class') . ' selectShorten'); $title = true; } if (is_null($selected)) { $selected = 'no'; if (is_array($this->value)) { if (str_in_array($value, $this->value)) { $selected = 'yes'; } } elseif (strcmp($value, $this->value) == 0) { $selected = 'yes'; } } else { $selected = 'yes'; } $citem = new CComboItem($value, $caption, $selected, $enabled); if ($title) { $citem->setTitle($caption); } parent::addItem($citem); } }
$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) { $interfacesComboBox->addItem($interfaceGroup); } $span = new CSpan(_('No interface found'), 'red'); $span->setAttribute('id', 'interface_not_defined'); $span->setAttribute('style', 'display: none;'); $itemFormList->addRow(_('Host interface'), array($interfacesComboBox, $span), false, 'interface_row'); $itemForm->addVar('selectedInterfaceId', $this->data['interfaceid']); } $itemFormList->addRow(_('SNMP OID'), new CTextBox('snmp_oid', $this->data['snmp_oid'], ZBX_TEXTBOX_STANDARD_SIZE, $this->data['limited']), false, 'row_snmp_oid'); $itemFormList->addRow(_('Context name'), new CTextBox('snmpv3_contextname', $this->data['snmpv3_contextname'], ZBX_TEXTBOX_STANDARD_SIZE), false, 'row_snmpv3_contextname'); $itemFormList->addRow(_('SNMP community'), new CTextBox('snmp_community', $this->data['snmp_community'], ZBX_TEXTBOX_STANDARD_SIZE, 'no', 64), false, 'row_snmp_community');
$name[] = NAME_DELIMITER; $name[] = new CSpan($graph['name']); $isCheckboxEnabled = false; } else { $name[] = new CLink($graph['name'], 'graphs.php?' . 'form=update' . '&graphid=' . $graphid . url_param('parent_discoveryid') . '&hostid=' . $this->data['hostid']); } $checkBox = new CCheckBox('group_graphid[' . $graphid . ']', null, null, $graphid); $checkBox->setEnabled($isCheckboxEnabled); $graphTable->addRow(array($checkBox, $this->data['displayNodes'] ? $graph['nodename'] : null, $hostList, $name, $graph['width'], $graph['height'], $graph['graphtype'])); } // create go buttons $goComboBox = new CComboBox('go'); if (!$this->data['parent_discoveryid']) { $goComboBox->addItem('copy_to', _('Copy selected to ...')); } $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', $this->data['parent_discoveryid'] ? _('Delete selected graph prototypes?') : _('Delete selected graphs?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->attr('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "group_graphid";'); if ($this->data['parent_discoveryid']) { zbx_add_post_js('chkbxRange.prefix = "' . $this->data['parent_discoveryid'] . '";'); zbx_add_post_js('cookie.prefix = "' . $this->data['parent_discoveryid'] . '";'); } else { zbx_add_post_js('chkbxRange.prefix = "' . $this->data['hostid'] . '";'); zbx_add_post_js('cookie.prefix = "' . $this->data['hostid'] . '";'); } // append table to form $graphForm->addItem(array($this->data['paging'], $graphTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton)))); // append form to widget
$caption[] = ')'; } $hostTemplates[] = $caption; $hostTemplates[] = ', '; } if ($hostTemplates) { array_pop($hostTemplates); } } $table->addRow(array(new CCheckBox('hosts[' . $host['hostid'] . ']', null, null, $host['hostid']), $displayNodes ? get_node_name_by_elid($host['hostid'], true) : null, $description, $applications, $items, $triggers, $graphs, $discoveries, $httpTests, $hostInterface, new CCol($hostTemplates, 'wraptext'), $status, getAvailabilityTable($host))); } $goBox = new CComboBox('go'); $goBox->addItem('export', _('Export selected')); $goBox->addItem('massupdate', _('Mass update')); $goOption = new CComboItem('activate', _('Enable selected')); $goOption->setAttribute('confirm', _('Enable selected hosts?')); $goBox->addItem($goOption); $goOption = new CComboItem('disable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected hosts?')); $goBox->addItem($goOption); $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected hosts?')); $goBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "hosts";'); $form->addItem(array($paging, $table, $paging, get_table_header(array($goBox, $goButton)))); $hostsWidget->addItem($form); } $hostsWidget->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$proxy = get_host_by_hostid($rule_data["proxy_hostid"]); array_push($description, $proxy["host"], ":"); } array_push($description, new CLink($rule_data['name'], "?form=update&druleid=" . $rule_data['druleid'])); $tblDiscovery->addRow(array(new CCheckBox('g_druleid[' . $rule_data["druleid"] . ']', null, null, $rule_data["druleid"]), $description, $rule_data['iprange'], $rule_data['delay'], implode(', ', $checks), $status)); } // pagination at the top and the bottom of the page $tblDiscovery->addRow(new CCol($paging)); $dscry_wdgt->addItem($paging); // gobox $goBox = new CComboBox('go'); $goOption = new CComboItem('activate', S_ENABLE_SELECTED); $goOption->setAttribute('confirm', S_ENABLE_SELECTED_DISCOVERY_RULES); $goBox->addItem($goOption); $goOption = new CComboItem('disable', S_DISABLE_SELECTED); $goOption->setAttribute('confirm', S_DISABLE_SELECTED_DISCOVERY_RULES); $goBox->addItem($goOption); $goOption = new CComboItem('delete', S_DELETE_SELECTED); $goOption->setAttribute('confirm', S_DELETE_SELECTED_DISCOVERY_RULES); $goBox->addItem($goOption); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "g_druleid";'); $tblDiscovery->setFooter(new CCol(array($goBox, $goButton))); //---- $form->addItem($tblDiscovery); $dscry_wdgt->addItem($form); } $dscry_wdgt->show(); include_once 'include/page_footer.php';
$style = 'unknown'; $url = 'templates.php?form=update&templateid=' . $linkedToHost['objectid']; break; default: $style = null; $url = 'hosts.php?form=update&hostid=' . $linkedToHost['objectid'] . '&groupid=' . $_REQUEST['groupid']; } if ($linkedToOutput) { $linkedToOutput[] = ', '; } $linkedToOutput[] = new CLink($linkedToHost['name'], $url, $style); } $table->addRow(array(new CCheckBox('templates[' . $template['templateid'] . ']', null, null, $template['templateid']), $templatesOutput, $applications, $items, $triggers, $graphs, $screens, $discoveries, $httpTests, $linkedTemplatesOutput ? new CCol($linkedTemplatesOutput, 'wraptext') : '-', $linkedToOutput ? new CCol($linkedToOutput, 'wraptext') : '-')); } $goBox = new CComboBox('action'); $goBox->addItem('template.export', _('Export selected')); $goOption = new CComboItem('template.massdelete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected templates?')); $goBox->addItem($goOption); $goOption = new CComboItem('template.massdeleteclear', _('Delete selected with linked elements')); $goOption->setAttribute('confirm', _('Delete and clear selected templates? (Warning: all linked hosts will be cleared!)')); $goBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "templates";'); $footer = get_table_header(array($goBox, $goButton)); $form->addItem(array($paging, $table, $paging, $footer)); $templateWidget->addItem($form); } $templateWidget->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
} if ($user['type'] == USER_TYPE_SUPER_ADMIN) { $userTypeStyle = 'disabled'; } // gui access style $guiAccessStyle = 'green'; if ($user['gui_access'] == GROUP_GUI_ACCESS_INTERNAL) { $guiAccessStyle = 'orange'; } if ($user['gui_access'] == GROUP_GUI_ACCESS_DISABLED) { $guiAccessStyle = 'disabled'; } // append user to table $usersTable->addRow(array(new CCheckBox('group_userid[' . $userId . ']', null, null, $userId), new CLink($user['alias'], 'users.php?form=update&userid=' . $userId), $user['name'], $user['surname'], user_type2str($user['type']), $usersGroups, $online, $blocked, new CSpan(user_auth_type2str($user['gui_access']), $guiAccessStyle), $user['debug_mode'] == GROUP_DEBUG_MODE_ENABLED ? new CSpan(_('Enabled'), 'orange') : new CSpan(_('Disabled'), 'green'), $user['users_status'] == 1 ? new CSpan(_('Disabled'), 'red') : new CSpan(_('Enabled'), 'green'))); } // append Go buttons $goComboBox = new CComboBox('action'); $goOption = new CComboItem('user.massunblock', _('Unblock selected')); $goOption->setAttribute('confirm', _('Unblock selected users?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('user.massdelete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected users?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "group_userid";'); // append table to form $usersForm->addItem(array($this->data['paging'], $usersTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton)))); // append form to widget $usersWidget->addItem($usersForm); return $usersWidget;
$map_wdgt->addHeader($numrows); $table = new CTableInfo(S_NO_MAPS_DEFINED); $table->setHeader(array(new CCheckBox('all_maps', NULL, "checkAll('" . $form->getName() . "','all_maps','maps');"), make_sorting_header(S_NAME, 'name'), make_sorting_header(S_WIDTH, 'width'), make_sorting_header(S_HEIGHT, 'height'), S_EDIT)); $sortfield = getPageSortField('name'); $sortorder = getPageSortOrder(); $options = array('editable' => 1, 'extendoutput' => 1, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1); $maps = CMap::get($options); // sorting order_result($maps, $sortfield, $sortorder); $paging = getPagingLine($maps); //------- foreach ($maps as $mnum => $map) { $table->addRow(array(new CCheckBox('maps[' . $map['sysmapid'] . ']', NULL, NULL, $map['sysmapid']), new CLink($map['name'], 'sysmap.php?sysmapid=' . $map['sysmapid']), $map['width'], $map['height'], new CLink(S_EDIT, 'sysmaps.php?form=update&sysmapid=' . $map['sysmapid'] . '#form'))); } // goBox $goBox = new CComboBox('go'); $goBox->addItem('export', S_EXPORT_SELECTED); $goOption = new CComboItem('delete', S_DELETE_SELECTED); $goOption->setAttribute('confirm', S_DELETE_SELECTED_MAPS_Q); $goBox->addItem($goOption); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "maps";'); $footer = get_table_header(array($goBox, $goButton)); $table = array($paging, $table, $paging, $footer); $form->addItem($table); $map_wdgt->addItem($form); } $map_wdgt->show(); include_once 'include/page_footer.php';
$name = new CLink($application['name'], 'applications.php?form=update&applicationid=' . $applicationid); } else { $template_host = get_realhost_by_applicationid($application['templateid']); $name = array(new CLink($template_host['host'], 'applications.php?hostid=' . $template_host['hostid']), ':', $application['name']); } $table->addRow(array(new CCheckBox('applications[' . $applicationid . ']', NULL, NULL, $applicationid), $_REQUEST['hostid'] > 0 ? null : $application['host'], $name, array(new CLink(S_ITEMS, 'items.php?hostid=' . $_REQUEST['hostid'] . '&filter_set=1&filter_application=' . urlencode($application['name'])), SPACE . '(' . count($application['items']) . ')'))); } // goBox $goBox = new CComboBox('go'); $goOption = new CComboItem('activate', S_ACTIVATE_SELECTED); $goOption->setAttribute('confirm', S_ACTIVATE_SELECTED_APPLICATIONS); $goBox->addItem($goOption); $goOption = new CComboItem('disable', S_DISABLE_SELECTED); $goOption->setAttribute('confirm', S_DISABLE_SELECTED_APPLICATIONS); $goBox->addItem($goOption); $goOption = new CComboItem('delete', S_DELETE_SELECTED); $goOption->setAttribute('confirm', S_DELETE_SELECTED_APPLICATIONS); $goBox->addItem($goOption); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "applications";'); $footer = get_table_header(new CCol(array($goBox, $goButton))); //---- $table = array($paging, $table, $paging, $footer); } $form->addItem($table); $app_wdgt->addItem($form); } $app_wdgt->show(); include_once 'include/page_footer.php';
$paging = getPagingLine($maintenances); foreach ($maintenances as $mnum => $maintenance) { $maintenanceid = $maintenance['maintenanceid']; switch ($maintenance['status']) { case MAINTENANCE_STATUS_EXPIRED: $mnt_status = new CSpan(S_EXPIRED, 'red'); break; case MAINTENANCE_STATUS_APPROACH: $mnt_status = new CSpan(S_APPROACHING, 'blue'); break; case MAINTENANCE_STATUS_ACTIVE: $mnt_status = new CSpan(S_ACTIVE, 'green'); break; } $table->addRow(array(new CCheckBox('maintenanceids[' . $maintenanceid . ']', NULL, NULL, $maintenanceid), new CLink($maintenance['name'], 'maintenance.php?form=update&maintenanceid=' . $maintenanceid . '#form'), $maintenance['maintenance_type'] ? S_NO_DATA_COLLECTION : S_WITH_DATA_COLLECTION, $mnt_status, $maintenance['description'])); } // goBox $goBox = new CComboBox('go'); $goOption = new CComboItem('delete', S_DELETE_SELECTED); $goOption->setAttribute('confirm', S_DELETE_SELECTED_MAINTENANCE_PERIODS_Q); $goBox->addItem($goOption); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "maintenanceids";'); $footer = get_table_header(array($goBox, $goButton)); $form->addItem(array($paging, $table, $paging, $footer)); $maintenance_wdgt->addItem($form); } $maintenance_wdgt->show(); include_once 'include/page_footer.php';
$hosts_output[] = ', '; } array_pop($hosts_output); $hostCount = $groupCounts[$group['groupid']]['hosts']; $templateCount = $groupCounts[$group['groupid']]['templates']; $table->addRow(array(new CCheckBox('groups[' . $group['groupid'] . ']', NULL, NULL, $group['groupid']), new CLink($group['name'], 'hostgroups.php?form=update&groupid=' . $group['groupid']), array(array(new CLink(S_TEMPLATES, 'templates.php?groupid=' . $group['groupid'], 'unknown'), ' (' . $templateCount . ')'), BR(), array(new CLink(S_HOSTS, 'hosts.php?groupid=' . $group['groupid']), ' (' . $hostCount . ')')), new CCol(empty($hosts_output) ? '-' : $hosts_output, 'wraptext'))); } //----- GO ------ $goBox = new CComboBox('go'); $goOption = new CComboItem('activate', S_ACTIVATE_SELECTED_HOSTS); $goOption->setAttribute('confirm', S_ENABLE_SELECTED_HOST_GROUPS); $goBox->addItem($goOption); $goOption = new CComboItem('disable', S_DISABLE_SELECTED_HOSTS); $goOption->setAttribute('confirm', S_DISABLE_SELECTED_HOST_GROUPS); $goBox->addItem($goOption); $goOption = new CComboItem('delete', S_DELETE_SELECTED_GROUPS); $goOption->setAttribute('confirm', S_DELETE_SELECTED_HOST_GROUPS); $goBox->addItem($goOption); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "groups";'); $footer = get_table_header(array($goBox, $goButton)); //---- // PAGING FOOTER $table = array($paging, $table, $paging, $footer); //--------- $form->addItem($table); $groups_wdgt->addItem($form); } $groups_wdgt->show();
$url = 'hosts.php?form=update&hostid=' . $linked_to_host['hostid'] . '&groupid=' . $_REQUEST['groupid']; break; } $linked_to_output[] = new CLink($linked_to_host['host'], $url, $style); $linked_to_output[] = ', '; } array_pop($linked_to_output); $table->addRow(array(new CCheckBox('templates[' . $template['templateid'] . ']', NULL, NULL, $template['templateid']), $templates_output, $applications, $items, $triggers, $graphs, empty($linked_templates_output) ? '-' : new CCol($linked_templates_output, 'wraptext'), empty($linked_to_output) ? '-' : new CCol($linked_to_output, 'wraptext'))); } // GO{ $goBox = new CComboBox('go'); $goBox->addItem('export', S_EXPORT_SELECTED); $goOption = new CComboItem('delete', S_DELETE_SELECTED); $goOption->setAttribute('confirm', S_DELETE_SELECTED_TEMPLATES_Q); $goBox->addItem($goOption); $goOption = new CComboItem('delete_and_clear', S_DELETE_SELECTED_WITH_LINKED_ELEMENTS); $goOption->setAttribute('confirm', S_WARNING_THIS_DELETE_TEMPLATES_AND_CLEAR); $goBox->addItem($goOption); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "templates";'); $footer = get_table_header(new CCol(array($goBox, $goButton))); // }GO // PAGING FOOTER $table = array($paging, $table, $paging, $footer); //--------- $form->addItem($table); $template_wdgt->addItem($form); } $template_wdgt->show();
order_result($action['operations'], 'operationtype', ZBX_SORT_DOWN); foreach ($action['operations'] as $onum => $operation) { $operations[] = array(get_operation_desc(SHORT_DESCRITION, $operation), BR()); } if ($action['status'] == ACTION_STATUS_DISABLED) { $status = new CLink(S_DISABLED, 'actionconf.php?go=activate&g_actionid%5B%5D=' . $action['actionid'] . url_param('eventsource'), 'disabled'); } else { $status = new CLink(S_ENABLED, 'actionconf.php?go=disable&g_actionid%5B%5D=' . $action['actionid'] . url_param('eventsource'), 'enabled'); } $tblActions->addRow(array(new CCheckBox('g_actionid[' . $action['actionid'] . ']', null, null, $action['actionid']), new CLink($action['name'], 'actionconf.php?form=update&actionid=' . $action['actionid']), $conditions, $operations, $status)); } //----- GO ------ $goBox = new CComboBox('go'); $goOption = new CComboItem('activate', S_ENABLE_SELECTED); $goOption->setAttribute('confirm', S_ENABLE . ' ' . S_SELECTED_ACTIONS); $goBox->addItem($goOption); $goOption = new CComboItem('disable', S_DISABLE_SELECTED); $goOption->setAttribute('confirm', S_DISABLE . ' ' . S_SELECTED_ACTIONS); $goBox->addItem($goOption); $goOption = new CComboItem('delete', S_DELETE_SELECTED); $goOption->setAttribute('confirm', S_DELETE . ' ' . S_SELECTED_ACTIONS); $goBox->addItem($goOption); $goButton = new CButton('goButton', S_GO); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "g_actionid";'); $footer = get_table_header(array($goBox, $goButton)); $form->addItem(array($paging, $tblActions, $paging, $footer)); $action_wdgt->addItem($form); } $action_wdgt->show(); include_once 'include/page_footer.php';
// 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'])); } // create go button $goComboBox = new CComboBox('go'); $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected maintenance periods?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "maintenanceids";'); // append table to form $maintenanceForm->addItem(array($this->data['paging'], $maintenanceTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton)))); // append form to widget $maintenanceWidget->addItem($maintenanceForm); return $maintenanceWidget;
$discoveryWidget->addHeaderRowNumber(); // create form $discoveryForm = new CForm(); $discoveryForm->setName('druleForm'); // create table $discoveryTable = new CTableInfo(_('No discovery rules found.')); $discoveryTable->setHeader(array(new CCheckBox('all_drules', null, "checkAll('" . $discoveryForm->getName() . "', 'all_drules', 'g_druleid');"), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('IP range'), _('Delay'), _('Checks'), _('Status'))); foreach ($data['drules'] as $drule) { array_push($drule['description'], new CLink($drule['name'], '?form=update&druleid=' . $drule['druleid'])); $status = new CCol(new CLink(discovery_status2str($drule['status']), '?g_druleid[]=' . $drule['druleid'] . '&action=' . ($drule['status'] == DRULE_STATUS_ACTIVE ? 'drule.massdisable' : 'drule.massenable'), discovery_status2style($drule['status']))); $discoveryTable->addRow(array(new CCheckBox('g_druleid[' . $drule['druleid'] . ']', null, null, $drule['druleid']), $drule['description'], $drule['iprange'], $drule['delay'], !empty($drule['checks']) ? implode(', ', $drule['checks']) : '', $status)); } // create go buttons $goComboBox = new CComboBox('action'); $goOption = new CComboItem('drule.massenable', _('Enable selected')); $goOption->setAttribute('confirm', _('Enable selected discovery rules?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('drule.massdisable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected discovery rules?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('drule.massdelete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected discovery rules?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "g_druleid";'); // append table to form $discoveryForm->addItem(array($this->data['paging'], $discoveryTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton)))); // append form to widget $discoveryWidget->addItem($discoveryForm); return $discoveryWidget;
$regExpForm = new CForm(); $regExpForm->setName('regularExpressionsForm'); $regExpForm->addItem(BR()); $regExpTable = new CTableInfo(_('No regular expressions found.')); $regExpTable->setHeader(array(new CCheckBox('all_regexps', null, "checkAll('regularExpressionsForm', 'all_regexps', 'regexpids');"), $this->data['displayNodes'] ? _('Node') : null, _('Name'), _('Expressions'))); $expressions = array(); $values = array(); foreach ($this->data['db_exps'] as $exp) { if (!isset($expressions[$exp['regexpid']])) { $values[$exp['regexpid']] = 1; } else { $values[$exp['regexpid']]++; } if (!isset($expressions[$exp['regexpid']])) { $expressions[$exp['regexpid']] = new CTable(); } $expressions[$exp['regexpid']]->addRow(array($values[$exp['regexpid']], ' » ', $exp['expression'], ' [' . expression_type2str($exp['expression_type']) . ']')); } foreach ($this->data['regexps'] as $regexpid => $regexp) { $regExpTable->addRow(array(new CCheckBox('regexpids[' . $regexp['regexpid'] . ']', null, null, $regexp['regexpid']), $this->data['displayNodes'] ? $regexp['nodename'] : null, new CLink($regexp['name'], 'adm.regexps.php?form=update' . '®expid=' . $regexp['regexpid']), isset($expressions[$regexpid]) ? $expressions[$regexpid] : '-')); } $goBox = new CComboBox('go'); $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected regular expressions?')); $goBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "regexpids";'); $regExpTable->setFooter(new CCol(array($goBox, $goButton))); $regExpForm->addItem($regExpTable); return $regExpForm;
$hostTemplates[] = ', '; } if ($hostTemplates) { array_pop($hostTemplates); } } // status $status = new CLink(item_status2str($hostPrototype['status']), '?group_hostid=' . $hostPrototype['hostid'] . '&parent_discoveryid=' . $discoveryRule['itemid'] . '&go=' . ($hostPrototype['status'] ? 'activate' : 'disable'), itemIndicatorStyle($hostPrototype['status'])); $hostTable->addRow(array(new CCheckBox('group_hostid[' . $hostPrototype['hostid'] . ']', null, null, $hostPrototype['hostid']), $name, new CCol($hostTemplates, 'wraptext'), $status)); } // create go buttons $goComboBox = new CComboBox('go'); $goOption = new CComboItem('activate', _('Activate selected')); $goOption->setAttribute('confirm', _('Enable selected host prototypes?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('disable', _('Disable selected')); $goOption->setAttribute('confirm', _('Disable selected host prototypes?')); $goComboBox->addItem($goOption); $goOption = new CComboItem('delete', _('Delete selected')); $goOption->setAttribute('confirm', _('Delete selected host prototypes?')); $goComboBox->addItem($goOption); $goButton = new CSubmit('goButton', _('Go') . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "group_hostid";'); zbx_add_post_js('chkbxRange.prefix = "' . $discoveryRule['itemid'] . '";'); zbx_add_post_js('cookie.prefix = "' . $discoveryRule['itemid'] . '";'); // append table to form $itemForm->addItem(array($this->data['paging'], $hostTable, $this->data['paging'], get_table_header(array($goComboBox, $goButton)))); // append form to widget $itemsWidget->addItem($itemForm); return $itemsWidget;
} } // PAGING FOOTER // $table->addRow(new CCol($paging)); // $http_wdgt->addItem($paging); //--------- //----- GO ------ $goBox = new CComboBox('go'); $goOption = new CComboItem('activate', S_ACTIVATE_SELECTED); $goOption->setAttribute('confirm', S_ENABLE_SELECTED_WEB_SCENARIOS_Q); $goBox->addItem($goOption); $goOption = new CComboItem('disable', S_DISABLE_SELECTED); $goOption->setAttribute('confirm', S_DISABLE_SELECTED_WEB_SCENARIOS_Q); $goBox->addItem($goOption); $goOption = new CComboItem('clean_history', S_CLEAR_HISTORY_FOR_SELECTED); $goOption->setAttribute('confirm', S_DELETE_HISTORY_SELECTED_WEB_SCENARIOS_Q); $goBox->addItem($goOption); $goOption = new CComboItem('delete', S_DELETE_SELECTED); $goOption->setAttribute('confirm', S_DELETE_SELECTED_WEB_SCENARIOS_Q); $goBox->addItem($goOption); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "group_httptestid";'); $table->setFooter(new CCol(array($goBox, $goButton))); //---- $form->addItem($table); $http_wdgt->addItem($form); } $http_wdgt->show(); include_once 'include/page_footer.php';