$options['groupids'] = $_REQUEST['groupid']; } if ($_REQUEST['hostid'] > 0) { $options['hostids'] = $_REQUEST['hostid']; } } else { if ($_REQUEST['hostid'] > 0) { $hosts = CHost::get(array('templateids' => $_REQUEST['hostid'])); $options['hostids'] = zbx_objectValues($hosts, 'hostid'); } if (isset($_REQUEST['tpl_triggerid']) && $_REQUEST['tpl_triggerid'] > 0) { $options['filter']['templateid'] = $_REQUEST['tpl_triggerid']; } } $triggers = CTrigger::get($options); morder_result($triggers, array('host', 'description')); $table = new CTableInfo(); $table->setHeader(array(is_show_all_nodes() ? S_NODE : null, $_REQUEST['hostid'] == 0 || 1 == $config ? S_HOST : NULL, S_NAME, S_PROBLEMS, S_OK, S_UNKNOWN, S_GRAPH)); foreach ($triggers as $trigger) { $availability = calculate_availability($trigger['triggerid'], $_REQUEST['filter_timesince'], $_REQUEST['filter_timetill']); $true = new CSpan(sprintf('%.4f%%', $availability['true']), 'on'); $false = new CSpan(sprintf('%.4f%%', $availability['false']), 'off'); $unknown = new CSpan(sprintf('%.4f%%', $availability['unknown']), 'unknown'); $actions = new CLink(S_SHOW, 'report2.php?filter_groupid=' . $_REQUEST['groupid'] . '&filter_hostid=' . $_REQUEST['hostid'] . '&triggerid=' . $trigger['triggerid']); $table->addRow(array(get_node_name_by_elid($trigger['hostid']), $_REQUEST['hostid'] == 0 || 1 == $config ? $trigger['host'] : NULL, new CLink($trigger['description'], 'events.php?triggerid=' . $trigger['triggerid']), $true, $false, $unknown, $actions)); } $rep2_wdgt->addItem($table); $rep2_wdgt->show(); } } include_once 'include/page_footer.php';
} else { if ($srctbl == 'applications') { $table = new CTableInfo(S_NO_APPLICATIONS_DEFINED); $table->setHeader(array($hostid > 0 ? null : S_HOST, S_NAME)); $options = array('nodeids' => $nodeid, 'hostids' => $hostid, 'output' => API_OUTPUT_EXTEND, 'expandData' => true); if (is_null($hostid)) { $options['groupids'] = $groupid; } if (!is_null($writeonly)) { $options['editable'] = 1; } if (!is_null($templated)) { $options['templated'] = $templated; } $apps = CApplication::get($options); morder_result($apps, array('host', 'name')); foreach ($apps as $app) { $name = new CSpan($app['name'], 'link'); $action = get_window_opener($dstfrm, $dstfld1, $app[$srcfld1]) . (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $app[$srcfld2]) : ''); $name->setAttribute('onclick', $action . " close_window(); return false;"); $table->addRow(array($hostid > 0 ? null : $app['host'], $name)); } $table->show(); } else { if ($srctbl == "nodes") { $table = new CTableInfo(S_NO_NODES_DEFINED); $table->setHeader(S_NAME); $result = DBselect('SELECT DISTINCT * FROM nodes WHERE ' . DBcondition('nodeid', $available_nodes)); while ($row = DBfetch($result)) { $name = new CSpan($row["name"], 'link'); $action = get_window_opener($dstfrm, $dstfld1, $row[$srcfld1]) . (isset($srcfld2) ? get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) : '');