source: admin/WebConsole/principal/colasacciones.php

qndtest
Last change on this file was 79a6616, checked in by Ramón M. Gómez <ramongomez@…>, 5 years ago

#834: Fix some HTML tags, remove trailing tabs and convert newlines to Unix format.

  • Property mode set to 100644
File size: 45.2 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        $urlimg="";
52        $textambito="";
53
54        if (isset($_GET["ambito"]))     $ambito=$_GET["ambito"]; 
55        if (isset($_GET["idambito"])) $idambito=$_GET["idambito"]; 
56        if (isset($_GET["nombreambito"])) $nombreambito=$_GET["nombreambito"]; 
57
58        if (isset($_POST["ambito"]))    $ambito=$_POST["ambito"]; 
59        if (isset($_POST["idambito"])) $idambito=$_POST["idambito"]; 
60        if (isset($_POST["nombreambito"])) $nombreambito=$_POST["nombreambito"]; 
61
62        if (isset($_POST["tipoaccion"])) $tipoaccion=$_POST["tipoaccion"]; 
63        if (isset($_POST["estado"])) $estado=$_POST["estado"]; 
64        if (isset($_POST["resultado"])) $resultado=$_POST["resultado"]; 
65
66        if (isset($_POST["fechainicio"])) $fechainicio=$_POST["fechainicio"]; 
67        if (isset($_POST["fechafin"])) $fechafin=$_POST["fechafin"]; 
68        if (isset($_POST["horainicio"])) $horainicio=$_POST["horainicio"]; 
69        if (isset($_POST["horafin"])) $horafin=$_POST["horafin"]; 
70
71        if (isset($_POST["swPOST"])) $swPOST=$_POST["swPOST"]; 
72        if (isset($_POST["visuprm"])) $visuprm=$_POST["visuprm"]; 
73        if (isset($_POST["visupro"])) $visupro=$_POST["visupro"]; 
74        if (isset($_POST["visucmd"])) $visucmd=$_POST["visucmd"]; 
75
76        if (isset($_POST["sesion"])) $sesion=$_POST["sesion"]; 
77
78        if (function_exists('date_default_timezone_set')) {
79                date_default_timezone_set('UTC');
80        }
81        if(empty($swPOST)){ // Valores por defecto
82                $wfechainicio=mktime(0, 0, 0, date("m")  , date("d")-180, date("Y")); // Acciones desde tres días antes
83                $wfechafin=mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"));
84                $fechainicio=date("d/m/Y",$wfechainicio);
85                $fechafin=date("d/m/Y ",$wfechafin);
86                $estado=0;
87                $resultado=0;
88                $tipoaccion=0;
89                $visuprm=0;
90                $visupro=0;
91                $visucmd=1;
92        }
93
94        if (isset($_POST["porcendesde"])) $porcendesde=$_POST["porcendesde"]; 
95        if (isset($_POST["porcenhasta"])) $porcenhasta=$_POST["porcenhasta"]; 
96        if($porcendesde=="") $porcendesde=0;
97        if($porcenhasta=="") $porcenhasta=100;
98       
99        //________________________________________________________________________________________________________
100
101        $cmd=CreaComando($cadenaconexion);
102        if (!$cmd)
103                Header('Location: '.$pagerror.'?herror=2'); // Error de conexión con servidor B.D.
104
105        $tbParametros=CreaTablaParametros($cmd); // Crea tabla en mezmmoria para acceder a detalles de comandos
106
107        //________________________________________________________________________________________________________
108        //
109        // Clausula WHERE ( construcción )
110        //________________________________________________________________________________________________________
111       
112        $ClausulaWhere="";
113
114        // Cuestion de fechas
115        $WhereFechaInicio="";
116        $WhereFechaFin="";
117        $WhereFechaReg="";
118        if($fechainicio!="")
119                $WhereFechaInicio="acciones.fechahorareg>='".InvFecha($fechainicio).' ' .$horainicio."'";
120        if($fechafin!="")
121                $WhereFechaFin.=" acciones.fechahorareg<='".InvFecha($fechafin).' ' .$horafin."'";
122        if($WhereFechaInicio!=""){
123                if($WhereFechaFin!="")
124                        $WhereFechaReg=" (".$WhereFechaInicio." AND ".$WhereFechaFin.") ";
125                else
126                        $WhereFechaReg=" (".$WhereFechaInicio.") ";
127        }
128        else{
129                        if($WhereFechaFin!="")
130                                $WhereFechaReg=" (".$WhereFechaFin.") ";
131        }
132        $ClausulaWhere.=$WhereFechaReg;
133       
134        // Cuestion tipos de acciones
135        if(!empty($tipoaccion)) $ClausulaWhere.=" AND acciones.tipoaccion=".$tipoaccion;
136
137        // Cuestion identificador del Centro que ha ejecutado la acción
138        $WhereCentroAccion="";
139        $WhereCentroAccion='acciones.idcentro='.$idcentro;
140        $ClausulaWhere.=" AND (".$WhereCentroAccion.")";
141        //________________________________________________________________________________________________________
142        ?>
143        <HTML>
144        <HEAD>
145                <TITLE>Administración web de aulas</TITLE>
146                <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
147                <LINK rel="stylesheet" type="text/css" href="../estilos.css">
148                <SCRIPT language="javascript" src="../clases/jscripts/MenuContextual.js"></SCRIPT>
149                <SCRIPT language="javascript" src="../jscripts/constantes.js"></SCRIPT>
150                <SCRIPT language="javascript" src="../jscripts/comunes.js"></SCRIPT>
151                <SCRIPT language="javascript" src="../jscripts/colasacciones.js"></SCRIPT>
152                <SCRIPT language="javascript" src="../clases/jscripts/HttpLib.js"></SCRIPT>                             
153                <?php echo '<SCRIPT language="javascript" src="../idiomas/javascripts/'.$idioma.'/colasacciones_'.$idioma.'.js"></SCRIPT>'?>
154        </HEAD>
155        <BODY oncontextmenu="return false">
156        <?php
157        echo '<P align=center class=cabeceras><img src="../images/iconos/acciones.gif">&nbsp;'.$TbMsg[0].'&nbsp;</P>';
158
159        echo '<FORM name="fdatos" action="colasacciones.php" method="post">';
160                echo '<INPUT type="hidden" name="ambito" value="'.$ambito.'">';
161                echo '<INPUT type="hidden" name="idambito" value="'.$idambito.'">';
162                echo '<INPUT type="hidden" name="nombreambito" value="'.$nombreambito.'">';
163                echo '<INPUT type="hidden" name="swPOST" value="1">';
164                echo '<INPUT type="hidden" name="tiposacciones" value="'.$tiposacciones.'">';
165                echo '<INPUT type="hidden" name="estados" value="'.$estados.'">';
166                echo '<INPUT type="hidden" name="resultados" value="'.$resultados.'">';
167                echo '<INPUT type="hidden" name="resultados" value="'.$fechainicio.'">';
168                echo '<INPUT type="hidden" name="resultados" value="'.$fechafin.'">';
169                echo '<INPUT type="hidden" name="resultados" value="'.$horainicio.'">';
170                echo '<INPUT type="hidden" name="resultados" value="'.$horafin.'">';
171                echo '<INPUT type="hidden" name="resultados" value="'.$porcendesde.'">';
172                echo '<INPUT type="hidden" name="resultados" value="'.$porcenhasta.'">';
173                echo '<INPUT type="hidden" name="sesion" value="'.$sesion.'">';
174               
175
176        $HTMLCriterios=""; 
177        $HTMLCriterios.='<TABLE class=tabla_busquedas align=center border="0">'; // Filtro de búsquedas
178        $HTMLCriterios.='       <TR>';
179        $HTMLCriterios.='               <TD HEIGHT="30px" style="BORDER-BOTTOM:#5a86b5 1px solid;" colspan=2 align="center">';
180        $HTMLCriterios.='                       <SPAN style="FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
181                                                                                                        FONT-SIZE: 11px;COLOR:#5a86b5;FONT-WEIGHT: 700;">____ '.$TbMsg[1].'____</SPAN></TD></TR>';
182
183        $HTMLCriterios.='<TR>';
184        $HTMLCriterios.='       <TD>'; // Desplegables de tipo de acciones y estados
185        $HTMLCriterios.='               <TABLE class=tabla_standar align=center border="0">';
186        $HTMLCriterios.='                       <TR>';
187        $HTMLCriterios.='                               <TH align=center>&nbsp;'.$TbMsg[2].'&nbsp;</TH></TR>';
188
189        // Desplegable con los tipos de acciones
190        $parametros="0=".$TbMsg[61].chr(13);
191        $parametros.=$EJECUCION_COMANDO."=".$LITEJECUCION_COMANDO.chr(13);
192        $parametros.=$EJECUCION_PROCEDIMIENTO."=".$LITEJECUCION_PROCEDIMIENTO.chr(13);
193        $parametros.=$EJECUCION_TAREA."=".$LITEJECUCION_TAREA;
194        $HTMLCriterios.='                       <TR>';
195        $HTMLCriterios.='                               <TD>'.HTMLCTESELECT($parametros,"tipoaccion","estilodesple","",$tipoaccion,100).'</TD></TR>';
196               
197        // Desplegable con los distintos estados
198        $HTMLCriterios.='                       <TR>';
199        $HTMLCriterios.='                               <TH align=center>&nbsp;'.$TbMsg[4].'&nbsp;</TH></TR>';
200        $HTMLCriterios.=                        '<TR>';
201        $parametros="0=".$TbMsg[60].chr(13);   
202        $parametros.=$ACCION_INICIADA."=".$LITACCION_INICIADA.chr(13);
203        $parametros.=$ACCION_DETENIDA."=".$LITACCION_DETENIDA.chr(13);
204        $parametros.=$ACCION_FINALIZADA."=".$LITACCION_FINALIZADA.chr(13);;
205        $parametros.=$ACCION_PROGRAMADA."=".$LITACCION_PROGRAMADA;
206        $HTMLCriterios.='                               <TD colspan=3>'.HTMLCTESELECT($parametros,"estado","estilodesple","",$estado,100,"chgdespleestados").'</TD></TR>';
207        $HTMLCriterios.=                '</TABLE>';
208        $HTMLCriterios.='       </TD>'; // Fin Desplegables de tipo de acciones y estados
209       
210        $HTMLCriterios.='       <TD valign=top>'; // Desplegables de resultados y porcentajes
211        // Desplegable con los distintos resultados
212        $HTMLCriterios.='               <TABLE class=tabla_standar align=center border="0">';
213        $HTMLCriterios.='                       <TR>';
214        $HTMLCriterios.='                               <TH align=center>&nbsp;'.$TbMsg[3].'&nbsp;</TH></TR>';
215        $HTMLCriterios.='                       <TR>';
216
217        $parametros=$ACCION_SINRESULTADO."=".$TbMsg[60].chr(13);
218        $parametros.=$ACCION_EXITOSA."=".$LITACCION_EXITOSA.chr(13);
219        $parametros.=$ACCION_FALLIDA."=".$LITACCION_FALLIDA;
220        $HTMLCriterios.='                               <TD colspan=3>'.HTMLCTESELECT($parametros,"resultado","estilodesple","",$resultado,250,"chgdespleresultados").'</TD></TR>';
221        // Porcentajes
222        $HTMLCriterios.='                       <TR>';
223        $HTMLCriterios.='                               <TH>&nbsp;'.$TbMsg[5].':&nbsp;<INPUT size=1 name="porcendesde" value="'.$porcendesde.'">&nbsp;'.$TbMsg[6].':&nbsp;
224                                                                                                                <INPUT size =1 name="porcenhasta" value="'.$porcenhasta.'"></TH></TR>';
225        $HTMLCriterios.='               </TABLE>';
226        $HTMLCriterios.='       </TD>'; // Fin Desplegables de resultados y porcentajes
227        $HTMLCriterios.='</TR>';               
228               
229               
230        $HTMLCriterios.='<TR>'; 
231        $HTMLCriterios.='       <TD  style="BORDER-BOTTOM:#5a86b5 1px solid;" colspan=2>'; // Fechas y horas
232        // Fechas
233        $HTMLCriterios.='               <TABLE WIDTH=100% class=tabla_standar align=center border="0">';
234        $HTMLCriterios.='                       <TR>';
235        $HTMLCriterios.='                               <TH>&nbsp;'.$TbMsg[7].':&nbsp;</TH>';
236        $HTMLCriterios.='                               <TD><INPUT class="cajatexto" onclick="vertabla_calendario(this)" style="WIDTH:80" name="fechainicio" value="'.$fechainicio.'"></TD>';
237        $HTMLCriterios.='                               <TH align=right>&nbsp;'.$TbMsg[8].':&nbsp;&nbsp;</TH>';
238        $HTMLCriterios.='                               <TD align=right><INPUT class="cajatexto" onclick="vertabla_calendario(this)" style="WIDTH:80" name="fechafin" value="'.$fechafin.'"></TD>';
239        $HTMLCriterios.='                       </TR>';
240        $HTMLCriterios.='                       <TR>';
241        $HTMLCriterios.='                               <TH>&nbsp;'.$TbMsg[9].':&nbsp;</TH>';
242        $HTMLCriterios.='                               <TD><INPUT class="cajatexto" onclick="vertabla_horario(this)" style="WIDTH:80" name="horainicio" value="'.$horainicio.'"></TD>';
243        $HTMLCriterios.='                               <TH align=right>&nbsp;'.$TbMsg[10].':&nbsp;&nbsp;</TH>';
244        $HTMLCriterios.='                               <TD align=right><INPUT class="cajatexto" onclick="vertabla_horario(this)" style="WIDTH:80" name="horafin" value="'.$horafin.'"></TD>';
245        $HTMLCriterios.='                       </TR>';
246        $HTMLCriterios.='               </TABLE>';
247        $HTMLCriterios.='       </TD>';
248        $HTMLCriterios.='</TR>';
249        $HTMLCriterios.='</TABLE>';// Fin filtro de búsquedas
250
251        $HTMLCriterios.='<BR>';
252        //      _________________________________________________________________________
253        //     
254        // Tabla de checkbox para elegir visualizar detalles
255        //      _________________________________________________________________________
256       
257        $HTMLCriterios.='<TABLE class="tabla_busquedas" align=center border=0 cellPadding=0 cellSpacing=0>';
258        $HTMLCriterios.='       <TR>';
259        $HTMLCriterios.='       <TH height=15 align="center" colspan=14>&nbsp;'.$TbMsg[47].'&nbsp;</TH>';
260        $HTMLCriterios.='       </TR>';
261        $HTMLCriterios.='       <TR>';
262        $HTMLCriterios.='               <TD align=right>'.$TbMsg[48].'</TD>';
263        $HTMLCriterios.='               <TD align=center><INPUT type="checkbox" value="1" name="visuprm"';
264        if($visuprm==1) $HTMLCriterios.=' checked ';
265        $HTMLCriterios.='></TD>';
266        $HTMLCriterios.='               <TD width="20" align=center>&nbsp;</TD>';
267        $HTMLCriterios.='               <TD align=right>'.$TbMsg[49].'</TD>';
268        $HTMLCriterios.='               <TD align=center><INPUT type="checkbox" value="1" name="visupro"';
269        if($visupro==1) $HTMLCriterios.=' checked ';
270        $HTMLCriterios.='></TD>';
271        $HTMLCriterios.='               <TD width="20" align=center>&nbsp;</TD>';
272        $HTMLCriterios.='               <TD align=right>'.$TbMsg[50].'</TD>';
273        $HTMLCriterios.='               <TD align=center><INPUT type="checkbox" value="1" name="visucmd"';
274        if($visucmd==1) $HTMLCriterios.=' checked ';
275        $HTMLCriterios.='></TD>';
276        $HTMLCriterios.='       </TR>';
277        $HTMLCriterios.='</TABLE>';
278
279        $HTMLCriterios.='<BR>';
280               
281        $HTMLCriterios.='<TABLE class="tabla_busquedas" align=center border="0">';
282        $HTMLCriterios.='       <TR>';
283        $HTMLCriterios.='               <TD>';  // Lupa
284        $HTMLCriterios.= '                      <A href="#busca"><IMG border=0 src="../images/iconos/busquedas.gif" onclick="fdatos.submit();" alt="Buscar"></A>';
285        $HTMLCriterios.='               </TD>';
286        $HTMLCriterios.='</TR>';
287        $HTMLCriterios.='</TABLE>';
288
289        echo $HTMLCriterios;   
290        echo '</FORM>'; // Fin formulario de criterios de busquedas
291       
292        /* Cabeceras */
293        tomaAmbito($ambito,$urlimg,$textambito);
294        echo '<DIV align=center>'; // Cabecera
295        echo '<span align=center class=subcabeceras><U>'.$TbMsg[11].':'.$textambito.'</U>,
296                                &nbsp;'.$nombreambito.'</span>&nbsp;&nbsp;<IMG src="'.$urlimg.'"></span>';
297        if(!empty($sesion))
298                echo '<BR><span align=center class="presentaciones">'.$TbMsg[51].'</span>&nbsp;&nbsp;
299                        <IMG src="../images/iconos/filtroaccion.gif">';
300        ?>
301        <BR>
302        <BR>
303        <?php 
304        //      _________________________________________________________________________
305        //     
306        // Tabla de opciones que afectan a todas las acciones mostradas
307        //      _________________________________________________________________________
308        ?>
309        <TABLE  align=center border=0 cellPadding=2 cellSpacing=5 >
310                <TR>
311                        <?php // Eliminar ?>
312                        <TD onclick="eleccion(1);">&nbsp;
313                                <TABLE class="filtros" >
314                                        <TR>
315                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/eliminar.gif"></A>&nbsp;</TD>
316                                                <TD><A style="text-decoration:none;COLOR:#999999;" href="#op">
317                                                        <span onmouseout="desresaltar(this);" onmouseover="resaltar(this);"><?php echo $TbMsg[12]?><span></A></TD>
318                                        </TR>
319                                </TABLE>
320                        </TD>           
321                       
322                        <TD onclick="eleccion(2);">&nbsp;
323                                <TABLE class=filtros>
324                                        <TR>
325                                                <?php // Resaltar ?>
326                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/reiniciar.gif"></A>&nbsp;</TD>
327                                                <TD><A style="text-decoration:none;COLOR:#999999;" href="#op">
328                                                                <span onmouseout="desresaltar(this);" onmouseover="resaltar(this);"><?php echo $TbMsg[13]?><span></A></TD>
329                                        </TR>
330                                </TABLE>
331                        </TD>                           
332
333                        <TD onclick="eleccion(3);">&nbsp;
334                                <TABLE class=filtros>
335                                        <TR>
336                                                <?php // Parar ?>
337                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/acDetenida.gif"></A>&nbsp;</TD>
338                                                <TD><A style="text-decoration:none;COLOR:#999999;" href="#op">
339                                                                        <span onmouseout="desresaltar(this);" onmouseover="resaltar(this);"><?php echo $TbMsg[14]?><span></A></TD>
340                                               
341                                        </TR>
342                                </TABLE>
343                        </TD>   
344                       
345                        <TD onclick="eleccion(4);">&nbsp;
346                                <TABLE class=filtros>
347                                        <TR>
348                                                <?php // Seguir ?>
349                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/acIniciada.gif"></A>&nbsp;</TD>
350                                                <TD>&nbsp;<A style="text-decoration:none;COLOR:#999999;" href="#op">
351                                                        <span onmouseout="desresaltar(this);" onmouseover="resaltar(this);"><?php echo $TbMsg[15]?></span></A>&nbsp;</TD>
352                                        </TR>
353                                </TABLE>
354                        </TD>   
355                       
356                        <TD onclick="eleccion(5);">&nbsp;
357                                <TABLE class=filtros>
358                                        <TR>
359                                                <?php // Seguir ?>
360                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/acExitosa.gif"></A>&nbsp;</TD>
361                                                <TD>&nbsp;<A style="text-decoration:none;COLOR:#999999;" href="#op">
362                                                        <span onmouseout=desresaltar(this); onmouseover=resaltar(this)><?php echo $TbMsg[55]?></span></A>&nbsp;</TD>
363                                        </TR>
364                                </TABLE>
365                        </TD>
366                        <TD onclick="eleccion(6);">&nbsp;
367                                <TABLE class=filtros>
368                                        <TR>
369                                                <?php // Seguir ?>
370                                                <TD><A href="#op"><IMG border=0 src="../images/iconos/acFallida.gif"></A>&nbsp;</TD>
371                                                <TD>&nbsp;<A style="text-decoration:none;COLOR:#999999;" href="#op">
372                                                        <span onmouseout=desresaltar(this); onmouseover=resaltar(this)><?php echo $TbMsg[56]?></span></A>&nbsp;</TD>
373                                        </TR>
374                                </TABLE>
375                        </TD>                   
376                </TR>
377        </TABLE>
378        <?php
379        //      _________________________________________________________________________
380        //     
381        // Tabla de registros de acciones
382        //      _________________________________________________________________________
383        ?>     
384        <TABLE  border=0 class="tabla_listados" cellspacing=1 cellpadding=0 >
385        <TBODY id="tbAcciones">
386        <?php
387                cabeceraAcciones();
388                listaAcciones($ambito,$idambito);
389
390        ?>
391        </TBODY>
392        </TABLE>
393        </DIV>         
394        <FORM name="facciones">
395                <INPUT type="hidden" name=acciones value="<?php echo $acciones?>">
396                <INPUT type="hidden" name=localaccion value="">
397                <INPUT type="hidden" name="sesion" value="<?php echo $sesion?>">               
398        </FORM>
399        <?php
400                $flotante=new MenuContextual(); // Crea objeto MenuContextual
401                $XMLcontextual=ContextualXMLAcciones(); // Crea contextual de las acciones
402                echo $flotante->CreaMenuContextual($XMLcontextual); 
403
404                $XMLcontextual=ContextualXMLNotificaciones(); // Crea contextual de las acciones
405                echo $flotante->CreaMenuContextual($XMLcontextual); 
406        ?>
407</BODY>
408</HTML>
409<?php
410/********************************************************************/
411//      Escribe la cabecera de los registros de acciones
412//      _________________________________________________________________________
413
414function cabeceraAcciones()
415{
416        global $TbMsg;
417       
418        $html="";
419        $html.='<TR height=20>';
420        $html.='<TH colspan=2>&nbsp;</TH>';     
421        $html.='<TH>&nbsp;R&nbsp;</TH>';               
422        $html.='<TH>&nbsp;'.$TbMsg[19].'&nbsp;</TH>';   
423        $html.='<TH>&nbsp;'.$TbMsg[20].'&nbsp;</TH>';
424        $html.='<TH>&nbsp;'.$TbMsg[21].'&nbsp;</TH>';
425        $html.='<TH>&nbsp;'.$TbMsg[22].'&nbsp;</TH>';
426        $html.='<TH>&nbsp;</TH>';
427        $html.='<TH>&nbsp;'.$TbMsg[23].'&nbsp;</TH>';
428        $html.='<TH>&nbsp;'.$TbMsg[57].'&nbsp;</TH>';
429        $html.='<TH>&nbsp;S&nbsp;</TH>';
430        $html.='<TH>&nbsp;%&nbsp;</TH>';                               
431        $html.='</TR>';
432        echo $html;
433}
434//      _________________________________________________________________________
435
436function listaAcciones($ambito,$idambito)
437{
438        global $cmd;
439        global $ClausulaWhere;
440        global $cadenaid;
441        global $cadenaip;
442        global $cadenamac;     
443        global $EJECUCION_COMANDO;     
444        global $EJECUCION_PROCEDIMIENTO;       
445        global $EJECUCION_TAREA;       
446        global $ACCION_PROGRAMADA;     
447        global $acciones;
448        global $sesion;
449        global $estado;
450       
451        $cadenaid="";
452        $cadenaip="";
453        $cadenamac="";
454        RecopilaIpesMacs($cmd,$ambito,$idambito); // Recopila Ipes del ámbito           
455        $cadenasesion="(SELECT DISTINCT sesion FROM acciones WHERE idordenador NOT IN (".$cadenaid."))";
456 
457        $cmd->texto="SELECT acciones.*, comandos.descripcion AS comando, acciones.parametros,
458                            comandos.visuparametros, ordenadores.nombreordenador,
459                            procedimientos.descripcion AS procedimiento,
460                            tareas.descripcion AS tarea, programaciones.sesion AS sesionprog
461                        FROM acciones
462                        INNER JOIN comandos ON comandos.idcomando=acciones.idcomando
463                        INNER JOIN ordenadores ON ordenadores.idordenador=acciones.idordenador
464                        LEFT OUTER JOIN procedimientos ON procedimientos.idprocedimiento=acciones.idprocedimiento
465                        LEFT OUTER JOIN tareas ON tareas.idtarea=acciones.idtarea
466                        LEFT OUTER JOIN programaciones ON programaciones.sesion=acciones.sesion";
467        if(!empty($sesion)) // Filtro por acción
468                $cmd->texto.=" WHERE acciones.sesion =".$sesion;
469        else
470                $cmd->texto.=" WHERE acciones.sesion NOT IN (".$cadenasesion.")";
471               
472        if($estado==$ACCION_PROGRAMADA)
473                $cmd->texto.=" AND (acciones.idprogramacion=0 AND programaciones.sesion>0)"; // Comando programado
474        else{
475                if(!empty($ClausulaWhere)) 
476                        $cmd->texto.=" AND (".$ClausulaWhere.")";
477        }       
478        $cmd->texto.=" ORDER BY acciones.idaccion DESC, acciones.sesion DESC";
479        $rs=new Recordset; 
480        $rs->Comando=&$cmd; 
481        if (!$rs->Abrir()) return; // Error al abrir recordset
482
483        $acciones="";   // Variable que recogerá las acciones que cumplan los criterios
484                        // con formato "ambito,idambito" concadenando con ";" a otro identificador
485                        // Esta variable se usara para las operaciones globales de Eliminar, etc...
486
487        // Recorre acciones
488        $html="";
489        while (!$rs->EOF){
490                switch($rs->campos["tipoaccion"]){
491                        case $EJECUCION_COMANDO:
492                                        $html.=listaComado($rs,$rs->campos["sesion"]);
493                                        break;
494                        case $EJECUCION_PROCEDIMIENTO:
495                                        $html.=listaProcedimiento($rs,$rs->campos["sesion"]);   
496                                        break;                                                 
497                        case $EJECUCION_TAREA:
498                                        $html.=listaTarea($rs,$rs->campos["sesion"]);   
499                                        break;                                 
500                }       
501        }
502        echo $html;
503}
504//      _________________________________________________________________________
505
506function listaTarea($rs,$sesion)
507{
508        global $acciones;
509       
510        $oA=new clsAccion; // Crea objeto acción para procesar comandos
511        iniAccion($rs,$oA);     
512        $html=recorreTarea($rs,$sesion,$oA);   
513        if(cumpleCriterios($oA)){
514                $acciones.=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Concadena identificador
515                $html=cabeceraSesion($oA).$html; // Escribe la cabecera del comando
516        }
517        else
518                $html=""; // No cumple con los criterios       
519        return($html);         
520}               
521//      _________________________________________________________________________
522
523function recorreTarea($rs,$sesion,$oA)
524{
525        $html="";
526        do{
527                $html.=listaProcedimiento($rs,$sesion,$rs->campos["idtarea"],$oA);
528        }while(!$rs->EOF
529                        && $rs->campos["sesion"]==$sesion);
530        return($html); 
531}
532//      _________________________________________________________________________
533
534function listaProcedimiento($rs,$sesion,$idtarea=0,$oA=null)
535{
536        global $acciones;
537       
538        if($oA!=null){ // Si la función es invocada por una tarea ...
539                $html=recorreProcedimiento($rs,$sesion,$idtarea,$oA);
540        }
541        else{
542                $oA=new clsAccion; // Crea objeto acción para procesar comandos
543                iniAccion($rs,$oA);     
544                $html=recorreProcedimiento($rs,$sesion,$idtarea,$oA);   
545                if(cumpleCriterios($oA)){
546                        $acciones.=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Concadena identificador
547                        if($rs->campos["sesion"]!=$sesion 
548                                || $rs->campos["idtarea"]!=$idtarea 
549                                || $rs->EOF)
550                                $html=cabeceraSesion($oA).$html; // Escribe la cabecera del procedimiento
551                }
552                else
553                        $html=""; // No cumple con los criterios                       
554        }
555        return($html);         
556}               
557//      _________________________________________________________________________
558
559function recorreProcedimiento($rs,$sesion,$idtarea,$oA)
560{
561        $html="";
562        do{
563                $html.=listaComado($rs,$sesion,$idtarea,$rs->campos["idprocedimiento"],$oA);
564        }while(!$rs->EOF
565                        && $rs->campos["sesion"]==$sesion
566                        && $rs->campos["idtarea"]==$idtarea);
567        return($html); 
568}
569//      _________________________________________________________________________
570
571function listaComado($rs,$sesion,$idtarea=0,$idprocedimiento=0,$oA=null)
572{
573        global $acciones;
574        global $visupro;
575       
576        if($oA!=null){ // Si la función es invocada por un procedimiento...
577                $html=recorreComando($rs,$sesion,$idtarea,$idprocedimiento,$oA);
578        }
579        else{
580                $oA=new clsAccion; // Crea objeto acción para procesar comandos
581                iniAccion($rs,$oA);     
582                $html=recorreComando($rs,$sesion,$idtarea,$idprocedimiento,$oA);
583       
584                $acciones.=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Concadena identificador
585                if($rs->campos["sesion"]!=$sesion 
586                        || $rs->campos["idtarea"]!=$idtarea 
587                        || $rs->campos["idprocedimiento"]!=$idprocedimiento 
588                        || $rs->EOF)
589                        if($oA->linot>0)                               
590                                $html=cabeceraSesion($oA).$html; // Escribe la cabecera del comando
591        }
592        return($html);
593}
594//      _________________________________________________________________________
595
596function recorreComando($rs,$sesion,$idtarea,$idprocedimiento,$oA)
597{
598        $html="";
599        do{
600                $html.=listaNotificacion($rs,$sesion,$idtarea,$idprocedimiento,$rs->campos["idcomando"],$oA);
601        }while(!$rs->EOF
602                        && $rs->campos["sesion"]==$sesion
603                        && $rs->campos["idtarea"]==$idtarea
604                        && $rs->campos["idprocedimiento"]==$idprocedimiento);
605        return($html); 
606}
607//      _________________________________________________________________________
608//     
609//      Recorre todas las notificaciones de un mismo comando registrando
610//  los datos que servirán para resumen de la Acción
611//      _________________________________________________________________________
612
613function listaNotificacion($rs,$sesion,$idtarea,$idprocedimiento,$idcomando,$oA)
614{       
615        global $ACCION_EXITOSA; 
616        global $ACCION_FALLIDA; 
617        global $ACCION_SINRESULTADO; 
618
619        global $ACCION_DETENIDA;
620        global $ACCION_INICIADA;
621        global $ACCION_FINALIZADA;
622                       
623        global $EJECUCION_TAREA; 
624        global $visuprm; 
625        global $visucmd; 
626        global $visupro; 
627
628        $html="";
629       
630        if($visupro==1)
631                $html.=cambiaAmbito($rs,$oA); // Escribe cambio de ámbito       
632               
633        if($visuprm==1)
634                $html.=escribeParametros($rs->campos["comando"],$rs->campos["parametros"],$rs->campos["visuparametros"],$oA);
635       
636       
637
638        do{
639                if(cumpleCriteriosNot($rs,$oA)){
640                        if($visucmd==1){
641                                $html.=escribeNotificacion($rs,$oA);
642                                $oA->linot++; // Contador de lineas de notificaciones escritas cumpliendo criterios
643                        }                               
644                }
645                /* Fechas y horas */
646                $fechahorareg=strtotime($rs->campos["fechahorareg"]);
647                if($fechahorareg>0)
648                        if($oA->fechahorareg>$fechahorareg) $oA->fechahorareg=$fechahorareg;
649                $fechahorafin=strtotime($rs->campos["fechahorafin"]);
650                if($fechahorafin>0)
651                        if($oA->fechahorafin<$fechahorafin) $oA->fechahorafin=$fechahorafin;
652
653                $oA->notif++; // Contador de notificaciones en el comando
654                switch($rs->campos["estado"]){
655                        case $ACCION_INICIADA:
656                                $oA->notini++; // Incrementa contador de comandos con estado de finalizado
657                                break;
658                        case $ACCION_DETENIDA:
659                                $oA->notdet++; // Incrementa contador de comandos con estado de finalizado
660                                break;
661                        case $ACCION_FINALIZADA:
662                                $oA->noter++; // Incrementa contador de comandos con estado de finalizado
663                                break;                         
664                }
665                /* Cuestión resultados */
666                /* Si existe al menos una notificación de error, la acción tiene ya resultado de error */
667                if($rs->campos["resultado"]==$ACCION_FALLIDA){
668                        $oA->resultado=$ACCION_FALLIDA;
669                }
670                /* Si existe aún alguna notificación pendiente, la acción no tiene resultado global */
671                if($rs->campos["resultado"]==$ACCION_SINRESULTADO){
672                        if($oA->resultado==$ACCION_EXITOSA)             
673                                $oA->resultado=$ACCION_SINRESULTADO;
674                }               
675                $rs->Siguiente();       
676               
677        }while(!$rs->EOF 
678                        && $rs->campos["sesion"]==$sesion
679                        && $rs->campos["idtarea"]==$idtarea
680                        && $rs->campos["idprocedimiento"]==$idprocedimiento
681                        && $rs->campos["idcomando"]==$idcomando);
682       
683        if($oA->notif>0)
684                $oA->porcen=floor($oA->noter*100/$oA->notif); // Calcula porcentaje de finalización
685
686        if($oA->notif==$oA->noter)
687                $oA->estado=$ACCION_FINALIZADA;  // Todas las acciones finalizadas
688        else{
689                if($oA->notif==$oA->notdet) 
690                        $oA->estado=$ACCION_DETENIDA;  // Todas las acciones detenidas
691                else
692                        $oA->estado=$ACCION_INICIADA; 
693        }
694        if(cumpleCriterios($oA)){
695                if($rs->campos["sesion"]!=$sesion && !$rs->EOF ) // Separación entre sesiones distintas
696                        $html.='<TR id="'.$oA->sesion.'" value="A"><TD colspan=12 style="BACKGROUND-COLOR:white;BORDER-BOTTOM:#999999 1px solid;">&nbsp;</TD></TR>';
697        }
698        return($html);
699}
700//      _________________________________________________________________________
701
702function escribeNotificacion($rs,$oA)
703{
704                global $ACCION_EXITOSA; 
705                global $ACCION_FALLIDA; 
706                global $ACCION_SINRESULTADO; 
707
708                global $ACCION_DETENIDA;
709                global $ACCION_INICIADA;
710                global $ACCION_FINALIZADA;
711               
712                global $TbMsg;
713                global $visupro;
714                global $visuprm;
715               
716                $html="";       
717                $html.='<TR id="'.$oA->sesion.'" value="D">';
718                if($visupro==0 )
719                        $html.='<TD align=right colspan=2>'.$rs->campos["comando"].'&nbsp;</TD>';
720                else
721                        $html.='<TD align=right colspan=2>&nbsp;</TD>';
722                       
723                /* Resultado */
724                switch($rs->campos["resultado"]){
725                        case $ACCION_EXITOSA:
726                                $html.='<TD align=center><IMG value="'.$ACCION_EXITOSA.'" src="../images/iconos/acExitosa.gif" width=16 height=16></TD>';
727                                break;
728                        case $ACCION_FALLIDA:
729                                $html.='<TD align=center><IMG value="'.$ACCION_FALLIDA.'" src="../images/iconos/acFallida.gif" width=16 height=16></TD>';
730                                break;
731                        case $ACCION_SINRESULTADO:
732                                $html.='<TD align=center><IMG value="'.$ACCION_SINRESULTADO.'" src="../images/iconos/nada.gif" width=16 height=16></TD>';
733                                break;
734                }       
735                if($oA->swcp){ // Comando programado
736                        $html.='<TD align=center>&nbsp;</TD>';
737                        $html.='<TD align=center>&nbsp;</TD>';
738                        $html.='<TD align=center>&nbsp;</TD>';
739                        $html.='<TD align=center>&nbsp;</TD>';
740                }
741                else{
742                        /* Fechas y horas */
743                        list($fecha,$hora)=explode(" ",substr($rs->campos["fechahorafin"],0));
744                        if ($fecha=="1970-01-01") $hora="";
745                        $html.='<TD align=center>&nbsp;'.InvFecha($fecha).'&nbsp;</TD>';
746                        $html.='<TD align=center>&nbsp;'.$hora.'&nbsp;</TD>';
747                               
748                        list($fecha,$hora)=explode(" ",substr($rs->campos["fechahorareg"],0));
749                        if ($fecha=="1970-01-01") $hora="";
750                        $html.='<TD align=center>&nbsp;'.InvFecha($fecha).'&nbsp;</TD>';
751                        $html.='<TD align=center>&nbsp;'.$hora.'&nbsp;</TD>';
752                }       
753                       
754                /* Ámbito de aplicación */
755                $urlimg='../images/iconos/ordenador.gif';
756                $accion=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",".$rs->campos["idaccion"].";"; // Tripla clave 
757                $oncontxt="document.facciones.localaccion.value='".$accion."';";
758                $oncontxt.="menu_contextual(null,'flo_notificaciones');";
759               
760                $html.='<TD id="'.$rs->campos["idaccion"].'" align=center><A href="#cmd"><IMG border=0 src="'.$urlimg.'"
761                                oncontextmenu="'.$oncontxt.'" ></A></TD>';
762                $html.='<TD align=left>&nbsp;'.$rs->campos["nombreordenador"].'&nbsp;</TD>';   
763               
764                /* Descripción de la notificación (Descripción del error si se ha producido alguno) */ 
765                $html.='<TD>&nbsp;'.$rs->campos["descrinotificacion"].'&nbsp;</TD>';
766                       
767                /* Estado */
768                if($oA->swcp) // Comando programado
769                                $html.='<TD align=center><IMG value="'.$ACCION_DETENIDA.'"
770                                src="../images/iconos/reloj.gif" width=16 height=16 style="cursor:pointer"
771                                onclick="programacion('.$rs->campos["idtipoaccion"].','.$rs->campos["sesion"].',\''.$rs->campos["comando"].'\')"></TD>';
772                else{
773                        switch($rs->campos["estado"]){
774                                case $ACCION_DETENIDA:
775                                        $html.='<TD align=center><IMG value="'.$ACCION_DETENIDA.'" src="../images/iconos/acDetenida.gif" width=16 height=16></TD>';
776                                        break;
777                                case $ACCION_INICIADA:
778                                        $html.='<TD align=center><IMG value="'.$ACCION_INICIADA.'" src="../images/iconos/acIniciada.gif" width=16 height=16></TD>';
779                                        break;
780                                case $ACCION_FINALIZADA:
781                                        $html.='<TD align=center><IMG value="'.$ACCION_FINALIZADA.'" src="../images/iconos/acFinalizada.gif" width=16 height=16></TD>';
782                                        break;
783                        }
784                }       
785
786                /* Porcentaje */
787                $html.='<TD align=center>&nbsp;</TD>';         
788                $html.='</TR>'; 
789                return($html);
790}       
791//      _________________________________________________________________________
792//     
793//      Inicializa la clase acción
794//
795//      Parámetros:
796//              oA: Objeto acción a inicializar
797//      _________________________________________________________________________
798
799function iniAccion($rs,$oA)
800{
801        global $ACCION_EXITOSA; 
802        global $ACCION_DETENIDA; 
803       
804        $oA->ambito=$rs->campos["ambito"];
805        $oA->idambito=$rs->campos["idambito"];
806        $oA->tipoaccion=$rs->campos["tipoaccion"];
807        $oA->idtipoaccion=$rs->campos["idtipoaccion"];
808        $oA->descriaccion=$rs->campos["descriaccion"];
809        $oA->sesion=$rs->campos["sesion"];
810        $oA->fechahorareg=strtotime($rs->campos["fechahorareg"]);
811        $oA->fechahorafin=0;
812        $oA->estado=$ACCION_DETENIDA; 
813        $oA->resultado=$ACCION_EXITOSA;
814        $oA->notif=$oA->noter=$oA->notini=$oA->notdet=$oA->linot=$oA->porcen=0;
815        if(empty($rs->campos["idprogramacion"]) && !empty($rs->campos["sesionprog"])) // switch de Comando programado
816                $oA->swcp=true;
817        else
818                $oA->swcp=false; 
819}
820//      _________________________________________________________________________
821
822function cabeceraSesion($oA)
823{
824        global $EJECUCION_COMANDO;
825        global $EJECUCION_PROCEDIMIENTO;
826        global $EJECUCION_TAREA;
827
828        $html="";               
829        $html.='<TR id="'.$oA->sesion.'" value="C">';
830       
831        $accion=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Tripla clave   
832        $oncontxt="document.facciones.sesion.value='".$oA->sesion."';";
833        $oncontxt.="document.facciones.localaccion.value='".$accion."';menu_contextual(null,'flo_acciones');";
834        switch($oA->tipoaccion){
835                case $EJECUCION_COMANDO:
836                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG style="cursor:pointer" border=0
837                                        oncontextmenu="'.$oncontxt.'"
838                                        src="../images/iconos/comandos.gif"></TD>';
839                        break;
840                case $EJECUCION_PROCEDIMIENTO:
841                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG style="cursor:pointer" border=0
842                                        oncontextmenu="'.$oncontxt.'"
843                                        src="../images/iconos/procedimiento.gif"></TD>';
844                        break;                         
845                case $EJECUCION_TAREA:
846                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG style="cursor:pointer" border=0 
847                                        oncontextmenu="'.$oncontxt.'"
848                                        src="../images/iconos/tareas.gif"></TD>';
849                        break;                                 
850        }
851        /* Cabeceras */
852        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=left><b>'.$oA->descriaccion.'</b></TD>';
853        $html.=escribeResumen($oA);
854        $html.='</TR>';
855
856        return($html);
857}
858//      _________________________________________________________________________
859
860function escribeResumen($oA)
861{
862                global $cmd;
863                global $TbMsg;
864                global $ACCION_EXITOSA; 
865                global $ACCION_FALLIDA; 
866                global $ACCION_SINRESULTADO;
867                global $ACCION_DETENIDA;
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 __construct(){  // 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=explode(";",$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.'&nbsp;&nbsp;&nbsp;</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=8><b>'.$descripcion.'</b>:
1119        '.$valor.'</TD>';
1120        $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=1 >&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><?php echo $TbMsg[18]?></TH>
1132                </TR>
1133                <TR>
1134                        <TD align=right><?php 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 ='<ITEM';
1201        $layerXML.=' alpulsar="eleccion(1,document.facciones.localaccion)"';
1202        $layerXML.=' imgitem="../images/iconos/eliminar.gif"';
1203        $layerXML.=' textoitem='.$TbMsg[46];
1204        $layerXML.='></ITEM>';
1205
1206        $layerXML.='<ITEM';
1207        $layerXML.=' alpulsar="eleccion(2,document.facciones.localaccion)"';
1208        $layerXML.=' imgitem="../images/iconos/reiniciar.gif"';
1209        $layerXML.=' textoitem='.$TbMsg[45];
1210        $layerXML.='></ITEM>';
1211       
1212        $layerXML.='<SEPARADOR>';
1213        $layerXML.='</SEPARADOR>';
1214       
1215        $layerXML.='<ITEM';
1216        $layerXML.=' alpulsar="eleccion(3,document.facciones.localaccion)"';
1217        $layerXML.=' imgitem="../images/iconos/acDetenida.gif"';
1218        $layerXML.=' textoitem='.$TbMsg[14];
1219        $layerXML.='></ITEM>';
1220       
1221        $layerXML.='<ITEM';
1222        $layerXML.=' alpulsar="eleccion(4,document.facciones.localaccion)"';
1223        $layerXML.=' imgitem="../images/iconos/acIniciada.gif"';
1224        $layerXML.=' textoitem='.$TbMsg[15];
1225        $layerXML.='></ITEM>'; 
1226
1227        $layerXML.='<SEPARADOR>';
1228        $layerXML.='</SEPARADOR>';     
1229       
1230        $layerXML.='<ITEM';
1231        $layerXML.=' alpulsar="eleccion(5,document.facciones.localaccion)"';
1232        $layerXML.=' imgitem="../images/iconos/acExitosa.gif"';
1233        $layerXML.=' textoitem="'.$TbMsg[55].'"';
1234        $layerXML.='></ITEM>';
1235
1236        $layerXML.='<ITEM';
1237        $layerXML.=' alpulsar="eleccion(6,document.facciones.localaccion)"';
1238        $layerXML.=' imgitem="../images/iconos/acFallida.gif"';
1239        $layerXML.=' textoitem="'.$TbMsg[56].'"';
1240        $layerXML.='></ITEM>'; 
1241        $layerXML.='</MENUCONTEXTUAL>';
1242        return($layerXML);
1243}
1244
Note: See TracBrowser for help on using the repository browser.