1 | <?php |
---|
2 | /* ------------------------------------------------------------------------------------------- |
---|
3 | Inserta, modifica o elimina un grupo de servidores dhcp de la base de datos |
---|
4 | ---------------------------------------------------------------------------------------------*/ |
---|
5 | function CuestionAcciones($cmd,$shidra,$parametros){ |
---|
6 | |
---|
7 | global $sw_ejya; |
---|
8 | global $sw_seguimiento; |
---|
9 | |
---|
10 | global $sw_mktarea; |
---|
11 | global $nwidtarea; |
---|
12 | global $nwdescritarea; |
---|
13 | |
---|
14 | global $sw_mkprocedimiento; |
---|
15 | global $nwidprocedimiento; |
---|
16 | global $nwdescriprocedimiento; |
---|
17 | |
---|
18 | global $identificador; |
---|
19 | |
---|
20 | if($sw_ejya=='true' ){ // switch de ejecución inmediata ---------------------------------------------------------------------- |
---|
21 | if($sw_seguimiento=='true' ){ // switch de ejecución con seguimiento |
---|
22 | $cmd->texto="INSERT INTO acciones (tipoaccion,idtipoaccion,cateaccion,ambito,idambito,fechahorareg,estado,resultado,idcentro,parametros,accionid,idnotificador) VALUES (@tipoaccion,@idtipoaccion,@cateaccion,@ambito,@idambito,@fechahorareg,@estado,@resultado,@idcentro,@parametros,0,0)"; |
---|
23 | $resul=$cmd->Ejecutar(); |
---|
24 | if($resul){ |
---|
25 | $parametros.="ids=".$cmd->Autonumerico().chr(13); |
---|
26 | } |
---|
27 | } |
---|
28 | // Envio al servidor hidra |
---|
29 | if ($shidra->conectar()){ // Se ha establecido la conexión con el servidor hidra |
---|
30 | $shidra->envia_comando($parametros); |
---|
31 | $shidra->desconectar(); |
---|
32 | } |
---|
33 | else |
---|
34 | return(false); |
---|
35 | } |
---|
36 | // Fin ejecución inmediata ------------------------------------------------------------------------------------------------------------- |
---|
37 | |
---|
38 | if($sw_mkprocedimiento=='true'){ // switch de creación o inclusión en procedimiento --------------------------------------------------------- |
---|
39 | if($nwidprocedimiento==0){ |
---|
40 | $cmd->ParamSetValor("@descripcion",$nwdescriprocedimiento,0); |
---|
41 | $cmd->texto="INSERT INTO procedimientos(descripcion,idcentro) VALUES (@descripcion,@idcentro)"; |
---|
42 | $resul=$cmd->Ejecutar(); |
---|
43 | if($resul) |
---|
44 | $nwidprocedimiento=$cmd->Autonumerico(); |
---|
45 | else |
---|
46 | return(false); |
---|
47 | } |
---|
48 | if($nwidprocedimiento>0){ // inclusión en procedimiento existente |
---|
49 | $cmd->ParamSetValor("@idprocedimiento",$nwidprocedimiento,1); |
---|
50 | $cmd->ParamSetValor("@idcomando",$identificador,1); |
---|
51 | $cmd->ParamSetValor("@parametros",Sin_iph($parametros),0); |
---|
52 | $cmd->texto="INSERT INTO procedimientos_comandos(idprocedimiento,orden,idcomando,parametros) VALUES (@idprocedimiento,0,@idcomando,@parametros)"; |
---|
53 | $resul=$cmd->Ejecutar(); |
---|
54 | $cmd->ParamSetValor("@parametros",$parametros); |
---|
55 | if(!$resul) return(false); |
---|
56 | } |
---|
57 | } |
---|
58 | |
---|
59 | if($sw_mktarea=='true'){ // switch de creación o inclusión en tarea ----------------------------------------------------------- |
---|
60 | if($nwidtarea==0){ // Nueva tarea |
---|
61 | $cmd->ParamSetValor("@descripcion",$nwdescritarea); |
---|
62 | $cmd->texto="INSERT INTO tareas(descripcion,idcentro) VALUES (@descripcion,@idcentro)"; |
---|
63 | $resul=$cmd->Ejecutar(); |
---|
64 | if($resul) |
---|
65 | $nwidtarea=$cmd->Autonumerico(); |
---|
66 | else |
---|
67 | return(false); |
---|
68 | } |
---|
69 | if($nwidtarea>0){ // inclusión en tarea existente |
---|
70 | $cmd->ParamSetValor("@idtarea",$nwidtarea); |
---|
71 | $cmd->ParamSetValor("@idcomando",$identificador); |
---|
72 | $cmd->texto="INSERT INTO tareas_comandos(idtarea,orden,idcomando,ambito,idambito,parametros) VALUES (@idtarea,0,@idcomando,@ambito,@idambito,@parametros)"; |
---|
73 | $resul=$cmd->Ejecutar(); |
---|
74 | if(!$resul) return(false); |
---|
75 | } |
---|
76 | } |
---|
77 | return(true); |
---|
78 | } |
---|
79 | |
---|