示例#1
0
 $templates = selectByPattern($db_templates, 'name', $search, $rows_per_page);
 $templateids = zbx_objectValues($templates, 'templateid');
 $params = array('nodeids' => get_current_nodeid(true), 'templateids' => $templateids, 'editable' => 1);
 $rw_templates = API::Template()->get($params);
 $rw_templates = zbx_toHash($rw_templates, 'templateid');
 $params = array('nodeids' => get_current_nodeid(true), 'search' => array('name' => $search), 'countOutput' => 1, 'editable' => 1);
 $overalCount = API::Template()->get($params);
 $viewCount = count($templates);
 $header = array(ZBX_DISTRIBUTED ? new CCol(_('Node')) : null, new CCol(_('Templates')), new CCol(_('Applications')), new CCol(_('Items')), new CCol(_('Triggers')), new CCol(_('Graphs')), new CCol(_('Screens')), new CCol(_('Discovery')), new CCol(_('Web')));
 $table = new CTableInfo(_('No templates found.'));
 $table->setHeader($header);
 foreach ($templates as $tnum => $template) {
     $templateid = $template['templateid'];
     $group = reset($template['groups']);
     $link = 'groupid=' . $group['groupid'] . '&hostid=' . $templateid . '&switch_node=' . id2nodeid($templateid);
     $caption = make_decoration($template['name'], $search);
     if (isset($rw_templates[$templateid])) {
         $template_link = new CLink($caption, 'templates.php?form=update&' . '&templateid=' . $templateid . '&switch_node=' . id2nodeid($templateid));
         $applications_link = array(new CLink(_('Applications'), 'applications.php?' . $link), ' (' . $template['applications'] . ')');
         $items_link = array(new CLink(_('Items'), 'items.php?filter_set=1&' . $link), ' (' . $template['items'] . ')');
         $triggers_link = array(new CLink(_('Triggers'), 'triggers.php?' . $link), ' (' . $template['triggers'] . ')');
         $graphs_link = array(new CLink(_('Graphs'), 'graphs.php?' . $link), ' (' . $template['graphs'] . ')');
         $screensLink = array(new CLink(_('Screens'), 'screenconf.php?templateid=' . $templateid), ' (' . $template['screens'] . ')');
         $discoveryLink = array(new CLink(_('Discovery'), 'host_discovery.php?' . $link), ' (' . $template['discoveries'] . ')');
         $httpTestsLink = array(new CLink(_('Web'), 'httpconf.php?' . $link), ' (' . $template['httpTests'] . ')');
     } else {
         $template_link = new CSpan($caption);
         $applications_link = _('Applications') . ' (' . $template['applications'] . ')';
         $items_link = _('Items') . ' (' . $template['items'] . ')';
         $triggers_link = _('Triggers') . ' (' . $template['triggers'] . ')';
         $graphs_link = _('Graphs') . ' (' . $template['graphs'] . ')';
示例#2
0
    $res = DBselect($sql);
    while ($templategroup = DBfetch($res)) {
        $hostsgroups[$templategroup['hostid']] = $templategroup['groupid'];
    }
    $params = array('nodeids' => get_current_nodeid(), 'pattern' => $search, 'count' => 1, 'editable' => 1);
    $hosts_count = CTemplate::get($params);
    $overalCount = $hosts_count['rowscount'];
    $viewCount = count($templates);
    $header = array(is_show_all_nodes() ? new CCol(S_NODE) : null, new CCol(S_TEMPLATES), new CCol(S_ITEMS), new CCol(S_TRIGGERS), new CCol(S_GRAPHS));
    $table = new CTableInfo();
    $table->setHeader($header);
    foreach ($templates as $num => $template) {
        $templateid = $template['hostid'];
        $groupid = isset($hostsgroups[$templateid]) ? $hostsgroups[$templateid] : 0;
        $link = 'groupid=' . $groupid . '&hostid=' . $templateid;
        $caption = make_decoration($template['host'], $search);
        $table->addRow(array(get_node_name_by_elid($templateid), new CLink($caption, 'hosts.php?config=3&hostid=' . $templateid), new CLink(S_GO, 'items.php?' . $link), new CLink(S_GO, 'triggers.php?' . $link), new CLink(S_GO, 'graphs.php?' . $link)));
    }
    $table->setFooter(new CCol(S_DISPLAYING . SPACE . $viewCount . SPACE . S_OF_SMALL . SPACE . $overalCount . SPACE . S_FOUND_SMALL));
    $wdgt_templates = new CWidget('search_templates', $table);
    $wdgt_templates->addHeader(S_TEMPLATES, SPACE);
    $right_tab->addRow($wdgt_templates);
}
//----------------
$td_l = new CCol($left_tab);
$td_l->setAttribute('valign', 'top');
$td_r = new CCol($right_tab);
$td_r->setAttribute('valign', 'top');
$outer_table = new CTable();
$outer_table->setAttribute('border', 0);
$outer_table->setCellPadding(1);
示例#3
0
            $discoveryLink = array(new CLink(_('Discovery'), 'host_discovery.php?' . $link), ' (' . $template['discoveries'] . ')');
            $httpTestsLink = array(new CLink(_('Web'), 'httpconf.php?' . $link), ' (' . $template['httpTests'] . ')');
        } else {
            // host
            $templateCell = array(new CSpan($templateVisibleName));
            $applications_link = _('Applications') . ' (' . $template['applications'] . ')';
            $items_link = _('Items') . ' (' . $template['items'] . ')';
            $triggers_link = _('Triggers') . ' (' . $template['triggers'] . ')';
            $graphs_link = _('Graphs') . ' (' . $template['graphs'] . ')';
            $screensLink = _('Screens') . ' (' . $template['screens'] . ')';
            $discoveryLink = _('Discovery') . ' (' . $template['discoveries'] . ')';
            $httpTestsLink = _('Web') . ' (' . $template['httpTests'] . ')';
        }
        // display the template host name only if it matches the search string and is different from the visible name
        if ($template['host'] !== $template['name'] && stripos($template['host'], $search) !== false) {
            $templateCell[] = BR();
            $templateCell[] = '(';
            $templateCell[] = make_decoration($template['host'], $search);
            $templateCell[] = ')';
        }
        $table->addRow(array($templateCell, $applications_link, $items_link, $triggers_link, $graphs_link, $screensLink, $discoveryLink, $httpTestsLink));
    }
    $searchTemplateWidget = new CCollapsibleUiWidget('search_templates', $table);
    $searchTemplateWidget->open = (bool) CProfile::get('web.search.hats.search_templates.state', true);
    $searchTemplateWidget->setHeader(_('Templates'));
    $searchTemplateWidget->setFooter(_s('Displaying %1$s of %2$s found', $viewCount, $overalCount));
    $searchWidget->addItem(new CDiv($searchTemplateWidget));
}
//----------------
$searchWidget->show();
require_once dirname(__FILE__) . '/include/page_footer.php';