Beispiel #1
0
     if ($hostid > 0) {
         $sql .= ' AND h.hostid=' . $hostid;
     }
     $sql .= ' ORDER BY h.host, i.description, i.key_, i.itemid';
     $result = DBselect($sql);
     while ($row = DBfetch($result)) {
         $row['node_name'] = isset($row['node_name']) ? '(' . $row['node_name'] . ') ' : '';
         $row['description'] = item_description($row);
         $description = new CLink($row['description'], '#', 'action');
         $row['description'] = $row['node_name'] . $row['host'] . ':' . $row['description'];
         if (isset($_REQUEST['reference']) && $_REQUEST['reference'] == 'dashboard') {
             $action = get_window_opener($dstfrm, $dstfld1, $srctbl) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]) . "window.opener.setTimeout('add2favorites();', 1000);";
         } else {
             $action = get_window_opener($dstfrm, $dstfld1, $row[$srcfld1]) . get_window_opener($dstfrm, $dstfld2, $row[$srcfld2]);
         }
         $description->SetAction($action . ' close_window(); return false;');
         $table->addRow(array($hostid > 0 ? null : $row['host'], $description, item_type2str($row['type']), item_value_type2str($row['value_type']), new CSpan(item_status2str($row['status']), item_status2style($row['status']))));
     }
     $table->Show();
 } else {
     if ('slides' == $srctbl) {
         require_once 'include/screens.inc.php';
         $table = new CTableInfo(S_NO_NODES_DEFINED);
         $table->SetHeader(S_NAME);
         $result = DBselect('select slideshowid,name from slideshows where ' . DBin_node('slideshowid', $nodeid) . ' ORDER BY name');
         while ($row = DBfetch($result)) {
             if (!slideshow_accessible($row['slideshowid'], PERM_READ_ONLY)) {
                 continue;
             }
             $name = new CLink($row['name'], '#', 'action');
             if (isset($_REQUEST['reference']) && $_REQUEST['reference'] == 'dashboard') {
Beispiel #2
0
        $childs_str = implode(',', $childs);
        !empty($childs_str) ? $childs_str .= ',' : '';
        $query = 'SELECT DISTINCT s.* ' . ' FROM services s ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (s.triggerid IS NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' AND s.serviceid NOT IN (' . $childs_str . $service['serviceid'] . ') ' . ' ORDER BY s.sortorder,s.name';
    } else {
        $query = 'SELECT DISTINCT s.* ' . ' FROM services s ' . ' WHERE ' . DBin_node('s.serviceid') . ' AND (s.triggerid IS NULL OR ' . DBcondition('s.triggerid', $available_triggers) . ') ' . ' ORDER BY s.sortorder,s.name';
    }
    $db_services = DBselect($query);
    while ($db_service_data = DBfetch($db_services)) {
        $prefix = null;
        $trigger = "-";
        $description = $db_service_data["name"];
        if (isset($db_service_data["triggerid"])) {
            $trigger = expand_trigger_description($db_service_data["triggerid"]);
        }
        $description = new CLink($description, '#', 'action');
        $description->SetAction('window.opener.add_child_service(' . zbx_jsvalue($db_service_data["name"]) . ',' . zbx_jsvalue($db_service_data["serviceid"]) . ',' . zbx_jsvalue($trigger) . ',' . zbx_jsvalue($db_service_data["triggerid"]) . '); self.close(); return false;');
        $table->AddRow(array(array($prefix, $description), algorithm2str($db_service_data["algorithm"]), $trigger));
    }
    $cb = new CButton('cancel', S_CANCEL);
    $cb->SetType('button');
    $cb->SetAction('javascript: self.close();');
    $td = new CCol($cb);
    $td->setAttribute('style', 'text-align:right;');
    $table->SetFooter($td);
    $form->AddItem($table);
    $form->Show();
}
//--------------------------------------------	</CHILD SERVICES LIST>  --------------------------------------------
//--------------------------------------------	<FORM>  --------------------------------------------
if (isset($_REQUEST['sform'])) {
    $frmService = new CFormTable(S_SERVICE, 'services_form.php', 'POST', null, 'sform');