source: admin/WebConsole/principal/colasacciones.php @ 4f19d25

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 4f19d25 was 3997593, checked in by alonso <alonso@…>, 12 years ago

git-svn-id: https://opengnsys.es/svn/branches/version1.0@3673 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100644
File size: 45.1 KB
RevLine 
[54909a3]1<?php
[3ec149c]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
[2e7c034]10// Cambio en la linea 73 la cantidad de días predeterminado por 180 (antes 3)
[3ec149c]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="";
[abb2eb0]44        $tiposacciones="";
45        $estados="";
[9553071]46        $resultados="";
[3ec149c]47        $visupro="";
48        $visuprm="";
[34374f0]49        $visucmd="";
50        $sesion="";
51        $urlimg="";
52        $textambito="";
53
[3ec149c]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"];
[34374f0]61
[3ec149c]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"];
[34374f0]70
[3ec149c]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
[abb2eb0]78        if (function_exists('date_default_timezone_set')) {
79                date_default_timezone_set('UTC');
80        }
[3ec149c]81        if(empty($swPOST)){ // Valores por defecto
[2e7c034]82                $wfechainicio=mktime(0, 0, 0, date("m")  , date("d")-180, date("Y")); // Acciones desde tres días antes
[3ec149c]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.
[34374f0]104
[3997593]105        $tbParametros=CreaTablaParametros($cmd); // Crea tabla en mezmmoria para acceder a detalles de comandos
[3ec149c]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
[9553071]135        if(!empty($tipoaccion)) $ClausulaWhere.=" AND acciones.tipoaccion=".$tipoaccion;
[3ec149c]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        <TITLE>Administración web de aulas</TITLE>
145        <HEAD>
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                <? echo '<SCRIPT language="javascript" src="../idiomas/javascripts/'.$idioma.'/colasacciones_'.$idioma.'.js"></SCRIPT>'?>
154        </HEAD>
155        <BODY oncontextmenu="return false">
[abb2eb0]156        <?php
[3ec149c]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 HEIGHT=30>';
179        $HTMLCriterios.='               <TD 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="javascript: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 */
[54909a3]293        tomaAmbito($ambito,$urlimg,$textambito);
[3ec149c]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>
[34374f0]303        <?php
[3ec149c]304        //      _________________________________________________________________________
305        //     
306        // Tabla de opciones que afectan a todas las acciones mostradas
307        //      _________________________________________________________________________
308        ?>
309        <TABLE  align=center border=0 align=left cellPadding=2 cellSpacing=5 >
310                <TR>
311                        <? // 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)><?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                                                <? // 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)><?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                                                <? // 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)><?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                                                <? // 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)><?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                                                <? // 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)><?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                                                <? // 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)><?echo $TbMsg[56]?></span></A>&nbsp;</TD>
373                                        </TR>
374                                </TABLE>
375                        </TD>                   
376                </TR>
377        </TABLE>
378        <?
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        <?
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="<? echo $acciones?>">
396                <INPUT type="hidden" name=localaccion value="">
397                <INPUT type="hidden" name="sesion" value="<? echo $sesion?>">           
398        </FORM>
399        <?
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<?
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 
[dc5e48a]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";
[3ec149c]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        }       
[dc5e48a]478        $cmd->texto.=" ORDER BY acciones.idaccion DESC, acciones.sesion DESC";
[3ec149c]479        $rs=new Recordset;
480        $rs->Comando=&$cmd;
481        if (!$rs->Abrir()) return; // Error al abrir recordset
482
[dc5e48a]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
[3ec149c]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...
[abb2eb0]577                $html=recorreComando($rs,$sesion,$idtarea,$idprocedimiento,$oA);
[3ec149c]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)=split(" ",substr($rs->campos["fechahorafin"],0));
744                        if ($fecha=="0000-00-00") $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)=split(" ",substr($rs->campos["fechahorareg"],0));
749                        if ($fecha=="0000-00-00") $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                               
865                global $ACCION_EXITOSA;
866                global $ACCION_FALLIDA;
867                global $ACCION_SINRESULTADO;
868                       
869                global $EJECUCION_TAREA;
870                       
871                $html="";               
872               
873                if($oA->swcp){ // Comando programado
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                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
879                        /* Ámbito de aplicación */
[54909a3]880                        tomaAmbito($oA->ambito,$urlimg,$textambito);
[3ec149c]881                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG src="'.$urlimg.'"></TD>';
[54909a3]882                        tomaDescriAmbito($cmd,$oA->ambito,$oA->idambito,$textambito);
[3ec149c]883                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;'.$textambito.'&nbsp;</TD>';     
884                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
885                       
886                                $html.='<TH align=center><IMG value="'.$ACCION_DETENIDA.'"
887                                src="../images/iconos/reloj.gif" width=16 height=16 style="cursor:pointer"
888                                onclick="programacion('.$oA->idtipoaccion.','.$oA->sesion.',\''.$oA->descriaccion.'\')"></TH>';
889                               
890                       
891                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
892                        return($html);
893                }
894               
895                /* Resultado */
896                switch($oA->resultado){
897                        case $ACCION_EXITOSA:
898                                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG value="'.$ACCION_EXITOSA.'" src="../images/iconos/acExitosa.gif" width=16 height=16></TD>';
899                                break;
900                        case $ACCION_FALLIDA:
901                                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG value="'.$ACCION_FALLIDA.'" src="../images/iconos/acFallida.gif" width=16 height=16></TD>';
902                                break;
903                        case $ACCION_SINRESULTADO:
904                                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG value="'.$ACCION_SINRESULTADO.'" src="../images/iconos/nada.gif" width=16 height=16></TD>';
905                }       
906                /* Fechas y horas */
907                if($oA->porcen==100){ // Si está acabada la acción
908                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%d-%m-%Y",$oA->fechahorafin).'&nbsp;</TD>';
909                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%H:%M:%S",$oA->fechahorafin).'&nbsp;</TD>';
910                }
911                else
912                {
913                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
914                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
915                }
916
917                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%d-%m-%Y",$oA->fechahorareg).'&nbsp;</TD>';
918                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%H:%M:%S",$oA->fechahorareg).'&nbsp;</TD>';
919
920                if($oA->tipoaccion==$EJECUCION_TAREA){
921                        $html.='<TD  style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;</TD>';
922                        $html.='<TD  style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;</TD>';
923                }
924                else{
925                        /* Ámbito de aplicación */
[cf0a0e4]926                        tomaAmbito($oA->ambito,$urlimg,$textambito);
[3ec149c]927                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG src="'.$urlimg.'"></TD>';
[54909a3]928                        tomaDescriAmbito($cmd,$oA->ambito,$oA->idambito,$textambito);
[3ec149c]929                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;'.$textambito.'&nbsp;</TD>';     
930                }       
931               
932                /* Descripción de la notificación (Descripción del error si se ha producido alguno) */ 
933                $html.='<TD style="BACKGROUND-COLOR: #b5daad" >&nbsp;'.$rs->campos["descrinotificacion"].'&nbsp;</TD>';
934
935                /* Estado */
936                $html.='<TD style="BACKGROUND-COLOR: #b5daad"  align=center>&nbsp;</TD>';
937               
938                /* Porcentaje */
939                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>'.$oA->porcen.'%</TD>';
940               
941       
942                return($html);
943}
944//      _________________________________________________________________________
945
946function cambiaAmbito($rs,$oA)
947{
948        global $cmd;
949        global $TbMsg;
950       
951        $bgcolor="#f6c8f5";
952        $html="";
953        $html.='<TR id="'.$oA->sesion.'" value="A">';
954        $procedimiento=TomaDato($cmd,0,'procedimientos',$rs->campos["idprocedimiento"],'idprocedimiento','descripcion');
955        $html.='<TD colspan=2 align="right" style="BACKGROUND-COLOR:'.$bgcolor.'">'.$rs->campos["comando"].'&nbsp;</TD>';
956        $html.='<TD style="BACKGROUND-COLOR:'.$bgcolor.'"><IMG style="cursor:pointer" src="../images/iconos/nada.gif">&nbsp;</TD>';
957        $html.='<TD colspan=4 style="BACKGROUND-COLOR:'.$bgcolor.'" align=right>'.$procedimiento.'&nbsp;</TD>';
958       
959        /* Ámbito de aplicación */
[54909a3]960        tomaAmbito($rs->campos["ambito"],$urlimg,$textambito);
[3ec149c]961        $html.='<TD style="BACKGROUND-COLOR:'.$bgcolor.'" align=center><IMG src="'.$urlimg.'"></TD>';
[54909a3]962        tomaDescriAmbito($cmd,$rs->campos["ambito"],$rs->campos["idambito"],$textambito);
[3ec149c]963        $html.='<TD style="BACKGROUND-COLOR:'.$bgcolor.'" align=left>&nbsp;'.$textambito.'&nbsp;</TD>';
964        $html.='<TD colspan=3 style="BACKGROUND-COLOR:'.$bgcolor.'" align=center>&nbsp;</TD>';
965        $html.='</TR>';
966        return($html);
967}
968//      _________________________________________________________________________
969//
970//      Comprueba si se cumplen los criterios para visualizar la acción
971//      _________________________________________________________________________
972
973function cumpleCriterios($oA)
974{
975        global $porcendesde;
976        global $porcenhasta;
977        global $estado;
978        global $resultado;
979        global $ACCION_PROGRAMADA;
980
981        if($estado==$ACCION_PROGRAMADA){       
982                if(!$oA->swcp)
983                        return(false); // Comandos programados
984                else
985                        return(true);
986        }
987        if($oA->swcp){
988                if($estado!=$ACCION_PROGRAMADA && $estado>0)   
989                        return(false); // Comandos programados
990                else
991                        return(true);
992        }
993
994        // Cuestion estados
995        if(!empty($estado))
996                if($oA->estado!=$estado) return(false);
997
998        if(!empty($resultado))         
999                if($oA->resultado!=$resultado) return(false);
1000       
1001        if($oA->porcen<$porcendesde || $oA->porcen>$porcenhasta) return(false);
1002        return(true);
1003}
1004//      _________________________________________________________________________
1005//
1006//      Comprueba si se cumplen los criterios para visualizar la notificación
1007//      _________________________________________________________________________
1008function cumpleCriteriosNot($rs,$oA)
1009{
1010        global $porcendesde;
1011        global $porcenhasta;
1012        global $estado;
1013        global $resultado;
1014        global $ACCION_PROGRAMADA;
1015
1016        if($estado==$ACCION_PROGRAMADA){       
1017                if(!$oA->swcp)
1018                        return(false); // Comandos programados
1019                else
1020                        return(true);
1021        }
1022        if($oA->swcp){
1023                if($estado!=$ACCION_PROGRAMADA && $estado>0)   
1024                        return(false); // Comandos programados
1025                else
1026                        return(true);
1027        }
1028        // Cuestion estados
1029        if(!empty($estado))
1030                if($rs->campos["estado"]!=$estado) return(false);
1031
1032        if(!empty($resultado))         
1033                if($rs->campos["resultado"]!=$resultado) return(false);
1034
1035        return(true);
1036}
1037//      _________________________________________________________________________
1038//
1039//      Clase para procesar las acciones
1040//      _________________________________________________________________________
1041
1042class clsAccion
1043{
1044        var $ambito;
1045        var $idambito;
1046        var $tipoaccion;
1047        var $idtipoaccion;     
1048        var $descriaccion;
1049        var $sesion;
1050        var $fechahorafin;
1051        var $fechahorareg;
1052        var $estado;
1053        var $resultado;
1054        var $porcen;
1055        var $notif;
1056        var $noter;
1057        var $notdet;
1058        var $notini;
1059        var $linot;
1060        var $swcp;
1061        function clsAccion(){  // Constructor
1062
1063        }
1064}
1065//________________________________________________________________________________________________________
1066
1067function escribeParametros($comando,$parametros,$visuparametros,$oA)
1068{       
1069        global $cmd;
1070        global $visupro;
1071        global $visupro;
1072        global $visucmd;
1073
1074        $html="";
1075        $tbParametrosValor=array();
[cf0a0e4]1076        ParametrosValor($cmd,$parametros,$tbParametrosValor); // Toma valores de cada parámetro
[3ec149c]1077        $vprm=split(";",$visuparametros);
1078
1079        if($visupro==1 || ($visupro=0 && $visucmd==0)) $comando="&nbsp;"; // No se muestra el nombre del comando
1080        for($i=0;$i<sizeof($vprm);$i++){
1081                $nemo=$vprm[$i]; // Para cada parámetro visualizable ...
1082                if(isset($tbParametrosValor[$nemo])){
1083                        for($j=0;$j<sizeof($tbParametrosValor[$nemo])-1;$j++){
1084                                $descripcion=$tbParametrosValor[$nemo]["descripcion"];
1085                                if(sizeof($tbParametrosValor[$nemo])>2)
1086                                        $valor=$tbParametrosValor[$nemo][$j]["valor"];
1087                                else
1088                                        $valor=$tbParametrosValor[$nemo]["valor"];
1089                                $html.=escribiendoParametros($comando,$descripcion,$valor,$oA);
1090                        }       
1091                }       
1092        }
1093        if(empty($visuparametros)){ // Sin parametros
1094                $bgcolor="#cedcec";
1095                $html.='<TR id="'.$oA->sesion.'" value="A">';
1096                $html.='<TD align=right style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=2>'.$comando.'</TD>';
1097                $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';">&nbsp;</TD>';
1098                $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=9>&nbsp;</TD>';
1099                $html.='</TR>';
1100        }
1101        return($html);
1102}
1103//________________________________________________________________________________________________________
1104
1105function escribiendoParametros($comando,$descripcion,$valor,$oA)
1106{
1107        $sw=true;
1108        $html="";
1109       
1110        $bgcolor="#cedcec";
1111        $html.='<TR id="'.$oA->sesion.'" value="A">';
1112        if($sw){
[3997593]1113                $html.='<TD align=right style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=2>'.$comando.'&nbsp;&nbsp;&nbsp;</TD>';
[3ec149c]1114                $sw=false;
1115        }
1116        else
1117                $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=2>&nbsp;</TD>';
1118        $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';">&nbsp;</TD>';
[3997593]1119        $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=8><b>'.$descripcion.'</b>:
[3ec149c]1120        '.$valor.'</TD>';
[3997593]1121        $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=1 >&nbsp;</TD>';
[3ec149c]1122        $html.='</TR>';
1123        return($html); 
1124}
1125//________________________________________________________________________________________________________
1126
1127function escribeCheck()
1128{
1129        echo'
1130        <TABLE class="tabla_busquedas" align=center border=0 cellPadding=0 cellSpacing=0>
1131                <TR>
1132                TH height=15 align="center" colspan=14><? echo $TbMsg[18]?></TH>
1133                </TR>
1134                <TR>
1135                        <TD align=right><? echo $TbMsg[30]?></TD>
1136                        <TD align=center><INPUT type="checkbox" checked></TD>
1137                        <TD width="20" align=center>&nbsp;</TD>
1138                </TR>
1139        </TABLE>';     
1140}
1141//________________________________________________________________________________________________________
1142
1143function ContextualXMLAcciones()
1144{
1145        global $TbMsg;
1146        global $sesion;
1147
1148        $layerXML='<MENUCONTEXTUAL';
1149        $layerXML.=' idctx="flo_acciones"';
1150        $layerXML.=' maxanchu=140';
1151        $layerXML.=' swimg=1';
1152        $layerXML.=' clase="menu_contextual"';
1153        $layerXML.='>';
1154       
1155        $layerXML.='<ITEM';
1156        if(empty($sesion)){
1157                $layerXML.=' alpulsar="filtroAccion(1)"';
1158                $layerXML.=' imgitem="../images/iconos/filtroaccion.gif"';
1159                $layerXML.=' textoitem='.$TbMsg[41];
1160                }
1161        else{
1162                $layerXML.=' alpulsar="filtroAccion(0)"';
1163                $layerXML.=' imgitem="../images/iconos/filtro_off.gif"';
1164                $layerXML.=' textoitem='.$TbMsg[43];           
1165        }       
1166               
1167        $layerXML.=' textoitem='.$TbMsg[41];
1168        $layerXML.='></ITEM>';
1169       
1170        $layerXML.='<SEPARADOR>';
1171        $layerXML.='</SEPARADOR>';
1172        $layerXML.=ContextualXMLComun();
1173        return($layerXML);     
1174}       
1175//________________________________________________________________________________________________________
1176
1177function ContextualXMLNotificaciones()
1178{       
1179
1180        $layerXML='<MENUCONTEXTUAL';
1181        $layerXML.=' idctx="flo_notificaciones"';
1182        $layerXML.=' maxanchu=140';
1183        $layerXML.=' swimg=1';
1184        $layerXML.=' clase="menu_contextual"';
1185        $layerXML.='>';
1186       
1187        $layerXML.=ContextualXMLComun();
1188        return($layerXML);     
1189}       
1190//________________________________________________________________________________________________________
1191
1192function ContextualXMLComun()
1193{       
1194        global $TbMsg;
1195        global $idcmdtskwrk;
1196        global $codtipoaccion;
1197        global $accionid;
1198        global $EJECUCION_TAREA;
1199        global $sesion;
1200       
1201        $layerXML="";
1202       
1203        $layerXML.='<ITEM';
1204        $layerXML.=' alpulsar="eleccion(1,document.facciones.localaccion)"';
1205        $layerXML.=' imgitem="../images/iconos/eliminar.gif"';
1206        $layerXML.=' textoitem='.$TbMsg[46];
1207        $layerXML.='></ITEM>';
1208
1209        $layerXML.='<ITEM';
1210        $layerXML.=' alpulsar="eleccion(2,document.facciones.localaccion)"';
1211        $layerXML.=' imgitem="../images/iconos/reiniciar.gif"';
1212        $layerXML.=' textoitem='.$TbMsg[45];
1213        $layerXML.='></ITEM>';
1214       
1215        $layerXML.='<SEPARADOR>';
1216        $layerXML.='</SEPARADOR>';
1217       
1218        $layerXML.='<ITEM';
1219        $layerXML.=' alpulsar="eleccion(3,document.facciones.localaccion)"';
1220        $layerXML.=' imgitem="../images/iconos/acDetenida.gif"';
1221        $layerXML.=' textoitem='.$TbMsg[14];
1222        $layerXML.='></ITEM>';
1223       
1224        $layerXML.='<ITEM';
1225        $layerXML.=' alpulsar="eleccion(4,document.facciones.localaccion)"';
1226        $layerXML.=' imgitem="../images/iconos/acIniciada.gif"';
1227        $layerXML.=' textoitem='.$TbMsg[15];
1228        $layerXML.='></ITEM>'; 
1229
1230        $layerXML.='<SEPARADOR>';
1231        $layerXML.='</SEPARADOR>';     
1232       
1233        $layerXML.='<ITEM';
1234        $layerXML.=' alpulsar="eleccion(5,document.facciones.localaccion)"';
1235        $layerXML.=' imgitem="../images/iconos/acExitosa.gif"';
1236        $layerXML.=' textoitem="'.$TbMsg[55].'"';
1237        $layerXML.='></ITEM>';
1238
1239        $layerXML.='<ITEM';
1240        $layerXML.=' alpulsar="eleccion(6,document.facciones.localaccion)"';
1241        $layerXML.=' imgitem="../images/iconos/acFallida.gif"';
1242        $layerXML.=' textoitem="'.$TbMsg[56].'"';
1243        $layerXML.='></ITEM>'; 
1244        $layerXML.='</MENUCONTEXTUAL>';
1245        return($layerXML);
1246}
1247?>
[319b9f5]1248
Note: See TracBrowser for help on using the repository browser.