1 | <?php
|
---|
2 | //// ******************************************************************************************************
|
---|
3 | // Aplicación WEB: ogAdmWebCon
|
---|
4 | // Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla
|
---|
5 | // Fecha Creación: Año 2009-2010
|
---|
6 | // Fecha Última modificación: Agosto-2010
|
---|
7 | // Nombre del fichero: inclusionacciones.php
|
---|
8 | // Descripción :
|
---|
9 | // Permite incorporar procedimientos y comandos a tareas y tareas ya existentes
|
---|
10 | // *******************************************************************************************************
|
---|
11 | include_once("../includes/ctrlacc.php");
|
---|
12 | include_once("../clases/AdoPhp.php");
|
---|
13 | include_once("../includes/CreaComando.php");
|
---|
14 | include_once("../includes/constantes.php");
|
---|
15 | include_once("../includes/comunes.php");
|
---|
16 | include_once("../includes/TomaDato.php");
|
---|
17 | include_once("../idiomas/php/".$idioma."/inclusionacciones_".$idioma.".php");
|
---|
18 | //________________________________________________________________________________________________________
|
---|
19 |
|
---|
20 | $idtipoaccion=0;
|
---|
21 | $tipoaccion=0;
|
---|
22 | $descripcionaccion="";
|
---|
23 | $ambito="";
|
---|
24 |
|
---|
25 | if (isset($_GET["idtipoaccion"])) $idtipoaccion=$_GET["idtipoaccion"];
|
---|
26 | if (isset($_GET["tipoaccion"])) $tipoaccion=$_GET["tipoaccion"];
|
---|
27 | if (isset($_GET["descripcionaccion"])) $descripcionaccion=$_GET["descripcionaccion"];
|
---|
28 | if (isset($_GET["ambito"])) $ambito=$_GET["ambito"];
|
---|
29 |
|
---|
30 | //________________________________________________________________________________________________________
|
---|
31 |
|
---|
32 | $cmd=CreaComando($cadenaconexion); // Crea objeto comando
|
---|
33 | if (!$cmd)
|
---|
34 | Header('Location: '.$pagerror.'?herror=2'); // Error de conexión con servidor B.D.
|
---|
35 |
|
---|
36 | $tbParametros=CreaTablaParametros($cmd); // Crea tabla en memmoria para acceder a detalles de comandos
|
---|
37 | //________________________________________________________________________________________________________
|
---|
38 | ?>
|
---|
39 | <HTML>
|
---|
40 | <HEAD>
|
---|
41 | <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
---|
42 | <LINK rel="stylesheet" type="text/css" href="../estilos.css">
|
---|
43 | <SCRIPT language="javascript" src="../clases/jscripts/MenuContextual.js"></SCRIPT>
|
---|
44 | <SCRIPT language="javascript" src="../jscripts/inclusionacciones.js"></SCRIPT>
|
---|
45 | <SCRIPT language="javascript" src="../clases/jscripts/HttpLib.js"></SCRIPT>
|
---|
46 | <SCRIPT language="javascript" src="../jscripts/comunes.js"></SCRIPT>
|
---|
47 | <SCRIPT language="javascript" src="../idiomas/javascripts/<?php echo $idioma?>/inclusionacciones_<?php echo $idioma?>.js"></SCRIPT>
|
---|
48 | </HEAD>
|
---|
49 | <BODY>
|
---|
50 | <?php
|
---|
51 | switch($tipoaccion){
|
---|
52 | case $AMBITO_PROCEDIMIENTOS:
|
---|
53 | $urlimg="../images/iconos/procedimiento.gif";
|
---|
54 | $literal=$TbMsg[0];
|
---|
55 | $litcab=$TbMsg[2];
|
---|
56 | break;
|
---|
57 | case $AMBITO_TAREAS:
|
---|
58 | $urlimg="../images/iconos/tareas.gif";
|
---|
59 | $literal=$TbMsg[1];
|
---|
60 | $litcab=$TbMsg[3];
|
---|
61 | break;
|
---|
62 | }
|
---|
63 | ?>
|
---|
64 | <P align=center class=cabeceras><IMG src="../images/iconos/acciones.gif"> <?php echo $literal?><BR>
|
---|
65 | <SPAN align=center class=subcabeceras><?php echo $descripcionaccion?></SPAN> <IMG src="<?php echo $urlimg?>"></P>
|
---|
66 |
|
---|
67 | <TABLE align=center border=0>
|
---|
68 | <TR>
|
---|
69 | <?php
|
---|
70 | $conTR=0; // Contador de lineas (Identificadores de las filas)
|
---|
71 | switch($tipoaccion){
|
---|
72 | case $AMBITO_PROCEDIMIENTOS:
|
---|
73 | $litmsg=$TbMsg[5];
|
---|
74 | listaProcedientos($cmd,$idtipoaccion);
|
---|
75 | break;
|
---|
76 | case $AMBITO_TAREAS:
|
---|
77 | $litmsg=$TbMsg[6];
|
---|
78 | listaTareas($cmd,$idtipoaccion,$ambito);
|
---|
79 | break;
|
---|
80 | }
|
---|
81 | ?>
|
---|
82 | </TR>
|
---|
83 | </TABLE>
|
---|
84 | <FORM name="fdatos">
|
---|
85 | <INPUT type="hidden" name="conTR" value="<?php echo $conTR?>">
|
---|
86 | <INPUT type="hidden" name="tipoaccion" value="<?php echo $tipoaccion?>">
|
---|
87 | <INPUT type="hidden" name="idtipoaccion" value="<?php echo $idtipoaccion?>">
|
---|
88 | </FORM>
|
---|
89 | </BODY>
|
---|
90 | </HTML>
|
---|
91 | <?php
|
---|
92 | // *************************************************************************************************************************************************
|
---|
93 | function listaProcedientos($cmd,$idprocedimiento)
|
---|
94 | {
|
---|
95 | global $AMBITO_PROCEDIMIENTOS;
|
---|
96 | global $TbMsg;
|
---|
97 |
|
---|
98 | $cmd->texto="SELECT procedimientos_acciones.idprocedimientoaccion AS identificador, procedimientos_acciones.orden,
|
---|
99 | procedimientos_acciones.parametros, procedimientos_acciones.procedimientoid,
|
---|
100 | comandos.idcomando, comandos.descripcion AS comando,
|
---|
101 | procedimientostemp.descripcion AS procedimiento
|
---|
102 | FROM procedimientos
|
---|
103 | INNER JOIN procedimientos_acciones ON procedimientos_acciones.idprocedimiento=procedimientos.idprocedimiento
|
---|
104 | LEFT OUTER JOIN comandos ON comandos.idcomando=procedimientos_acciones.idcomando
|
---|
105 | LEFT OUTER JOIN procedimientos AS procedimientostemp
|
---|
106 | ON procedimientostemp.idprocedimiento=procedimientos_acciones.procedimientoid
|
---|
107 | WHERE procedimientos.idprocedimiento=".$idprocedimiento."
|
---|
108 | ORDER BY procedimientos_acciones.orden";
|
---|
109 |
|
---|
110 | $idprocedimientos=escribeAcciones($cmd,$AMBITO_PROCEDIMIENTOS,true,7);
|
---|
111 |
|
---|
112 | $idprocedimientos=$idprocedimiento; // Excluye sólo a él para evitar dead-lock
|
---|
113 | $cmd->texto="SELECT idprocedimiento AS identificador, 0 AS orden, 0 AS idcomando, descripcion AS procedimiento
|
---|
114 | FROM procedimientos
|
---|
115 | WHERE idprocedimiento NOT IN (".$idprocedimientos.")
|
---|
116 | ORDER BY descripcion";
|
---|
117 |
|
---|
118 | escribeAcciones($cmd,$AMBITO_PROCEDIMIENTOS,false,8);
|
---|
119 | }
|
---|
120 | // *************************************************************************************************************************************************
|
---|
121 | function listaTareas($cmd,$idtarea,$ambito)
|
---|
122 | {
|
---|
123 | global $AMBITO_PROCEDIMIENTOS;
|
---|
124 | global $AMBITO_TAREAS;
|
---|
125 | global $AMBITO_TAREAS;
|
---|
126 | global $TbMsg;
|
---|
127 |
|
---|
128 | /* Contenido de tarea */
|
---|
129 | $cmd->texto="SELECT tareas.ambito, tareas.idambito, tareas_acciones.idtareaaccion AS identificador,
|
---|
130 | tareas_acciones.orden, tareas_acciones.tareaid, procedimientos.idprocedimiento,
|
---|
131 | procedimientos.descripcion AS procedimiento, tareastemp.descripcion AS tarea
|
---|
132 | FROM tareas
|
---|
133 | INNER JOIN tareas_acciones ON tareas_acciones.idtarea=tareas.idtarea
|
---|
134 | LEFT OUTER JOIN procedimientos ON procedimientos.idprocedimiento=tareas_acciones.idprocedimiento
|
---|
135 | LEFT OUTER JOIN tareas AS tareastemp
|
---|
136 | ON tareastemp.idtarea=tareas_acciones.tareaid
|
---|
137 | WHERE tareas.idtarea=".$idtarea."
|
---|
138 | ORDER BY tareas_acciones.orden";
|
---|
139 |
|
---|
140 | $idtareas=escribeAcciones($cmd,$AMBITO_TAREAS,true,7);
|
---|
141 |
|
---|
142 | /* Procedimientos disponibles */
|
---|
143 | if(!empty($ambito)){
|
---|
144 | $cmd->texto="SELECT idprocedimiento AS identificador, 0 AS orden, 0 AS idcomando, descripcion AS procedimiento
|
---|
145 | FROM procedimientos
|
---|
146 | ORDER BY descripcion";
|
---|
147 |
|
---|
148 | escribeAcciones($cmd,$AMBITO_PROCEDIMIENTOS,false,8);
|
---|
149 | }
|
---|
150 |
|
---|
151 | /* Tareas disponibles */
|
---|
152 | $idtareas=$idtarea; // Excluye sólo a ella para evitar dead-lock
|
---|
153 | $cmd->texto="SELECT idtarea AS identificador, 0 AS orden, 0 AS idprocedimiento, descripcion AS tarea
|
---|
154 | FROM tareas
|
---|
155 | WHERE idtarea NOT IN (".$idtareas.")
|
---|
156 | ORDER BY descripcion";
|
---|
157 | escribeAcciones($cmd,$AMBITO_TAREAS,false,9);
|
---|
158 | }
|
---|
159 | //________________________________________________________________________________________________________
|
---|
160 |
|
---|
161 | function escribeAcciones($cmd,$tipoaccion,$sw,$imsg)
|
---|
162 | {
|
---|
163 | global $AMBITO_PROCEDIMIENTOS;
|
---|
164 | global $AMBITO_TAREAS;
|
---|
165 | global $AMBITO_COMANDOS;
|
---|
166 | global $conTR;
|
---|
167 | global $TbMsg;
|
---|
168 |
|
---|
169 | $rs=new Recordset;
|
---|
170 | $rs->Comando=&$cmd;
|
---|
171 | if (!$rs->Abrir()) return("");
|
---|
172 |
|
---|
173 | $idacciones="";
|
---|
174 |
|
---|
175 | echo '<TD valign=top>';
|
---|
176 | if($rs->EOF && !$sw){
|
---|
177 | echo '</P></TD>';
|
---|
178 | return;
|
---|
179 | }
|
---|
180 |
|
---|
181 | echo '<P align=center><SPAN class=presentaciones><B>'.$TbMsg[$imsg].'</B></SPAN></BR>';
|
---|
182 | echo ' <TABLE align=center class="tabla_listados" cellspacing=1 cellpadding=0>';
|
---|
183 | escribeCabecera();
|
---|
184 | while (!$rs->EOF){
|
---|
185 | echo '<TR id="TR-'.$conTR.'" value="'.$rs->campos["identificador"].'">';
|
---|
186 | $conTR++;
|
---|
187 | echo '<TD align=center><INPUT type=checkbox';
|
---|
188 | if($sw)
|
---|
189 | echo ' value="1" checked '; // Lo marca como seleccionado (1ª. ronda)
|
---|
190 | else
|
---|
191 | echo ' value="0"';
|
---|
192 | echo '></TD>';
|
---|
193 | echo '<TD align=center ><INPUT class="formulariodatos" style="WIDTH:30px"
|
---|
194 | type="text" value="'.$rs->campos["orden"].'" id="'.$rs->campos["orden"].'"></TD>';
|
---|
195 |
|
---|
196 | // Descripcion de la acción
|
---|
197 | switch($tipoaccion){
|
---|
198 | case $AMBITO_PROCEDIMIENTOS:
|
---|
199 | if(!empty($rs->campos["idcomando"])){
|
---|
200 | $urlimg="../images/iconos/comandos.gif";
|
---|
201 | $accion=$rs->campos["comando"];
|
---|
202 | $value=$AMBITO_COMANDOS;
|
---|
203 | }
|
---|
204 | else{
|
---|
205 | $urlimg="../images/iconos/procedimiento.gif";
|
---|
206 | $accion=$rs->campos["procedimiento"];
|
---|
207 | $value=$AMBITO_PROCEDIMIENTOS;
|
---|
208 | }
|
---|
209 | break;
|
---|
210 | case $AMBITO_TAREAS:
|
---|
211 | if(!empty($rs->campos["idprocedimiento"])){
|
---|
212 | $urlimg="../images/iconos/procedimiento.gif";
|
---|
213 | $accion=$rs->campos["procedimiento"];
|
---|
214 | $value=$AMBITO_PROCEDIMIENTOS;
|
---|
215 | }
|
---|
216 | else{
|
---|
217 | $urlimg="../images/iconos/tareas.gif";
|
---|
218 | $accion=$rs->campos["tarea"];
|
---|
219 | $value=$AMBITO_TAREAS;
|
---|
220 | }
|
---|
221 | break;
|
---|
222 | }
|
---|
223 | echo '<TD align=center><IMG style="cursor:pointer" src="'.$urlimg.'" value="'.$value.'"></TD>';
|
---|
224 | echo '<TD>'.$accion.'</TD>';
|
---|
225 | // Orden del item del item
|
---|
226 | echo '</TR>';
|
---|
227 |
|
---|
228 | /* Muestra parámetros de los comandos (Se hace en Información)
|
---|
229 | if($tipoaccion==$AMBITO_PROCEDIMIENTOS){
|
---|
230 | if(!empty($rs->campos["idcomando"])){ // Se trata de un comando, se muestran parámetros)
|
---|
231 | $htmlprm=escribeParametros($rs->campos["parametros"]);
|
---|
232 | if(!empty($htmlprm)){
|
---|
233 | echo '<TR>';
|
---|
234 | echo '<TD> </TD>';
|
---|
235 | echo '<TD colspan=3>'.escribeParametros($rs->campos["parametros"]).'</TD>';
|
---|
236 | }
|
---|
237 | }
|
---|
238 | }
|
---|
239 | */
|
---|
240 | $rs->Siguiente();
|
---|
241 | }
|
---|
242 | echo '</TABLE>';
|
---|
243 | if($sw) escribePie();
|
---|
244 | echo '</P></TD>';
|
---|
245 | $rs->Cerrar();
|
---|
246 | $idacciones.="0"; // Para evitar el último ";"
|
---|
247 | return($idacciones);
|
---|
248 | }
|
---|
249 | //________________________________________________________________________________________________________
|
---|
250 |
|
---|
251 | function escribeCabecera()
|
---|
252 | {
|
---|
253 | global $TbMsg;
|
---|
254 | global $litcab;
|
---|
255 |
|
---|
256 | echo '<TR height=20>
|
---|
257 | <TH> </TH>
|
---|
258 | <TH> '.$TbMsg[4].' </TH>
|
---|
259 | <TH>T</TH>
|
---|
260 | <TH> '.$litcab.'</TH>
|
---|
261 | </TR>';
|
---|
262 | }
|
---|
263 | //________________________________________________________________________________________________________
|
---|
264 |
|
---|
265 | function escribePie()
|
---|
266 | {
|
---|
267 | global $litmsg;
|
---|
268 | global $op;
|
---|
269 |
|
---|
270 | echo '<BR><TABLE align=center>
|
---|
271 | <TR>
|
---|
272 | <TD><A href="#botones"><IMG border=0 src="../images/boton_confirmar.gif"
|
---|
273 | onclick="javascript:confirmar('.$op.')"></A></TD>
|
---|
274 | </TR>
|
---|
275 | </TABLE>
|
---|
276 | <BR>
|
---|
277 | <DIV id="Layer_nota" align=center>
|
---|
278 | <SPAN align=center class=notas><I>'.$litmsg.'</I></SPAN>
|
---|
279 | </DIV>';
|
---|
280 | }
|
---|
281 | ?>
|
---|
282 |
|
---|