} elseif (array_key_exists($group['groupid'], $data['groupsAllowed'])) {
            $groupsTB->addItem($group['groupid'], $group['name']);
        }
    }
    $hostList->addRow(_('Groups'), $groupsTB->get(_('In groups'), _('Other groups')));
    $new_group = (new CTextBox('newgroup', $data['newgroup']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)->setAttribute('maxlength', 64);
    $new_group_label = _('New group');
    if (CWebUser::$data['type'] != USER_TYPE_SUPER_ADMIN) {
        $new_group_label .= ' ' . _('(Only super admins can create groups)');
        $new_group->setReadonly(true);
    }
    $hostList->addRow(new CLabel($new_group_label, 'newgroup'), (new CSpan($new_group))->addClass(ZBX_STYLE_FORM_NEW_GROUP));
} else {
    // groups for discovered hosts
    $groupBox = new CListBox(null, null, 10);
    $groupBox->setEnabled(false);
    foreach ($data['groupsAll'] as $group) {
        if (in_array($group['groupid'], $data['groups'])) {
            $groupBox->addItem($group['groupid'], $group['name'], null, array_key_exists($group['groupid'], $data['groupsAllowed']));
        }
    }
    $hostList->addRow(_('Groups'), $groupBox);
    $hostList->addVar('groups', $data['groups']);
}
// interfaces for normal hosts
if ($data['flags'] != ZBX_FLAG_DISCOVERY_CREATED) {
    zbx_add_post_js($data['interfaces'] ? 'hostInterfacesManager.add(' . CJs::encodeJson($data['interfaces']) . ');' : 'hostInterfacesManager.addNew("agent");');
    // Zabbix agent interfaces
    $ifTab = (new CTable())->setId('agentInterfaces')->setHeader([new CColHeader(), new CColHeader(_('IP address')), new CColHeader(_('DNS name')), new CColHeader(_('Connect to')), new CColHeader(_('Port')), (new CColHeader(_('Default')))->setColSpan(2)])->addRow((new CRow([(new CCol((new CButton('addAgentInterface', _('Add')))->addClass(ZBX_STYLE_BTN_LINK)))->setColSpan(7)]))->setId('agentInterfacesFooter'));
    $hostList->addRow(_('Agent interfaces'), (new CDiv($ifTab))->addClass(ZBX_STYLE_TABLE_FORMS_SEPARATOR)->setAttribute('data-type', 'agent')->setWidth(ZBX_HOST_INTERFACE_WIDTH));
    // SNMP interfaces