// create table
$itemTable = new CTableInfo(_('No item prototypes found.'));
$sortLink = new CUrl();
$sortLink->setArgument('parent_discoveryid', $this->data['parent_discoveryid']);
$sortLink = $sortLink->getUrl();
$itemTable->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $itemForm->getName() . "', 'all_items', 'group_itemid');"), make_sorting_header(_('Name'), 'name', $sortLink), make_sorting_header(_('Key'), 'key_', $sortLink), make_sorting_header(_('Interval'), 'delay', $sortLink), make_sorting_header(_('History'), 'history', $sortLink), make_sorting_header(_('Trends'), 'trends', $sortLink), make_sorting_header(_('Type'), 'type', $sortLink), _('Applications'), make_sorting_header(_('Status'), 'status', $sortLink)));
foreach ($this->data['items'] as $item) {
    $description = array();
    if (!empty($item['templateid'])) {
        $template_host = get_realhost_by_itemid($item['templateid']);
        $templateDiscoveryRuleId = get_realrule_by_itemid_and_hostid($this->data['parent_discoveryid'], $template_host['hostid']);
        $description[] = new CLink($template_host['name'], '?parent_discoveryid=' . $templateDiscoveryRuleId, 'unknown');
        $description[] = NAME_DELIMITER;
    }
    $description[] = new CLink($item['name_expanded'], '?form=update&itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid']);
    $status = new CLink(itemIndicator($item['status']), '?group_itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid'] . '&go=' . ($item['status'] ? 'activate' : 'disable'), itemIndicatorStyle($item['status']));
    if (!empty($item['applications'])) {
        order_result($item['applications'], 'name');
        $applications = zbx_objectValues($item['applications'], 'name');
        $applications = implode(', ', $applications);
        if (empty($applications)) {
            $applications = '-';
        }
    } else {
        $applications = '-';
    }
    $itemTable->addRow(array(new CCheckBox('group_itemid[' . $item['itemid'] . ']', null, null, $item['itemid']), $description, $item['key_'], $item['delay'], $item['history'], in_array($item['value_type'], array(ITEM_VALUE_TYPE_STR, ITEM_VALUE_TYPE_LOG, ITEM_VALUE_TYPE_TEXT)) ? '' : $item['trends'], item_type2str($item['type']), new CCol($applications, 'wraptext'), $status));
}
// create go buttons
$goComboBox = new CComboBox('go');
$goOption = new CComboItem('activate', _('Enable selected'));
$currentTime = time();
foreach ($this->data['items'] as $item) {
    // description
    $description = array();
    if (!empty($item['template_host'])) {
        $description[] = new CLink(CHtml::encode($item['template_host']['name']), '?hostid=' . $item['template_host']['hostid'] . '&filter_set=1', 'unknown');
        $description[] = NAME_DELIMITER;
    }
    if (!empty($item['discoveryRule'])) {
        $description[] = new CLink(CHtml::encode($item['discoveryRule']['name']), 'disc_prototypes.php?parent_discoveryid=' . $item['discoveryRule']['itemid'], 'parent-discovery');
        $description[] = NAME_DELIMITER . $item['name_expanded'];
    } else {
        $description[] = new CLink(CHtml::encode($item['name_expanded']), '?form=update&hostid=' . $item['hostid'] . '&itemid=' . $item['itemid']);
    }
    // status
    $status = new CCol(new CLink(itemIndicator($item['status'], $item['state']), '?group_itemid=' . $item['itemid'] . '&hostid=' . $item['hostid'] . '&action=' . ($item['status'] == ITEM_STATUS_DISABLED ? 'item.massenable' : 'item.massdisable'), itemIndicatorStyle($item['status'], $item['state'])));
    // info
    if ($data['showInfoColumn']) {
        $infoIcons = array();
        if ($item['status'] == ITEM_STATUS_ACTIVE && !zbx_empty($item['error'])) {
            $info = new CDiv(SPACE, 'status_icon iconerror');
            $info->setHint($item['error'], 'on');
            $infoIcons[] = $info;
        }
        // discovered item lifetime indicator
        if ($item['flags'] == ZBX_FLAG_DISCOVERY_CREATED && $item['itemDiscovery']['ts_delete']) {
            $deleteError = new CDiv(SPACE, 'status_icon iconwarning');
            // Check if item should've been deleted in the past.
            if ($currentTime > $item['itemDiscovery']['ts_delete']) {
                $deleteError->setHint(_s('The item is not discovered anymore and will be deleted the next time discovery rule is processed.'));
            } else {
**/
$widget = (new CWidget())->setTitle(_('Item prototypes'))->setControls((new CForm('get'))->cleanItems()->addVar('parent_discoveryid', $this->data['parent_discoveryid'])->addItem((new CList())->addItem(new CSubmit('form', _('Create item prototype')))))->addItem(get_header_host_table('items', $this->data['hostid'], $this->data['parent_discoveryid']));
// create form
$itemForm = (new CForm())->setName('items')->addVar('hostid', $this->data['hostid'])->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
// create table
$itemTable = (new CTableInfo())->setHeader([(new CColHeader((new CCheckBox('all_items'))->onClick("checkAll('" . $itemForm->getName() . "', 'all_items', 'group_itemid');")))->addClass(ZBX_STYLE_CELL_WIDTH), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Key'), 'key_', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Interval'), 'delay', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('History'), 'history', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Trends'), 'trends', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'type', $this->data['sort'], $this->data['sortorder']), _('Applications'), make_sorting_header(_('Status'), 'status', $this->data['sort'], $this->data['sortorder'])]);
foreach ($this->data['items'] as $item) {
    $description = [];
    if (!empty($item['templateid'])) {
        $template_host = get_realhost_by_itemid($item['templateid']);
        $templateDiscoveryRuleId = get_realrule_by_itemid_and_hostid($this->data['parent_discoveryid'], $template_host['hostid']);
        $description[] = (new CLink($template_host['name'], '?parent_discoveryid=' . $templateDiscoveryRuleId))->addClass(ZBX_STYLE_LINK_ALT)->addClass(ZBX_STYLE_GREY);
        $description[] = NAME_DELIMITER;
    }
    $description[] = new CLink($item['name_expanded'], '?form=update&itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid']);
    $status = (new CLink(itemIndicator($item['status']), '?group_itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid'] . '&action=' . ($item['status'] == ITEM_STATUS_DISABLED ? 'itemprototype.massenable' : 'itemprototype.massdisable')))->addClass(ZBX_STYLE_LINK_ACTION)->addClass(itemIndicatorStyle($item['status']))->addSID();
    if (!empty($item['applications'])) {
        order_result($item['applications'], 'name');
        $applications = zbx_objectValues($item['applications'], 'name');
        $applications = implode(', ', $applications);
        if (empty($applications)) {
            $applications = '';
        }
    } else {
        $applications = '';
    }
    $itemTable->addRow([new CCheckBox('group_itemid[' . $item['itemid'] . ']', $item['itemid']), $description, $item['key_'], $item['delay'] !== '' ? convertUnitsS($item['delay']) : '', $item['history'] . _x('d', 'day short'), $item['trends'] !== '' ? $item['trends'] . _x('d', 'day short') : '', item_type2str($item['type']), $applications, $status]);
}
zbx_add_post_js('cookie.prefix = "' . $this->data['parent_discoveryid'] . '";');
// append table to form
$itemForm->addItem([$itemTable, $this->data['paging'], new CActionButtonList('action', 'group_itemid', ['itemprototype.massenable' => ['name' => _('Enable'), 'confirm' => _('Enable selected item prototypes?')], 'itemprototype.massdisable' => ['name' => _('Disable'), 'confirm' => _('Disable selected item prototypes?')], 'itemprototype.massdelete' => ['name' => _('Delete'), 'confirm' => _('Delete selected item prototypes?')]], $this->data['parent_discoveryid'])]);
$discoveryForm->setName('discovery');
$discoveryForm->addVar('hostid', $this->data['hostid']);
// create table
$discoveryTable = new CTableInfo(_('No discovery rules found.'));
$discoveryTable->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $discoveryForm->getName() . "', 'all_items', 'g_hostdruleid');"), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('Items'), _('Triggers'), _('Graphs'), $data['host']['flags'] == ZBX_FLAG_DISCOVERY_NORMAL ? _('Hosts') : null, make_sorting_header(_('Key'), 'key_', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Interval'), 'delay', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'type', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Status'), 'status', $this->data['sort'], $this->data['sortorder']), $data['showInfoColumn'] ? _('Info') : null));
foreach ($data['discoveries'] as $discovery) {
    // description
    $description = array();
    if ($discovery['templateid']) {
        $dbTemplate = get_realhost_by_itemid($discovery['templateid']);
        $description[] = new CLink($dbTemplate['name'], '?hostid=' . $dbTemplate['hostid'], 'unknown');
        $description[] = NAME_DELIMITER;
    }
    $description[] = new CLink($discovery['name_expanded'], '?form=update&itemid=' . $discovery['itemid']);
    // status
    $status = new CLink(itemIndicator($discovery['status'], $discovery['state']), '?hostid=' . $_REQUEST['hostid'] . '&g_hostdruleid=' . $discovery['itemid'] . '&action=' . ($discovery['status'] == ITEM_STATUS_DISABLED ? 'discoveryrule.massenable' : 'discoveryrule.massdisable'), itemIndicatorStyle($discovery['status'], $discovery['state']));
    // info
    if ($data['showInfoColumn']) {
        if ($discovery['status'] == ITEM_STATUS_ACTIVE && !zbx_empty($discovery['error'])) {
            $info = new CDiv(SPACE, 'status_icon iconerror');
            $info->setHint($discovery['error'], 'on');
        } else {
            $info = '';
        }
    } else {
        $info = null;
    }
    // host prototype link
    $hostPrototypeLink = null;
    if ($data['host']['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
        $hostPrototypeLink = array(new CLink(_('Host prototypes'), 'host_prototypes.php?parent_discoveryid=' . $discovery['itemid']), ' (' . $discovery['hostPrototypes'] . ')');
// create table
$discoveryTable = new CTableInfo(_('No discovery rules found.'));
$sortLink = new CUrl();
$sortLink->setArgument('hostid', $this->data['hostid']);
$sortLink = $sortLink->getUrl();
$discoveryTable->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $discoveryForm->getName() . "', 'all_items', 'g_hostdruleid');"), make_sorting_header(_('Name'), 'name', $sortLink), _('Items'), _('Triggers'), _('Graphs'), $data['host']['flags'] == ZBX_FLAG_DISCOVERY_NORMAL ? _('Hosts') : null, make_sorting_header(_('Key'), 'key_', $sortLink), make_sorting_header(_('Interval'), 'delay', $sortLink), make_sorting_header(_('Type'), 'type', $sortLink), make_sorting_header(_('Status'), 'status', $sortLink), $data['showErrorColumn'] ? _('Error') : null));
foreach ($data['discoveries'] as $discovery) {
    $description = array();
    if ($discovery['templateid']) {
        $template_host = get_realhost_by_itemid($discovery['templateid']);
        $description[] = new CLink($template_host['name'], '?hostid=' . $template_host['hostid'], 'unknown');
        $description[] = NAME_DELIMITER;
    }
    $discovery['name_expanded'] = itemName($discovery);
    $description[] = new CLink($discovery['name_expanded'], '?form=update&itemid=' . $discovery['itemid']);
    $status = new CLink(itemIndicator($discovery['status'], $discovery['state']), '?hostid=' . $_REQUEST['hostid'] . '&g_hostdruleid=' . $discovery['itemid'] . '&go=' . ($discovery['status'] ? 'activate' : 'disable'), itemIndicatorStyle($discovery['status'], $discovery['state']));
    if ($data['showErrorColumn']) {
        $error = '';
        if ($discovery['status'] == ITEM_STATUS_ACTIVE) {
            if (zbx_empty($discovery['error'])) {
                $error = new CDiv(SPACE, 'status_icon iconok');
            } else {
                $error = new CDiv(SPACE, 'status_icon iconerror');
                $error->setHint($discovery['error'], '', 'on');
            }
        }
    }
    // host prototype link
    $hostPrototypeLink = null;
    if ($data['host']['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
        $hostPrototypeLink = array(new CLink(_('Host prototypes'), 'host_prototypes.php?parent_discoveryid=' . $discovery['itemid']), ' (' . $discovery['hostPrototypes'] . ')');
Пример #6
0
            $values = array();
            for ($i = 1; $i <= $dstfldCount; $i++) {
                $dstfld = get_request('dstfld' . $i);
                $srcfld = get_request('srcfld' . $i);
                if (!empty($dstfld) && !empty($item[$srcfld])) {
                    $values[$dstfld] = $item[$srcfld];
                }
            }
            // if we need to submit parent window
            $js_action = 'javascript: addValues(' . zbx_jsvalue($dstfrm) . ', ' . zbx_jsvalue($values) . ', ' . ($submitParent ? 'true' : 'false') . '); return false;';
        }
        $description->setAttribute('onclick', $js_action . ' jQuery(this).removeAttr("onclick");');
        if ($multiselect) {
            $description = new CCol(array(new CCheckBox('items[' . zbx_jsValue($item[$srcfld1]) . ']', null, null, $item['itemid']), $description));
        }
        $table->addRow(array($description, $item['key_'], item_type2str($item['type']), itemValueTypeString($item['value_type']), new CSpan(itemIndicator($item['status']), itemIndicatorStyle($item['status']))));
    }
    if ($multiselect) {
        $button = new CButton('select', _('Select'), "javascript: addSelectedValues('items', " . zbx_jsvalue($reference) . ');');
        $table->setFooter(new CCol($button, 'right'));
        insert_js('var popupReference = ' . zbx_jsvalue($items, true) . ';');
    }
    unset($items);
    zbx_add_post_js('chkbxRange.pageGoName = "items";');
    $form->addItem($table);
    $form->show();
} elseif ($srctbl == 'applications') {
    $form = new CForm();
    $form->setName('applicationform');
    $form->setAttribute('id', 'applications');
    $table = new CTableInfo(_('No applications found.'));
$itemTable->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $itemForm->getName() . "', 'all_items', 'group_itemid');"), $this->data['displayNodes'] ? _('Node') : null, _('Wizard'), empty($this->data['filter_hostid']) ? _('Host') : null, make_sorting_header(_('Name'), 'name'), _('Triggers'), make_sorting_header(_('Key'), 'key_'), make_sorting_header(_('Interval'), 'delay'), make_sorting_header(_('History'), 'history'), make_sorting_header(_('Trends'), 'trends'), make_sorting_header(_('Type'), 'type'), _('Applications'), make_sorting_header(_('Status'), 'status'), $data['showErrorColumn'] ? _('Error') : null));
foreach ($this->data['items'] as $item) {
    // description
    $description = array();
    if (!empty($item['template_host'])) {
        $description[] = new CLink(CHtml::encode($item['template_host']['name']), '?hostid=' . $item['template_host']['hostid'] . '&filter_set=1', 'unknown');
        $description[] = NAME_DELIMITER;
    }
    if (!empty($item['discoveryRule'])) {
        $description[] = new CLink(CHtml::encode($item['discoveryRule']['name']), 'disc_prototypes.php?parent_discoveryid=' . $item['discoveryRule']['itemid'], 'parent-discovery');
        $description[] = NAME_DELIMITER . $item['name_expanded'];
    } else {
        $description[] = new CLink(CHtml::encode($item['name_expanded']), '?form=update&hostid=' . $item['hostid'] . '&itemid=' . $item['itemid']);
    }
    // status
    $status = new CCol(new CLink(itemIndicator($item['status'], $item['state']), '?group_itemid=' . $item['itemid'] . '&hostid=' . $item['hostid'] . '&go=' . ($item['status'] ? 'activate' : 'disable'), itemIndicatorStyle($item['status'], $item['state'])));
    if ($data['showErrorColumn']) {
        $statusIcons = array();
        if ($item['status'] == ITEM_STATUS_ACTIVE) {
            if (zbx_empty($item['error'])) {
                $error = new CDiv(SPACE, 'status_icon iconok');
            } else {
                $error = new CDiv(SPACE, 'status_icon iconerror');
                $error->setHint($item['error'], '', 'on');
            }
            $statusIcons[] = $error;
        }
        // discovered item lifetime indicator
        if ($item['flags'] == ZBX_FLAG_DISCOVERY_CREATED && $item['itemDiscovery']['ts_delete']) {
            $deleteError = new CDiv(SPACE, 'status_icon iconwarning');
            $deleteError->setHint(_s('The item is not discovered anymore and will be deleted in %1$s (on %2$s at %3$s).', zbx_date2age($item['itemDiscovery']['ts_delete']), zbx_date2str(_('d M Y'), $item['itemDiscovery']['ts_delete']), zbx_date2str(_('H:i:s'), $item['itemDiscovery']['ts_delete'])));
$itemForm->setName('items');
$itemForm->addVar('hostid', $this->data['hostid']);
$itemForm->addVar('parent_discoveryid', $this->data['parent_discoveryid']);
// create table
$itemTable = new CTableInfo(_('No item prototypes found.'));
$itemTable->setHeader(array(new CCheckBox('all_items', null, "checkAll('" . $itemForm->getName() . "', 'all_items', 'group_itemid');"), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Key'), 'key_', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Interval'), 'delay', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('History'), 'history', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Trends'), 'trends', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'type', $this->data['sort'], $this->data['sortorder']), _('Applications'), make_sorting_header(_('Status'), 'status', $this->data['sort'], $this->data['sortorder'])));
foreach ($this->data['items'] as $item) {
    $description = array();
    if (!empty($item['templateid'])) {
        $template_host = get_realhost_by_itemid($item['templateid']);
        $templateDiscoveryRuleId = get_realrule_by_itemid_and_hostid($this->data['parent_discoveryid'], $template_host['hostid']);
        $description[] = new CLink($template_host['name'], '?parent_discoveryid=' . $templateDiscoveryRuleId, 'unknown');
        $description[] = NAME_DELIMITER;
    }
    $description[] = new CLink($item['name_expanded'], '?form=update&itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid']);
    $status = new CLink(itemIndicator($item['status']), '?group_itemid=' . $item['itemid'] . '&parent_discoveryid=' . $this->data['parent_discoveryid'] . '&action=' . ($item['status'] == ITEM_STATUS_DISABLED ? 'itemprototype.massenable' : 'itemprototype.massdisable'), itemIndicatorStyle($item['status']));
    if (!empty($item['applications'])) {
        order_result($item['applications'], 'name');
        $applications = zbx_objectValues($item['applications'], 'name');
        $applications = implode(', ', $applications);
        if (empty($applications)) {
            $applications = '-';
        }
    } else {
        $applications = '-';
    }
    $itemTable->addRow(array(new CCheckBox('group_itemid[' . $item['itemid'] . ']', null, null, $item['itemid']), $description, $item['key_'], $item['delay'], $item['history'], in_array($item['value_type'], array(ITEM_VALUE_TYPE_STR, ITEM_VALUE_TYPE_LOG, ITEM_VALUE_TYPE_TEXT)) ? '' : $item['trends'], item_type2str($item['type']), new CCol($applications, 'wraptext'), $status));
}
// create go buttons
$goComboBox = new CComboBox('action');
$goOption = new CComboItem('itemprototype.massenable', _('Enable selected'));
Пример #9
0
        if ($multiselect) {
            $js_action = 'javascript: addValue(' . zbx_jsvalue($reference) . ', ' . zbx_jsvalue($item['itemid']) . ');';
        } else {
            $values = array();
            for ($i = 1; $i <= $dstfldCount; $i++) {
                $dstfld = getRequest('dstfld' . $i);
                $srcfld = getRequest('srcfld' . $i);
                if (!empty($dstfld) && !empty($item[$srcfld])) {
                    $values[$dstfld] = $item[$srcfld];
                }
            }
            // if we need to submit parent window
            $js_action = 'javascript: addValues(' . zbx_jsvalue($dstfrm) . ', ' . zbx_jsvalue($values) . ', ' . ($submitParent ? 'true' : 'false') . '); return false;';
        }
        $description->setAttribute('onclick', $js_action . ' jQuery(this).removeAttr("onclick");');
        $table->addRow(array($hostid > 0 ? null : $item['hostname'], $multiselect ? new CCheckBox('items[' . zbx_jsValue($item[$srcfld1]) . ']', null, null, $item['itemid']) : null, $description, $item['key_'], item_type2str($item['type']), itemValueTypeString($item['value_type']), new CSpan(itemIndicator($item['status'], $item['state']), itemIndicatorStyle($item['status'], $item['state']))));
        // made to save memory usage
        if ($multiselect) {
            $jsItems[$item['itemid']] = array('itemid' => $item['itemid'], 'name' => $item['name'], 'key_' => $item['key_'], 'flags' => $item['flags'], 'type' => $item['type'], 'value_type' => $item['value_type'], 'host' => $item['hostname']);
        }
    }
    if ($multiselect) {
        $button = new CButton('select', _('Select'), "javascript: addSelectedValues('items', " . zbx_jsvalue($reference) . ');');
        $table->setFooter(new CCol($button, 'right'));
        insert_js('var popupReference = ' . zbx_jsvalue($jsItems, true) . ';');
    }
    $form->addItem($table);
    $form->show();
} elseif ($srctbl == 'applications') {
    $form = new CForm();
    $form->setName('applicationform');
$widget = (new CWidget())->setTitle(_('Discovery rules'))->setControls((new CForm('get'))->cleanItems()->addVar('hostid', $this->data['hostid'])->addItem((new CList())->addItem(new CSubmit('form', _('Create discovery rule')))))->addItem(get_header_host_table('discoveries', $this->data['hostid']));
// create form
$discoveryForm = (new CForm())->setName('discovery')->addVar('hostid', $this->data['hostid']);
// create table
$discoveryTable = (new CTableInfo())->setHeader([(new CColHeader((new CCheckBox('all_items'))->onClick("checkAll('" . $discoveryForm->getName() . "', 'all_items', 'g_hostdruleid');")))->addClass(ZBX_STYLE_CELL_WIDTH), make_sorting_header(_('Name'), 'name', $this->data['sort'], $this->data['sortorder']), _('Items'), _('Triggers'), _('Graphs'), $data['host']['flags'] == ZBX_FLAG_DISCOVERY_NORMAL ? _('Hosts') : null, make_sorting_header(_('Key'), 'key_', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Interval'), 'delay', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Type'), 'type', $this->data['sort'], $this->data['sortorder']), make_sorting_header(_('Status'), 'status', $this->data['sort'], $this->data['sortorder']), $data['showInfoColumn'] ? _('Info') : null]);
foreach ($data['discoveries'] as $discovery) {
    // description
    $description = [];
    if ($discovery['templateid']) {
        $dbTemplate = get_realhost_by_itemid($discovery['templateid']);
        $description[] = (new CLink($dbTemplate['name'], '?hostid=' . $dbTemplate['hostid']))->addClass(ZBX_STYLE_LINK_ALT)->addClass(ZBX_STYLE_GREY);
        $description[] = NAME_DELIMITER;
    }
    $description[] = new CLink($discovery['name_expanded'], '?form=update&itemid=' . $discovery['itemid']);
    // status
    $status = (new CLink(itemIndicator($discovery['status'], $discovery['state']), '?hostid=' . $_REQUEST['hostid'] . '&g_hostdruleid=' . $discovery['itemid'] . '&action=' . ($discovery['status'] == ITEM_STATUS_DISABLED ? 'discoveryrule.massenable' : 'discoveryrule.massdisable')))->addClass(ZBX_STYLE_LINK_ACTION)->addClass(itemIndicatorStyle($discovery['status'], $discovery['state']))->addSID();
    // info
    if ($data['showInfoColumn']) {
        if ($discovery['status'] == ITEM_STATUS_ACTIVE && !zbx_empty($discovery['error'])) {
            $info = makeErrorIcon($discovery['error']);
        } else {
            $info = '';
        }
    } else {
        $info = null;
    }
    // host prototype link
    $hostPrototypeLink = null;
    if ($data['host']['flags'] == ZBX_FLAG_DISCOVERY_NORMAL) {
        $hostPrototypeLink = [new CLink(_('Host prototypes'), 'host_prototypes.php?parent_discoveryid=' . $discovery['itemid']), CViewHelper::showNum($discovery['hostPrototypes'])];
    }