Estoy trabajando con PHP y dhtmlxtree, ayuda!
Hola que tal! Necesito ayuda, estoy trabajando en un proyecto muy importante de la u y lance un proyecto, bueno no te alargo más el tema... Sucede que estoy usando una librería llamada dhtmlxtree para poder armar mi árbol el cual ya esta desarrollado, lo que no entiendo es como puedo usar el evento onclick o alguno que me permita hacer algo cuándo doy click en algún nodo, soy nuevo en PHP por eso es que se me complica bastante este punto... Te facilito los código:
El código que se uso para cargar el tree es:
<script type="text/javascript">
tree=new dhtmlXTreeObject("apDiv3","100%","100%",0);
tree.setImagePath("images/dhtmlxTree/csh_scbrblue/");
tree.setOnClickHandler("tree.php");//set function object to call on node select
?
<script>
y el codigo que se usa para formar el arbol es:
<?php header(Content-type:text/xml);
require_once 'config.php';
require_once 'misc.php';
global $ColeccionEtiquetas;
$dbCon =& getDbCon();
$vcn = $dbCon->Conectar();
$outXML = new DOMDocument('1.0');
$outXML->formatOuput = true;
$raiz = $outXML->createElement("tree");
$raiz = $outXML->appendChild($raiz);
$raiz->setAttribute('id',0);
$cuidad_instalados = $outXML->createElement("item");
$cuidad_instalados = $raiz->appendChild($cuidad_instalados);
$cuidad_instalados->setAttribute("id","1");
$cuidad_instalados->setAttribute("text",$ColeccionEtiquetas['244']);
//$cuidad_instalados->setAttribute("select","3");
$nodo_general = $outXML->createElement("item");
$nodo_general = $cuidad_instalados->appendChild($nodo_general);
$nodo_general->setAttribute("id","1-1");
$nodo_general->setAttribute("text",$ColeccionEtiquetas['248']);//General
$nodo_general->setAttribute("select","1");
$medidores = $outXML->createElement("item");
$medidores = $nodo_general->appendChild($medidores);
$medidores->setAttribute("id","1000");
$medidores->setAttribute("text",$ColeccionEtiquetas['103']);//Medidores
$repetidores = $outXML->createElement("item");
$repetidores = $nodo_general->appendChild($repetidores);
$repetidores->setAttribute("id","2000");
$repetidores->setAttribute("text",$ColeccionEtiquetas['246']);//Repetidores
$gateways = $outXML->createElement("item");
$gateways = $nodo_general->appendChild($gateways);
$gateways->setAttribute("id","3000");
$gateways->setAttribute("text","GATEWAYS");//Geteways
// Variables para los Id de los Atributos del Archivo XML
$m = 100; $r = 100; $g = 100; $gr = 100;
$md = 777; $rd = 888; $gd = 999; $grd = 555;
// Arreglo para sacar las Zonas
$Param=array();
$Param[0]=array("pHandler","conect",10,0);
$Param[1]=array("c_res","","",2);
$Param[2]=array("P1","",10,0);
$Param[3]=array("P2","",10,0);
$Param[4]=array("P3","",10,0);
$Param[5]=array("P4","",10,0);
if($dbCon->Ejecutar($vcn,$PARAMS_ORACLE["esqusr"].".PRUEBAS.sp_GetData2",$Param,&$vCur)){
$bValido = OCIExecute($vCur);
$column_name = oci_num_fields($vCur);
// Arreglo para sacar los codigos de los eficios
if($bValido){
// Ejecucion para sacar el nombre de los edificios
while ($row = oci_fetch_assoc($vCur)){
$codigo_edificio = $row['CODIGO'];
$Param2=array();
$Param2[0]=array("pHandler","edificios",10,0);
$Param2[1]=array("c_res","","",2);
$Param2[2]=array("P1","",10,0);
$Param2[3]=array("P2",$codigo_edificio,10,0);
$Param2[4]=array("P3","",10,0);
$Param2[5]=array("P4","",10,0);
$dbCon->Ejecutar($vcn, $PARAMS_ORACLE["esqusr"].".PRUEBAS.sp_GetData2",$Param2,&$vCur2);
$bValido2 = OCIExecute($vCur2);
//$rowf = oci_fetch_assoc($vCur2);
$tree = $outXML->createElement("item");
$tree = $cuidad_instalados->appendChild($tree);
$tree->setAttribute("id", $row['CODIGO']);
$tree->setAttribute("text",$row['ZONA']);
$general = $outXML->createElement("item");
$general = $tree->appendChild($general);
$general->setAttribute("id",$gr);
$general->setAttribute("text",$ColeccionEtiquetas['248']);//General
$medidor = $outXML->createElement("item");
$medidor = $general->appendChild($medidor);
...
El código que se uso para cargar el tree es:
<script type="text/javascript">
tree=new dhtmlXTreeObject("apDiv3","100%","100%",0);
tree.setImagePath("images/dhtmlxTree/csh_scbrblue/");
tree.setOnClickHandler("tree.php");//set function object to call on node select
?
<script>
y el codigo que se usa para formar el arbol es:
<?php header(Content-type:text/xml);
require_once 'config.php';
require_once 'misc.php';
global $ColeccionEtiquetas;
$dbCon =& getDbCon();
$vcn = $dbCon->Conectar();
$outXML = new DOMDocument('1.0');
$outXML->formatOuput = true;
$raiz = $outXML->createElement("tree");
$raiz = $outXML->appendChild($raiz);
$raiz->setAttribute('id',0);
$cuidad_instalados = $outXML->createElement("item");
$cuidad_instalados = $raiz->appendChild($cuidad_instalados);
$cuidad_instalados->setAttribute("id","1");
$cuidad_instalados->setAttribute("text",$ColeccionEtiquetas['244']);
//$cuidad_instalados->setAttribute("select","3");
$nodo_general = $outXML->createElement("item");
$nodo_general = $cuidad_instalados->appendChild($nodo_general);
$nodo_general->setAttribute("id","1-1");
$nodo_general->setAttribute("text",$ColeccionEtiquetas['248']);//General
$nodo_general->setAttribute("select","1");
$medidores = $outXML->createElement("item");
$medidores = $nodo_general->appendChild($medidores);
$medidores->setAttribute("id","1000");
$medidores->setAttribute("text",$ColeccionEtiquetas['103']);//Medidores
$repetidores = $outXML->createElement("item");
$repetidores = $nodo_general->appendChild($repetidores);
$repetidores->setAttribute("id","2000");
$repetidores->setAttribute("text",$ColeccionEtiquetas['246']);//Repetidores
$gateways = $outXML->createElement("item");
$gateways = $nodo_general->appendChild($gateways);
$gateways->setAttribute("id","3000");
$gateways->setAttribute("text","GATEWAYS");//Geteways
// Variables para los Id de los Atributos del Archivo XML
$m = 100; $r = 100; $g = 100; $gr = 100;
$md = 777; $rd = 888; $gd = 999; $grd = 555;
// Arreglo para sacar las Zonas
$Param=array();
$Param[0]=array("pHandler","conect",10,0);
$Param[1]=array("c_res","","",2);
$Param[2]=array("P1","",10,0);
$Param[3]=array("P2","",10,0);
$Param[4]=array("P3","",10,0);
$Param[5]=array("P4","",10,0);
if($dbCon->Ejecutar($vcn,$PARAMS_ORACLE["esqusr"].".PRUEBAS.sp_GetData2",$Param,&$vCur)){
$bValido = OCIExecute($vCur);
$column_name = oci_num_fields($vCur);
// Arreglo para sacar los codigos de los eficios
if($bValido){
// Ejecucion para sacar el nombre de los edificios
while ($row = oci_fetch_assoc($vCur)){
$codigo_edificio = $row['CODIGO'];
$Param2=array();
$Param2[0]=array("pHandler","edificios",10,0);
$Param2[1]=array("c_res","","",2);
$Param2[2]=array("P1","",10,0);
$Param2[3]=array("P2",$codigo_edificio,10,0);
$Param2[4]=array("P3","",10,0);
$Param2[5]=array("P4","",10,0);
$dbCon->Ejecutar($vcn, $PARAMS_ORACLE["esqusr"].".PRUEBAS.sp_GetData2",$Param2,&$vCur2);
$bValido2 = OCIExecute($vCur2);
//$rowf = oci_fetch_assoc($vCur2);
$tree = $outXML->createElement("item");
$tree = $cuidad_instalados->appendChild($tree);
$tree->setAttribute("id", $row['CODIGO']);
$tree->setAttribute("text",$row['ZONA']);
$general = $outXML->createElement("item");
$general = $tree->appendChild($general);
$general->setAttribute("id",$gr);
$general->setAttribute("text",$ColeccionEtiquetas['248']);//General
$medidor = $outXML->createElement("item");
$medidor = $general->appendChild($medidor);
...
1 respuesta
Respuesta
1