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