1 | <?
|
---|
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/<? echo $idioma?>/inclusionacciones_<? echo $idioma?>.js"></SCRIPT>
|
---|
48 | </HEAD>
|
---|
49 | <BODY>
|
---|
50 | <?
|
---|
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"> <?echo $literal?><BR>
|
---|
65 | <SPAN align=center class=subcabeceras><?echo $descripcionaccion?></SPAN> <IMG src="<? echo $urlimg?>"></P>
|
---|
66 |
|
---|
67 | <TABLE align=center border=0>
|
---|
68 | <TR>
|
---|
69 | <?
|
---|
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="<?echo $conTR?>">
|
---|
86 | <INPUT type="hidden" name="tipoaccion" value="<?echo $tipoaccion?>">
|
---|
87 | <INPUT type="hidden" name="idtipoaccion" value="<?echo $idtipoaccion?>">
|
---|
88 | </FORM>
|
---|
89 | </BODY>
|
---|
90 | </HTML>
|
---|
91 | <?
|
---|
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 | //echo $cmd->texto;
|
---|
111 |
|
---|
112 | $idprocedimientos=escribeAcciones($cmd,$AMBITO_PROCEDIMIENTOS,true,7);
|
---|
113 |
|
---|
114 | //$idprocedimientos.=$idprocedimiento; // Excluye a él mismo de la segunda ronda
|
---|
115 | $idprocedimientos=$idprocedimiento; // Excluye sólo a él para evitar dead-lock
|
---|
116 | $cmd->texto="SELECT idprocedimiento as identificador, 0 as orden, 0 as idcomando,descripcion as procedimiento
|
---|
117 | FROM procedimientos
|
---|
118 | WHERE idprocedimiento NOT IN (".$idprocedimientos.")
|
---|
119 | ORDER BY descripcion";
|
---|
120 |
|
---|
121 | escribeAcciones($cmd,$AMBITO_PROCEDIMIENTOS,false,8);
|
---|
122 | }
|
---|
123 | // *************************************************************************************************************************************************
|
---|
124 | function listaTareas($cmd,$idtarea,$ambito)
|
---|
125 | {
|
---|
126 | global $AMBITO_PROCEDIMIENTOS;
|
---|
127 | global $AMBITO_TAREAS;
|
---|
128 | global $AMBITO_TAREAS;
|
---|
129 | global $TbMsg;
|
---|
130 |
|
---|
131 | /* Contenido de tarea */
|
---|
132 | $cmd->texto="SELECT tareas.ambito,tareas.idambito,tareas_acciones.idtareaaccion as identificador,tareas_acciones.orden,
|
---|
133 | tareas_acciones.tareaid,procedimientos.idprocedimiento,procedimientos.descripcion as procedimiento,
|
---|
134 | tareastemp.descripcion as tarea
|
---|
135 | FROM tareas
|
---|
136 | INNER JOIN tareas_acciones ON tareas_acciones.idtarea=tareas.idtarea
|
---|
137 | LEFT OUTER JOIN procedimientos ON procedimientos.idprocedimiento=tareas_acciones.idprocedimiento
|
---|
138 | LEFT OUTER JOIN tareas as tareastemp
|
---|
139 | ON tareastemp.idtarea=tareas_acciones.tareaid
|
---|
140 | WHERE tareas.idtarea=".$idtarea."
|
---|
141 | ORDER by tareas_acciones.orden";
|
---|
142 |
|
---|
143 | //echo $cmd->texto;
|
---|
144 | $idtareas=escribeAcciones($cmd,$AMBITO_TAREAS,true,7);
|
---|
145 |
|
---|
146 | /* Procedimientos disponibles */
|
---|
147 | if(!empty($ambito)){
|
---|
148 | $cmd->texto="SELECT idprocedimiento as identificador, 0 as orden, 0 as idcomando,descripcion as procedimiento
|
---|
149 | FROM procedimientos
|
---|
150 | ORDER BY descripcion";
|
---|
151 |
|
---|
152 | escribeAcciones($cmd,$AMBITO_PROCEDIMIENTOS,false,8);
|
---|
153 | }
|
---|
154 |
|
---|
155 | /* Tareas disponibles */
|
---|
156 | //$idtareas.=$idtarea; // Excluye a ella misma de la segunda ronda
|
---|
157 | $idtareas=$idtarea; // Excluye sólo a ella para evitar dead-lock
|
---|
158 | $cmd->texto="SELECT idtarea as identificador, 0 as orden, 0 as idprocedimiento, descripcion as tarea
|
---|
159 | FROM tareas
|
---|
160 | WHERE idtarea NOT IN (".$idtareas.")
|
---|
161 | ORDER BY descripcion";
|
---|
162 | escribeAcciones($cmd,$AMBITO_TAREAS,false,9);
|
---|
163 | }
|
---|
164 | //________________________________________________________________________________________________________
|
---|
165 |
|
---|
166 | function escribeAcciones($cmd,$tipoaccion,$sw,$imsg)
|
---|
167 | {
|
---|
168 | global $AMBITO_PROCEDIMIENTOS;
|
---|
169 | global $AMBITO_TAREAS;
|
---|
170 | global $AMBITO_COMANDOS;
|
---|
171 | global $conTR;
|
---|
172 | global $TbMsg;
|
---|
173 |
|
---|
174 | $rs=new Recordset;
|
---|
175 | $rs->Comando=&$cmd;
|
---|
176 | if (!$rs->Abrir()) return("");
|
---|
177 |
|
---|
178 | $idacciones="";
|
---|
179 |
|
---|
180 | echo '<TD valign=top>';
|
---|
181 | if($rs->EOF && !sw){
|
---|
182 | echo '</P></TD>';
|
---|
183 | return;
|
---|
184 | }
|
---|
185 |
|
---|
186 | echo '<P align=center><SPAN class=presentaciones><B>'.$TbMsg[$imsg].'</B></SPAN></BR>';
|
---|
187 | echo ' <TABLE align=center class="tabla_listados" cellspacing=1 cellpadding=0>';
|
---|
188 | escribeCabecera();
|
---|
189 | while (!$rs->EOF){
|
---|
190 | echo '<TR id="TR-'.$conTR.'" value="'.$rs->campos["identificador"].'">';
|
---|
191 | $conTR++;
|
---|
192 | echo '<TD align=center><INPUT type=checkbox';
|
---|
193 | if($sw)
|
---|
194 | echo ' value="1" checked '; // Lo marca como seleccionado (1ª. ronda)
|
---|
195 | else
|
---|
196 | echo ' value="0"';
|
---|
197 | echo '></TD>';
|
---|
198 | echo '<TD align=center ><INPUT class="formulariodatos" style="WIDTH:30px"
|
---|
199 | type="text" value="'.$rs->campos["orden"].'" id="'.$rs->campos["orden"].'"></TD>';
|
---|
200 |
|
---|
201 | // Descripcion de la acción
|
---|
202 | switch($tipoaccion){
|
---|
203 | case $AMBITO_PROCEDIMIENTOS:
|
---|
204 | if(!empty($rs->campos["idcomando"])){
|
---|
205 | $urlimg="../images/iconos/comandos.gif";
|
---|
206 | $accion=$rs->campos["comando"];
|
---|
207 | $value=$AMBITO_COMANDOS;
|
---|
208 | }
|
---|
209 | else{
|
---|
210 | $urlimg="../images/iconos/procedimiento.gif";
|
---|
211 | $accion=$rs->campos["procedimiento"];
|
---|
212 | $idacciones.=$rs->campos["procedimientoid"].",";
|
---|
213 | $value=$AMBITO_PROCEDIMIENTOS;
|
---|
214 | }
|
---|
215 | break;
|
---|
216 | case $AMBITO_TAREAS:
|
---|
217 | if(!empty($rs->campos["idprocedimiento"])){
|
---|
218 | $urlimg="../images/iconos/procedimiento.gif";
|
---|
219 | $accion=$rs->campos["procedimiento"];
|
---|
220 | $value=$AMBITO_PROCEDIMIENTOS;
|
---|
221 | }
|
---|
222 | else{
|
---|
223 | $urlimg="../images/iconos/tareas.gif";
|
---|
224 | $accion=$rs->campos["tarea"];
|
---|
225 | $idacciones.=$rs->campos["tareaid"].",";
|
---|
226 | $value=$AMBITO_TAREAS;
|
---|
227 | }
|
---|
228 | break;
|
---|
229 | }
|
---|
230 | echo '<TD align=center><IMG style="cursor:pointer" src="'.$urlimg.'" value="'.$value.'"></TD>';
|
---|
231 | echo '<TD>'.$accion.'</TD>';
|
---|
232 | // Orden del item del item
|
---|
233 | echo '</TR>';
|
---|
234 |
|
---|
235 | /* Muestra parámetros de los comandos (Se hace en Información)
|
---|
236 | if($tipoaccion==$AMBITO_PROCEDIMIENTOS){
|
---|
237 | if(!empty($rs->campos["idcomando"])){ // Se trata de un comando, se muestran parámetros)
|
---|
238 | $htmlprm=escribeParametros($rs->campos["parametros"]);
|
---|
239 | if(!empty($htmlprm)){
|
---|
240 | echo '<TR>';
|
---|
241 | echo '<TD> </TD>';
|
---|
242 | echo '<TD colspan=3>'.escribeParametros($rs->campos["parametros"]).'</TD>';
|
---|
243 | }
|
---|
244 | }
|
---|
245 | }
|
---|
246 | */
|
---|
247 | $rs->Siguiente();
|
---|
248 | }
|
---|
249 | echo '</TABLE>';
|
---|
250 | if($sw) escribePie();
|
---|
251 | echo '</P></TD>';
|
---|
252 | $rs->Cerrar();
|
---|
253 | $idacciones.="0"; // Para evitar el último ";"
|
---|
254 | return($idacciones);
|
---|
255 | }
|
---|
256 | //________________________________________________________________________________________________________
|
---|
257 |
|
---|
258 | function escribeCabecera()
|
---|
259 | {
|
---|
260 | global $TbMsg;
|
---|
261 | global $litcab;
|
---|
262 |
|
---|
263 | echo '<TR height=20>
|
---|
264 | <TH> </TH>
|
---|
265 | <TH> '.$TbMsg[4].' </TH>
|
---|
266 | <TH>T</TH>
|
---|
267 | <TH> '.$litcab.'</TH>
|
---|
268 | </TR>';
|
---|
269 | }
|
---|
270 | //________________________________________________________________________________________________________
|
---|
271 |
|
---|
272 | function escribePie()
|
---|
273 | {
|
---|
274 | global $litmsg;
|
---|
275 | global $op;
|
---|
276 |
|
---|
277 | echo '<BR><TABLE align=center>
|
---|
278 | <TR>
|
---|
279 | <TD><A href="#botones"><IMG border=0 src="../images/boton_confirmar.gif"
|
---|
280 | onclick="javascript:confirmar('.$op.')"></A></TD>
|
---|
281 | </TR>
|
---|
282 | </TABLE>
|
---|
283 | <BR>
|
---|
284 | <DIV id="Layer_nota" align=center>
|
---|
285 | <SPAN align=center class=notas><I>'.$litmsg.'</I></SPAN>
|
---|
286 | </DIV>';
|
---|
287 | }
|
---|
288 | ?> |
---|