Пример #1
0
     $table->setFooter(new CCol($form));
     $table->showEnd();
 } else {
     /* table HOSTS */
     $form = new CForm(null, 'post');
     $form->SetName('hosts');
     $form->AddVar('config', $config);
     $form->AddVar('update', true);
     $cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
     foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
         $cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
     }
     $header = get_table_header(S_HOSTS_BIG, array(S_GROUP . SPACE, $cmbGroups));
     $form->addItem($header);
     $table = new CTableInfo(S_NO_HOSTS_DEFINED);
     $table->setHeader(array(array(new CCheckBox("all_hosts", true, "CheckAll('" . $form->GetName() . "','all_hosts','hosts');"), make_sorting_link(S_NAME, 'h.host')), make_sorting_link(S_DNS, 'h.dns'), make_sorting_link(S_IP, 'h.ip'), make_sorting_link(S_PORT, 'h.port'), make_sorting_link(S_STATUS, 'h.status'), array(new CCheckBox("all_templates", true, "CheckAll('" . $form->GetName() . "','all_templates','templates');"), S_TEMPLATES), array(new CCheckBox("all_items", true, "CheckAll('" . $form->GetName() . "','all_items','items');"), S_ITEMS), array(new CCheckBox("all_triggers", true, "CheckAll('" . $form->GetName() . "','all_triggers','triggers');"), S_TRIGGERS), array(new CCheckBox("all_graphs", true, "CheckAll('" . $form->GetName() . "','all_graphs','graphs');"), S_GRAPHS)));
     $sql_from = '';
     $sql_where = '';
     if ($_REQUEST['groupid'] > 0) {
         $sql_from .= ' ,hosts_groups hg ';
         $sql_where .= ' AND hg.groupid=' . $_REQUEST['groupid'] . ' AND hg.hostid=h.hostid ';
     }
     $hosts = array();
     $hostids = array();
     $sql = 'SELECT DISTINCT h.* ' . ' FROM hosts h ' . $sql_from . ' WHERE ' . DBcondition('h.hostid', $available_hosts) . $sql_where . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ',' . HOST_STATUS_TEMPLATE . ')' . order_by('h.host,h.dns,h.ip,h.port,h.status');
     $result = DBselect($sql);
     while ($host = DBfetch($result)) {
         $hosts[$host['hostid']] = $host;
         $hostids[$host['hostid']] = $host['hostid'];
     }
     // templates
Пример #2
0
 * Form
 */
if ($_REQUEST['fullscreen']) {
    $triggerInfo = new CTriggersInfo($_REQUEST['groupid'], $_REQUEST['hostid']);
    $triggerInfo->hideHeader();
    $triggerInfo->show();
}
$triggerForm = new CForm('get', 'acknow.php');
$triggerForm->setName('tr_status');
$triggerForm->addVar('backurl', $page['file']);
/*
 * Table
 */
$showEventColumn = $config['event_ack_enable'] && $_REQUEST['show_events'] != EVENTS_OPTION_NOEVENT;
$switcherName = 'trigger_switchers';
$headerCheckBox = $showEventColumn ? new CCheckBox('all_events', false, "checkAll('" . $triggerForm->GetName() . "', 'all_events', 'events');") : new CCheckBox('all_triggers', false, "checkAll('" . $triggerForm->GetName() . "', 'all_triggers', 'triggers');");
if ($showEvents != EVENTS_OPTION_NOEVENT) {
    $showHideAllDiv = new CDiv(SPACE, 'filterclosed');
    $showHideAllDiv->setAttribute('id', $switcherName);
} else {
    $showHideAllDiv = null;
}
$triggerTable = new CTableInfo(_('No triggers found.'));
$triggerTable->setHeader(array($showHideAllDiv, $config['event_ack_enable'] ? $headerCheckBox : null, make_sorting_header(_('Severity'), 'priority'), _('Status'), _('Info'), make_sorting_header(_('Last change'), 'lastchange'), _('Age'), $showEventColumn ? _('Duration') : null, $config['event_ack_enable'] ? _('Acknowledged') : null, $displayNodes ? _('Node') : null, _('Host'), make_sorting_header(_('Name'), 'description'), _('Comments')));
// get triggers
$sortfield = getPageSortField('description');
$sortorder = getPageSortOrder();
$options = array('output' => array('triggerid', $sortfield), 'nodeids' => get_current_nodeid(), 'monitored' => true, 'skipDependent' => true, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1);
if ($pageFilter->hostsSelected) {
    if ($pageFilter->hostid > 0) {
        $options['hostids'] = $pageFilter->hostid;
Пример #3
0
 $params = array('hostids' => $hosts_linked_to, 'templated_hosts' => 1, 'editable' => 1, 'extendoutput' => 1);
 $db_hosts = CHost::get($params);
 order_result($db_hosts, 'host');
 foreach ($db_hosts as $hnum => $db_host) {
     $host_tb->addItem($db_host['hostid'], $db_host['host']);
 }
 $template_tbl->addRow(array(S_HOSTS . '|' . S_TEMPLATES, $host_tb->Get(S_IN, array(S_OTHER . SPACE . '|' . SPACE . S_GROUP . SPACE, $cmbGroups))));
 // FORM ITEM : linked Template table
 $tpl_table = new CTable();
 $tpl_table->setCellPadding(0);
 $tpl_table->setCellSpacing(0);
 foreach ($templates as $tid => $tname) {
     $frmHost->addVar('templates[' . $tid . ']', $tname);
     $tpl_table->addRow(array($tname, new CButton('unlink[' . $tid . ']', S_UNLINK), isset($original_templates[$tid]) ? new CButton('unlink_and_clear[' . $tid . ']', S_UNLINK_AND_CLEAR) : SPACE));
 }
 $template_tbl->addRow(array(S_LINK_WITH_TEMPLATE, array($tpl_table, new CButton('add_template', S_ADD, 'return PopUp("popup.php?dstfrm=' . $frmHost->GetName() . '&dstfld1=new_template&srctbl=templates&srcfld1=hostid&srcfld2=host&excludeids[' . $templateid . ']=' . $templateid . url_param($templates, false, "existed_templates") . '",450,450)', 'T'))));
 // FULL CLONE {
 if ($_REQUEST['form'] == 'full_clone') {
     // FORM ITEM : Template items
     $items_lbx = new CListBox('items', null, 8);
     $items_lbx->setAttribute('disabled', 'disabled');
     $options = array('editable' => 1, 'hostids' => $templateid, 'output' => API_OUTPUT_EXTEND);
     $template_items = CItem::get($options);
     if (empty($template_items)) {
         $items_lbx->setAttribute('style', 'width: 200px;');
     } else {
         foreach ($template_items as $inum => $titem) {
             $item_description = item_description($titem);
             $items_lbx->addItem($titem['itemid'], $item_description);
         }
     }
Пример #4
0
                 $available = new CSpan(S_UNKNOWN, 'unknown');
             }
         }
     }
     $tbl_header_host = new CTableInfo();
     $tbl_header_host->addRow(array(new CLink(bold(S_HOST_LIST), 'hosts.php?hostid=' . $header_host['hostid'] . url_param('groupid')), $description, $items, $graphs, array(bold(S_DNS . ': '), $dns), array(bold(S_IP . ': '), $ip), array(bold(S_PORT . ': '), $port), array(bold(S_STATUS . ': '), $status), array(bold(S_AVAILABILITY . ': '), $available)));
     $tbl_header_host->setClass('infobox');
     $tbl_header_host->show();
 }
 // --->>> SELECTED HOST HEADER INFORMATION <<<---
 $form = new CForm('triggers.php');
 $form->setName('triggers');
 $form->setMethod('post');
 $form->addVar('hostid', $_REQUEST['hostid']);
 $table = new CTableInfo(S_NO_TRIGGERS_DEFINED);
 $table->setHeader(array(new CCheckBox('all_triggers', NULL, "checkAll('" . $form->GetName() . "','all_triggers','g_triggerid');"), make_sorting_link(S_SEVERITY, 't.priority'), make_sorting_link(S_STATUS, 't.status'), $_REQUEST['hostid'] > 0 ? NULL : make_sorting_link(S_HOST, 'h.host'), make_sorting_link(S_NAME, 't.description'), S_EXPRESSION, S_ERROR));
 $options = array('select_hosts' => 1, 'editable' => 1, 'extendoutput' => 1);
 if ($showdisabled == 0) {
     $options += array('status' => TRIGGER_STATUS_ENABLED);
 }
 if ($PAGE_HOSTS['selected'] > 0) {
     $options += array('hostids' => $PAGE_HOSTS['selected']);
 } else {
     if ($PAGE_GROUPS['selected'] > 0) {
         $options += array('groupids' => $PAGE_GROUPS['selected']);
     }
 }
 $triggers = CTrigger::get($options);
 foreach ($triggers as $triggerid => $trigger) {
     $description = array();
     if ($trigger['templateid'] > 0) {
Пример #5
0
 } else {
     if ($config['dropdown_first_entry'] == ZBX_DROPDOWN_FIRST_ALL) {
         $sqls[] = 'SELECT m.* ' . ' FROM maintenances m ' . ' WHERE ' . DBin_node('m.maintenanceid') . ' AND ' . DBcondition('m.maintenanceid', $available_maintenances) . ' ORDER BY m.name';
     }
 }
 foreach ($sqls as $num => $sql) {
     $db_maintenances = DBselect($sql);
     while ($maintenance = DBfetch($db_maintenances)) {
         $maintenances[$maintenance['maintenanceid']] = $maintenance;
         $maintenanceids[$maintenance['maintenanceid']] = $maintenance['maintenanceid'];
     }
 }
 $form = new CForm(null, 'post');
 $form->setName('maintenances');
 $table = new CTableInfo();
 $table->setHeader(array(new CCheckBox('all_maintenances', NULL, "checkAll('" . $form->GetName() . "','all_maintenances','maintenanceids');"), make_sorting_link(S_NAME, 'm.name'), S_TYPE, S_STATUS, S_DESCRIPTION));
 foreach ($maintenances as $maintenanceid => $maintenance) {
     if ($maintenance['active_till'] < time()) {
         $mnt_status = new CSpan(S_EXPIRED, 'red');
     } else {
         $mnt_status = new CSpan(S_ACTIVE, 'green');
     }
     $table->addRow(array(new CCheckBox('maintenanceids[' . $maintenance['maintenanceid'] . ']', NULL, NULL, $maintenance['maintenanceid']), new CLink($maintenance['name'], 'maintenance.php?form=update&maintenanceid=' . $maintenance['maintenanceid'] . '#form'), $maintenance['maintenance_type'] ? S_NO_DATA_PROCESSING : S_NORMAL_PROCESSING, $mnt_status, $maintenance['description']));
     $row_count++;
 }
 //			$table->setFooter(new CCol(new CButtonQMessage('delete_selected',S_DELETE_SELECTED,S_DELETE_SELECTED_USERS_Q)));
 $goBox = new CComboBox('go');
 $goBox->addItem('delete', S_DELETE_SELECTED);
 // goButton name is necessary!!!
 $goButton = new CButton('goButton', S_GO . ' (0)');
 $goButton->setAttribute('id', 'goButton');
Пример #6
0
        }
        $frmHostG->addItemToBottomRow($dltButton);
    }
    $frmHostG->addItemToBottomRow(SPACE);
    $frmHostG->addItemToBottomRow(new CButtonCancel(url_param('config')));
    $frmHostG->show();
} else {
    $config = select_config();
    $numrows = new CSpan(null, 'info');
    $numrows->setAttribute('name', 'numrows');
    $header = get_table_header(array(S_HOST_GROUPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $form = new CForm('hostgroups.php');
    $form->setName('form_groups');
    $table = new CTableInfo(S_NO_HOST_GROUPS_DEFINED);
    $table->setHeader(array(new CCheckBox('all_groups', NULL, "checkAll('" . $form->GetName() . "','all_groups','groups');"), make_sorting_link(S_NAME, 'g.name'), ' # ', S_MEMBERS));
    $groups = CHostGroup::get(array('order' => 'name', 'editable' => 1, 'extendoutput' => 1, 'select_hosts' => 1));
    foreach ($groups as $groupid => $group) {
        $tpl_count = 0;
        $host_count = 0;
        $i = 0;
        $hosts_output = array();
        foreach ($group['hosts'] as $hostid => $host) {
            $i++;
            if ($i > $config['max_in_table']) {
                $hosts_output[] = '...';
                $hosts_output[] = '//empty for array_pop';
                break;
            }
            switch ($host['status']) {
                case HOST_STATUS_NOT_MONITORED:
Пример #7
0
 $frmForm->addVar('config', $_REQUEST['config']);
 $cmbGroups = new CComboBox('groupid', $PAGE_GROUPS['selected'], 'javascript: submit();');
 foreach ($PAGE_GROUPS['groups'] as $groupid => $name) {
     $cmbGroups->addItem($groupid, get_node_name_by_elid($groupid) . $name);
 }
 $frmForm->addItem(array(S_GROUP . SPACE, $cmbGroups));
 $numrows = new CSpan(null, 'info');
 $numrows->setAttribute('name', 'numrows');
 $header = get_table_header(array(S_HOSTS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
 show_table_header($header, $frmForm);
 /* table HOSTS */
 $form = new CForm();
 $form->setName('hosts');
 $form->addVar('config', get_request('config', 0));
 $table = new CTableInfo(S_NO_HOSTS_DEFINED);
 $table->setHeader(array(new CCheckBox('all_hosts', NULL, "checkAll('" . $form->GetName() . "','all_hosts','hosts');"), make_sorting_link(S_NAME, 'h.host'), S_ITEMS, S_TRIGGERS, S_GRAPHS, make_sorting_link(S_DNS, 'h.dns'), make_sorting_link(S_IP, 'h.ip'), make_sorting_link(S_PORT, 'h.port'), S_TEMPLATES, make_sorting_link(S_STATUS, 'h.status'), make_sorting_link(S_AVAILABILITY, 'h.available'), S_ERROR));
 $options = array('hostids' => $PAGE_HOSTS['hostids'], 'extendoutput' => 1, 'select_templates' => 1, 'select_items' => 1, 'select_triggers' => 1, 'select_graphs' => 1, 'editable' => 1, 'order' => 'host');
 if ($_REQUEST['groupid'] > 0) {
     $options['groupids'] = $PAGE_GROUPS['selected'];
 }
 $hosts = Chost::get($options);
 foreach ($hosts as $hostid => $row) {
     $description = array();
     $items = array(new CLink(S_ITEMS, 'items.php?groupid=' . $PAGE_GROUPS['selected'] . '&hostid=' . $row['hostid']), ' (' . count($row['itemids']) . ')');
     $triggers = array(new CLink(S_TRIGGERS, 'triggers.php?groupid=' . $PAGE_GROUPS['selected'] . '&hostid=' . $row['hostid']), ' (' . count($row['triggerids']) . ')');
     $graphs = array(new CLink(S_GRAPHS, 'graphs.php?groupid=' . $PAGE_GROUPS['selected'] . '&hostid=' . $row['hostid']), ' (' . count($row['graphids']) . ')');
     if ($row['proxy_hostid']) {
         $proxy = get_host_by_hostid($row['proxy_hostid']);
         array_push($description, $proxy['host'], ':');
     }
     array_push($description, new CLink($row['host'], 'hosts.php?form=update&hostid=' . $row['hostid'] . url_param('groupid')));
Пример #8
0
$filterForm->addItemToBottomRow($reset);
$trigg_wdgt->addFlicker($filterForm, get_profile('web.tr_status.filter.state', 0));
/*************** FILTER END ******************/
if ($_REQUEST['fullscreen']) {
    $triggerInfo = new CTriggersInfo();
    $triggerInfo->HideHeader();
    $triggerInfo->show();
}
$m_form = new CForm('acknow.php');
$m_form->setName('tr_status');
$admin_links = $USER_DETAILS['type'] == USER_TYPE_ZABBIX_ADMIN || $USER_DETAILS['type'] == USER_TYPE_SUPER_ADMIN;
$table = new CTableInfo();
$table->showStart();
$header = array();
$show_event_col = $config['event_ack_enable'] && $show_events != EVENTS_OPTION_NOEVENT;
$table->setHeader(array($show_event_col ? new CCheckBox('all_events', false, "checkAll('" . $m_form->GetName() . "','all_events','events');") : NULL, make_sorting_link(S_SEVERITY, 't.priority'), S_STATUS, make_sorting_link(S_LAST_CHANGE, 't.lastchange'), is_show_all_nodes() ? make_sorting_link(S_NODE, 'h.hostid') : null, $_REQUEST['hostid'] > 0 ? null : make_sorting_link(S_HOST, 'h.host'), make_sorting_link(S_NAME, 't.description'), $_REQUEST['show_actions'] ? S_ACTIONS : NULL, $show_event_col ? S_ACKNOWLEDGED : NULL, S_COMMENTS));
$cond = $_REQUEST['hostid'] > 0 ? ' AND h.hostid=' . $_REQUEST['hostid'] . ' ' : '';
switch ($show_triggers) {
    case TRIGGERS_OPTION_ALL:
        $cond .= '';
        break;
    case TRIGGERS_OPTION_NOFALSEFORB:
        $cond .= '';
        break;
    case TRIGGERS_OPTION_ONLYTRUE:
    default:
        $cond .= ' AND ((t.value=' . TRIGGER_VALUE_TRUE . ') OR ((t.value=' . TRIGGER_VALUE_FALSE . ') AND ((' . time() . '-t.lastchange)<' . TRIGGER_FALSE_PERIOD . ')))';
        break;
}
if ($show_severity > -1) {
    $cond .= ' AND t.priority>=' . $show_severity;
Пример #9
0
         $where_case[] = 'i.logtimefmt=' . zbx_dbstr($_REQUEST['filter_logtimefmt']);
     }
     if (isset($_REQUEST['filter_delta']) && $_REQUEST['filter_delta'] != -1) {
         $where_case[] = 'i.delta=' . $_REQUEST['filter_delta'];
     }
     if (isset($_REQUEST['filter_trapper_hosts'])) {
         $where_case[] = 'i.trapper_hosts like ' . zbx_dbstr('%' . $_REQUEST['filter_trapper_hosts'] . '%');
     }
     $show_applications = 0;
 }
 //--------------------------
 // TABLE
 $form = new CForm();
 $form->setName('items');
 $table = new CTableInfo();
 $table->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $form->GetName() . "','all_items','group_itemid');"), $show_host ? make_sorting_link(S_HOST, 'h.host') : null, make_sorting_link(S_DESCRIPTION, 'i.description'), make_sorting_link(S_KEY, 'i.key_'), make_sorting_link(S_INTERVAL, 'i.delay'), make_sorting_link(S_HISTORY, 'i.history'), make_sorting_link(S_TRENDS, 'i.trends'), make_sorting_link(S_TYPE, 'i.type'), make_sorting_link(S_STATUS, 'i.status'), $show_applications ? S_APPLICATIONS : null, S_ERROR));
 $from_tables['i'] = 'items i';
 /* NOTE: must be added as last element to use left join */
 /*
 		$sql = 'SELECT DISTINCT th.host as template_host,th.hostid as template_hostid, h.host, h.hostid, hgg.groupid, i.* '.
 				' FROM '.implode(',', $from_tables).
 					' LEFT JOIN hosts_groups hgg ON hgg.hostid=i.hostid '.
 					' LEFT JOIN items ti ON i.templateid=ti.itemid '.
 					' LEFT JOIN hosts th ON ti.hostid=th.hostid '.
 				' WHERE '.implode(' AND ', $where_case).
 				order_by('h.host,i.description,i.key_,i.delay,i.history,i.trends,i.type,i.status','i.itemid');
 //*/
 //*
 $sql = 'SELECT DISTINCT th.host as template_host,th.hostid as template_hostid, h.host, h.hostid, i.* ' . ' FROM ' . implode(',', $from_tables) . ' LEFT JOIN items ti ON i.templateid=ti.itemid ' . ' LEFT JOIN hosts th ON ti.hostid=th.hostid ' . ' WHERE ' . implode(' and ', $where_case) . order_by('h.host,i.description,i.key_,i.delay,i.history,i.trends,i.type,i.status', 'i.itemid');
 //*/
 $db_items = DBselect($sql);
Пример #10
0
                            while ($exp = DBfetch($db_exps)) {
                                if (!isset($expressions[$exp['regexpid']])) {
                                    $count[$exp['regexpid']] = 1;
                                } else {
                                    $count[$exp['regexpid']]++;
                                }
                                if (!isset($expressions[$exp['regexpid']])) {
                                    $expressions[$exp['regexpid']] = new CTable();
                                }
                                $expressions[$exp['regexpid']]->addRow(array($count[$exp['regexpid']], ' &raquo; ', $exp['expression'], ' [' . expression_type2str($exp['expression_type']) . ']'));
                                $regexp[$exp['regexpid']]['expressions'][$exp['expressionid']] = $exp;
                            }
                            $form = new CForm(null, 'post');
                            $form->setName('regexp');
                            $table = new CTableInfo();
                            $table->setHeader(array(array(new CCheckBox('all_regexps', NULL, "CheckAll('" . $form->GetName() . "','all_regexps','group_regexpid');"), S_NAME), S_EXPRESSIONS));
                            foreach ($regexps as $regexpid => $regexp) {
                                $table->addRow(array(array(new CCheckBox('regexpids[' . $regexp['regexpid'] . ']', NULL, NULL, $regexp['regexpid']), new CLink($regexp['name'], 'config.php?form=update' . url_param('config') . '&regexpid=' . $regexp['regexpid'] . '#form', 'action')), isset($expressions[$regexpid]) ? $expressions[$regexpid] : '-'));
                            }
                            //			$table->SetFooter(new CCol(new CButtonQMessage('delete_selected',S_DELETE_SELECTED,S_DELETE_SELECTED_USERS_Q)));
                            $table->SetFooter(new CCol(array(new CButtonQMessage('delete', S_DELETE_SELECTED, S_DELETE_SELECTED_REGULAR_EXPRESSIONS_Q))));
                            $form->AddItem($table);
                            $form->show();
                        }
                    }
                }
            }
        }
    }
}
include_once 'include/page_footer.php';
Пример #11
0
         $l_header->AddVar('mark_color', $_REQUEST['mark_color']);
     }
     $cmbLogList = new CComboBox('cmbloglist');
     if (is_array($_REQUEST['itemid'])) {
         $cmbLogList->AddItem(0, $main_header);
         foreach ($_REQUEST['itemid'] as $itemid) {
             if (!($item = get_item_by_itemid($itemid)) || $item['value_type'] != ITEM_VALUE_TYPE_LOG) {
                 invalid_url();
             }
             $host = get_host_by_hostid($item['hostid']);
             $cmbLogList->AddItem($itemid, $host['host'] . ': ' . item_description($item));
         }
     } else {
         $cmbLogList->AddItem($_REQUEST['itemid'], $main_header);
     }
     $l_header->AddItem(array("Log files list", SPACE, $cmbLogList, SPACE, new CButton("add_log", "Add", "return PopUp('popup.php?" . "dstfrm=" . $l_header->GetName() . "&srctbl=logitems&dstfld1=itemid&srcfld1=itemid');"), SPACE, $cmbLogList->ItemsCount() > 1 ? new CButton("remove_log", "Remove selected") : null));
 }
 $form = new CForm();
 $form->SetMethod('get');
 $form->AddVar("itemid", $_REQUEST["itemid"]);
 if (isset($_REQUEST["filter_task"])) {
     $form->AddVar("filter_task", $_REQUEST["filter_task"]);
 }
 if (isset($_REQUEST["filter"])) {
     $form->AddVar("filter", $_REQUEST["filter"]);
 }
 if (isset($_REQUEST["mark_color"])) {
     $form->AddVar("mark_color", $_REQUEST["mark_color"]);
 }
 $cmbAction = new CComboBox("action", $_REQUEST["action"], "submit()");
 if (str_in_array($item_type, array(ITEM_VALUE_TYPE_FLOAT, ITEM_VALUE_TYPE_UINT64))) {
Пример #12
0
     $items = array();
 } else {
     $items = CItem::get($options);
 }
 // Header Host
 if ($hostid > 0) {
     $tbl_header_host = get_header_host_table($hostid, array('triggers', 'applications', 'graphs'));
     $items_wdgt->addItem($tbl_header_host);
     $show_host = false;
 }
 $form = new CForm();
 $form->setName('items');
 $form->addVar('hostid', $hostid);
 $table = new CTableInfo();
 // Table Header //
 $table->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $form->GetName() . "','all_items','group_itemid');"), S_WIZARD, $show_host ? S_HOST : null, make_sorting_header(S_DESCRIPTION, 'description'), S_TRIGGERS, make_sorting_header(S_KEY, 'key_'), make_sorting_header(S_INTERVAL, 'delay'), make_sorting_header(S_HISTORY, 'history'), make_sorting_header(S_TRENDS, 'trends'), make_sorting_header(S_TYPE, 'type'), make_sorting_header(S_STATUS, 'status'), S_APPLICATIONS, S_ERROR));
 // SET VALUES FOR SUBFILTERS {
 // if any of subfilters = false then item shouldnt be shown
 foreach ($items as $num => $item) {
     $item['hostids'] = zbx_objectValues($item['hosts'], 'hostid');
     $item['subfilters'] = array();
     $item['subfilters']['subfilter_hosts'] = empty($_REQUEST['subfilter_hosts']) || (bool) array_intersect($_REQUEST['subfilter_hosts'], $item['hostids']);
     $item['subfilters']['subfilter_apps'] = false;
     if (empty($_REQUEST['subfilter_apps'])) {
         $item['subfilters']['subfilter_apps'] = true;
     } else {
         foreach ($item['applications'] as $app) {
             if (str_in_array($app['name'], $_REQUEST['subfilter_apps'])) {
                 $item['subfilters']['subfilter_apps'] = true;
                 break;
             }
Пример #13
0
$cmbConf->addItem('users.php', S_USERS);
$frmForm->addItem(array($cmbConf, SPACE, new CButton('form', S_CREATE_GROUP)));
$usrgroup_wdgt = new CWidget();
$usrgroup_wdgt->addPageHeader(S_CONFIGURATION_OF_USERS_AND_USER_GROUPS, $frmForm);
if (isset($_REQUEST['form'])) {
    $usrgroup_wdgt->addItem(insert_usergroups_form());
} else {
    $numrows = new CDiv();
    $numrows->setAttribute('name', 'numrows');
    $usrgroup_wdgt->addHeader(S_USER_GROUPS_BIG);
    $usrgroup_wdgt->addHeader($numrows);
    // Groups table
    $form = new CForm();
    $form->setName('usrgrp_form');
    $table = new CTableInfo(S_NO_USER_GROUPS_DEFINED);
    $table->setHeader(array(new CCheckBox('all_groups', NULL, "checkAll('" . $form->GetName() . "','all_groups','group_groupid');"), make_sorting_header(S_NAME, 'name'), '#', S_MEMBERS, S_USERS_STATUS, S_GUI_ACCESS, S_API_ACCESS, S_DEBUG_MODE));
    $sortfield = getPageSortField('name');
    $sortorder = getPageSortOrder();
    $options = array('output' => API_OUTPUT_EXTEND, 'select_users' => API_OUTPUT_EXTEND, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1);
    $usrgrps = CUserGroup::get($options);
    // sorting
    order_result($usrgrps, $sortfield, $sortorder);
    $paging = getPagingLine($usrgrps);
    //---------
    foreach ($usrgrps as $ugnum => $usrgrp) {
        $usrgrpid = $usrgrp['usrgrpid'];
        $api_access = $usrgrp['api_access'] == GROUP_API_ACCESS_ENABLED ? new CLink(S_ENABLED, 'usergrps.php?go=disable_api&usrgrpid=' . $usrgrpid, 'orange') : new CLink(S_DISABLED, 'usergrps.php?go=enable_api&usrgrpid=' . $usrgrpid, 'enabled');
        $debug_mode = $usrgrp['debug_mode'] == GROUP_DEBUG_MODE_ENABLED ? new CLink(S_ENABLED, 'usergrps.php?go=disable_debug&usrgrpid=' . $usrgrpid, 'orange') : new CLink(S_DISABLED, 'usergrps.php?go=enable_debug&usrgrpid=' . $usrgrpid, 'enabled');
        $gui_access = user_auth_type2str($usrgrp['gui_access']);
        $gui_access_style = 'enabled';
        if (GROUP_GUI_ACCESS_INTERNAL == $usrgrp['gui_access']) {
Пример #14
0
    $frmHostG->addItemToBottomRow(new CButton('save', S_SAVE));
    if ($_REQUEST['hostid'] > 0) {
        $frmHostG->addItemToBottomRow(array(SPACE, new CButton('clone', S_CLONE), SPACE, new CButtonDelete(S_DELETE_SELECTED_PROXY_Q, url_param('form') . url_param('hostid')), SPACE));
    }
    $frmHostG->addItemToBottomRow(new CButtonCancel());
    $proxies_wdgt->addItem($frmHostG);
    $proxies_wdgt->show();
} else {
    $numrows = new CDiv();
    $numrows->setAttribute('name', 'numrows');
    $proxies_wdgt->addHeader(S_PROXIES_BIG);
    $proxies_wdgt->addHeader($numrows);
    $form = new CForm('proxies.php', 'get');
    $form->setName('hosts');
    $table = new CTableInfo(S_NO_PROXIES_DEFINED);
    $table->setHeader(array(new CCheckBox('all_hosts', NULL, "checkAll('" . $form->GetName() . "','all_hosts','hosts');"), make_sorting_header(S_NAME, 'host'), S_MODE, S_LASTSEEN_AGE, S_HOST_COUNT, S_ITEM_COUNT, S_REQUIRED_PERFORMANCE, S_HOSTS));
    $sortfield = getPageSortField('host');
    $sortorder = getPageSortOrder();
    $options = array('editable' => 1, 'select_hosts' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1);
    $proxies = CProxy::get($options);
    $proxies = zbx_toHash($proxies, 'proxyid');
    // ordering && paging
    order_result($proxies, $sortfield, $sortorder);
    $paging = getPagingLine($proxies);
    // --
    // CALCULATE PERFORMANCE {{{
    $proxyids = array_keys($proxies);
    $sql = 'SELECT h.proxy_hostid, sum(1.0/i.delay) as qps ' . ' FROM items i,hosts h ' . ' WHERE i.status=' . ITEM_STATUS_ACTIVE . ' AND i.hostid=h.hostid ' . ' AND h.status=' . HOST_STATUS_MONITORED . ' AND i.delay<>0' . ' AND ' . DBcondition('h.proxy_hostid', $proxyids) . ' GROUP BY h.proxy_hostid';
    $db_perf = DBselect($sql);
    while ($perf = DBfetch($db_perf)) {
        $proxies[$perf['proxy_hostid']]['perf'] = round($perf['qps'], 2);
Пример #15
0
 foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) {
     $cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name);
 }
 $r_form->addItem(array(S_GROUP . SPACE, $cmbGroups));
 $r_form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
 $row_count = 0;
 $numrows = new CSpan(null, 'info');
 $numrows->addOption('name', 'numrows');
 $header = get_table_header(array(S_GRAPHS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
 show_table_header($header, $r_form);
 /* TABLE */
 $form = new CForm();
 $form->setName('graphs');
 $form->addVar('hostid', $_REQUEST['hostid']);
 $table = new CTableInfo(S_NO_GRAPHS_DEFINED);
 $table->setHeader(array($_REQUEST['hostid'] != 0 ? NULL : S_HOSTS, array(new CCheckBox('all_graphs', NULL, "CheckAll('" . $form->GetName() . "','all_graphs');"), make_sorting_link(S_NAME, 'g.name')), make_sorting_link(S_WIDTH, 'g.width'), make_sorting_link(S_HEIGHT, 'g.height'), make_sorting_link(S_GRAPH_TYPE, 'g.graphtype')));
 $sql_from = '';
 $sql_where = '';
 if ($PAGE_HOSTS['selected'] > 0) {
     $sql_where .= ' AND i.hostid=' . $PAGE_HOSTS['selected'];
 }
 $sql = 'SELECT DISTINCT g.* ' . ' FROM graphs g, graphs_items gi,items i ' . $sql_from . ' WHERE ' . DBcondition('g.graphid', $available_graphs) . ' AND gi.graphid=g.graphid ' . ' AND i.itemid=gi.itemid ' . $sql_where . order_by('g.name,g.width,g.height,g.graphtype', 'g.graphid');
 $result = DBselect($sql);
 while ($row = DBfetch($result)) {
     if ($_REQUEST['hostid'] != 0) {
         $host_list = NULL;
     } else {
         $host_list = array();
         $db_hosts = get_hosts_by_graphid($row['graphid']);
         while ($db_host = DBfetch($db_hosts)) {
             array_push($host_list, $db_host['host']);
Пример #16
0
 $form->SetMethod('get');
 $cmbSource = new CComboBox('eventsource', $_REQUEST['eventsource'], 'submit()');
 $cmbSource->addItem(EVENT_SOURCE_TRIGGERS, S_TRIGGERS);
 $cmbSource->addItem(EVENT_SOURCE_DISCOVERY, S_DISCOVERY);
 $form->addItem(array(S_EVENT_SOURCE, SPACE, $cmbSource));
 $row_count = 0;
 $numrows = new CSpan(null, 'info');
 $numrows->addOption('name', 'numrows');
 $header = get_table_header(array(S_ACTIONS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
 show_table_header($header, $form);
 unset($form, $cmbSource);
 /* table */
 $form = new CForm();
 $form->SetName('actions');
 $tblActions = new CTableInfo(S_NO_ACTIONS_DEFINED);
 $tblActions->SetHeader(array(array(new CCheckBox('all_items', null, 'CheckAll("' . $form->GetName() . '","all_items");'), make_sorting_link(S_NAME, 'a.name')), S_CONDITIONS, S_OPERATIONS, make_sorting_link(S_STATUS, 'a.status')));
 $db_actions = DBselect('SELECT a.* ' . ' FROM actions a' . ' WHERE a.eventsource=' . $_REQUEST['eventsource'] . ' AND ' . DBin_node('actionid') . order_by('a.name,a.status', 'a.actionid'));
 while ($action_data = DBfetch($db_actions)) {
     if (!action_accessible($action_data['actionid'], PERM_READ_WRITE)) {
         continue;
     }
     $conditions = array();
     $db_conditions = DBselect('select * from conditions where actionid=' . $action_data['actionid'] . ' order by conditiontype,conditionid');
     while ($condition_data = DBfetch($db_conditions)) {
         array_push($conditions, array(get_condition_desc($condition_data['conditiontype'], $condition_data['operator'], $condition_data['value']), BR()));
     }
     unset($db_conditions, $condition_data);
     $operations = array();
     $db_operations = DBselect('select * from operations where actionid=' . $action_data['actionid'] . ' order by operationtype,operationid');
     while ($operation_data = DBfetch($db_operations)) {
         array_push($operations, array(get_operation_desc(SHORT_DESCRITION, $operation_data), BR()));
Пример #17
0
        $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->addOption('id', 'scripts');
    $form->addVar('action', '1');
    $numrows = new CSpan(null, 'info');
    $numrows->addOption('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(array(new CCheckBox('all_scripts', null, "CheckAll('" . $form->GetName() . "','all_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(array(new CCheckBox('scripts[' . $script['scriptid'] . ']', 'no', NULL, $script['scriptid']), new CLink($script['name'], 'scripts.php?form=1' . '&scriptid=' . $script['scriptid'] . '#form', 'action')), htmlspecialchars($script['command']), $user_group_name, $host_group_name, PERM_READ_WRITE == $script['host_access'] ? S_WRITE : S_READ));
        $row_count++;
Пример #18
0
    // adding javascript, so that auth fields would be hidden if they are not used in specific auth type
    $securityLevelVisibility = array();
    zbx_subarray_push($securityLevelVisibility, ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV, 'row_snmpv3_authpassphrase');
    zbx_subarray_push($securityLevelVisibility, ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV, 'row_snmpv3_authpassphrase');
    zbx_subarray_push($securityLevelVisibility, ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV, 'row_snmpv3_privpassphrase');
    zbx_add_post_js("var securityLevelSwitcher = new CViewSwitcher('new_check_snmpv3_securitylevel', 'change', " . zbx_jsvalue($securityLevelVisibility, true) . ");");
} else {
    $numrows = new CDiv();
    $numrows->setAttribute('name', 'numrows');
    $dscry_wdgt->addHeader(S_DISCOVERY_BIG);
    $dscry_wdgt->addHeader($numrows);
    /* table */
    $form = new CForm();
    $form->setName('frmdrules');
    $tblDiscovery = new CTableInfo(S_NO_DISCOVERY_RULES_DEFINED);
    $tblDiscovery->setHeader(array(new CCheckBox('all_drules', null, "checkAll('" . $form->GetName() . "','all_drules','g_druleid');"), make_sorting_header(S_NAME, 'd.name'), make_sorting_header(S_IP_RANGE, 'd.iprange'), make_sorting_header(S_DELAY, 'd.delay'), S_CHECKS, S_STATUS));
    $sql = 'SELECT d.* ' . ' FROM drules d' . ' WHERE ' . DBin_node('druleid') . order_by('d.name,d.iprange,d.delay', 'd.druleid');
    $db_rules = DBselect($sql);
    // Discovery rules will be gathered here, so we can feed this array to pagination function
    $rules_arr = array();
    while ($rule_data = DBfetch($db_rules)) {
        $rules_arr[] = $rule_data;
    }
    // getting paging element
    $paging = getPagingLine($rules_arr);
    foreach ($rules_arr as $rule_data) {
        $checks = array();
        $sql = 'SELECT type FROM dchecks WHERE druleid=' . $rule_data['druleid'] . ' ORDER BY type, ports';
        $db_checks = DBselect($sql);
        while ($check_data = DBfetch($db_checks)) {
            if (!isset($checks[$check_data['type']])) {
Пример #19
0
    echo $dstfrm;
    ?>
'];
<!--
<?php 
    foreach ($new_group as $id => $name) {
        echo 'add_var_to_opener_obj(form,"new_group[' . $id . ']","' . $name . '")' . "\r";
    }
    ?>
if(form)
{
	form.submit();
	close_window();
}
-->
</script>
<?php 
}
$form = new CForm();
$form->AddVar('dstfrm', $dstfrm);
$form->SetName('groups');
$table = new CTableInfo(S_NO_GROUPS_DEFINED);
$table->SetHeader(array(array(new CCheckBox("all_groups", NULL, "CheckAll('" . $form->GetName() . "','all_groups');"), S_NAME)));
$result = DBselect('select * from usrgrp where ' . DBin_node('usrgrpid') . ' order by name');
while ($row = DBfetch($result)) {
    $table->AddRow(array(array(new CCheckBox('new_group[' . $row['usrgrpid'] . ']', isset($new_group[$row['usrgrpid']]), NULL, $row['name']), $row['name'])));
}
$table->SetFooter(new CButton('select', S_SELECT));
$form->AddItem($table);
$form->Show();
include_once "include/page_footer.php";
Пример #20
0
        $jsmenu->InsertJavaScript();
        set_users_jsmenu_array();
    }
} else {
    if ($_REQUEST['config'] == 1) {
        // USER GROUPS
        if (isset($_REQUEST['form'])) {
            insert_usergroups_form();
        } else {
            $numrows = new CSpan(null, 'info');
            $numrows->addOption('name', 'numrows');
            $header = get_table_header(array(S_USER_GROUPS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
            show_table_header($header);
            $form = new CForm();
            $table = new CTableInfo(S_NO_USER_GROUPS_DEFINED);
            $table->setHeader(array(S_USERS_STATUS, S_GUI_ACCESS, array(new CCheckBox('all_groups', NULL, "CheckAll('" . $form->GetName() . "','all_groups');"), make_sorting_link(S_NAME, 'ug.name')), S_MEMBERS));
            $result = DBselect('SELECT ug.usrgrpid, ug.name, ug.users_status, ug.gui_access ' . ' FROM usrgrp ug' . ' WHERE ' . DBin_node('ug.usrgrpid') . order_by('ug.name'));
            while ($row = DBfetch($result)) {
                $users = array();
                $users_id = array();
                $db_users = DBselect('SELECT DISTINCT u.alias,u.userid ' . ' FROM users u,users_groups ug ' . ' WHERE u.userid=ug.userid ' . ' AND ug.usrgrpid=' . $row['usrgrpid'] . ' ORDER BY u.alias');
                while ($db_user = DBfetch($db_users)) {
                    if (!empty($users)) {
                        $users[$db_user['userid']][] = ', ';
                    } else {
                        $users[$db_user['userid']] = array();
                    }
                    $users[$db_user['userid']][] = new Clink($db_user['alias'], 'users.php?form=update&config=0&userid=' . $db_user['userid'] . '#form');
                }
                $gui_access = user_auth_type2str($row['gui_access']);
                $users_status = $row['users_status'] == GROUP_STATUS_ENABLED ? S_ENABLED : S_DISABLED;
Пример #21
0
$frmForm->addItem(SPACE . '|' . SPACE);
$frmForm->addItem($btnNew = new CButton('form', S_CREATE_USER));
show_table_header(S_CONFIGURATION_OF_USERS_AND_USER_GROUPS, $frmForm);
echo SBR;
$row_count = 0;
if (isset($_REQUEST['form'])) {
    insert_user_form(get_request('userid', null));
} else {
    $form = new CForm(null, 'post');
    $form->setName('users');
    $numrows = new CSpan(null, 'info');
    $numrows->setAttribute('name', 'numrows');
    $header = get_table_header(array(S_USERS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
    show_table_header($header);
    $table = new CTableInfo(S_NO_USERS_DEFINED);
    $table->setHeader(array(new CCheckBox('all_users', NULL, "checkAll('" . $form->GetName() . "','all_users','group_userid');"), make_sorting_link(S_ALIAS, 'u.alias'), make_sorting_link(S_NAME, 'u.name'), make_sorting_link(S_SURNAME, 'u.surname'), make_sorting_link(S_USER_TYPE, 'u.type'), S_GROUPS, S_IS_ONLINE_Q, S_GUI_ACCESS, S_API_ACCESS, S_DEBUG_MODE, S_STATUS));
    $cond_from = '';
    $cond_where = '';
    if ($_REQUEST['filter_usrgrpid'] > 0) {
        $cond_from = ', users_groups ug, usrgrp ugrp ';
        $cond_where = ' AND ug.userid = u.userid ' . ' AND ug.usrgrpid=' . $_REQUEST['filter_usrgrpid'];
    }
    $users = array();
    $userids = array();
    $db_users = DBselect('SELECT DISTINCT u.userid,u.alias,u.name,u.surname,u.type,u.autologout ' . ' FROM users u ' . $cond_from . ' WHERE ' . DBin_node('u.userid') . $cond_where . order_by('u.alias,u.name,u.surname,u.type', 'u.userid'));
    while ($db_user = DBfetch($db_users)) {
        $users[$db_user['userid']] = $db_user;
        $userids[$db_user['userid']] = $db_user['userid'];
    }
    $users_sessions = array();
    $sql = 'SELECT s.userid, MAX(s.lastaccess) as lastaccess, s.status ' . ' FROM sessions s, users u' . ' WHERE ' . DBcondition('s.userid', $userids) . ' AND s.userid=u.userid ' . ' GROUP BY s.userid,s.status';
Пример #22
0
$filterForm->addItemToBottomRow(new CButton('filter_rst', S_RESET));
$trigg_wdgt->addFlicker($filterForm, CProfile::get('web.tr_status.filter.state', 0));
/*************** FILTER END ******************/
if ($_REQUEST['fullscreen']) {
    $triggerInfo = new CTriggersInfo($_REQUEST['groupid'], $_REQUEST['hostid']);
    $triggerInfo->HideHeader();
    $triggerInfo->show();
}
$m_form = new CForm('acknow.php');
$m_form->setName('tr_status');
$m_form->addVar('backurl', $page['file']);
$admin_links = $USER_DETAILS['type'] == USER_TYPE_ZABBIX_ADMIN || $USER_DETAILS['type'] == USER_TYPE_SUPER_ADMIN;
$show_event_col = $config['event_ack_enable'] && $_REQUEST['show_events'] != EVENTS_OPTION_NOEVENT;
$table = new CTableInfo();
$switcherName = 'trigger_switchers';
$header_cb = $show_event_col ? new CCheckBox('all_events', false, "checkAll('" . $m_form->GetName() . "','all_events','events');") : new CCheckBox('all_triggers', false, "checkAll('" . $m_form->GetName() . "','all_triggers', 'triggers');");
if ($show_events != EVENTS_OPTION_NOEVENT) {
    $whow_hide_all = new CDiv(SPACE, 'filterclosed');
    $whow_hide_all->setAttribute('id', $switcherName);
} else {
    $whow_hide_all = NULL;
}
$table->setHeader(array($whow_hide_all, $config['event_ack_enable'] ? $header_cb : null, make_sorting_header(S_SEVERITY, 'priority'), S_STATUS, make_sorting_header(S_LAST_CHANGE, 'lastchange'), S_AGE, $show_event_col ? S_DURATION : NULL, $config['event_ack_enable'] ? S_ACKNOWLEDGED : NULL, is_show_all_nodes() ? S_NODE : null, S_HOST, make_sorting_header(S_NAME, 'description'), S_COMMENTS));
$sortfield = getPageSortField('description');
$sortorder = getPageSortOrder();
$options = array('nodeids' => get_current_nodeid(), 'filter' => array(), 'monitored' => 1, 'output' => API_OUTPUT_EXTEND, 'skipDependent' => 1, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'limit' => $config['search_limit'] + 1);
// Filtering
if ($pageFilter->hostsSelected) {
    if ($pageFilter->hostid > 0) {
        $options['hostids'] = $pageFilter->hostid;
    } else {
Пример #23
0
 foreach ($PAGE_HOSTS['hosts'] as $hostid => $name) {
     $cmbHosts->addItem($hostid, get_node_name_by_elid($hostid) . $name);
 }
 $form->addItem(array(S_GROUP . SPACE, $cmbGroups));
 $form->addItem(array(SPACE . S_HOST . SPACE, $cmbHosts));
 $numrows = new CSpan(null, 'info');
 $numrows->setAttribute('name', 'numrows');
 $header = get_table_header(array(S_APPLICATIONS_BIG, new CSpan(SPACE . SPACE . '|' . SPACE . SPACE, 'divider'), S_FOUND . ': ', $numrows));
 show_table_header($header, $form);
 /* TABLE */
 $form = new CForm();
 $form->setName('applications');
 $form->addVar('groupid', $PAGE_GROUPS['selected']);
 $form->addVar('hostid', $PAGE_HOSTS['selected']);
 $table = new CTableInfo();
 $table->setHeader(array(new CCheckBox('all_applications', NULL, "checkAll('" . $form->GetName() . "','all_applications','applications');"), make_sorting_link(S_APPLICATION, 'a.name'), S_SHOW));
 $sql = 'SELECT a.* ' . ' FROM applications a' . ' WHERE a.hostid=' . $_REQUEST['hostid'] . order_by('a.name');
 $db_applications = DBselect($sql);
 while ($db_app = DBfetch($db_applications)) {
     if ($db_app['templateid'] == 0) {
         $name = new CLink($db_app['name'], 'applications.php?form=update&applicationid=' . $db_app['applicationid']);
     } else {
         $template_host = get_realhost_by_applicationid($db_app['templateid']);
         $name = array(new CLink($template_host['host'], 'applications.php?hostid=' . $template_host['hostid']), ':', $db_app['name']);
     }
     $items = get_items_by_applicationid($db_app['applicationid']);
     $rows = 0;
     while (DBfetch($items)) {
         $rows++;
     }
     $table->addRow(array(new CCheckBox('applications[' . $db_app['applicationid'] . ']', NULL, NULL, $db_app['applicationid']), $name, array(new CLink(S_ITEMS, 'items.php?hostid=' . $db_app['hostid']), SPACE . '(' . $rows . ')')));