source: admin/WebConsole/principal/colasacciones.php @ 2256beb

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 2256beb was 2e7c034, checked in by albertogp <albertogp@…>, 13 years ago

Incluido en Version 1.0 #485

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

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