コード例 #1
0
$hostList->addRow(_('Visible name'), $visiblenameTB);
// groups for normal hosts
if (!$isDiscovered) {
    $grp_tb = new CTweenBox($frmHost, 'groups', $host_groups, 10);
    $all_groups = API::HostGroup()->get(array('editable' => true, 'output' => API_OUTPUT_EXTEND));
    order_result($all_groups, 'name');
    foreach ($all_groups as $group) {
        $grp_tb->addItem($group['groupid'], $group['name']);
    }
    $hostList->addRow(_('Groups'), $grp_tb->get(_('In groups'), _('Other groups')));
    $newgroupTB = new CTextBox('newgroup', $newgroup, ZBX_TEXTBOX_SMALL_SIZE);
    $newgroupTB->setAttribute('maxlength', 64);
    $tmp_label = _('New group');
    if (CWebUser::$data['type'] != USER_TYPE_SUPER_ADMIN) {
        $tmp_label .= SPACE . _('(Only super admins can create groups)');
        $newgroupTB->setReadonly(true);
    }
    $hostList->addRow(SPACE, array(new CLabel($tmp_label, 'newgroup'), BR(), $newgroupTB), null, null, null, 'new');
} else {
    $groupBox = new CComboBox('groups');
    $groupBox->setAttribute('readonly', true);
    $groupBox->setAttribute('size', 10);
    foreach ($dbHost['groups'] as $group) {
        $groupBox->addItem($group['groupid'], $group['name']);
    }
    $hostList->addRow(_('Groups'), $groupBox);
}
// interfaces for normal hosts
if (!$isDiscovered) {
    if (empty($interfaces)) {
        $script = 'hostInterfacesManager.addNew("agent");';