function createServiceTree(&$services, &$temp, $id = 0, $serviceupid = 0, $parentid = 0, $soft = 0, $linkid = '') { $rows = $services[$id]; if ($rows['serviceid'] > 0 && $rows['caption'] != 'root') { $rows['algorithm'] = algorithm2str($rows['algorithm']); } //---------------------------- if not leaf ----------------------------- $rows['parentid'] = $parentid; if ($soft == 0) { $rows['caption'] = new CLink($rows['caption'], '#', null, 'javascript: call_menu(event, ' . zbx_jsvalue($rows['serviceid']) . ',' . zbx_jsvalue($rows['caption']) . '); return false;'); $temp[$rows['serviceid']] = $rows; if (isset($rows['childs'])) { foreach ($rows['childs'] as $cid => $nodeid) { if (!isset($services[$nodeid['id']])) { continue; } if (isset($services[$nodeid['id']]['serviceupid'])) { createServiceTree($services, $temp, $nodeid['id'], $services[$nodeid['id']]['serviceupid'], $rows['serviceid'], $nodeid['soft'], $nodeid['linkid']); } } } } else { $rows['caption'] = new CSpan($rows['caption'], 'unknown'); $temp[$rows['serviceid'] . '.' . $linkid] = $rows; } return; }
} $table->AddRow(array(array(new CCheckBox('childs_to_del[' . $child['serviceid'] . '][serviceid]', null, null, $child['serviceid']), new CVar('childs[' . $child['serviceid'] . '][serviceid]', $child['serviceid'])), array($description, new CVar('childs[' . $child['serviceid'] . '][name]', $child['name'])), new CCheckBox('childs[' . $child['serviceid'] . '][soft]', isset($child['soft']) && !empty($child['soft']) ? 'checked' : 'no', null, isset($child['soft']) && !empty($child['soft']) ? 1 : 0), array($trigger, new CVar('childs[' . $child['serviceid'] . '][triggerid]', isset($child['triggerid']) ? $child['triggerid'] : '')))); } $cb = new CButton('add_child_service', S_ADD); $cb->SetType('button'); $cb->SetAction("javascript: openWinCentered('services_form.php?cservices=1" . url_param('serviceid') . "','ZBX_Services_List',640,520,'scrollbars=1, toolbar=0, menubar=0, resizable=0');"); $cb2 = new CButton('del_child_service', S_REMOVE); $cb2->SetType('button'); $cb2->SetAction("javascript: remove_childs('" . $frmService->GetName() . "','childs_to_del','tr');"); $frmService->AddRow(S_DEPENDS_ON, array($table, BR(), $cb, $cb2)); //---------- //--------------------------------------------- </LINK> ------------------------------------------- //algorithm $cmbAlg = new CComboBox('algorithm', $algorithm); foreach (array(SERVICE_ALGORITHM_MAX, SERVICE_ALGORITHM_MIN, SERVICE_ALGORITHM_NONE) as $val) { $cmbAlg->AddItem($val, algorithm2str($val)); } $frmService->AddRow(S_STATUS_CALCULATION_ALGORITHM, $cmbAlg); //------- //SLA $frmService->AddRow(S_CALCULATE_SLA, new CCheckBox('showsla', $showsla, "javascript: display_element('sla_row');", 1)); $row = new CRow(array(new CCol(S_ACCEPTABLE_SLA_IN_PERCENT, 'form_row_l'), new CCol(new CTextBox("goodsla", $goodsla, 6), 'form_row_r'))); $row->setAttribute('style', $linktrigger == 1 ? '' : 'display: none;'); $row->setAttribute('id', 'sla_row'); $row->setAttribute('style', $showsla ? '' : 'display: none;'); $frmService->AddRow($row); //------ //times $stime_el = array(); $i = 0; foreach ($service_times as $val) {