$listBox = new CListBox('screens', null, 8); $listBox->setAttribute('disabled', 'disabled'); $listBox->addItems($screensList); $templateList->addRow(_('Screens'), $listBox); } // web scenarios $httpTests = API::HttpTest()->get(array('output' => array('httptestid', 'name'), 'hostids' => $templateid, 'inherited' => false)); if ($httpTests) { $httpTestList = array(); foreach ($httpTests as $httpTest) { $httpTestList[$httpTest['httptestid']] = $httpTest['name']; } order_result($httpTestList); $listBox = new CListBox('httpTests', null, 8); $listBox->setAttribute('disabled', 'disabled'); $listBox->addItems($httpTestList); $templateList->addRow(_('Web scenarios'), $listBox); } } $divTabs->addTab('templateTab', _('Template'), $templateList); // FULL CLONE } // } TEMPLATE WIDGET // TEMPLATES{ $tmplList = new CFormList('tmpllist'); // create linked template table $linkedTemplateTable = new CTable(_('No templates linked.'), 'formElementTable'); $linkedTemplateTable->attr('id', 'linkedTemplateTable'); $linkedTemplateTable->attr('style', 'min-width: 400px;'); $linkedTemplateTable->setHeader(array(_('Name'), _('Action'))); $ignoredTemplates = array(); foreach ($this->data['linkedTemplates'] as $template) {
$listBox = new CListBox('graphPrototypes', null, 8); $listBox->setAttribute('disabled', 'disabled'); $listBox->addItems($prototypeList); $hostList->addRow(_('Graph prototypes'), $listBox); } // host prototypes $hostPrototypes = API::HostPrototype()->get(array('discoveryids' => $hostDiscoveryRuleids, 'inherited' => false, 'output' => array('hostid', 'name'))); if ($hostPrototypes) { $prototypeList = array(); foreach ($hostPrototypes as $hostPrototype) { $prototypeList[$hostPrototype['hostid']] = $hostPrototype['name']; } order_result($prototypeList); $listBox = new CListBox('hostPrototypes', null, 8); $listBox->setAttribute('disabled', 'disabled'); $listBox->addItems($prototypeList); $hostList->addRow(_('Host prototypes'), $listBox); } } $divTabs->addTab('hostTab', _('Host'), $hostList); // templates $tmplList = new CFormList('tmpllist'); // create linked template table $linkedTemplateTable = new CTable(_('No templates linked.'), 'formElementTable'); $linkedTemplateTable->attr('id', 'linkedTemplateTable'); $linkedTemplates = API::Template()->get(array('templateids' => $templateIds, 'output' => array('templateid', 'name'))); CArrayHelper::sort($linkedTemplates, array('name')); // templates for normal hosts if (!$isDiscovered) { $linkedTemplateTable->setHeader(array(_('Name'), _('Action'))); $ignoredTemplates = array();
$listBox->setAttribute('disabled', 'disabled'); $listBox->addItems($prototypeList); $templateList->addRow(_('Graph prototypes'), $listBox); } } // screens $screens = API::TemplateScreen()->get(array('inherited' => false, 'templateids' => $templateid, 'output' => array('screenid', 'name'))); if (!empty($screens)) { $screensList = array(); foreach ($screens as $screen) { $screensList[$screen['screenid']] = $screen['name']; } order_result($screensList); $listBox = new CListBox('screens', null, 8); $listBox->setAttribute('disabled', 'disabled'); $listBox->addItems($screensList); $templateList->addRow(_('Screens'), $listBox); } } $divTabs->addTab('templateTab', _('Template'), $templateList); // FULL CLONE } // } TEMPLATE WIDGET // TEMPLATES{ $tmplList = new CFormList('tmpllist'); foreach ($templates as $tid => $temp_name) { $frmHost->addVar('templates[' . $tid . ']', $temp_name); $tmplList->addRow($temp_name, array(new CSubmit('unlink[' . $tid . ']', _('Unlink'), null, 'link_menu'), SPACE, SPACE, isset($original_templates[$tid]) ? new CSubmit('unlink_and_clear[' . $tid . ']', _('Unlink and clear'), null, 'link_menu') : SPACE)); } $tmplAdd = new CButton('add', _('Add'), 'return PopUp("popup.php?srctbl=templates&srcfld1=hostid&srcfld2=host' . '&dstfrm=' . $frmHost->getName() . '&dstfld1=new_template&templated_hosts=1' . '&excludeids[' . $templateid . ']=' . $templateid . url_param($templates, false, 'existed_templates') . '",450,450)', 'link_menu'); $tmplList->addRow($tmplAdd, SPACE); $divTabs->addTab('tmplTab', _('Linked templates'), $tmplList);