**
** 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.
**/
$itemsWidget = new CWidget();
$discoveryRule = $this->data['discovery_rule'];
// create new item button
$createForm = new CForm('get');
$createForm->cleanItems();
$createForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
$createForm->addItem(new CSubmit('form', _('Create host prototype')));
$itemsWidget->addPageHeader(_('CONFIGURATION OF HOST PROTOTYPES'), $createForm);
// header
$itemsWidget->addHeader(array(_('Host prototypes of') . SPACE, new CSpan($this->data['discovery_rule']['name'], 'parent-discovery')));
$itemsWidget->addHeaderRowNumber();
$itemsWidget->addItem(get_header_host_table('hosts', $discoveryRule['hostid'], $this->data['parent_discoveryid']));
// create form
$itemForm = new CForm();
$itemForm->setName('hosts');
$itemForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
// create table
$hostTable = new CTableInfo(_('No host prototypes found.'));
$sortLink = new CUrl();
$sortLink->setArgument('parent_discoveryid', $this->data['parent_discoveryid']);
$sortLink = $sortLink->getUrl();
$hostTable->setHeader(array(new CCheckBox('all_hosts', null, "checkAll('" . $itemForm->getName() . "', 'all_hosts', 'group_hostid');"), make_sorting_header(_('Name'), 'name', $sortLink), _('Templates'), make_sorting_header(_('Status'), 'status', $sortLink)));
foreach ($this->data['hostPrototypes'] as $hostPrototype) {
    // name
    $name = array();
    if ($hostPrototype['templateid']) {
        $hosts_wdgt->addItem(get_header_host_table('', $_REQUEST['hostid']));
    }
    $hostForm = new CView('configuration.host.edit');
    $hosts_wdgt->addItem($hostForm->render());
    $hosts_wdgt->setRootClass('host-edit');
} else {
    $frmForm = new CForm();
    $frmForm->cleanItems();
    $buttons = new CDiv(array(new CSubmit('form', _('Create host')), new CButton('form', _('Import'), 'redirect("conf.import.php?rules_preset=host")')));
    $frmForm->addItem($buttons);
    $frmForm->addItem(new CVar('groupid', $_REQUEST['groupid'], 'filter_groupid_id'));
    $hosts_wdgt->addPageHeader(_('CONFIGURATION OF HOSTS'), $frmForm);
    $frmGroup = new CForm('get');
    $frmGroup->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB()));
    $hosts_wdgt->addHeader(_('Hosts'), $frmGroup);
    $hosts_wdgt->addHeaderRowNumber();
    $hosts_wdgt->setRootClass('host-list');
    // filter
    $filter_table = new CTable('', 'filter');
    $filter_table->addRow(array(array(array(bold(_('Name')), SPACE . _('like') . ': '), new CTextBox('filter_host', $_REQUEST['filter_host'], 20)), array(array(bold(_('DNS')), SPACE . _('like') . ': '), new CTextBox('filter_dns', $_REQUEST['filter_dns'], 20)), array(array(bold(_('IP')), SPACE . _('like') . ': '), new CTextBox('filter_ip', $_REQUEST['filter_ip'], 20)), array(bold(_('Port') . ': '), new CTextBox('filter_port', $_REQUEST['filter_port'], 20))));
    $filter = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true);");
    $filter->useJQueryStyle('main');
    $reset = new CButton('reset', _('Reset'), "javascript: clearAllForm('zbx_filter');");
    $reset->useJQueryStyle();
    $div_buttons = new CDiv(array($filter, SPACE, $reset));
    $div_buttons->setAttribute('style', 'padding: 4px 0;');
    $filter_table->addRow(new CCol($div_buttons, 'center', 4));
    $filter_form = new CForm('get');
    $filter_form->setAttribute('name', 'zbx_filter');
    $filter_form->setAttribute('id', 'zbx_filter');
    $filter_form->addItem($filter_table);
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** 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.
**/
$discoveryWidget = new CWidget();
// create new discovery rule button
$createForm = new CForm('get');
$createForm->cleanItems();
$createForm->addItem(new CSubmit('form', _('Create discovery rule')));
$discoveryWidget->addPageHeader(_('CONFIGURATION OF DISCOVERY RULES'), $createForm);
$discoveryWidget->addHeader(_('Discovery rules'));
$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?'));
$createForm->cleanItems();
$configurationComboBox = new CComboBox('config', 'users.php', 'javascript: redirect(this.options[this.selectedIndex].value);');
$configurationComboBox->addItem('usergrps.php', _('User groups'));
$configurationComboBox->addItem('users.php', _('Users'));
$createForm->addItem(array($configurationComboBox, new CSubmit('form', _('Create user'))));
$usersWidget->addPageHeader(_('CONFIGURATION OF USERS'), $createForm);
// append form header to widget
$userGroupListForm = new CForm('get');
$userGroupComboBox = new CComboBox('filter_usrgrpid', $_REQUEST['filter_usrgrpid'], 'submit()');
$userGroupComboBox->addItem(0, _('All'));
foreach ($this->data['userGroups'] as $userGroup) {
    $userGroupComboBox->addItem($userGroup['usrgrpid'], $userGroup['name']);
}
$userGroupListForm->addItem(array(_('User group') . SPACE, $userGroupComboBox));
$usersWidget->addHeader(_('Users'), $userGroupListForm);
$usersWidget->addHeaderRowNumber();
// create form
$usersForm = new CForm();
$usersForm->setName('userForm');
// create users table
$usersTable = new CTableInfo(_('No users found.'));
$usersTable->setHeader(array(new CCheckBox('all_users', null, "checkAll('" . $usersForm->getName() . "', 'all_users', 'group_userid');"), make_sorting_header(_('Alias'), 'alias', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_x('Name', 'user first name'), 'name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Surname'), 'surname', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('User type'), 'type', $this->data['sort'], $this->data['sortorder']), _('Groups'), _('Is online?'), _('Login'), _('Frontend access'), _('Debug mode'), _('Status')));
foreach ($this->data['users'] as $user) {
    $userId = $user['userid'];
    $session = $this->data['usersSessions'][$userId];
    // online time
    if ($session['lastaccess']) {
        $onlineTime = $user['autologout'] == 0 || ZBX_USER_ONLINE_TIME < $user['autologout'] ? ZBX_USER_ONLINE_TIME : $user['autologout'];
        $online = $session['lastaccess'] + $onlineTime >= time() ? new CCol(_('Yes') . ' (' . zbx_date2str(DATE_TIME_FORMAT_SECONDS, $session['lastaccess']) . ')', 'enabled') : new CCol(_('No') . ' (' . zbx_date2str(DATE_TIME_FORMAT_SECONDS, $session['lastaccess']) . ')', 'disabled');
    } else {
        $online = new CCol(_('No'), 'disabled');
** 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.
**/
$sysmapWidget = new CWidget();
// create header buttons
$createForm = new CForm('get');
$createForm->cleanItems();
$createForm->addItem(new CSubmit('form', _('Create map')));
$createForm->addItem(new CButton('form', _('Import'), 'redirect("conf.import.php?rules_preset=map")'));
$sysmapWidget->addPageHeader(_('CONFIGURATION OF NETWORK MAPS'), $createForm);
// create form
$sysmapForm = new CForm();
$sysmapForm->setName('frm_maps');
$sysmapWidget->addHeader(_('Maps'));
$sysmapWidget->addHeaderRowNumber();
// create table
$sysmapTable = new CTableInfo(_('No maps found.'));
$sysmapTable->setHeader(array(new CCheckBox('all_maps', null, "checkAll('" . $sysmapForm->getName() . "', 'all_maps', 'maps');"), $this->data['displayNodes'] ? _('Node') : null, make_sorting_header(_('Name'), 'name'), make_sorting_header(_('Width'), 'width'), make_sorting_header(_('Height'), 'height'), _('Edit')));
foreach ($this->data['maps'] as $map) {
    $sysmapTable->addRow(array(new CCheckBox('maps[' . $map['sysmapid'] . ']', null, null, $map['sysmapid']), $this->data['displayNodes'] ? $map['nodename'] : null, new CLink($map['name'], 'sysmap.php?sysmapid=' . $map['sysmapid']), $map['width'], $map['height'], new CLink(_('Edit'), 'sysmaps.php?form=update&sysmapid=' . $map['sysmapid'] . '#form')));
}
// create go button
$goComboBox = new CComboBox('go');
$goComboBox->addItem('export', _('Export selected'));
$goOption = new CComboItem('delete', _('Delete selected'));
$goOption->setAttribute('confirm', _('Delete selected maps?'));
$goComboBox->addItem($goOption);
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
$goButton->setAttribute('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "maps";');
**
** 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.
**/
$maintenanceWidget = new CWidget();
// 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;
    $createForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
    $triggersWidget->addPageHeader(_('CONFIGURATION OF TRIGGER PROTOTYPES'), $createForm);
} else {
    if (empty($this->data['hostid'])) {
        $createButton = new CSubmit('form', _('Create trigger (select host first)'));
        $createButton->setEnabled(false);
        $createForm->addItem($createButton);
    } else {
        $createForm->addItem(new CSubmit('form', _('Create trigger')));
    }
    $triggersWidget->addPageHeader(_('CONFIGURATION OF TRIGGERS'), $createForm);
}
// create widget header
if (!empty($this->data['parent_discoveryid'])) {
    $triggersWidget->addHeader(array(_('Trigger prototypes of') . SPACE, new CSpan($this->data['discovery_rule']['name'], 'parent-discovery')));
    $triggersWidget->addHeaderRowNumber(array('[ ', new CLink($this->data['showdisabled'] ? _('Hide disabled trigger prototypes') : _('Show disabled trigger prototypes'), 'trigger_prototypes.php?' . 'showdisabled=' . ($this->data['showdisabled'] ? 0 : 1) . '&hostid=' . $this->data['hostid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid']), ' ]'));
} else {
    $filterForm = new CForm('get');
    $filterForm->addItem(array(_('Group') . SPACE, $this->data['pageFilter']->getGroupsCB()));
    $filterForm->addItem(array(SPACE . _('Host') . SPACE, $this->data['pageFilter']->getHostsCB()));
    $triggersWidget->addHeader(_('Triggers'), $filterForm);
    $triggersWidget->addHeaderRowNumber(array('[ ', new CLink($this->data['showdisabled'] ? _('Hide disabled triggers') : _('Show disabled triggers'), 'triggers.php?' . 'hostid=' . $this->data['hostid'] . '&showdisabled=' . ($this->data['showdisabled'] ? 0 : 1)), ' ]'));
}
// create form
$triggersForm = new CForm();
$triggersForm->setName('triggersForm');
$triggersForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
$triggersForm->addVar('hostid', $this->data['hostid']);
// create table
$triggersTable = new CTableInfo(_('No triggers found.'));
$triggersTable->setHeader(array(new CCheckBox('all_triggers', null, "checkAll('" . $triggersForm->getName() . "', 'all_triggers', 'g_triggerid');"), make_sorting_header(_('Severity'), 'priority', $this->data['sort'], $this->data['sortorder']), empty($this->data['hostid']) ? _('Host') : null, make_sorting_header(_('Name'), 'description', $this->data['sort'], $this->data['sortorder']), _('Expression'), make_sorting_header(_('Status'), 'status', $this->data['sort'], $this->data['sortorder']), $data['showInfoColumn'] ? _('Info') : null));
    $rootClass = 'host-edit';
    if (get_request('hostid') && $dbHost['flags'] == ZBX_FLAG_DISCOVERY_CREATED) {
        $rootClass .= ' host-edit-discovered';
    }
    $hostsWidget->setRootClass($rootClass);
} else {
    $displayNodes = is_array(get_current_nodeid()) && $pageFilter->groupid == 0;
    $frmForm = new CForm();
    $frmForm->cleanItems();
    $frmForm->addItem(new CDiv(array(new CSubmit('form', _('Create host')), new CButton('form', _('Import'), 'redirect("conf.import.php?rules_preset=host")'))));
    $frmForm->addItem(new CVar('groupid', $_REQUEST['groupid'], 'filter_groupid_id'));
    $hostsWidget->addPageHeader(_('CONFIGURATION OF HOSTS'), $frmForm);
    $frmGroup = new CForm('get');
    $frmGroup->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
    $hostsWidget->addHeader(_('Hosts'), $frmGroup);
    $hostsWidget->addHeaderRowNumber();
    $hostsWidget->setRootClass('host-list');
    // filter
    $filterTable = new CTable('', 'filter');
    $filterTable->addRow(array(array(array(bold(_('Name')), SPACE . _('like') . NAME_DELIMITER), new CTextBox('filter_host', $_REQUEST['filter_host'], 20)), array(array(bold(_('DNS')), SPACE . _('like') . NAME_DELIMITER), new CTextBox('filter_dns', $_REQUEST['filter_dns'], 20)), array(array(bold(_('IP')), SPACE . _('like') . NAME_DELIMITER), new CTextBox('filter_ip', $_REQUEST['filter_ip'], 20)), array(bold(_('Port') . NAME_DELIMITER), new CTextBox('filter_port', $_REQUEST['filter_port'], 20))));
    $filter = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true); chkbxRange.clearSelectedOnFilterChange();");
    $filter->useJQueryStyle('main');
    $reset = new CButton('reset', _('Reset'), "javascript: clearAllForm('zbx_filter');");
    $reset->useJQueryStyle();
    $divButtons = new CDiv(array($filter, SPACE, $reset));
    $divButtons->setAttribute('style', 'padding: 4px 0;');
    $filterTable->addRow(new CCol($divButtons, 'center', 4));
    $filterForm = new CForm('get');
    $filterForm->setAttribute('name', 'zbx_filter');
    $filterForm->setAttribute('id', 'zbx_filter');
    $filterForm->addItem($filterTable);
Beispiel #9
0
/*
 * Display
 */
$displayNodes = is_show_all_nodes() && $pageFilter->groupid == 0 && $pageFilter->hostid == 0;
$showTriggers = $_REQUEST['show_triggers'];
$showEvents = $_REQUEST['show_events'];
$showSeverity = $_REQUEST['show_severity'];
$ackStatus = $_REQUEST['ack_status'];
$triggerWidget = new CWidget();
$rightForm = new CForm('get');
$rightForm->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
$rightForm->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true)));
$rightForm->addVar('fullscreen', $_REQUEST['fullscreen']);
$triggerWidget->addPageHeader(_('STATUS OF TRIGGERS') . SPACE . '[' . zbx_date2str(_('d M Y H:i:s')) . ']', get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
$triggerWidget->addHeader(_('Triggers'), $rightForm);
$triggerWidget->addHeaderRowNumber();
/*
 * Filter
 */
$filterForm = new CFormTable(null, null, 'get');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addVar('fullscreen', $_REQUEST['fullscreen']);
$filterForm->addVar('groupid', $_REQUEST['groupid']);
$filterForm->addVar('hostid', $_REQUEST['hostid']);
$statusComboBox = new CComboBox('show_triggers', $showTriggers);
$statusComboBox->addItem(TRIGGERS_OPTION_ALL, _('Any'));
$statusComboBox->additem(TRIGGERS_OPTION_ONLYTRUE, _('Problem'));
$filterForm->addRow(_('Triggers status'), $statusComboBox);
if ($config['event_ack_enable']) {
    $ackStatusComboBox = new CComboBox('ack_status', $ackStatus);
$createForm->addVar('hostid', $this->data['hostid']);
if (empty($this->data['hostid'])) {
    $createButton = new CSubmit('form', _('Create scenario (select host first)'));
    $createButton->setEnabled(false);
    $createForm->addItem($createButton);
} else {
    $createForm->addItem(new CSubmit('form', _('Create scenario')));
    $httpWidget->addItem(get_header_host_table('web', $this->data['hostid']));
}
$httpWidget->addPageHeader(_('CONFIGURATION OF WEB MONITORING'), $createForm);
// header
$filterForm = new CForm('get');
$filterForm->addItem(array(_('Group') . SPACE, $this->data['pageFilter']->getGroupsCB(true)));
$filterForm->addItem(array(SPACE . _('Host') . SPACE, $this->data['pageFilter']->getHostsCB(true)));
$httpWidget->addHeader(_('Scenarios'), $filterForm);
$httpWidget->addHeaderRowNumber(array('[ ', new CLink($this->data['showDisabled'] ? _('Hide disabled scenarios') : _('Show disabled scenarios'), '?showdisabled=' . ($this->data['showDisabled'] ? 0 : 1), null), ' ]'));
// create form
$httpForm = new CForm();
$httpForm->setName('scenarios');
$httpForm->addVar('hostid', $this->data['hostid']);
$httpTable = new CTableInfo(_('No web scenarios found.'));
$httpTable->setHeader(array(new CCheckBox('all_httptests', null, "checkAll('" . $httpForm->getName() . "', 'all_httptests', 'group_httptestid');"), $this->data['displayNodes'] ? _('Node') : null, $this->data['hostid'] == 0 ? make_sorting_header(_('Host'), 'hostname') : null, make_sorting_header(_('Name'), 'name'), _('Number of steps'), _('Update interval'), make_sorting_header(_('Status'), 'status')));
foreach ($this->data['httpTests'] as $httpTestId => $httpTest) {
    $name = array();
    if (isset($this->data['parentTemplates'][$httpTestId])) {
        $template = $this->data['parentTemplates'][$httpTestId];
        $name[] = new CLink($template['name'], '?groupid=0&hostid=' . $template['id'], 'unknown');
        $name[] = NAME_DELIMITER;
    }
    $name[] = new CLink($httpTest['name'], '?form=update' . '&httptestid=' . $httpTest['httptestid'] . '&hostid=' . $httpTest['hostid']);
    $httpTable->addRow(array(new CCheckBox('group_httptestid[' . $httpTest['httptestid'] . ']', null, null, $httpTest['httptestid']), $this->data['displayNodes'] ? $httpTest['nodename'] : null, $this->data['hostid'] > 0 ? null : $httpTest['hostname'], $name, $httpTest['stepscnt'], $httpTest['delay'], new CLink(httptest_status2str($httpTest['status']), '?group_httptestid[]=' . $httpTest['httptestid'] . '&hostid=' . $httpTest['hostid'] . '&go=' . ($httpTest['status'] ? 'activate' : 'disable'), httptest_status2style($httpTest['status']))));
**/
$hostGroupWidget = new CWidget();
// create new hostgroup button
$createForm = new CForm('get');
$createForm->cleanItems();
if (CWebUser::getType() == USER_TYPE_SUPER_ADMIN) {
    $tmpItem = new CSubmit('form', _('Create host group'));
} else {
    $tmpItem = new CSubmit('form', _('Create host group') . SPACE . _('(Only super admins can create groups)'));
    $tmpItem->setEnabled(false);
}
$createForm->addItem($tmpItem);
$hostGroupWidget->addPageHeader(_('CONFIGURATION OF HOST GROUPS'), $createForm);
// header
$hostGroupWidget->addHeader(_('Host groups'));
$hostGroupWidget->addHeaderRowNumber();
// create form
$hostGroupForm = new CForm();
$hostGroupForm->setName('hostgroupForm');
// if any of the groups are about to be deleted, show the status column
$showStatus = false;
foreach ($this->data['groups'] as $hostGroup) {
    if ($hostGroup['groupDiscovery'] && $hostGroup['groupDiscovery']['ts_delete']) {
        $showStatus = true;
        break;
    }
}
// create table
$hostGroupTable = new CTableInfo(_('No host groups found.'));
$hostGroupTable->setHeader(array(new CCheckBox('all_groups', null, "checkAll('" . $hostGroupForm->getName() . "', 'all_groups', 'groups');"), $this->data['displayNodes'] ? _('Node') : null, make_sorting_header(_('Name'), 'name'), ' # ', _('Members'), $showStatus ? _('Status') : null));
foreach ($this->data['groups'] as $group) {
// append host summary to widget header
if (empty($this->data['hostid'])) {
    $createButton = new CSubmit('form', _('Create application (select host first)'));
    $createButton->setEnabled(false);
    $createForm->addItem($createButton);
} else {
    $createForm->addItem(new CSubmit('form', _('Create application')));
    $applicationWidget->addItem(get_header_host_table('applications', $this->data['hostid']));
}
$applicationWidget->addPageHeader(_('CONFIGURATION OF APPLICATIONS'), $createForm);
// create widget header
$filterForm = new CForm('get');
$filterForm->addItem(array(_('Group') . SPACE, $this->data['pageFilter']->getGroupsCB(true)));
$filterForm->addItem(array(SPACE . _('Host') . SPACE, $this->data['pageFilter']->getHostsCB(true)));
$applicationWidget->addHeader(_('Applications'), $filterForm);
$applicationWidget->addHeaderRowNumber();
// create form
$applicationForm = new CForm();
$applicationForm->setName('applicationForm');
$applicationForm->addVar('groupid', $this->data['groupid']);
$applicationForm->addVar('hostid', $this->data['hostid']);
// create table
$applicationTable = new CTableInfo(_('No applications found.'));
$applicationTable->setHeader(array(new CCheckBox('all_applications', null, "checkAll('" . $applicationForm->getName() . "', 'all_applications', 'applications');"), $this->data['displayNodes'] ? _('Node') : null, $this->data['hostid'] > 0 ? null : _('Host'), make_sorting_header(_('Application'), 'name'), _('Show')));
foreach ($this->data['applications'] as $application) {
    // inherited app, display the template list
    if ($application['templateids'] && !empty($application['sourceTemplates'])) {
        $name = array();
        CArrayHelper::sort($application['sourceTemplates'], array('name'));
        foreach ($application['sourceTemplates'] as $template) {
            $name[] = new CLink($template['name'], 'applications.php?hostid=' . $template['hostid'], 'unknown');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$r_form->addVar('stime', get_request('stime'));
$r_form->addVar('period', get_request('period'));
// add host and group filters to the form
if ($source == EVENT_SOURCE_TRIGGERS) {
    $r_form->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
    $r_form->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true)));
}
if ($allow_discovery) {
    $cmbSource = new CComboBox('source', $source, 'submit()');
    $cmbSource->addItem(EVENT_SOURCE_TRIGGERS, _('Trigger'));
    $cmbSource->addItem(EVENT_SOURCE_DISCOVERY, _('Discovery'));
    $r_form->addItem(array(SPACE . _('Source') . SPACE, $cmbSource));
}
$events_wdgt->addHeader(_('Events'), $r_form);
$events_wdgt->addHeaderRowNumber();
// FILTER {{{
$filterForm = null;
if (EVENT_SOURCE_TRIGGERS == $source) {
    $filterForm = new CFormTable(null, null, 'get');
    //,'events.php?filter_set=1','POST',null,'sform');
    $filterForm->setAttribute('name', 'zbx_filter');
    $filterForm->setAttribute('id', 'zbx_filter');
    $filterForm->addVar('triggerid', get_request('triggerid'));
    $filterForm->addVar('stime', get_request('stime'));
    $filterForm->addVar('period', get_request('period'));
    if (isset($_REQUEST['triggerid']) && $_REQUEST['triggerid'] > 0) {
        $dbTrigger = API::Trigger()->get(array('triggerids' => $_REQUEST['triggerid'], 'output' => array('description', 'expression'), 'selectHosts' => array('name'), 'preservekeys' => true, 'expandDescription' => true));
        // check if trigger is accessible
        if ($dbTrigger) {
            $dbTrigger = reset($dbTrigger);
// create new action button
$createForm = new CForm('get');
$createForm->cleanItems();
$createForm->addVar('eventsource', $this->data['eventsource']);
$createForm->addItem(new CSubmit('form', _('Create action')));
$actionWidget->addPageHeader(_('CONFIGURATION OF ACTIONS'), $createForm);
// create widget header
$sourceComboBox = new CComboBox('eventsource', $this->data['eventsource'], 'submit()');
$sourceComboBox->addItem(EVENT_SOURCE_TRIGGERS, _('Triggers'));
$sourceComboBox->addItem(EVENT_SOURCE_DISCOVERY, _('Discovery'));
$sourceComboBox->addItem(EVENT_SOURCE_AUTO_REGISTRATION, _('Auto registration'));
$sourceComboBox->addItem(EVENT_SOURCE_INTERNAL, _x('Internal', 'event source'));
$filterForm = new CForm('get');
$filterForm->addItem(array(_('Event source'), SPACE, $sourceComboBox));
$actionWidget->addHeader(_('Actions'), $filterForm);
$actionWidget->addHeaderRowNumber();
// create form
$actionForm = new CForm();
$actionForm->setName('actionForm');
// create table
$actionTable = new CTableInfo(_('No actions found.'));
$actionTable->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $actionForm->getName() . "', 'all_items', 'g_actionid');"), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('Conditions'), _('Operations'), make_sorting_header(_('Status'), 'status', $this->data['sort'], $this->data['sortorder'])));
foreach ($this->data['actions'] as $action) {
    $conditions = array();
    order_result($action['filter']['conditions'], 'conditiontype', ZBX_SORT_DOWN);
    foreach ($action['filter']['conditions'] as $condition) {
        $conditions[] = get_condition_desc($condition['conditiontype'], $condition['operator'], $condition['value']);
        $conditions[] = BR();
    }
    sortOperations($this->data['eventsource'], $action['operations']);
    $operations = array();
** 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.
**/
$userGroupsWidget = new CWidget();
// append page header to widget
$createForm = new CForm('get');
$createForm->cleanItems();
$configurationComboBox = new CComboBox('config', 'usergrps.php', 'javascript: redirect(this.options[this.selectedIndex].value);');
$configurationComboBox->addItem('usergrps.php', _('User groups'));
$configurationComboBox->addItem('users.php', _('Users'));
$createForm->addItem(array($configurationComboBox, new CSubmit('form', _('Create user group'))));
$userGroupsWidget->addPageHeader(_('CONFIGURATION OF USER GROUPS'), $createForm);
// append header to widget
$userGroupsWidget->addHeader(_('User groups'));
$userGroupsWidget->addHeaderRowNumber();
// create form
$userGroupsForm = new CForm();
$userGroupsForm->setName('userGroupsForm');
// create user group table
$userGroupTable = new CTableInfo(_('No user groups found.'));
$userGroupTable->setHeader(array(new CCheckBox('all_groups', null, "checkAll('" . $userGroupsForm->getName() . "','all_groups','group_groupid');"), $this->data['displayNodes'] ? _('Node') : null, make_sorting_header(_('Name'), 'name'), '#', _('Members'), _('Status'), _('Frontend access'), _('Debug mode')));
foreach ($this->data['usergroups'] as $usrgrp) {
    $userGroupId = $usrgrp['usrgrpid'];
    $debugMode = $usrgrp['debug_mode'] == GROUP_DEBUG_MODE_ENABLED ? new CLink(_('Enabled'), 'usergrps.php?go=disable_debug&usrgrpid=' . $userGroupId, 'orange') : new CLink(_('Disabled'), 'usergrps.php?go=enable_debug&usrgrpid=' . $userGroupId, 'enabled');
    // gui access
    $guiAccess = user_auth_type2str($usrgrp['gui_access']);
    $guiAccessStyle = 'enabled';
    if ($usrgrp['gui_access'] == GROUP_GUI_ACCESS_INTERNAL) {
        $guiAccessStyle = 'orange';
    }
$results = mysql_query($sql, $db);
echo mysql_error($db);
$level = array(" - Any - ");
while ($row = mysql_fetch_assoc($results)) {
    $level[$row['priority']] = $row['priority'];
}
$r_form->addItem(array(SPACE . _('Server') . SPACE, new CComboBox('server', $selected_server, 'javascript: submit();', $servers), SPACE . _('Server') . SPACE, new CComboBox('priority', $selectedPriority, 'javascript: submit();', $level)));
// add host and group filters to the form
//if ($source == EVENT_SOURCE_TRIGGERS) {
//    $r_form->addItem(array(
//        SPACE . _('Host') . SPACE,
//        $pageFilter->getHostsCB(true)
//    ));
//}
$eventsWidget->addHeader(_('Events'), $r_form);
$eventsWidget->addHeaderRowNumber();
$filterForm = null;
//
//if ($source == EVENT_SOURCE_TRIGGERS) {
$filterForm = new CFormTable(null, null, 'get');
$eventsWidget->addFlicker(null, CProfile::get('web.events.filter.state', 0));
$scroll = new CDiv();
$scroll->setAttribute('id', 'scrollbar_cntr');
$eventsWidget->addFlicker($scroll, CProfile::get('web.events.filter.state', 1));
/*
 * Display
 */
$table = new CTableInfo(_('No events found.'), 'tableinfo Eventlog');
if (isset($_REQUEST['period'])) {
    $_REQUEST['period'] = getRequest('period', ZBX_PERIOD_DEFAULT);
    CProfile::update('web.eventlog.period', $_REQUEST['period'], PROFILE_TYPE_INT);
    if ($templateid = get_request('templateid', 0)) {
        $template_wdgt->addItem(get_header_host_table('', $templateid));
    }
    $templateForm = new CView('configuration.template.edit');
    $template_wdgt->addItem($templateForm->render());
} else {
    $frmForm = new CForm();
    $frmForm->cleanItems();
    $buttons = new CDiv(array(new CSubmit('form', _('Create template')), new CButton('form', _('Import'), 'redirect("conf.import.php?rules_preset=template")')));
    $frmForm->addItem($buttons);
    $frmForm->addItem(new CVar('groupid', $_REQUEST['groupid'], 'filter_groupid_id'));
    $template_wdgt->addPageHeader(_('CONFIGURATION OF TEMPLATES'), $frmForm);
    $frmGroup = new CForm('get');
    $frmGroup->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB()));
    $template_wdgt->addHeader(_('Templates'), $frmGroup);
    $template_wdgt->addHeaderRowNumber();
    $form = new CForm();
    $form->setName('templates');
    $table = new CTableInfo(_('No templates defined.'));
    $table->setHeader(array(new CCheckBox('all_templates', NULL, "checkAll('" . $form->getName() . "', 'all_templates', 'templates');"), make_sorting_header(_('Templates'), 'name'), _('Applications'), _('Items'), _('Triggers'), _('Graphs'), _('Screens'), _('Discovery'), _('Linked templates'), _('Linked to')));
    // get templates
    $templates = array();
    $sortfield = getPageSortField('name');
    $sortorder = getPageSortOrder();
    if ($pageFilter->groupsSelected) {
        $options = array('editable' => 1, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1);
        if ($pageFilter->groupid > 0) {
            $options['groupids'] = $pageFilter->groupid;
        }
        $templates = API::Template()->get($options);
    }
        $createForm->addItem(new CSubmit('form', _('Create graph')));
    } else {
        $createGraphButton = new CSubmit('form', _('Create graph (select host first)'));
        $createGraphButton->setEnabled(false);
        $createForm->addItem($createGraphButton);
    }
    $graphWidget->addPageHeader(_('CONFIGURATION OF GRAPHS'), $createForm);
    $filterForm = new CForm('get');
    $filterForm->addItem(array(_('Group') . SPACE, $this->data['pageFilter']->getGroupsCB(true)));
    $filterForm->addItem(array(SPACE . _('Host') . SPACE, $this->data['pageFilter']->getHostsCB(true)));
    $graphWidget->addHeader(_('Graphs'), $filterForm);
    if (!empty($this->data['hostid'])) {
        $graphWidget->addItem(get_header_host_table('graphs', $this->data['hostid']));
    }
}
$graphWidget->addHeaderRowNumber();
// create form
$graphForm = new CForm();
$graphForm->setName('graphForm');
$graphForm->addVar('hostid', $this->data['hostid']);
if (!empty($this->data['parent_discoveryid'])) {
    $graphForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
}
// create table
$graphTable = new CTableInfo(!empty($this->data['parent_discoveryid']) ? _('No graph prototypes found.') : _('No graphs found.'));
$graphTable->setHeader(array(new CCheckBox('all_graphs', null, "checkAll('" . $graphForm->getName() . "', 'all_graphs', 'group_graphid');"), $this->data['displayNodes'] ? _('Node') : null, !empty($this->data['hostid']) ? null : _('Hosts'), make_sorting_header(_('Name'), 'name'), _('Width'), _('Height'), make_sorting_header(_('Graph type'), 'graphtype')));
foreach ($this->data['graphs'] as $graph) {
    $graphid = $graph['graphid'];
    $hostList = null;
    if (empty($this->data['hostid'])) {
        $hostList = array();
**
** 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.
**/
$auditWidget = new CWidget();
// 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));
 $exactComboBox->addItem('1', _('exactly'));
 $filter_table->addRow(array(array(array(bold(_('Field:')), $inventoryFieldsComboBox), array($exactComboBox, new CTextBox('filter_field_value', $_REQUEST['filter_field_value'], 20)))));
 $filter = new CButton('filter', _('Filter'), "javascript: create_var('zbx_filter', 'filter_set', '1', true);");
 $filter->useJQueryStyle('main');
 $reset = new CButton('reset', _('Reset'), "javascript: clearAllForm('zbx_filter');");
 $reset->useJQueryStyle();
 $div_buttons = new CDiv(array($filter, SPACE, $reset));
 $div_buttons->setAttribute('style', 'padding: 4px 0px;');
 $footer_col = new CCol($div_buttons, 'controls');
 $filter_table->addRow($footer_col);
 $filter_form = new CForm('get');
 $filter_form->setAttribute('name', 'zbx_filter');
 $filter_form->setAttribute('id', 'zbx_filter');
 $filter_form->addItem($filter_table);
 $hostinvent_wdgt->addFlicker($filter_form, CProfile::get('web.hostinventories.filter.state', 0));
 $hostinvent_wdgt->addHeaderRowNumber();
 $table = new CTableInfo(_('No hosts defined.'));
 $table->setHeader(array(is_show_all_nodes() ? make_sorting_header(_('Node'), 'hostid') : null, make_sorting_header(_('Host'), 'name'), _('Group'), make_sorting_header(_('Name'), 'pr_name'), make_sorting_header(_('Type'), 'pr_type'), make_sorting_header(_('OS'), 'pr_os'), make_sorting_header(_('Serial number A'), 'pr_serialno_a'), make_sorting_header(_('Tag'), 'pr_tag'), make_sorting_header(_('MAC address A'), 'pr_macaddress_a')));
 $hosts = array();
 $paging = getPagingLine($hosts);
 if ($pageFilter->groupsSelected) {
     // which inventory fields we will need for displaying
     $requiredInventoryFields = array('name', 'type', 'os', 'serialno_a', 'tag', 'macaddress_a');
     // checking if correct inventory field is specified for filter
     $possibleInventoryFields = getHostInventories();
     $possibleInventoryFields = zbx_toHash($possibleInventoryFields, 'db_field');
     if (!empty($_REQUEST['filter_field']) && !empty($_REQUEST['filter_field_value']) && !isset($possibleInventoryFields[$_REQUEST['filter_field']])) {
         error(_s('Impossible to filter by inventory field "%s", which does not exist.', $_REQUEST['filter_field']));
     } else {
         // if we are filtering by field, this field is also required
         if (!empty($_REQUEST['filter_field']) && !empty($_REQUEST['filter_field_value'])) {
Beispiel #21
0
    $templateForm = new CView('configuration.template.edit', $data);
    $templateWidget->addItem($templateForm->render());
} else {
    $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'name'));
    $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) {
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** 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.
**/
$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[] = ' &hellip;';
                break;
            }
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** 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 = '';
$exactComboBox->addItem('1', _('exactly'));
$filterTable->addRow(array(array(array(bold(_('Field')), SPACE, $inventoryFieldsComboBox), array($exactComboBox, new CTextBox('filter_field_value', $this->data['filterFieldValue'], 20)))), 'host-inventories');
$filter = new CSubmit('filter_set', _('Filter'));
$filter->useJQueryStyle('main');
$reset = new CSubmit('filter_rst', _('Reset'));
$reset->useJQueryStyle();
$divButtons = new CDiv(array($filter, SPACE, $reset));
$divButtons->setAttribute('style', 'padding: 4px 0px;');
$footerCol = new CCol($divButtons, 'controls');
$filterTable->addRow($footerCol);
$filterForm = new CForm('get');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addItem($filterTable);
$hostInventoryWidget->addFlicker($filterForm, CProfile::get('web.hostinventories.filter.state', 0));
$hostInventoryWidget->addHeaderRowNumber();
$table = new CTableInfo(_('No hosts found.'));
$table->setHeader(array(make_sorting_header(_('Host'), 'name', $this->data['sort'], $this->data['sortorder']), _('Group'), make_sorting_header(_('Name'), 'pr_name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'pr_type', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('OS'), 'pr_os', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Serial number A'), 'pr_serialno_a', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Tag'), 'pr_tag', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('MAC address A'), 'pr_macaddress_a', $this->data['sort'], $this->data['sortorder'])));
foreach ($this->data['hosts'] as $host) {
    $hostGroups = array();
    foreach ($host['groups'] as $group) {
        $hostGroups[] = $group['name'];
    }
    natsort($hostGroups);
    $hostGroups = implode(', ', $hostGroups);
    $row = array(new CLink($host['name'], '?hostid=' . $host['hostid'] . url_param('groupid'), $host['status'] == HOST_STATUS_NOT_MONITORED ? 'not-monitored' : ''), $hostGroups, zbx_str2links($host['inventory']['name']), zbx_str2links($host['inventory']['type']), zbx_str2links($host['inventory']['os']), zbx_str2links($host['inventory']['serialno_a']), zbx_str2links($host['inventory']['tag']), zbx_str2links($host['inventory']['macaddress_a']));
    $table->addRow($row);
}
$table = array($this->data['paging'], $table, $this->data['paging']);
$hostInventoryWidget->addItem($table);
return $hostInventoryWidget;
**/
$screenWidget = new CWidget();
// create new screen button
$createForm = new CForm('get');
$createForm->cleanItems();
$createForm->addItem(new CSubmit('form', _('Create screen')));
if (!empty($this->data['templateid'])) {
    $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'));
}
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** 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.
**/
$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:
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** 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.
**/
$slideWidget = new CWidget();
// create new hostgroup button
$createForm = new CForm('get');
$createForm->cleanItems();
$createForm->addItem(new CSubmit('form', _('Create slide show')));
$slideWidget->addPageHeader(_('CONFIGURATION OF SLIDE SHOWS'), $createForm);
$slideWidget->addHeader(_('Slide shows'));
$slideWidget->addHeaderRowNumber();
// create form
$slideForm = new CForm();
$slideForm->setName('slideForm');
// create table
$slidesTable = new CTableInfo(_('No slide shows found.'));
$slidesTable->setHeader(array(new CCheckBox('all_shows', null, "checkAll('" . $slideForm->getName() . "', 'all_shows', 'shows');"), $this->data['displayNodes'] ? _('Node') : null, make_sorting_header(_('Name'), 'name'), make_sorting_header(_('Delay'), 'delay'), make_sorting_header(_('Count of slides'), 'cnt')));
foreach ($this->data['slides'] as $slide) {
    $slidesTable->addRow(array(new CCheckBox('shows[' . $slide['slideshowid'] . ']', null, null, $slide['slideshowid']), $this->data['displayNodes'] ? $slide['nodename'] : null, new CLink($slide['name'], '?form=update&slideshowid=' . $slide['slideshowid'], 'action'), $slide['delay'], $slide['cnt']));
}
// create go button
$goComboBox = new CComboBox('go');
$goOption = new CComboItem('delete', _('Delete selected'));
$goOption->setAttribute('confirm', _('Delete selected slide shows?'));
$goComboBox->addItem($goOption);
$goButton = new CSubmit('goButton', _('Go') . ' (0)');
Beispiel #28
0
    access_deny();
}
validate_sort_and_sortorder('name', ZBX_SORT_DOWN);
$options = array('groups' => array('real_hosts' => true, 'with_httptests' => true), 'hosts' => array('with_monitored_items' => true, 'with_httptests' => true), 'hostid' => get_request('hostid', null), 'groupid' => get_request('groupid', null));
$pageFilter = new CPageFilter($options);
$_REQUEST['groupid'] = $pageFilter->groupid;
$_REQUEST['hostid'] = $pageFilter->hostid;
$displayNodes = is_array(get_current_nodeid()) && $pageFilter->groupid == 0 && $pageFilter->hostid == 0;
$r_form = new CForm('get');
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$r_form->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
$r_form->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true)));
$httpmon_wdgt = new CWidget();
$httpmon_wdgt->addPageHeader(_('STATUS OF WEB MONITORING'), get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen'])));
$httpmon_wdgt->addHeader(_('Web scenarios'), $r_form);
$httpmon_wdgt->addHeaderRowNumber();
// TABLE
$table = new CTableInfo(_('No web scenarios found.'));
$table->SetHeader(array($displayNodes ? _('Node') : null, $_REQUEST['hostid'] == 0 ? make_sorting_header(_('Host'), 'hostname') : null, make_sorting_header(_('Name'), 'name'), _('Number of steps'), _('Last check'), _('Status')));
$paging = null;
if ($pageFilter->hostsSelected) {
    $options = array('output' => array('httptestid'), 'templated' => false, 'filter' => array('status' => HTTPTEST_STATUS_ACTIVE), 'limit' => $config['search_limit'] + 1);
    if ($pageFilter->hostid > 0) {
        $options['hostids'] = $pageFilter->hostid;
    } elseif ($pageFilter->groupid > 0) {
        $options['groupids'] = $pageFilter->groupid;
    }
    $httpTests = API::HttpTest()->get($options);
    $paging = getPagingLine($httpTests);
    $httpTests = API::HttpTest()->get(array('httptestids' => zbx_objectValues($httpTests, 'httptestid'), 'preservekeys' => true, 'output' => API_OUTPUT_EXTEND, 'selectHosts' => array('name', 'status'), 'selectSteps' => API_OUTPUT_COUNT));
    foreach ($httpTests as &$httpTest) {
$ack_status = $_REQUEST['ack_status'];
// --------------
validate_sort_and_sortorder('lastchange', ZBX_SORT_DOWN);
$mute = CProfile::get('web.tr_status.mute', 0);
if (isset($audio) && !$mute) {
    play_sound($audio);
}
$trigg_wdgt = new CWidget();
$r_form = new CForm('get');
$r_form->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true)));
$r_form->addItem(array(SPACE . _('Host') . SPACE, $pageFilter->getHostsCB(true)));
$r_form->addVar('fullscreen', $_REQUEST['fullscreen']);
$fs_icon = get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen']));
$trigg_wdgt->addPageHeader(_('STATUS OF TRIGGERS') . SPACE . '[' . zbx_date2str(_('d M Y H:i:s')) . ']', $fs_icon);
$trigg_wdgt->addHeader(_('Triggers'), $r_form);
$trigg_wdgt->addHeaderRowNumber();
/************************* FILTER **************************/
/***********************************************************/
$filterForm = new CFormTable(null, null, 'get');
//,'tr_status.php?filter_set=1','POST',null,'sform');
$filterForm->setAttribute('name', 'zbx_filter');
$filterForm->setAttribute('id', 'zbx_filter');
$filterForm->addVar('fullscreen', $_REQUEST['fullscreen']);
$filterForm->addVar('groupid', $_REQUEST['groupid']);
$filterForm->addVar('hostid', $_REQUEST['hostid']);
$tr_select = new CComboBox('show_triggers', $show_triggers);
$tr_select->addItem(TRIGGERS_OPTION_ALL, _('Any'));
$tr_select->additem(TRIGGERS_OPTION_ONLYTRUE, _('Problem'));
$filterForm->addRow(_('Triggers status'), $tr_select);
if ($config['event_ack_enable']) {
    $cb_ack_status = new CComboBox('ack_status', $ack_status);