source: admin/WebConsole/principal/colasacciones.php @ 51c2318

Last change on this file since 51c2318 was c057e20, checked in by ramon <ramongomez@…>, 13 years ago

Versión 1.0.4a, #556: Integrar versión de mantenimiento 1.0.4a en rama principal.

git-svn-id: https://opengnsys.es/svn/trunk@3379 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100644
File size: 45.1 KB
Line 
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: colasacciones.php
8// Descripción :
9//              Visualiza las acciones pendientes y finalizadas con los resultados de estatus y horas de inicio y finalización
10// Cambio en la linea 73 la cantidad de días predeterminado por 180 (antes 3)
11// *************************************************************************************************************************************************
12        include_once("../includes/ctrlacc.php");
13        include_once("../clases/AdoPhp.php");
14        include_once("../clases/MenuContextual.php");
15        include_once("../includes/constantes.php");
16        include_once("../includes/comunes.php");
17        include_once("../includes/RecopilaIpesMacs.php");
18        include_once("../includes/InvFecha.php");
19        include_once("../clases/XmlPhp.php");
20        include_once("../includes/HTMLSELECT.php");
21        include_once("../includes/HTMLCTESELECT.php");
22        include_once("../includes/TomaDato.php");       
23        include_once("../includes/CreaComando.php");
24        include_once("../idiomas/php/".$idioma."/colasacciones_".$idioma.".php");
25        //________________________________________________________________________________________________________
26        //
27        // Captura de parámetros       
28        //________________________________________________________________________________________________________
29       
30        $ambito="";
31        $idambito=0;
32        $nombreambito="";
33
34        $fechainicio="";
35        $fechafin="";
36        $horainicio="";
37        $horafin="";
38        $tipoaccion="";
39        $estado="";
40        $resultado="";
41        $porcendesde="";
42        $porcenhasta="";
43        $swPOST="";
44        $tiposacciones="";
45        $estados="";
46        $resultados="";
47        $visupro="";
48        $visuprm="";
49        $visucmd="";   
50        $sesion="";     
51       
52        if (isset($_GET["ambito"]))     $ambito=$_GET["ambito"];
53        if (isset($_GET["idambito"])) $idambito=$_GET["idambito"];
54        if (isset($_GET["nombreambito"])) $nombreambito=$_GET["nombreambito"];
55
56        if (isset($_POST["ambito"]))    $ambito=$_POST["ambito"];
57        if (isset($_POST["idambito"])) $idambito=$_POST["idambito"];
58        if (isset($_POST["nombreambito"])) $nombreambito=$_POST["nombreambito"];
59       
60        if (isset($_POST["tipoaccion"])) $tipoaccion=$_POST["tipoaccion"];
61        if (isset($_POST["estado"])) $estado=$_POST["estado"];
62        if (isset($_POST["resultado"])) $resultado=$_POST["resultado"];
63
64        if (isset($_POST["fechainicio"])) $fechainicio=$_POST["fechainicio"];
65        if (isset($_POST["fechafin"])) $fechafin=$_POST["fechafin"];
66        if (isset($_POST["horainicio"])) $horainicio=$_POST["horainicio"];
67        if (isset($_POST["horafin"])) $horafin=$_POST["horafin"];
68       
69        if (isset($_POST["swPOST"])) $swPOST=$_POST["swPOST"];
70        if (isset($_POST["visuprm"])) $visuprm=$_POST["visuprm"];
71        if (isset($_POST["visupro"])) $visupro=$_POST["visupro"];
72        if (isset($_POST["visucmd"])) $visucmd=$_POST["visucmd"];
73
74
75        if (isset($_POST["sesion"])) $sesion=$_POST["sesion"];
76
77        if (function_exists('date_default_timezone_set')) {
78                date_default_timezone_set('UTC');
79        }
80        if(empty($swPOST)){ // Valores por defecto
81                $wfechainicio=mktime(0, 0, 0, date("m")  , date("d")-180, date("Y")); // Acciones desde tres días antes
82                $wfechafin=mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"));
83                $fechainicio=date("d/m/Y",$wfechainicio);
84                $fechafin=date("d/m/Y ",$wfechafin);
85                $estado=0;
86                $resultado=0;
87                $tipoaccion=0;
88                $visuprm=0;
89                $visupro=0;
90                $visucmd=1;
91        }
92
93        if (isset($_POST["porcendesde"])) $porcendesde=$_POST["porcendesde"];
94        if (isset($_POST["porcenhasta"])) $porcenhasta=$_POST["porcenhasta"];
95        if($porcendesde=="") $porcendesde=0;
96        if($porcenhasta=="") $porcenhasta=100;
97       
98        //________________________________________________________________________________________________________
99
100        $cmd=CreaComando($cadenaconexion);
101        if (!$cmd)
102                Header('Location: '.$pagerror.'?herror=2'); // Error de conexión con servidor B.D.
103               
104        $tbParametros=CreaTablaParametros($cmd); // Crea tabla en memmoria para acceder a detalles de comandos
105
106        //________________________________________________________________________________________________________
107        //
108        // Clausula WHERE ( construcción )
109        //________________________________________________________________________________________________________
110       
111        $ClausulaWhere="";
112
113        // Cuestion de fechas
114        $WhereFechaInicio="";
115        $WhereFechaFin="";
116        $WhereFechaReg="";
117        if($fechainicio!="")
118                $WhereFechaInicio="acciones.fechahorareg>='".InvFecha($fechainicio).' ' .$horainicio."'";
119        if($fechafin!="")
120                $WhereFechaFin.=" acciones.fechahorareg<='".InvFecha($fechafin).' ' .$horafin."'";
121        if($WhereFechaInicio!=""){
122                if($WhereFechaFin!="")
123                        $WhereFechaReg=" (".$WhereFechaInicio." AND ".$WhereFechaFin.") ";
124                else
125                        $WhereFechaReg=" (".$WhereFechaInicio.") ";
126        }
127        else{
128                        if($WhereFechaFin!="")
129                                $WhereFechaReg=" (".$WhereFechaFin.") ";
130        }
131        $ClausulaWhere.=$WhereFechaReg;
132       
133        // Cuestion tipos de acciones
134        if(!empty($tipoaccion)) $ClausulaWhere.=" AND acciones.tipoaccion=".$tipoaccion;
135
136        // Cuestion identificador del Centro que ha ejecutado la acción
137        $WhereCentroAccion="";
138        $WhereCentroAccion='acciones.idcentro='.$idcentro;
139        $ClausulaWhere.=" AND (".$WhereCentroAccion.")";
140        //________________________________________________________________________________________________________
141        ?>
142        <HTML>
143        <TITLE>Administración web de aulas</TITLE>
144        <HEAD>
145                <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
146                <LINK rel="stylesheet" type="text/css" href="../estilos.css">
147                <SCRIPT language="javascript" src="../clases/jscripts/MenuContextual.js"></SCRIPT>
148                <SCRIPT language="javascript" src="../jscripts/constantes.js"></SCRIPT>
149                <SCRIPT language="javascript" src="../jscripts/comunes.js"></SCRIPT>
150                <SCRIPT language="javascript" src="../jscripts/colasacciones.js"></SCRIPT>
151                <SCRIPT language="javascript" src="../clases/jscripts/HttpLib.js"></SCRIPT>                             
152                <? echo '<SCRIPT language="javascript" src="../idiomas/javascripts/'.$idioma.'/colasacciones_'.$idioma.'.js"></SCRIPT>'?>
153        </HEAD>
154        <BODY oncontextmenu="return false">
155        <?php
156        echo '<P align=center class=cabeceras><img src="../images/iconos/acciones.gif">&nbsp;'.$TbMsg[0].'&nbsp;</P>';
157
158        echo '<FORM name="fdatos" action="colasacciones.php" method="post">';
159                echo '<INPUT type="hidden" name="ambito" value="'.$ambito.'">';
160                echo '<INPUT type="hidden" name="idambito" value="'.$idambito.'">';
161                echo '<INPUT type="hidden" name="nombreambito" value="'.$nombreambito.'">';
162                echo '<INPUT type="hidden" name="swPOST" value="1">';
163                echo '<INPUT type="hidden" name="tiposacciones" value="'.$tiposacciones.'">';
164                echo '<INPUT type="hidden" name="estados" value="'.$estados.'">';
165                echo '<INPUT type="hidden" name="resultados" value="'.$resultados.'">';
166                echo '<INPUT type="hidden" name="resultados" value="'.$fechainicio.'">';
167                echo '<INPUT type="hidden" name="resultados" value="'.$fechafin.'">';
168                echo '<INPUT type="hidden" name="resultados" value="'.$horainicio.'">';
169                echo '<INPUT type="hidden" name="resultados" value="'.$horafin.'">';
170                echo '<INPUT type="hidden" name="resultados" value="'.$porcendesde.'">';
171                echo '<INPUT type="hidden" name="resultados" value="'.$porcenhasta.'">';
172                echo '<INPUT type="hidden" name="sesion" value="'.$sesion.'">';
173               
174
175        $HTMLCriterios="";
176        $HTMLCriterios.='<TABLE class=tabla_busquedas align=center border="0">'; // Filtro de búsquedas
177        $HTMLCriterios.='       <TR HEIGHT=30>';
178        $HTMLCriterios.='               <TD style="     BORDER-BOTTOM:#5a86b5 1px solid;"colspan=2 align="center" >';
179        $HTMLCriterios.='                       <SPAN style="FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
180                                                                                                        FONT-SIZE: 11px;COLOR:#5a86b5;FONT-WEIGHT: 700;">____ '.$TbMsg[1].'____</SPAN></TD></TR>';
181
182        $HTMLCriterios.='<TR>';
183        $HTMLCriterios.='       <TD>'; // Desplegables de tipo de acciones y estados
184        $HTMLCriterios.='               <TABLE class=tabla_standar align=center border="0">';
185        $HTMLCriterios.='                       <TR>';
186        $HTMLCriterios.='                               <TH align=center>&nbsp;'.$TbMsg[2].'&nbsp;</TH></TR>';
187
188        // Desplegable con los tipos de acciones
189        $parametros="0=".$TbMsg[61].chr(13);
190        $parametros.=$EJECUCION_COMANDO."=".$LITEJECUCION_COMANDO.chr(13);
191        $parametros.=$EJECUCION_PROCEDIMIENTO."=".$LITEJECUCION_PROCEDIMIENTO.chr(13);
192        $parametros.=$EJECUCION_TAREA."=".$LITEJECUCION_TAREA;
193        $HTMLCriterios.='                       <TR>';
194        $HTMLCriterios.='                               <TD>'.HTMLCTESELECT($parametros,"tipoaccion","estilodesple","",$tipoaccion,100).'</TD></TR>';
195               
196        // Desplegable con los distintos estados
197        $HTMLCriterios.='                       <TR>';
198        $HTMLCriterios.='                               <TH align=center>&nbsp;'.$TbMsg[4].'&nbsp;</TH></TR>';
199        $HTMLCriterios.=                        '<TR>';
200        $parametros="0=".$TbMsg[60].chr(13);   
201        $parametros.=$ACCION_INICIADA."=".$LITACCION_INICIADA.chr(13);
202        $parametros.=$ACCION_DETENIDA."=".$LITACCION_DETENIDA.chr(13);
203        $parametros.=$ACCION_FINALIZADA."=".$LITACCION_FINALIZADA.chr(13);;
204        $parametros.=$ACCION_PROGRAMADA."=".$LITACCION_PROGRAMADA;
205        $HTMLCriterios.='                               <TD colspan=3>'.HTMLCTESELECT($parametros,"estado","estilodesple","",$estado,100,"chgdespleestados").'</TD></TR>';
206        $HTMLCriterios.=                '</TABLE>';
207        $HTMLCriterios.='       </TD>'; // Fin Desplegables de tipo de acciones y estados
208       
209        $HTMLCriterios.='       <TD valign=top>'; // Desplegables de resultados y porcentajes
210        // Desplegable con los distintos resultados
211        $HTMLCriterios.='               <TABLE class=tabla_standar align=center border="0">';
212        $HTMLCriterios.='                       <TR>';
213        $HTMLCriterios.='                               <TH align=center>&nbsp;'.$TbMsg[3].'&nbsp;</TH></TR>';
214        $HTMLCriterios.='                       <TR>';
215
216        $parametros=$ACCION_SINRESULTADO."=".$TbMsg[60].chr(13);
217        $parametros.=$ACCION_EXITOSA."=".$LITACCION_EXITOSA.chr(13);
218        $parametros.=$ACCION_FALLIDA."=".$LITACCION_FALLIDA;
219        $HTMLCriterios.='                               <TD colspan=3>'.HTMLCTESELECT($parametros,"resultado","estilodesple","",$resultado,250,"chgdespleresultados").'</TD></TR>';
220        // Porcentajes
221        $HTMLCriterios.='                       <TR>';
222        $HTMLCriterios.='                               <TH>&nbsp;'.$TbMsg[5].':&nbsp;<INPUT size=1 name="porcendesde" value="'.$porcendesde.'">&nbsp;'.$TbMsg[6].':&nbsp;
223                                                                                                                <INPUT size =1 name="porcenhasta" value="'.$porcenhasta.'"></TH></TR>';
224        $HTMLCriterios.='               </TABLE>';
225        $HTMLCriterios.='       </TD>'; // Fin Desplegables de resultados y porcentajes
226        $HTMLCriterios.='</TR>';               
227               
228               
229        $HTMLCriterios.='<TR>';
230        $HTMLCriterios.='       <TD  style="BORDER-BOTTOM:#5a86b5 1px solid;" colspan=2>'; // Fechas y horas
231        // Fechas
232        $HTMLCriterios.='               <TABLE WIDTH=100% class=tabla_standar align=center border="0">';
233        $HTMLCriterios.='                       <TR>';
234        $HTMLCriterios.='                               <TH>&nbsp;'.$TbMsg[7].':&nbsp;</TH>';
235        $HTMLCriterios.='                               <TD><INPUT class="cajatexto" onclick="vertabla_calendario(this)" style="WIDTH:80" name="fechainicio" value="'.$fechainicio.'"></TD>';
236        $HTMLCriterios.='                               <TH align=right>&nbsp;'.$TbMsg[8].':&nbsp;&nbsp;</TH>';
237        $HTMLCriterios.='                               <TD align=right><INPUT class="cajatexto" onclick="vertabla_calendario(this)" style="WIDTH:80" name="fechafin" value="'.$fechafin.'"></TD>';
238        $HTMLCriterios.='                       </TR>';
239        $HTMLCriterios.='                       <TR>';
240        $HTMLCriterios.='                               <TH>&nbsp;'.$TbMsg[9].':&nbsp;</TH>';
241        $HTMLCriterios.='                               <TD><INPUT class="cajatexto" onclick="vertabla_horario(this)" style="WIDTH:80" name="horainicio" value="'.$horainicio.'"></TD>';
242        $HTMLCriterios.='                               <TH align=right>&nbsp;'.$TbMsg[10].':&nbsp;&nbsp;</TH>';
243        $HTMLCriterios.='                               <TD align=right><INPUT class="cajatexto" onclick="vertabla_horario(this)" style="WIDTH:80" name="horafin" value="'.$horafin.'"></TD>';
244        $HTMLCriterios.='                       </TR>';
245        $HTMLCriterios.='               </TABLE>';
246        $HTMLCriterios.='       </TD>';
247        $HTMLCriterios.='</TR>';
248        $HTMLCriterios.='</TABLE>';// Fin filtro de búsquedas
249
250        $HTMLCriterios.='<BR>';
251        //      _________________________________________________________________________
252        //     
253        // Tabla de checkbox para elegir visualizar detalles
254        //      _________________________________________________________________________
255       
256        $HTMLCriterios.='<TABLE class="tabla_busquedas" align=center border=0 cellPadding=0 cellSpacing=0>';
257        $HTMLCriterios.='       <TR>';
258        $HTMLCriterios.='       <TH height=15 align="center" colspan=14>&nbsp;'.$TbMsg[47].'&nbsp;</TH>';
259        $HTMLCriterios.='       </TR>';
260        $HTMLCriterios.='       <TR>';
261        $HTMLCriterios.='               <TD align=right>'.$TbMsg[48].'</TD>';
262        $HTMLCriterios.='               <TD align=center><INPUT type="checkbox" value="1" name="visuprm"';
263        if($visuprm==1) $HTMLCriterios.=' checked ';
264        $HTMLCriterios.='></TD>';
265        $HTMLCriterios.='               <TD width="20" align=center>&nbsp;</TD>';
266        $HTMLCriterios.='               <TD align=right>'.$TbMsg[49].'</TD>';
267        $HTMLCriterios.='               <TD align=center><INPUT type="checkbox" value="1" name="visupro"';
268        if($visupro==1) $HTMLCriterios.=' checked ';
269        $HTMLCriterios.='></TD>';
270        $HTMLCriterios.='               <TD width="20" align=center>&nbsp;</TD>';
271        $HTMLCriterios.='               <TD align=right>'.$TbMsg[50].'</TD>';
272        $HTMLCriterios.='               <TD align=center><INPUT type="checkbox" value="1" name="visucmd"';
273        if($visucmd==1) $HTMLCriterios.=' checked ';
274        $HTMLCriterios.='></TD>';
275        $HTMLCriterios.='       </TR>';
276        $HTMLCriterios.='</TABLE>';
277
278        $HTMLCriterios.='<BR>';
279               
280        $HTMLCriterios.='<TABLE class="tabla_busquedas" align=center border="0">';
281        $HTMLCriterios.='       <TR>';
282        $HTMLCriterios.='               <TD>';  // Lupa
283        $HTMLCriterios.='                       <A href="#busca"><IMG border=0 src="../images/iconos/busquedas.gif" onclick="javascript:fdatos.submit()" alt="Buscar"></A>';
284        $HTMLCriterios.='               </TD>';
285        $HTMLCriterios.='</TR>';
286        $HTMLCriterios.='</TABLE>';
287
288        echo $HTMLCriterios;   
289        echo '</FORM>'; // Fin formulario de criterios de busquedas
290       
291        /* Cabeceras */
292        tomaAmbito($ambito,$urlimg,$textambito);
293        echo '<DIV align=center>'; // Cabecera
294        echo '<span align=center class=subcabeceras><U>'.$TbMsg[11].':'.$textambito.'</U>,
295                                &nbsp;'.$nombreambito.'</span>&nbsp;&nbsp;<IMG src="'.$urlimg.'"></span>';
296        if(!empty($sesion))
297                echo '<BR><span align=center class="presentaciones">'.$TbMsg[51].'</span>&nbsp;&nbsp;
298                        <IMG src="../images/iconos/filtroaccion.gif">';
299        ?>
300        <BR>
301        <BR>
302        <?
303        //      _________________________________________________________________________
304        //     
305        // Tabla de opciones que afectan a todas las acciones mostradas
306        //      _________________________________________________________________________
307        ?>
308        <TABLE  align=center border=0 align=left cellPadding=2 cellSpacing=5 >
309                <TR>
310                        <? // Eliminar ?>
311                        <TD onclick=eleccion(1)>&nbsp;
312                                <TABLE class="filtros" >
313                                        <TR>
314                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/eliminar.gif"></A>&nbsp;</TD>
315                                                <TD><A style="text-decoration:none;COLOR:#999999;" href="#op">
316                                                        <span    onmouseout=desresaltar(this) onmouseover=resaltar(this)><?echo $TbMsg[12]?><span></A></TD>
317                                        </TR>
318                                </TABLE>
319                        </TD>           
320                       
321                        <TD onclick=eleccion(2)>&nbsp;
322                                <TABLE class=filtros>
323                                        <TR>
324                                                <? // Resaltar ?>
325                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/reiniciar.gif"></A>&nbsp;</TD>
326                                                <TD><A style="text-decoration:none;COLOR:#999999;" href="#op">
327                                                                <span    onmouseout=desresaltar(this) onmouseover=resaltar(this)><?echo $TbMsg[13]?><span></A></TD>
328                                        </TR>
329                                </TABLE>
330                        </TD>                           
331
332                        <TD onclick=eleccion(3)>&nbsp;
333                                <TABLE class=filtros>
334                                        <TR>
335                                                <? // Parar ?>
336                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/acDetenida.gif"></A>&nbsp;</TD>
337                                                <TD><A style="text-decoration:none;COLOR:#999999;" href="#op">
338                                                                        <span    onmouseout=desresaltar(this) onmouseover=resaltar(this)><?echo $TbMsg[14]?><span></A></TD>
339                                               
340                                        </TR>
341                                </TABLE>
342                        </TD>   
343                       
344                        <TD onclick=eleccion(4)>&nbsp;
345                                <TABLE class=filtros>
346                                        <TR>
347                                                <? // Seguir ?>
348                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/acIniciada.gif"></A>&nbsp;</TD>
349                                                <TD>&nbsp;<A style="text-decoration:none;COLOR:#999999;" href="#op">
350                                                        <span onmouseout=desresaltar(this) onmouseover=resaltar(this)><?echo $TbMsg[15]?></span></A>&nbsp;</TD>
351                                        </TR>
352                                </TABLE>
353                        </TD>   
354                       
355                        <TD onclick=eleccion(5)>&nbsp;
356                                <TABLE class=filtros>
357                                        <TR>
358                                                <? // Seguir ?>
359                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/acExitosa.gif"></A>&nbsp;</TD>
360                                                <TD>&nbsp;<A style="text-decoration:none;COLOR:#999999;" href="#op">
361                                                        <span onmouseout=desresaltar(this) onmouseover=resaltar(this)><?echo $TbMsg[55]?></span></A>&nbsp;</TD>
362                                        </TR>
363                                </TABLE>
364                        </TD>
365                        <TD onclick=eleccion(6)>&nbsp;
366                                <TABLE class=filtros>
367                                        <TR>
368                                                <? // Seguir ?>
369                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/acFallida.gif"></A>&nbsp;</TD>
370                                                <TD>&nbsp;<A style="text-decoration:none;COLOR:#999999;" href="#op">
371                                                        <span onmouseout=desresaltar(this) onmouseover=resaltar(this)><?echo $TbMsg[56]?></span></A>&nbsp;</TD>
372                                        </TR>
373                                </TABLE>
374                        </TD>                   
375                </TR>
376        </TABLE>
377        <?
378        //      _________________________________________________________________________
379        //     
380        // Tabla de registros de acciones
381        //      _________________________________________________________________________
382        ?>     
383        <TABLE  border=0 class="tabla_listados" cellspacing=1 cellpadding=0 >
384        <TBODY id="tbAcciones">
385        <?
386                cabeceraAcciones();
387                listaAcciones($ambito,$idambito);
388
389        ?>
390        </TBODY>
391        </TABLE>
392        </DIV>         
393        <FORM name="facciones">
394                <INPUT type="hidden" name=acciones value="<? echo $acciones?>">
395                <INPUT type="hidden" name=localaccion value="">
396                <INPUT type="hidden" name="sesion" value="<? echo $sesion?>">           
397        </FORM>
398        <?
399                $flotante=new MenuContextual(); // Crea objeto MenuContextual
400                $XMLcontextual=ContextualXMLAcciones(); // Crea contextual de las acciones
401                echo $flotante->CreaMenuContextual($XMLcontextual);
402
403                $XMLcontextual=ContextualXMLNotificaciones(); // Crea contextual de las acciones
404                echo $flotante->CreaMenuContextual($XMLcontextual);
405        ?>
406</BODY>
407</HTML>
408<?
409/********************************************************************/
410//      Escribe la cabecera de los registros de acciones
411//      _________________________________________________________________________
412
413function cabeceraAcciones()
414{
415        global $TbMsg;
416       
417        $html="";
418        $html.='<TR height=20>';
419        $html.='<TH colspan=2>&nbsp;</TH>';     
420        $html.='<TH>&nbsp;R&nbsp;</TH>';               
421        $html.='<TH>&nbsp;'.$TbMsg[19].'&nbsp;</TH>';   
422        $html.='<TH>&nbsp;'.$TbMsg[20].'&nbsp;</TH>';
423        $html.='<TH>&nbsp;'.$TbMsg[21].'&nbsp;</TH>';
424        $html.='<TH>&nbsp;'.$TbMsg[22].'&nbsp;</TH>';
425        $html.='<TH>&nbsp;</TH>';
426        $html.='<TH>&nbsp;'.$TbMsg[23].'&nbsp;</TH>';
427        $html.='<TH>&nbsp;'.$TbMsg[57].'&nbsp;</TH>';
428        $html.='<TH>&nbsp;S&nbsp;</TH>';
429        $html.='<TH>&nbsp;%&nbsp;</TH>';                               
430        $html.='</TR>';
431        echo $html;
432}
433//      _________________________________________________________________________
434
435function listaAcciones($ambito,$idambito)
436{
437        global $cmd;
438        global $ClausulaWhere;
439        global $cadenaid;
440        global $cadenaip;
441        global $cadenamac;     
442        global $EJECUCION_COMANDO;     
443        global $EJECUCION_PROCEDIMIENTO;       
444        global $EJECUCION_TAREA;       
445        global $ACCION_PROGRAMADA;     
446        global $acciones;
447        global $sesion;
448        global $estado;
449       
450        $cadenaid="";
451        $cadenaip="";
452        $cadenamac="";
453        RecopilaIpesMacs($cmd,$ambito,$idambito); // Recopila Ipes del ámbito           
454        $cadenasesion="(SELECT DISTINCT sesion FROM acciones WHERE idordenador NOT IN (".$cadenaid."))";
455 
456        $cmd->texto="SELECT acciones.*, comandos.descripcion AS comando, acciones.parametros,
457                            comandos.visuparametros, ordenadores.nombreordenador,
458                            procedimientos.descripcion AS procedimiento,
459                            tareas.descripcion AS tarea, programaciones.sesion AS sesionprog
460                        FROM acciones
461                        INNER JOIN comandos ON comandos.idcomando=acciones.idcomando
462                        INNER JOIN ordenadores ON ordenadores.idordenador=acciones.idordenador
463                        LEFT OUTER JOIN procedimientos ON procedimientos.idprocedimiento=acciones.idprocedimiento
464                        LEFT OUTER JOIN tareas ON tareas.idtarea=acciones.idtarea
465                        LEFT OUTER JOIN programaciones ON programaciones.sesion=acciones.sesion";
466        if(!empty($sesion)) // Filtro por acción
467                $cmd->texto.=" WHERE acciones.sesion =".$sesion;
468        else
469                $cmd->texto.=" WHERE acciones.sesion NOT IN (".$cadenasesion.")";
470               
471        if($estado==$ACCION_PROGRAMADA)
472                $cmd->texto.=" AND (acciones.idprogramacion=0 AND programaciones.sesion>0)"; // Comando programado
473        else{
474                if(!empty($ClausulaWhere))
475                        $cmd->texto.=" AND (".$ClausulaWhere.")";
476        }       
477        $cmd->texto.=" ORDER BY acciones.idaccion DESC, acciones.sesion DESC";
478        $rs=new Recordset;
479        $rs->Comando=&$cmd;
480        if (!$rs->Abrir()) return; // Error al abrir recordset
481
482        $acciones="";   // Variable que recogerá las acciones que cumplan los criterios
483                        // con formato "ambito,idambito" concadenando con ";" a otro identificador
484                        // Esta variable se usara para las operaciones globales de Eliminar, etc...
485
486        // Recorre acciones
487        $html="";
488        while (!$rs->EOF){
489                switch($rs->campos["tipoaccion"]){
490                        case $EJECUCION_COMANDO:
491                                        $html.=listaComado($rs,$rs->campos["sesion"]);
492                                        break;
493                        case $EJECUCION_PROCEDIMIENTO:
494                                        $html.=listaProcedimiento($rs,$rs->campos["sesion"]);   
495                                        break;                                                 
496                        case $EJECUCION_TAREA:
497                                        $html.=listaTarea($rs,$rs->campos["sesion"]);   
498                                        break;                                 
499                }       
500        }
501        echo $html;
502}
503//      _________________________________________________________________________
504
505function listaTarea($rs,$sesion)
506{
507        global $acciones;
508       
509        $oA=new clsAccion; // Crea objeto acción para procesar comandos
510        iniAccion($rs,$oA);     
511        $html=recorreTarea($rs,$sesion,$oA);   
512        if(cumpleCriterios($oA)){
513                $acciones.=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Concadena identificador
514                $html=cabeceraSesion($oA).$html; // Escribe la cabecera del comando
515        }
516        else
517                $html=""; // No cumple con los criterios       
518        return($html);         
519}               
520//      _________________________________________________________________________
521
522function recorreTarea($rs,$sesion,$oA)
523{
524        $html="";
525        do{
526                $html.=listaProcedimiento($rs,$sesion,$rs->campos["idtarea"],$oA);
527        }while(!$rs->EOF
528                        && $rs->campos["sesion"]==$sesion);
529        return($html); 
530}
531//      _________________________________________________________________________
532
533function listaProcedimiento($rs,$sesion,$idtarea=0,$oA=null)
534{
535        global $acciones;
536       
537        if($oA!=null){ // Si la función es invocada por una tarea ...
538                $html=recorreProcedimiento($rs,$sesion,$idtarea,$oA);
539        }
540        else{
541                $oA=new clsAccion; // Crea objeto acción para procesar comandos
542                iniAccion($rs,$oA);     
543                $html=recorreProcedimiento($rs,$sesion,$idtarea,$oA);   
544                if(cumpleCriterios($oA)){
545                        $acciones.=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Concadena identificador
546                        if($rs->campos["sesion"]!=$sesion
547                                || $rs->campos["idtarea"]!=$idtarea
548                                || $rs->EOF)
549                                $html=cabeceraSesion($oA).$html; // Escribe la cabecera del procedimiento
550                }
551                else
552                        $html=""; // No cumple con los criterios                       
553        }
554        return($html);         
555}               
556//      _________________________________________________________________________
557
558function recorreProcedimiento($rs,$sesion,$idtarea,$oA)
559{
560        $html="";
561        do{
562                $html.=listaComado($rs,$sesion,$idtarea,$rs->campos["idprocedimiento"],$oA);
563        }while(!$rs->EOF
564                        && $rs->campos["sesion"]==$sesion
565                        && $rs->campos["idtarea"]==$idtarea);
566        return($html); 
567}
568//      _________________________________________________________________________
569
570function listaComado($rs,$sesion,$idtarea=0,$idprocedimiento=0,$oA=null)
571{
572        global $acciones;
573        global $visupro;
574       
575        if($oA!=null){ // Si la función es invocada por un procedimiento...
576                $html=recorreComando($rs,$sesion,$idtarea,$idprocedimiento,$oA);
577        }
578        else{
579                $oA=new clsAccion; // Crea objeto acción para procesar comandos
580                iniAccion($rs,$oA);     
581                $html=recorreComando($rs,$sesion,$idtarea,$idprocedimiento,$oA);
582       
583                $acciones.=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Concadena identificador
584                if($rs->campos["sesion"]!=$sesion
585                        || $rs->campos["idtarea"]!=$idtarea
586                        || $rs->campos["idprocedimiento"]!=$idprocedimiento
587                        || $rs->EOF)
588                        if($oA->linot>0)                               
589                                $html=cabeceraSesion($oA).$html; // Escribe la cabecera del comando
590        }
591        return($html);
592}
593//      _________________________________________________________________________
594
595function recorreComando($rs,$sesion,$idtarea,$idprocedimiento,$oA)
596{
597        $html="";
598        do{
599                $html.=listaNotificacion($rs,$sesion,$idtarea,$idprocedimiento,$rs->campos["idcomando"],$oA);
600        }while(!$rs->EOF
601                        && $rs->campos["sesion"]==$sesion
602                        && $rs->campos["idtarea"]==$idtarea
603                        && $rs->campos["idprocedimiento"]==$idprocedimiento);
604        return($html); 
605}
606//      _________________________________________________________________________
607//     
608//      Recorre todas las notificaciones de un mismo comando registrando
609//  los datos que servirán para resumen de la Acción
610//      _________________________________________________________________________
611
612function listaNotificacion($rs,$sesion,$idtarea,$idprocedimiento,$idcomando,$oA)
613{       
614        global $ACCION_EXITOSA;
615        global $ACCION_FALLIDA;
616        global $ACCION_SINRESULTADO;
617
618        global $ACCION_DETENIDA;
619        global $ACCION_INICIADA;
620        global $ACCION_FINALIZADA;
621                       
622        global $EJECUCION_TAREA;
623        global $visuprm;
624        global $visucmd;
625        global $visupro;
626
627        $html="";
628       
629        if($visupro==1)
630                $html.=cambiaAmbito($rs,$oA); // Escribe cambio de ámbito       
631               
632        if($visuprm==1)
633                $html.=escribeParametros($rs->campos["comando"],$rs->campos["parametros"],$rs->campos["visuparametros"],$oA);
634       
635       
636
637        do{
638                if(cumpleCriteriosNot($rs,$oA)){
639                        if($visucmd==1){
640                                $html.=escribeNotificacion($rs,$oA);
641                                $oA->linot++; // Contador de lineas de notificaciones escritas cumpliendo criterios
642                        }                               
643                }
644                /* Fechas y horas */
645                $fechahorareg=strtotime($rs->campos["fechahorareg"]);
646                if($fechahorareg>0)
647                        if($oA->fechahorareg>$fechahorareg) $oA->fechahorareg=$fechahorareg;
648                $fechahorafin=strtotime($rs->campos["fechahorafin"]);
649                if($fechahorafin>0)
650                        if($oA->fechahorafin<$fechahorafin) $oA->fechahorafin=$fechahorafin;
651
652                $oA->notif++; // Contador de notificaciones en el comando
653                switch($rs->campos["estado"]){
654                        case $ACCION_INICIADA:
655                                $oA->notini++; // Incrementa contador de comandos con estado de finalizado
656                                break;
657                        case $ACCION_DETENIDA:
658                                $oA->notdet++; // Incrementa contador de comandos con estado de finalizado
659                                break;
660                        case $ACCION_FINALIZADA:
661                                $oA->noter++; // Incrementa contador de comandos con estado de finalizado
662                                break;                         
663                }
664                /* Cuestión resultados */
665                /* Si existe al menos una notificación de error, la acción tiene ya resultado de error */
666                if($rs->campos["resultado"]==$ACCION_FALLIDA){
667                        $oA->resultado=$ACCION_FALLIDA;
668                }
669                /* Si existe aún alguna notificación pendiente, la acción no tiene resultado global */
670                if($rs->campos["resultado"]==$ACCION_SINRESULTADO){
671                        if($oA->resultado==$ACCION_EXITOSA)             
672                                $oA->resultado=$ACCION_SINRESULTADO;
673                }               
674                $rs->Siguiente();       
675               
676        }while(!$rs->EOF
677                        && $rs->campos["sesion"]==$sesion
678                        && $rs->campos["idtarea"]==$idtarea
679                        && $rs->campos["idprocedimiento"]==$idprocedimiento
680                        && $rs->campos["idcomando"]==$idcomando);
681       
682        if($oA->notif>0)
683                $oA->porcen=floor($oA->noter*100/$oA->notif); // Calcula porcentaje de finalización
684
685        if($oA->notif==$oA->noter)
686                $oA->estado=$ACCION_FINALIZADA;  // Todas las acciones finalizadas
687        else{
688                if($oA->notif==$oA->notdet)
689                        $oA->estado=$ACCION_DETENIDA;  // Todas las acciones detenidas
690                else
691                        $oA->estado=$ACCION_INICIADA;
692        }
693        if(cumpleCriterios($oA)){
694                if($rs->campos["sesion"]!=$sesion && !$rs->EOF ) // Separación entre sesiones distintas
695                        $html.='<TR id="'.$oA->sesion.'" value="A"><TD colspan=12 style="BACKGROUND-COLOR:white;BORDER-BOTTOM:#999999 1px solid;">&nbsp;</TD></TR>';
696        }
697        return($html);
698}
699//      _________________________________________________________________________
700
701function escribeNotificacion($rs,$oA)
702{
703                global $ACCION_EXITOSA;
704                global $ACCION_FALLIDA;
705                global $ACCION_SINRESULTADO;
706
707                global $ACCION_DETENIDA;
708                global $ACCION_INICIADA;
709                global $ACCION_FINALIZADA;
710               
711                global $TbMsg;
712                global $visupro;
713                global $visuprm;
714               
715                $html="";       
716                $html.='<TR id="'.$oA->sesion.'" value="D">';
717                if($visupro==0 )
718                        $html.='<TD align=right colspan=2>'.$rs->campos["comando"].'&nbsp;</TD>';
719                else
720                        $html.='<TD align=right colspan=2>&nbsp;</TD>';
721                       
722                /* Resultado */
723                switch($rs->campos["resultado"]){
724                        case $ACCION_EXITOSA:
725                                $html.='<TD align=center><IMG value="'.$ACCION_EXITOSA.'" src="../images/iconos/acExitosa.gif" width=16 height=16></TD>';
726                                break;
727                        case $ACCION_FALLIDA:
728                                $html.='<TD align=center><IMG value="'.$ACCION_FALLIDA.'" src="../images/iconos/acFallida.gif" width=16 height=16></TD>';
729                                break;
730                        case $ACCION_SINRESULTADO:
731                                $html.='<TD align=center><IMG value="'.$ACCION_SINRESULTADO.'" src="../images/iconos/nada.gif" width=16 height=16></TD>';
732                                break;
733                }       
734                if($oA->swcp){ // Comando programado
735                        $html.='<TD align=center>&nbsp;</TD>';
736                        $html.='<TD align=center>&nbsp;</TD>';
737                        $html.='<TD align=center>&nbsp;</TD>';
738                        $html.='<TD align=center>&nbsp;</TD>';
739                }
740                else{
741                        /* Fechas y horas */
742                        list($fecha,$hora)=split(" ",substr($rs->campos["fechahorafin"],0));
743                        if ($fecha=="0000-00-00") $hora="";
744                        $html.='<TD align=center>&nbsp;'.InvFecha($fecha).'&nbsp;</TD>';
745                        $html.='<TD align=center>&nbsp;'.$hora.'&nbsp;</TD>';
746                               
747                        list($fecha,$hora)=split(" ",substr($rs->campos["fechahorareg"],0));
748                        if ($fecha=="0000-00-00") $hora="";
749                        $html.='<TD align=center>&nbsp;'.InvFecha($fecha).'&nbsp;</TD>';
750                        $html.='<TD align=center>&nbsp;'.$hora.'&nbsp;</TD>';
751                }       
752                       
753                /* Ámbito de aplicación */
754                $urlimg='../images/iconos/ordenador.gif';
755                $accion=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",".$rs->campos["idaccion"].";"; // Tripla clave 
756                $oncontxt="document.facciones.localaccion.value='".$accion."';";
757                $oncontxt.="menu_contextual(null,'flo_notificaciones');";
758               
759                $html.='<TD id="'.$rs->campos["idaccion"].'" align=center><A href="#cmd"><IMG border=0 src="'.$urlimg.'"
760                                oncontextmenu="'.$oncontxt.'" ></A></TD>';
761                $html.='<TD align=left>&nbsp;'.$rs->campos["nombreordenador"].'&nbsp;</TD>';   
762               
763                /* Descripción de la notificación (Descripción del error si se ha producido alguno) */ 
764                $html.='<TD>&nbsp;'.$rs->campos["descrinotificacion"].'&nbsp;</TD>';
765                       
766                /* Estado */
767                if($oA->swcp) // Comando programado
768                                $html.='<TD align=center><IMG value="'.$ACCION_DETENIDA.'"
769                                src="../images/iconos/reloj.gif" width=16 height=16 style="cursor:pointer"
770                                onclick="programacion('.$rs->campos["idtipoaccion"].','.$rs->campos["sesion"].',\''.$rs->campos["comando"].'\')"></TD>';
771                else{
772                        switch($rs->campos["estado"]){
773                                case $ACCION_DETENIDA:
774                                        $html.='<TD align=center><IMG value="'.$ACCION_DETENIDA.'" src="../images/iconos/acDetenida.gif" width=16 height=16></TD>';
775                                        break;
776                                case $ACCION_INICIADA:
777                                        $html.='<TD align=center><IMG value="'.$ACCION_INICIADA.'" src="../images/iconos/acIniciada.gif" width=16 height=16></TD>';
778                                        break;
779                                case $ACCION_FINALIZADA:
780                                        $html.='<TD align=center><IMG value="'.$ACCION_FINALIZADA.'" src="../images/iconos/acFinalizada.gif" width=16 height=16></TD>';
781                                        break;
782                        }
783                }       
784
785                /* Porcentaje */
786                $html.='<TD align=center>&nbsp;</TD>';         
787                $html.='</TR>';
788                return($html);
789}       
790//      _________________________________________________________________________
791//     
792//      Inicializa la clase acción
793//
794//      Parámetros:
795//              oA: Objeto acción a inicializar
796//      _________________________________________________________________________
797
798function iniAccion($rs,$oA)
799{
800        global $ACCION_EXITOSA;
801        global $ACCION_DETENIDA;
802       
803        $oA->ambito=$rs->campos["ambito"];
804        $oA->idambito=$rs->campos["idambito"];
805        $oA->tipoaccion=$rs->campos["tipoaccion"];
806        $oA->idtipoaccion=$rs->campos["idtipoaccion"];
807        $oA->descriaccion=$rs->campos["descriaccion"];
808        $oA->sesion=$rs->campos["sesion"];
809        $oA->fechahorareg=strtotime($rs->campos["fechahorareg"]);
810        $oA->fechahorafin=0;
811        $oA->estado=$ACCION_DETENIDA;
812        $oA->resultado=$ACCION_EXITOSA;
813        $oA->notif=$oA->noter=$oA->notini=$oA->notdet=$oA->linot=$oA->porcen=0;
814        if(empty($rs->campos["idprogramacion"]) && !empty($rs->campos["sesionprog"])) // switch de Comando programado
815                $oA->swcp=true;
816        else
817                $oA->swcp=false;
818}
819//      _________________________________________________________________________
820
821function cabeceraSesion($oA)
822{
823        global $EJECUCION_COMANDO;
824        global $EJECUCION_PROCEDIMIENTO;
825        global $EJECUCION_TAREA;
826
827        $html="";               
828        $html.='<TR id="'.$oA->sesion.'" value="C">';
829       
830        $accion=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Tripla clave   
831        $oncontxt="document.facciones.sesion.value='".$oA->sesion."';";
832        $oncontxt.="document.facciones.localaccion.value='".$accion."';menu_contextual(null,'flo_acciones');";
833        switch($oA->tipoaccion){
834                case $EJECUCION_COMANDO:
835                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG style="cursor:pointer" border=0
836                                        oncontextmenu="'.$oncontxt.'"
837                                        src="../images/iconos/comandos.gif"></TD>';
838                        break;
839                case $EJECUCION_PROCEDIMIENTO:
840                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG style="cursor:pointer" border=0
841                                        oncontextmenu="'.$oncontxt.'"
842                                        src="../images/iconos/procedimiento.gif"></TD>';
843                        break;                         
844                case $EJECUCION_TAREA:
845                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG style="cursor:pointer" border=0 
846                                        oncontextmenu="'.$oncontxt.'"
847                                        src="../images/iconos/tareas.gif"></TD>';
848                        break;                                 
849        }
850        /* Cabeceras */
851        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=left><b>'.$oA->descriaccion.'</b></TD>';
852        $html.=escribeResumen($oA);
853        $html.='</TR>';
854
855        return($html);
856}
857//      _________________________________________________________________________
858
859function escribeResumen($oA)
860{
861                global $cmd;
862                global $TbMsg;
863                               
864                global $ACCION_EXITOSA;
865                global $ACCION_FALLIDA;
866                global $ACCION_SINRESULTADO;
867                       
868                global $EJECUCION_TAREA;
869                       
870                $html="";               
871               
872                if($oA->swcp){ // Comando programado
873                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
874                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
875                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
876                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
877                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
878                        /* Ámbito de aplicación */
879                        tomaAmbito($oA->ambito,$urlimg,$textambito);
880                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG src="'.$urlimg.'"></TD>';
881                        tomaDescriAmbito($cmd,$oA->ambito,$oA->idambito,$textambito);
882                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;'.$textambito.'&nbsp;</TD>';     
883                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
884                       
885                                $html.='<TH align=center><IMG value="'.$ACCION_DETENIDA.'"
886                                src="../images/iconos/reloj.gif" width=16 height=16 style="cursor:pointer"
887                                onclick="programacion('.$oA->idtipoaccion.','.$oA->sesion.',\''.$oA->descriaccion.'\')"></TH>';
888                               
889                       
890                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
891                        return($html);
892                }
893               
894                /* Resultado */
895                switch($oA->resultado){
896                        case $ACCION_EXITOSA:
897                                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG value="'.$ACCION_EXITOSA.'" src="../images/iconos/acExitosa.gif" width=16 height=16></TD>';
898                                break;
899                        case $ACCION_FALLIDA:
900                                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG value="'.$ACCION_FALLIDA.'" src="../images/iconos/acFallida.gif" width=16 height=16></TD>';
901                                break;
902                        case $ACCION_SINRESULTADO:
903                                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG value="'.$ACCION_SINRESULTADO.'" src="../images/iconos/nada.gif" width=16 height=16></TD>';
904                }       
905                /* Fechas y horas */
906                if($oA->porcen==100){ // Si está acabada la acción
907                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%d-%m-%Y",$oA->fechahorafin).'&nbsp;</TD>';
908                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%H:%M:%S",$oA->fechahorafin).'&nbsp;</TD>';
909                }
910                else
911                {
912                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
913                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
914                }
915
916                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%d-%m-%Y",$oA->fechahorareg).'&nbsp;</TD>';
917                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%H:%M:%S",$oA->fechahorareg).'&nbsp;</TD>';
918
919                if($oA->tipoaccion==$EJECUCION_TAREA){
920                        $html.='<TD  style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;</TD>';
921                        $html.='<TD  style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;</TD>';
922                }
923                else{
924                        /* Ámbito de aplicación */
925                        tomaAmbito($oA->ambito,$urlimg,$textambito);
926                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG src="'.$urlimg.'"></TD>';
927                        tomaDescriAmbito($cmd,$oA->ambito,$oA->idambito,$textambito);
928                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;'.$textambito.'&nbsp;</TD>';     
929                }       
930               
931                /* Descripción de la notificación (Descripción del error si se ha producido alguno) */ 
932                $html.='<TD style="BACKGROUND-COLOR: #b5daad" >&nbsp;'.$rs->campos["descrinotificacion"].'&nbsp;</TD>';
933
934                /* Estado */
935                $html.='<TD style="BACKGROUND-COLOR: #b5daad"  align=center>&nbsp;</TD>';
936               
937                /* Porcentaje */
938                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>'.$oA->porcen.'%</TD>';
939               
940       
941                return($html);
942}
943//      _________________________________________________________________________
944
945function cambiaAmbito($rs,$oA)
946{
947        global $cmd;
948        global $TbMsg;
949       
950        $bgcolor="#f6c8f5";
951        $html="";
952        $html.='<TR id="'.$oA->sesion.'" value="A">';
953        $procedimiento=TomaDato($cmd,0,'procedimientos',$rs->campos["idprocedimiento"],'idprocedimiento','descripcion');
954        $html.='<TD colspan=2 align="right" style="BACKGROUND-COLOR:'.$bgcolor.'">'.$rs->campos["comando"].'&nbsp;</TD>';
955        $html.='<TD style="BACKGROUND-COLOR:'.$bgcolor.'"><IMG style="cursor:pointer" src="../images/iconos/nada.gif">&nbsp;</TD>';
956        $html.='<TD colspan=4 style="BACKGROUND-COLOR:'.$bgcolor.'" align=right>'.$procedimiento.'&nbsp;</TD>';
957       
958        /* Ámbito de aplicación */
959        tomaAmbito($rs->campos["ambito"],$urlimg,$textambito);
960        $html.='<TD style="BACKGROUND-COLOR:'.$bgcolor.'" align=center><IMG src="'.$urlimg.'"></TD>';
961        tomaDescriAmbito($cmd,$rs->campos["ambito"],$rs->campos["idambito"],$textambito);
962        $html.='<TD style="BACKGROUND-COLOR:'.$bgcolor.'" align=left>&nbsp;'.$textambito.'&nbsp;</TD>';
963        $html.='<TD colspan=3 style="BACKGROUND-COLOR:'.$bgcolor.'" align=center>&nbsp;</TD>';
964        $html.='</TR>';
965        return($html);
966}
967//      _________________________________________________________________________
968//
969//      Comprueba si se cumplen los criterios para visualizar la acción
970//      _________________________________________________________________________
971
972function cumpleCriterios($oA)
973{
974        global $porcendesde;
975        global $porcenhasta;
976        global $estado;
977        global $resultado;
978        global $ACCION_PROGRAMADA;
979
980        if($estado==$ACCION_PROGRAMADA){       
981                if(!$oA->swcp)
982                        return(false); // Comandos programados
983                else
984                        return(true);
985        }
986        if($oA->swcp){
987                if($estado!=$ACCION_PROGRAMADA && $estado>0)   
988                        return(false); // Comandos programados
989                else
990                        return(true);
991        }
992
993        // Cuestion estados
994        if(!empty($estado))
995                if($oA->estado!=$estado) return(false);
996
997        if(!empty($resultado))         
998                if($oA->resultado!=$resultado) return(false);
999       
1000        if($oA->porcen<$porcendesde || $oA->porcen>$porcenhasta) return(false);
1001        return(true);
1002}
1003//      _________________________________________________________________________
1004//
1005//      Comprueba si se cumplen los criterios para visualizar la notificación
1006//      _________________________________________________________________________
1007function cumpleCriteriosNot($rs,$oA)
1008{
1009        global $porcendesde;
1010        global $porcenhasta;
1011        global $estado;
1012        global $resultado;
1013        global $ACCION_PROGRAMADA;
1014
1015        if($estado==$ACCION_PROGRAMADA){       
1016                if(!$oA->swcp)
1017                        return(false); // Comandos programados
1018                else
1019                        return(true);
1020        }
1021        if($oA->swcp){
1022                if($estado!=$ACCION_PROGRAMADA && $estado>0)   
1023                        return(false); // Comandos programados
1024                else
1025                        return(true);
1026        }
1027        // Cuestion estados
1028        if(!empty($estado))
1029                if($rs->campos["estado"]!=$estado) return(false);
1030
1031        if(!empty($resultado))         
1032                if($rs->campos["resultado"]!=$resultado) return(false);
1033
1034        return(true);
1035}
1036//      _________________________________________________________________________
1037//
1038//      Clase para procesar las acciones
1039//      _________________________________________________________________________
1040
1041class clsAccion
1042{
1043        var $ambito;
1044        var $idambito;
1045        var $tipoaccion;
1046        var $idtipoaccion;     
1047        var $descriaccion;
1048        var $sesion;
1049        var $fechahorafin;
1050        var $fechahorareg;
1051        var $estado;
1052        var $resultado;
1053        var $porcen;
1054        var $notif;
1055        var $noter;
1056        var $notdet;
1057        var $notini;
1058        var $linot;
1059        var $swcp;
1060        function clsAccion(){  // Constructor
1061
1062        }
1063}
1064//________________________________________________________________________________________________________
1065
1066function escribeParametros($comando,$parametros,$visuparametros,$oA)
1067{       
1068        global $cmd;
1069        global $visupro;
1070        global $visupro;
1071        global $visucmd;
1072
1073        $html="";
1074        $tbParametrosValor=array();
1075        ParametrosValor($cmd,$parametros,$tbParametrosValor); // Toma valores de cada parámetro
1076        $vprm=split(";",$visuparametros);
1077
1078        if($visupro==1 || ($visupro=0 && $visucmd==0)) $comando="&nbsp;"; // No se muestra el nombre del comando
1079        for($i=0;$i<sizeof($vprm);$i++){
1080                $nemo=$vprm[$i]; // Para cada parámetro visualizable ...
1081                if(isset($tbParametrosValor[$nemo])){
1082                        for($j=0;$j<sizeof($tbParametrosValor[$nemo])-1;$j++){
1083                                $descripcion=$tbParametrosValor[$nemo]["descripcion"];
1084                                if(sizeof($tbParametrosValor[$nemo])>2)
1085                                        $valor=$tbParametrosValor[$nemo][$j]["valor"];
1086                                else
1087                                        $valor=$tbParametrosValor[$nemo]["valor"];
1088                                $html.=escribiendoParametros($comando,$descripcion,$valor,$oA);
1089                        }       
1090                }       
1091        }
1092        if(empty($visuparametros)){ // Sin parametros
1093                $bgcolor="#cedcec";
1094                $html.='<TR id="'.$oA->sesion.'" value="A">';
1095                $html.='<TD align=right style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=2>'.$comando.'</TD>';
1096                $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';">&nbsp;</TD>';
1097                $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=9>&nbsp;</TD>';
1098                $html.='</TR>';
1099        }
1100        return($html);
1101}
1102//________________________________________________________________________________________________________
1103
1104function escribiendoParametros($comando,$descripcion,$valor,$oA)
1105{
1106        $sw=true;
1107        $html="";
1108       
1109        $bgcolor="#cedcec";
1110        $html.='<TR id="'.$oA->sesion.'" value="A">';
1111        if($sw){
1112                $html.='<TD align=right style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=2>'.$comando.'</TD>';
1113                $sw=false;
1114        }
1115        else
1116                $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=2>&nbsp;</TD>';
1117        $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';">&nbsp;</TD>';
1118        $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=4><b>'.$descripcion.'</b>:
1119        '.$valor.'</TD>';
1120        $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=5 >&nbsp;</TD>';
1121        $html.='</TR>';
1122        return($html); 
1123}
1124//________________________________________________________________________________________________________
1125
1126function escribeCheck()
1127{
1128        echo'
1129        <TABLE class="tabla_busquedas" align=center border=0 cellPadding=0 cellSpacing=0>
1130                <TR>
1131                TH height=15 align="center" colspan=14><? echo $TbMsg[18]?></TH>
1132                </TR>
1133                <TR>
1134                        <TD align=right><? echo $TbMsg[30]?></TD>
1135                        <TD align=center><INPUT type="checkbox" checked></TD>
1136                        <TD width="20" align=center>&nbsp;</TD>
1137                </TR>
1138        </TABLE>';     
1139}
1140//________________________________________________________________________________________________________
1141
1142function ContextualXMLAcciones()
1143{
1144        global $TbMsg;
1145        global $sesion;
1146
1147        $layerXML='<MENUCONTEXTUAL';
1148        $layerXML.=' idctx="flo_acciones"';
1149        $layerXML.=' maxanchu=140';
1150        $layerXML.=' swimg=1';
1151        $layerXML.=' clase="menu_contextual"';
1152        $layerXML.='>';
1153       
1154        $layerXML.='<ITEM';
1155        if(empty($sesion)){
1156                $layerXML.=' alpulsar="filtroAccion(1)"';
1157                $layerXML.=' imgitem="../images/iconos/filtroaccion.gif"';
1158                $layerXML.=' textoitem='.$TbMsg[41];
1159                }
1160        else{
1161                $layerXML.=' alpulsar="filtroAccion(0)"';
1162                $layerXML.=' imgitem="../images/iconos/filtro_off.gif"';
1163                $layerXML.=' textoitem='.$TbMsg[43];           
1164        }       
1165               
1166        $layerXML.=' textoitem='.$TbMsg[41];
1167        $layerXML.='></ITEM>';
1168       
1169        $layerXML.='<SEPARADOR>';
1170        $layerXML.='</SEPARADOR>';
1171        $layerXML.=ContextualXMLComun();
1172        return($layerXML);     
1173}       
1174//________________________________________________________________________________________________________
1175
1176function ContextualXMLNotificaciones()
1177{       
1178
1179        $layerXML='<MENUCONTEXTUAL';
1180        $layerXML.=' idctx="flo_notificaciones"';
1181        $layerXML.=' maxanchu=140';
1182        $layerXML.=' swimg=1';
1183        $layerXML.=' clase="menu_contextual"';
1184        $layerXML.='>';
1185       
1186        $layerXML.=ContextualXMLComun();
1187        return($layerXML);     
1188}       
1189//________________________________________________________________________________________________________
1190
1191function ContextualXMLComun()
1192{       
1193        global $TbMsg;
1194        global $idcmdtskwrk;
1195        global $codtipoaccion;
1196        global $accionid;
1197        global $EJECUCION_TAREA;
1198        global $sesion;
1199       
1200        $layerXML="";
1201       
1202        $layerXML.='<ITEM';
1203        $layerXML.=' alpulsar="eleccion(1,document.facciones.localaccion)"';
1204        $layerXML.=' imgitem="../images/iconos/eliminar.gif"';
1205        $layerXML.=' textoitem='.$TbMsg[46];
1206        $layerXML.='></ITEM>';
1207
1208        $layerXML.='<ITEM';
1209        $layerXML.=' alpulsar="eleccion(2,document.facciones.localaccion)"';
1210        $layerXML.=' imgitem="../images/iconos/reiniciar.gif"';
1211        $layerXML.=' textoitem='.$TbMsg[45];
1212        $layerXML.='></ITEM>';
1213       
1214        $layerXML.='<SEPARADOR>';
1215        $layerXML.='</SEPARADOR>';
1216       
1217        $layerXML.='<ITEM';
1218        $layerXML.=' alpulsar="eleccion(3,document.facciones.localaccion)"';
1219        $layerXML.=' imgitem="../images/iconos/acDetenida.gif"';
1220        $layerXML.=' textoitem='.$TbMsg[14];
1221        $layerXML.='></ITEM>';
1222       
1223        $layerXML.='<ITEM';
1224        $layerXML.=' alpulsar="eleccion(4,document.facciones.localaccion)"';
1225        $layerXML.=' imgitem="../images/iconos/acIniciada.gif"';
1226        $layerXML.=' textoitem='.$TbMsg[15];
1227        $layerXML.='></ITEM>'; 
1228
1229        $layerXML.='<SEPARADOR>';
1230        $layerXML.='</SEPARADOR>';     
1231       
1232        $layerXML.='<ITEM';
1233        $layerXML.=' alpulsar="eleccion(5,document.facciones.localaccion)"';
1234        $layerXML.=' imgitem="../images/iconos/acExitosa.gif"';
1235        $layerXML.=' textoitem="'.$TbMsg[55].'"';
1236        $layerXML.='></ITEM>';
1237
1238        $layerXML.='<ITEM';
1239        $layerXML.=' alpulsar="eleccion(6,document.facciones.localaccion)"';
1240        $layerXML.=' imgitem="../images/iconos/acFallida.gif"';
1241        $layerXML.=' textoitem="'.$TbMsg[56].'"';
1242        $layerXML.='></ITEM>'; 
1243        $layerXML.='</MENUCONTEXTUAL>';
1244        return($layerXML);
1245}
1246?>
1247
Note: See TracBrowser for help on using the repository browser.