source: admin/WebConsole/principal/colasacciones.php @ a4c7e74

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since a4c7e74 was 319b9f5, checked in by ramon <ramongomez@…>, 13 years ago

#551: Quitar algunos avisos para mejorar la compatibilidad con PHP 5.4, eliminando mensajes de error en fichero de log de Apache.

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