DESC; $db = DB::getDB(); $r = $db->get_by_id($tblName, $id); if (!$r) { throw new HttpException("Rekord ID={$id} nie istnieje", 404); } $wsk = array(); $ids_conf_arr = array(); $ids_conf_arr['DEVICES'] = array('id_col'=>"T_DEVICE_SERIAL",'allowed_cols'=>"ID,CRM_LISTA_ZASOBOW_ID:CLZ_ID,T_TELBOX_NEIGHBOUR_IN,T_DEVICE_SERIAL,T_DEVICE_INFO,A_STATUS,S_OTHER_INFO"); $ids_conf_arr['TELBOXES'] = array('id_col'=>"T_TELBOX_NAME",'allowed_cols'=>"ID,CRM_LISTA_ZASOBOW_ID:CLZ_ID,T_TELBOX_NEIGHBOUR_IN,T_TELBOX_NEIGHBOUR_OUT,T_TELBOX_NAME,A_STATUS,S_OTHER_INFO"); if (!empty($ids_conf_arr)) { $external_ids = array(); foreach ($ids_conf_arr as $k_table_name => $v_cnf) { $cur_cnf = new stdClass(); $cur_cnf->id_col = V::get('id_col', 'ID', $v_cnf); $cur_cnf->search_col = V::get('search_col', 'ID_PROJECT', $v_cnf); $cur_cnf->search_col_regex = V::get('search_col_regex', '', $v_cnf); $sql_id_col = $cur_cnf->id_col; $sql_where = ""; if ($cur_cnf->search_col_regex) { $sql_where = "`{$cur_cnf->search_col}` like '".str_replace('$ID', $r->ID, $cur_cnf->search_col_regex)."'"; } else { $sql_where = "`{$cur_cnf->search_col}`='{$r->ID}'"; } $db = DB::getDB(); $sql = "select t.`{$sql_id_col}` from `{$k_table_name}` as t where {$sql_where} "; $res = $db->query($sql); while ($r_wsk = $db->fetch($res)) { $wsk[] = (object)array('name'=>$r_wsk->$sql_id_col, 'table'=>$k_table_name); } } } $response = new stdClass(); $response->ids = $wsk; return $response; } function TREEJS() { global $result,$thiss; $ajaxTask = V::get('_ajaxTask', '', $_GET); $funName = "TREEJS__ajaxTask__{$ajaxTask}"; if (function_exists($funName)) { try { $response = $funName($_GET); } catch (HttpException $e) { $response = new stdClass(); $response->type = 'error'; $response->msg = $e->getMessage(); $response->errorCode = $e->getCode(); Http::sendHeaderByCode($e->getCode()); } catch (Exception $e) { $response = new stdClass(); $response->type = 'error'; $response->msg = $e->getMessage(); $response->errorCode = $e->getCode(); } header('Content-type: application/json'); if (!$response) $response = new stdClass(); echo json_encode($response); exit; } $zasobID = V::get('ZASOB_ID', 0, $_GET, 'int'); if ($zasobID <= 0) { echo 'Wrong param ZASOB_ID'; return; } $TEST_TREE_LAZY_LOAD = 1; $DBG_TIME = ('1' == V::get('DBG_TIME', '', $_GET)); $dbgExecTime = new DebugExecutionTime(); if ($DBG_TIME) $dbgExecTime->activate(); $dbgExecTime->log('start'); echo "<<".'Powrot do tabeli'; $conf = null; $tblName = ''; $zasobObj = ProcesHelper::getZasobTableInfo($zasobID); if (!$zasobObj) { echo "Zasob TABELA ID={$zasobID} nie istnieje"; return; } $tblName = $zasobObj->DESC; $allowed_tables_conf = array(); $allowed_tables_conf['IN7_MK_BAZA_DYSTRYBUCJI'] = array('set_parent_id_col'=>'P_ID'); $allowed_tables_conf['IN7_MK_BAZA_DYSTRYBUCJI']['params'] = array(); $allowed_tables_conf['IN7_MK_BAZA_DYSTRYBUCJI']['params']['show_item_callback'] = 'tree_callback__show_item_from_IN7_MK_BAZA_DYSTRYBUCJI'; $allowed_tables_conf['IN7_MK_BAZA_DYSTRYBUCJI']['params']['ajax'] ='NIE'; if (!array_key_exists($tblName, $allowed_tables_conf)) { echo'
'."Brak dostepu".'
'; } $conf = $allowed_tables_conf[$tblName]; echo''."\n"; App::show_head_css(); App::show_head_js(); function tree_callback__show_item_from_IN7_MK_BAZA_DYSTRYBUCJI(&$r, &$tree) { $zasobID = V::get('ZASOB_ID', 0, $_GET, 'int'); // TODO: btn-box zasob type from PARENT_ID $cls = array(); if (($search_id = $tree->get_param('search_id')) > 0 && $search_id == $r->ID) { $cls[] = 'search_id'; } $cls = (!empty($cls))? ' class="'.implode(' ', $cls).'"' : ''; $out_id = ($r->ID < 10)? ' '.$r->ID.'' : $r->ID; $htmlTreeId = $tree->get_param('htmlTreeId'); $idLink = "index.php?MENU_INIT=TREEJS&ZASOB_ID={$zasobID}&filtr_id={$r->ID}#TREE{$r->ID}"; $editLink = "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID={$zasobID}#EDIT/{$r->ID}"; $addChildLink = "index.php?MENU_INIT=VIEWTABLE_AJAX&ZASOB_ID={$zasobID}&ff_P_ID={$r->ID}#CREATE"; //if ($r->has_childrens) { // if (!$tree->get_param('rozwin')) { // $js = "return " . $tree->js_tree_open_rec_fun . "(this," . $r->ID . ");"; // echo''."L".''; // } //} // TODO: edycja nie działa - bierze ostatni edytowany rekord //echo' ID}".'" class="btn-box">'."E".''; $st_status_bg = ''; if ($r->A_STATUS == 'NORMAL') { $st_status_bg = '#8F8;'; } else if ($r->A_STATUS == 'WAITING') { $st_status_bg = '#F8F;'; } else if ($r->A_STATUS == 'DELETED') { $st_status_bg = '#ccc;'; } else if ($r->A_STATUS == 'OFF_SOFT') { $st_status_bg = '#F99;'; } else if ($r->A_STATUS == 'OFF_HARD') { $st_status_bg = '#eee;'; } $st_status_bg = ($st_status_bg)? 'background-color:'.$st_status_bg : ''; ?>