break; default: $style = null; $url = 'hosts.php?form=update&hostid=' . $hostid . '&groupid=' . $groupid; break; } $hosts_output[] = new CLink($host['host'], $url, $style); $hosts_output[] = ', '; } array_pop($hosts_output); foreach ($group['hosts'] as $hostid => $host) { $host['status'] == HOST_STATUS_TEMPLATE ? $tpl_count++ : $host_count++; } $table->addRow(array(new CCheckBox('groups[' . $groupid . ']', NULL, NULL, $groupid), new CLink($group['name'], 'hostgroups.php?form=update&groupid=' . $groupid), array(array(new CLink(S_HOSTS, 'hosts.php?groupid=' . $groupid), ' (' . $host_count . ')'), BR(), array(new CLink(S_TEMPLATES, 'templates.php?groupid=' . $groupid, 'unknown'), ' (' . $tpl_count . ')')), new CCol(empty($hosts_output) ? '-' : $hosts_output, 'wraptext'))); } $row_count = $table->getNumRows(); //----- GO ------ $goBox = new CComboBox('go'); $goBox->addItem('activate', S_ACTIVATE_SELECTED); $goBox->addItem('disable', S_DISABLE_SELECTED); $goBox->addItem('delete', S_DELETE_SELECTED); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "groups";'); $table->setFooter(new CCol(array($goBox, $goButton))); //---- $form->addItem($table); $form->show(); zbx_add_post_js('insert_in_element("numrows","' . $row_count . '");'); }
if ($host['proxy_hostid']) { $proxyHostIds[$host['proxy_hostid']] = $host['proxy_hostid']; } } if ($proxyHostIds) { $proxies = API::Proxy()->get(['proxyids' => $proxyHostIds, 'output' => ['proxyid', 'host'], 'preservekeys' => true]); } $table->setHeader([_('Scheduled check'), _('Delayed by'), _('Host'), _('Name')]); $i = 0; foreach ($queueData as $itemData) { if (!isset($items[$itemData['itemid']])) { continue; } // display only the first 500 items $i++; if ($i > QUEUE_DETAIL_ITEM_COUNT) { break; } $item = $items[$itemData['itemid']]; $host = reset($item['hosts']); $table->addRow([zbx_date2str(DATE_TIME_FORMAT_SECONDS, $itemData['nextcheck']), zbx_date2age($itemData['nextcheck']), isset($proxies[$hosts[$item['hostid']]['proxy_hostid']]) ? $proxies[$hosts[$item['hostid']]['proxy_hostid']]['host'] . NAME_DELIMITER . $host['name'] : $host['name'], $item['name_expanded']]); } } // display the table footer if ($config == QUEUE_OVERVIEW_BY_PROXY) { $table->setFooter(new CCol(_('Total') . ': ' . $table->getNumRows())); } elseif ($config == QUEUE_DETAILS) { $table->setFooter(new CCol(_('Total') . ': ' . $table->getNumRows() . (count($queueData) > QUEUE_DETAIL_ITEM_COUNT ? ' (' . _('Truncated') . ')' : ''))); } $widget->addItem($table)->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$style = 'unknown'; $url = 'templates.php?form=update&templateid=' . $linked_to_hostid; break; default: $style = null; $url = 'hosts.php?form=update&hostid=' . $linked_to_hostid . '&groupid=' . $selected_group; break; } $linked_to_hosts_output[] = new CLink($linked_to_host['host'], $url, $style); $linked_to_hosts_output[] = ', '; } array_pop($linked_to_hosts_output); $table->addRow(array(new CCheckBox('templates[' . $templateid . ']', NULL, NULL, $templateid), $templates_output, empty($linked_templates_output) ? '-' : new CCol($linked_templates_output, 'wraptext'), empty($linked_to_hosts_output) ? '-' : new CCol($linked_to_hosts_output, 'wraptext'))); } // --->>> GENERATE OUTPUTS <<<--- zbx_add_post_js('insert_in_element("numrows","' . $table->getNumRows() . '");'); //----- GO ------ $goBox = new CComboBox('go'); $goBox->addItem('delete', S_DELETE_SELECTED); $goBox->addItem('delete_and_clear', S_DELETE_SELECTED_WITH_LINKED_ELEMENTS); // goButton name is necessary!!! $goButton = new CButton('goButton', S_GO . ' (0)'); $goButton->setAttribute('id', 'goButton'); zbx_add_post_js('chkbxRange.pageGoName = "templates";'); $table->setFooter(new CCol(array($goBox, $goButton))); //---- $form->addItem($table); $form->show(); } /****************************************/ /* --->>> TEMPLATE LIST AND FORM <<<--- */