Beispiel #1
0
 while ($host = DBfetch($db_hosts)) {
     $el_table = new CTableInfo(S_ONLY_HOST_INFO);
     $sqls = array(S_TEMPLATE => !isset($templates[$host['hostid']]) ? null : 'SELECT MIN(ht.hostid) as hostid, h.host as info, count(distinct ht.hosttemplateid) as cnt ' . ' FROM hosts h, hosts_templates ht ' . ' WHERE ht.templateid = h.hostid ' . ' GROUP BY h.host', S_ITEM => !isset($items[$host['hostid']]) ? null : 'SELECT hostid, description as info, 1 as cnt ' . ' FROM items' . ' WHERE hostid=' . $host['hostid'], S_TRIGGER => !isset($triggers[$host['hostid']]) ? null : 'SELECT i.hostid, t.description as info, count(distinct i.hostid) as cnt, f.triggerid ' . ' FROM functions f, items i, triggers t' . ' WHERE t.triggerid=f.triggerid' . ' AND f.itemid=i.itemid' . ' GROUP BY f.triggerid, i.hostid, t.description', S_GRAPH => !isset($graphs[$host['hostid']]) ? null : 'SELECT MIN(g.name) as info, i.hostid, count(distinct i.hostid) as cnt, gi.graphid' . ' FROM graphs_items gi, items i, graphs g ' . ' WHERE g.graphid=gi.graphid ' . ' AND gi.itemid=i.itemid' . ' GROUP BY gi.graphid, i.hostid');
     foreach ($sqls as $el_type => $sql) {
         if (!isset($sql)) {
             continue;
         }
         $db_els = DBselect($sql);
         while ($el = DBfetch($db_els)) {
             if ($el['cnt'] != 1 || bccomp($el['hostid'], $host['hostid']) != 0) {
                 continue;
             }
             $el_table->addRow(array($el_type, $el['info']));
         }
     }
     $table->showRow(array(new CCol($host['host'], 'top'), $el_table));
     unset($el_table);
 }
 $form = new CForm(null, 'post');
 $form->setName('hosts');
 $form->addVar('config', $config);
 $form->addVar('update', true);
 $form->addVar('groupid', $PAGE_GROUPS['selected']);
 $form->addVar('hosts', $hosts);
 $form->addVar('templates', $templates);
 $form->addVar('items', $items);
 $form->addVar('graphs', $graphs);
 $form->addVar('triggers', $triggers);
 //----- GO ------
 $goBox = new CComboBox('go');
 $goBox->addItem('back', S_BACK);