'."Wrong ID".'
'; return; } $db = DB::getDB(); $proces = $db->get_by_id('CRM_PROCES', $id_proces); if (!$proces) { echo''."Process {$id_proces} not exists".'
'; return; } $ajaxTask = V::get('ajaxTask', '', $_REQUEST); if ($ajaxTask == 'getInfo') { $id = V::get('id', 0, $_REQUEST, 'int'); if ($id > 0) { $step = $db->get_by_id('CRM_PROCES', $id); //echo' (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($step);echo'';
?>
ID; ?> DESC; ?>
OPIS; ?>
htmlID = 'graph_proces_id_' . $id_proces; $graph->procesTreeFlat = array(); $graph->procesTreeGoto = array(); $graph->treeItems = array(); $graph->elements = new stdClass(); $graph->elements->nodes = array(); $graph->elements->edges = array(); /* elements: { nodes: [ { data: { id: 'j', name: 'Jerry' } }, { data: { id: 'e', name: 'Elaine' } }, { data: { id: 'k', name: 'Kramer' } }, { data: { id: 'g', name: 'George' } } ], edges: [ { data: { source: 'j', target: 'e' } }, { data: { source: 'j', target: 'k' } }, { data: { source: 'j', target: 'g' } }, { data: { source: 'e', target: 'j' } }, { data: { source: 'e', target: 'k' } }, { data: { source: 'k', target: 'j' } }, { data: { source: 'k', target: 'e' } }, { data: { source: 'k', target: 'g' } }, { data: { source: 'g', target: 'j' } } ] }, */ function graph__addNodeID($id, $graph,$name=null) { if (!array_key_exists($id, $graph->treeItems)) { if(empty($name)) $name=$id; $graph->elements->nodes[] = array('data'=>array('id'=>$id, 'name'=>$id)); } } function SearchParentsWithExits($id_start,$id_proces_step,&$graph,$string,$loop=0,&$path_arr=array()) { graph__addNodeID('994', $graph,'994'); graph__addNodeID('3468', $graph,'3468'); return ; $loop++; if($loop>100) { return false; die('error loop'); } $sql="select `ID`,`IF_TRUE_GOTO`,`TYPE`,`PARENT_ID` from `CRM_PROCES` where PARENT_ID=994 and `A_STATUS` in ('WAITING','NORMAL') " ; $res=DB::query($sql); if(DB::num_rows($res) >0) { while($h=DB::fetch($res)) { $path_arr[$h->ID]=true; $string.=" \n".$h->ID; // // $graph->elements->edges[] = array('data'=>array('source'=>$id_proces_step, 'target'=>$h->ID, 'type'=>'GOTO')); // SearchParentsWithExits($h->ID,$h->ID,&$graph,$string,&$loop,$path_arr); } } } $db = DB::getDB(); $sql= "select p.`ID`,`DESC` from `CRM_PROCES` as p where p.`A_STATUS` in('WAITING','NORMAL') and p.`TYPE`='PROCES_INIT' and ID=994 limit 1"; $res=DB::query($sql); while($h=DB::fetch($res)) { SearchParentsWithExits($h->ID,$h->ID,$graph,'Proces '.$h->ID,0); // graph__addNodeID(995,$graph,995); // graph__addNodeID(3468, $graph,3468); //$graph->treeItems[$h->ID] = true; //$graph->elements->nodes[] = array('data'=>array('id'=>$h->ID, 'name'=>$h->ID.substr($h->DESC,0,50) , 'type'=>'procesInit')); } echo 'dupaxxx'; foreach($graph->elements->nodes as $var) { //echo " (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r("TODO: add node ($kID); add edge from $kID to $vGotoID");echo'';
graph__addNodeID($kID, $graph);
//$graph->elements->edges[] = array('data'=>array('source'=>$kID, 'target'=>$vGotoID, 'type'=>'GOTO'));
}
}
}
}
*/
?>