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

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 efe8ac7 was dc5e48a, checked in by ramon <ramongomez@…>, 13 years ago

Versión 1.0.4, #531: Retoques en mensajes y ficheros de idiomas.

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

  • Property mode set to 100644
File size: 45.1 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,
450                            comandos.visuparametros, ordenadores.nombreordenador,
451                            procedimientos.descripcion AS procedimiento,
452                            tareas.descripcion AS tarea, programaciones.sesion AS sesionprog
453                        FROM acciones
454                        INNER JOIN comandos ON comandos.idcomando=acciones.idcomando
455                        INNER JOIN ordenadores ON ordenadores.idordenador=acciones.idordenador
456                        LEFT OUTER JOIN procedimientos ON procedimientos.idprocedimiento=acciones.idprocedimiento
457                        LEFT OUTER JOIN tareas ON tareas.idtarea=acciones.idtarea
458                        LEFT OUTER JOIN programaciones ON programaciones.sesion=acciones.sesion";
459        if(!empty($sesion)) // Filtro por acción
460                $cmd->texto.=" WHERE acciones.sesion =".$sesion;
461        else
462                $cmd->texto.=" WHERE acciones.sesion NOT IN (".$cadenasesion.")";
463               
464        if($estado==$ACCION_PROGRAMADA)
465                $cmd->texto.=" AND (acciones.idprogramacion=0 AND programaciones.sesion>0)"; // Comando programado
466        else{
467                if(!empty($ClausulaWhere))
468                        $cmd->texto.=" AND (".$ClausulaWhere.")";
469        }       
470        $cmd->texto.=" ORDER BY acciones.idaccion DESC, acciones.sesion DESC";
471        $rs=new Recordset;
472        $rs->Comando=&$cmd;
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;
495while (!$rs->EOF){
496echo $rs->campos['descripcion'].'</br>';
497};
498}
499//      _________________________________________________________________________
500
501function listaTarea($rs,$sesion)
502{
503        global $acciones;
504       
505        $oA=new clsAccion; // Crea objeto acción para procesar comandos
506        iniAccion($rs,$oA);     
507        $html=recorreTarea($rs,$sesion,$oA);   
508        if(cumpleCriterios($oA)){
509                $acciones.=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Concadena identificador
510                $html=cabeceraSesion($oA).$html; // Escribe la cabecera del comando
511        }
512        else
513                $html=""; // No cumple con los criterios       
514        return($html);         
515}               
516//      _________________________________________________________________________
517
518function recorreTarea($rs,$sesion,$oA)
519{
520        $html="";
521        do{
522                $html.=listaProcedimiento($rs,$sesion,$rs->campos["idtarea"],$oA);
523        }while(!$rs->EOF
524                        && $rs->campos["sesion"]==$sesion);
525        return($html); 
526}
527//      _________________________________________________________________________
528
529function listaProcedimiento($rs,$sesion,$idtarea=0,$oA=null)
530{
531        global $acciones;
532       
533        if($oA!=null){ // Si la función es invocada por una tarea ...
534                $html=recorreProcedimiento($rs,$sesion,$idtarea,$oA);
535        }
536        else{
537                $oA=new clsAccion; // Crea objeto acción para procesar comandos
538                iniAccion($rs,$oA);     
539                $html=recorreProcedimiento($rs,$sesion,$idtarea,$oA);   
540                if(cumpleCriterios($oA)){
541                        $acciones.=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Concadena identificador
542                        if($rs->campos["sesion"]!=$sesion
543                                || $rs->campos["idtarea"]!=$idtarea
544                                || $rs->EOF)
545                                $html=cabeceraSesion($oA).$html; // Escribe la cabecera del procedimiento
546                }
547                else
548                        $html=""; // No cumple con los criterios                       
549        }
550        return($html);         
551}               
552//      _________________________________________________________________________
553
554function recorreProcedimiento($rs,$sesion,$idtarea,$oA)
555{
556        $html="";
557        do{
558                $html.=listaComado($rs,$sesion,$idtarea,$rs->campos["idprocedimiento"],$oA);
559        }while(!$rs->EOF
560                        && $rs->campos["sesion"]==$sesion
561                        && $rs->campos["idtarea"]==$idtarea);
562        return($html); 
563}
564//      _________________________________________________________________________
565
566function listaComado($rs,$sesion,$idtarea=0,$idprocedimiento=0,$oA=null)
567{
568        global $acciones;
569        global $visupro;
570       
571        if($oA!=null){ // Si la función es invocada por un procedimiento...
572                $html.=recorreComando($rs,$sesion,$idtarea,$idprocedimiento,$oA);
573        }
574        else{
575                $oA=new clsAccion; // Crea objeto acción para procesar comandos
576                iniAccion($rs,$oA);     
577                $html=recorreComando($rs,$sesion,$idtarea,$idprocedimiento,$oA);
578       
579                $acciones.=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Concadena identificador
580                if($rs->campos["sesion"]!=$sesion
581                        || $rs->campos["idtarea"]!=$idtarea
582                        || $rs->campos["idprocedimiento"]!=$idprocedimiento
583                        || $rs->EOF)
584                        if($oA->linot>0)                               
585                                $html=cabeceraSesion($oA).$html; // Escribe la cabecera del comando
586        }
587        return($html);
588}
589//      _________________________________________________________________________
590
591function recorreComando($rs,$sesion,$idtarea,$idprocedimiento,$oA)
592{
593        $html="";
594        do{
595                $html.=listaNotificacion($rs,$sesion,$idtarea,$idprocedimiento,$rs->campos["idcomando"],$oA);
596        }while(!$rs->EOF
597                        && $rs->campos["sesion"]==$sesion
598                        && $rs->campos["idtarea"]==$idtarea
599                        && $rs->campos["idprocedimiento"]==$idprocedimiento);
600        return($html); 
601}
602//      _________________________________________________________________________
603//     
604//      Recorre todas las notificaciones de un mismo comando registrando
605//  los datos que servirán para resumen de la Acción
606//      _________________________________________________________________________
607
608function listaNotificacion($rs,$sesion,$idtarea,$idprocedimiento,$idcomando,$oA)
609{       
610        global $ACCION_EXITOSA;
611        global $ACCION_FALLIDA;
612        global $ACCION_SINRESULTADO;
613
614        global $ACCION_DETENIDA;
615        global $ACCION_INICIADA;
616        global $ACCION_FINALIZADA;
617                       
618        global $EJECUCION_TAREA;
619        global $visuprm;
620        global $visucmd;
621        global $visupro;
622
623        $html="";
624       
625        if($visupro==1)
626                $html.=cambiaAmbito($rs,$oA); // Escribe cambio de ámbito       
627               
628        if($visuprm==1)
629                $html.=escribeParametros($rs->campos["comando"],$rs->campos["parametros"],$rs->campos["visuparametros"],$oA);
630       
631       
632
633        do{
634                if(cumpleCriteriosNot($rs,$oA)){
635                        if($visucmd==1){
636                                $html.=escribeNotificacion($rs,$oA);
637                                $oA->linot++; // Contador de lineas de notificaciones escritas cumpliendo criterios
638                        }                               
639                }
640                /* Fechas y horas */
641                $fechahorareg=strtotime($rs->campos["fechahorareg"]);
642                if($fechahorareg>0)
643                        if($oA->fechahorareg>$fechahorareg) $oA->fechahorareg=$fechahorareg;
644                $fechahorafin=strtotime($rs->campos["fechahorafin"]);
645                if($fechahorafin>0)
646                        if($oA->fechahorafin<$fechahorafin) $oA->fechahorafin=$fechahorafin;
647
648                $oA->notif++; // Contador de notificaciones en el comando
649                switch($rs->campos["estado"]){
650                        case $ACCION_INICIADA:
651                                $oA->notini++; // Incrementa contador de comandos con estado de finalizado
652                                break;
653                        case $ACCION_DETENIDA:
654                                $oA->notdet++; // Incrementa contador de comandos con estado de finalizado
655                                break;
656                        case $ACCION_FINALIZADA:
657                                $oA->noter++; // Incrementa contador de comandos con estado de finalizado
658                                break;                         
659                }
660                /* Cuestión resultados */
661                /* Si existe al menos una notificación de error, la acción tiene ya resultado de error */
662                if($rs->campos["resultado"]==$ACCION_FALLIDA){
663                        $oA->resultado=$ACCION_FALLIDA;
664                }
665                /* Si existe aún alguna notificación pendiente, la acción no tiene resultado global */
666                if($rs->campos["resultado"]==$ACCION_SINRESULTADO){
667                        if($oA->resultado==$ACCION_EXITOSA)             
668                                $oA->resultado=$ACCION_SINRESULTADO;
669                }               
670                $rs->Siguiente();       
671               
672        }while(!$rs->EOF
673                        && $rs->campos["sesion"]==$sesion
674                        && $rs->campos["idtarea"]==$idtarea
675                        && $rs->campos["idprocedimiento"]==$idprocedimiento
676                        && $rs->campos["idcomando"]==$idcomando);
677       
678        if($oA->notif>0)
679                $oA->porcen=floor($oA->noter*100/$oA->notif); // Calcula porcentaje de finalización
680
681        if($oA->notif==$oA->noter)
682                $oA->estado=$ACCION_FINALIZADA;  // Todas las acciones finalizadas
683        else{
684                if($oA->notif==$oA->notdet)
685                        $oA->estado=$ACCION_DETENIDA;  // Todas las acciones detenidas
686                else
687                        $oA->estado=$ACCION_INICIADA;
688        }
689        if(cumpleCriterios($oA)){
690                if($rs->campos["sesion"]!=$sesion && !$rs->EOF ) // Separación entre sesiones distintas
691                        $html.='<TR id="'.$oA->sesion.'" value="A"><TD colspan=12 style="BACKGROUND-COLOR:white;BORDER-BOTTOM:#999999 1px solid;">&nbsp;</TD></TR>';
692        }
693        return($html);
694}
695//      _________________________________________________________________________
696
697function escribeNotificacion($rs,$oA)
698{
699                global $ACCION_EXITOSA;
700                global $ACCION_FALLIDA;
701                global $ACCION_SINRESULTADO;
702
703                global $ACCION_DETENIDA;
704                global $ACCION_INICIADA;
705                global $ACCION_FINALIZADA;
706               
707                global $TbMsg;
708                global $visupro;
709                global $visuprm;
710               
711                $html="";       
712                $html.='<TR id="'.$oA->sesion.'" value="D">';
713                if($visupro==0 )
714                        $html.='<TD align=right colspan=2>'.$rs->campos["comando"].'&nbsp;</TD>';
715                else
716                        $html.='<TD align=right colspan=2>&nbsp;</TD>';
717                       
718                /* Resultado */
719                switch($rs->campos["resultado"]){
720                        case $ACCION_EXITOSA:
721                                $html.='<TD align=center><IMG value="'.$ACCION_EXITOSA.'" src="../images/iconos/acExitosa.gif" width=16 height=16></TD>';
722                                break;
723                        case $ACCION_FALLIDA:
724                                $html.='<TD align=center><IMG value="'.$ACCION_FALLIDA.'" src="../images/iconos/acFallida.gif" width=16 height=16></TD>';
725                                break;
726                        case $ACCION_SINRESULTADO:
727                                $html.='<TD align=center><IMG value="'.$ACCION_SINRESULTADO.'" src="../images/iconos/nada.gif" width=16 height=16></TD>';
728                                break;
729                }       
730                if($oA->swcp){ // Comando programado
731                        $html.='<TD align=center>&nbsp;</TD>';
732                        $html.='<TD align=center>&nbsp;</TD>';
733                        $html.='<TD align=center>&nbsp;</TD>';
734                        $html.='<TD align=center>&nbsp;</TD>';
735                }
736                else{
737                        /* Fechas y horas */
738                        list($fecha,$hora)=split(" ",substr($rs->campos["fechahorafin"],0));
739                        if ($fecha=="0000-00-00") $hora="";
740                        $html.='<TD align=center>&nbsp;'.InvFecha($fecha).'&nbsp;</TD>';
741                        $html.='<TD align=center>&nbsp;'.$hora.'&nbsp;</TD>';
742                               
743                        list($fecha,$hora)=split(" ",substr($rs->campos["fechahorareg"],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                       
749                /* Ámbito de aplicación */
750                $urlimg='../images/iconos/ordenador.gif';
751                $accion=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",".$rs->campos["idaccion"].";"; // Tripla clave 
752                $oncontxt="document.facciones.localaccion.value='".$accion."';";
753                $oncontxt.="menu_contextual(null,'flo_notificaciones');";
754               
755                $html.='<TD id="'.$rs->campos["idaccion"].'" align=center><A href="#cmd"><IMG border=0 src="'.$urlimg.'"
756                                oncontextmenu="'.$oncontxt.'" ></A></TD>';
757                $html.='<TD align=left>&nbsp;'.$rs->campos["nombreordenador"].'&nbsp;</TD>';   
758               
759                /* Descripción de la notificación (Descripción del error si se ha producido alguno) */ 
760                $html.='<TD>&nbsp;'.$rs->campos["descrinotificacion"].'&nbsp;</TD>';
761                       
762                /* Estado */
763                if($oA->swcp) // Comando programado
764                                $html.='<TD align=center><IMG value="'.$ACCION_DETENIDA.'"
765                                src="../images/iconos/reloj.gif" width=16 height=16 style="cursor:pointer"
766                                onclick="programacion('.$rs->campos["idtipoaccion"].','.$rs->campos["sesion"].',\''.$rs->campos["comando"].'\')"></TD>';
767                else{
768                        switch($rs->campos["estado"]){
769                                case $ACCION_DETENIDA:
770                                        $html.='<TD align=center><IMG value="'.$ACCION_DETENIDA.'" src="../images/iconos/acDetenida.gif" width=16 height=16></TD>';
771                                        break;
772                                case $ACCION_INICIADA:
773                                        $html.='<TD align=center><IMG value="'.$ACCION_INICIADA.'" src="../images/iconos/acIniciada.gif" width=16 height=16></TD>';
774                                        break;
775                                case $ACCION_FINALIZADA:
776                                        $html.='<TD align=center><IMG value="'.$ACCION_FINALIZADA.'" src="../images/iconos/acFinalizada.gif" width=16 height=16></TD>';
777                                        break;
778                        }
779                }       
780
781                /* Porcentaje */
782                $html.='<TD align=center>&nbsp;</TD>';         
783                $html.='</TR>';
784                return($html);
785}       
786//      _________________________________________________________________________
787//     
788//      Inicializa la clase acción
789//
790//      Parámetros:
791//              oA: Objeto acción a inicializar
792//      _________________________________________________________________________
793
794function iniAccion($rs,$oA)
795{
796        global $ACCION_EXITOSA;
797        global $ACCION_DETENIDA;
798       
799        $oA->ambito=$rs->campos["ambito"];
800        $oA->idambito=$rs->campos["idambito"];
801        $oA->tipoaccion=$rs->campos["tipoaccion"];
802        $oA->idtipoaccion=$rs->campos["idtipoaccion"];
803        $oA->descriaccion=$rs->campos["descriaccion"];
804        $oA->sesion=$rs->campos["sesion"];
805        $oA->fechahorareg=strtotime($rs->campos["fechahorareg"]);
806        $oA->fechahorafin=0;
807        $oA->estado=$ACCION_DETENIDA;
808        $oA->resultado=$ACCION_EXITOSA;
809        $oA->notif=$oA->noter=$oA->notini=$oA->notdet=$oA->linot=$oA->porcen=0;
810        if(empty($rs->campos["idprogramacion"]) && !empty($rs->campos["sesionprog"])) // switch de Comando programado
811                $oA->swcp=true;
812        else
813                $oA->swcp=false;
814}
815//      _________________________________________________________________________
816
817function cabeceraSesion($oA)
818{
819        global $EJECUCION_COMANDO;
820        global $EJECUCION_PROCEDIMIENTO;
821        global $EJECUCION_TAREA;
822
823        $html="";               
824        $html.='<TR id="'.$oA->sesion.'" value="C">';
825       
826        $accion=$oA->tipoaccion.",".$oA->idtipoaccion.",".$oA->sesion.",0;"; // Tripla clave   
827        $oncontxt="document.facciones.sesion.value='".$oA->sesion."';";
828        $oncontxt.="document.facciones.localaccion.value='".$accion."';menu_contextual(null,'flo_acciones');";
829        switch($oA->tipoaccion){
830                case $EJECUCION_COMANDO:
831                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG style="cursor:pointer" border=0
832                                        oncontextmenu="'.$oncontxt.'"
833                                        src="../images/iconos/comandos.gif"></TD>';
834                        break;
835                case $EJECUCION_PROCEDIMIENTO:
836                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG style="cursor:pointer" border=0
837                                        oncontextmenu="'.$oncontxt.'"
838                                        src="../images/iconos/procedimiento.gif"></TD>';
839                        break;                         
840                case $EJECUCION_TAREA:
841                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG style="cursor:pointer" border=0 
842                                        oncontextmenu="'.$oncontxt.'"
843                                        src="../images/iconos/tareas.gif"></TD>';
844                        break;                                 
845        }
846        /* Cabeceras */
847        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=left><b>'.$oA->descriaccion.'</b></TD>';
848        $html.=escribeResumen($oA);
849        $html.='</TR>';
850
851        return($html);
852}
853//      _________________________________________________________________________
854
855function escribeResumen($oA)
856{
857                global $cmd;
858                global $TbMsg;
859                               
860                global $ACCION_EXITOSA;
861                global $ACCION_FALLIDA;
862                global $ACCION_SINRESULTADO;
863                       
864                global $EJECUCION_TAREA;
865                       
866                $html="";               
867               
868                if($oA->swcp){ // Comando programado
869                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
870                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
871                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
872                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
873                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
874                        /* Ámbito de aplicación */
875                        tomaAmbito($oA->ambito,&$urlimg,&$textambito);
876                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG src="'.$urlimg.'"></TD>';
877                        tomaDescriAmbito($cmd,$oA->ambito,$oA->idambito,&$textambito);
878                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;'.$textambito.'&nbsp;</TD>';     
879                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
880                       
881                                $html.='<TH align=center><IMG value="'.$ACCION_DETENIDA.'"
882                                src="../images/iconos/reloj.gif" width=16 height=16 style="cursor:pointer"
883                                onclick="programacion('.$oA->idtipoaccion.','.$oA->sesion.',\''.$oA->descriaccion.'\')"></TH>';
884                               
885                       
886                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
887                        return($html);
888                }
889               
890                /* Resultado */
891                switch($oA->resultado){
892                        case $ACCION_EXITOSA:
893                                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG value="'.$ACCION_EXITOSA.'" src="../images/iconos/acExitosa.gif" width=16 height=16></TD>';
894                                break;
895                        case $ACCION_FALLIDA:
896                                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG value="'.$ACCION_FALLIDA.'" src="../images/iconos/acFallida.gif" width=16 height=16></TD>';
897                                break;
898                        case $ACCION_SINRESULTADO:
899                                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG value="'.$ACCION_SINRESULTADO.'" src="../images/iconos/nada.gif" width=16 height=16></TD>';
900                }       
901                /* Fechas y horas */
902                if($oA->porcen==100){ // Si está acabada la acción
903                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%d-%m-%Y",$oA->fechahorafin).'&nbsp;</TD>';
904                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%H:%M:%S",$oA->fechahorafin).'&nbsp;</TD>';
905                }
906                else
907                {
908                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
909                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;</TD>';
910                }
911
912                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%d-%m-%Y",$oA->fechahorareg).'&nbsp;</TD>';
913                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>&nbsp;'.strftime("%H:%M:%S",$oA->fechahorareg).'&nbsp;</TD>';
914
915                if($oA->tipoaccion==$EJECUCION_TAREA){
916                        $html.='<TD  style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;</TD>';
917                        $html.='<TD  style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;</TD>';
918                }
919                else{
920                        /* Ámbito de aplicación */
921                        tomaAmbito($oA->ambito,&$urlimg,&$textambito);
922                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center><IMG src="'.$urlimg.'"></TD>';
923                        tomaDescriAmbito($cmd,$oA->ambito,$oA->idambito,&$textambito);
924                        $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=left>&nbsp;'.$textambito.'&nbsp;</TD>';     
925                }       
926               
927                /* Descripción de la notificación (Descripción del error si se ha producido alguno) */ 
928                $html.='<TD style="BACKGROUND-COLOR: #b5daad" >&nbsp;'.$rs->campos["descrinotificacion"].'&nbsp;</TD>';
929
930                /* Estado */
931                $html.='<TD style="BACKGROUND-COLOR: #b5daad"  align=center>&nbsp;</TD>';
932               
933                /* Porcentaje */
934                $html.='<TD style="BACKGROUND-COLOR: #b5daad" align=center>'.$oA->porcen.'%</TD>';
935               
936       
937                return($html);
938}
939//      _________________________________________________________________________
940
941function cambiaAmbito($rs,$oA)
942{
943        global $cmd;
944        global $TbMsg;
945       
946        $bgcolor="#f6c8f5";
947        $html="";
948        $html.='<TR id="'.$oA->sesion.'" value="A">';
949        $procedimiento=TomaDato($cmd,0,'procedimientos',$rs->campos["idprocedimiento"],'idprocedimiento','descripcion');
950        $html.='<TD colspan=2 align="right" style="BACKGROUND-COLOR:'.$bgcolor.'">'.$rs->campos["comando"].'&nbsp;</TD>';
951        $html.='<TD style="BACKGROUND-COLOR:'.$bgcolor.'"><IMG style="cursor:pointer" src="../images/iconos/nada.gif">&nbsp;</TD>';
952        $html.='<TD colspan=4 style="BACKGROUND-COLOR:'.$bgcolor.'" align=right>'.$procedimiento.'&nbsp;</TD>';
953       
954        /* Ámbito de aplicación */
955        tomaAmbito($rs->campos["ambito"],&$urlimg,&$textambito);
956        $html.='<TD style="BACKGROUND-COLOR:'.$bgcolor.'" align=center><IMG src="'.$urlimg.'"></TD>';
957        tomaDescriAmbito($cmd,$rs->campos["ambito"],$rs->campos["idambito"],&$textambito);
958        $html.='<TD style="BACKGROUND-COLOR:'.$bgcolor.'" align=left>&nbsp;'.$textambito.'&nbsp;</TD>';
959        $html.='<TD colspan=3 style="BACKGROUND-COLOR:'.$bgcolor.'" align=center>&nbsp;</TD>';
960        $html.='</TR>';
961        return($html);
962}
963//      _________________________________________________________________________
964//
965//      Comprueba si se cumplen los criterios para visualizar la acción
966//      _________________________________________________________________________
967
968function cumpleCriterios($oA)
969{
970        global $porcendesde;
971        global $porcenhasta;
972        global $estado;
973        global $resultado;
974        global $ACCION_PROGRAMADA;
975
976        if($estado==$ACCION_PROGRAMADA){       
977                if(!$oA->swcp)
978                        return(false); // Comandos programados
979                else
980                        return(true);
981        }
982        if($oA->swcp){
983                if($estado!=$ACCION_PROGRAMADA && $estado>0)   
984                        return(false); // Comandos programados
985                else
986                        return(true);
987        }
988
989        // Cuestion estados
990        if(!empty($estado))
991                if($oA->estado!=$estado) return(false);
992
993        if(!empty($resultado))         
994                if($oA->resultado!=$resultado) return(false);
995       
996        if($oA->porcen<$porcendesde || $oA->porcen>$porcenhasta) return(false);
997        return(true);
998}
999//      _________________________________________________________________________
1000//
1001//      Comprueba si se cumplen los criterios para visualizar la notificación
1002//      _________________________________________________________________________
1003function cumpleCriteriosNot($rs,$oA)
1004{
1005        global $porcendesde;
1006        global $porcenhasta;
1007        global $estado;
1008        global $resultado;
1009        global $ACCION_PROGRAMADA;
1010
1011        if($estado==$ACCION_PROGRAMADA){       
1012                if(!$oA->swcp)
1013                        return(false); // Comandos programados
1014                else
1015                        return(true);
1016        }
1017        if($oA->swcp){
1018                if($estado!=$ACCION_PROGRAMADA && $estado>0)   
1019                        return(false); // Comandos programados
1020                else
1021                        return(true);
1022        }
1023        // Cuestion estados
1024        if(!empty($estado))
1025                if($rs->campos["estado"]!=$estado) return(false);
1026
1027        if(!empty($resultado))         
1028                if($rs->campos["resultado"]!=$resultado) return(false);
1029
1030        return(true);
1031}
1032//      _________________________________________________________________________
1033//
1034//      Clase para procesar las acciones
1035//      _________________________________________________________________________
1036
1037class clsAccion
1038{
1039        var $ambito;
1040        var $idambito;
1041        var $tipoaccion;
1042        var $idtipoaccion;     
1043        var $descriaccion;
1044        var $sesion;
1045        var $fechahorafin;
1046        var $fechahorareg;
1047        var $estado;
1048        var $resultado;
1049        var $porcen;
1050        var $notif;
1051        var $noter;
1052        var $notdet;
1053        var $notini;
1054        var $linot;
1055        var $swcp;
1056        function clsAccion(){  // Constructor
1057
1058        }
1059}
1060//________________________________________________________________________________________________________
1061
1062function escribeParametros($comando,$parametros,$visuparametros,$oA)
1063{       
1064        global $cmd;
1065        global $visupro;
1066        global $visupro;
1067        global $visucmd;
1068
1069        $html="";
1070        $tbParametrosValor=array();
1071        ParametrosValor($cmd,$parametros,&$tbParametrosValor); // Toma valores de cada parámetro
1072        $vprm=split(";",$visuparametros);
1073
1074        if($visupro==1 || ($visupro=0 && $visucmd==0)) $comando="&nbsp;"; // No se muestra el nombre del comando
1075        for($i=0;$i<sizeof($vprm);$i++){
1076                $nemo=$vprm[$i]; // Para cada parámetro visualizable ...
1077                if(isset($tbParametrosValor[$nemo])){
1078                        for($j=0;$j<sizeof($tbParametrosValor[$nemo])-1;$j++){
1079                                $descripcion=$tbParametrosValor[$nemo]["descripcion"];
1080                                $valor=$tbParametrosValor[$nemo][$j]["valor"];
1081                                if(sizeof($tbParametrosValor[$nemo])>2)
1082                                        $valor=$tbParametrosValor[$nemo][$j]["valor"];
1083                                else
1084                                        $valor=$tbParametrosValor[$nemo]["valor"];
1085                                $html.=escribiendoParametros($comando,$descripcion,$valor,$oA);
1086                        }       
1087                }       
1088        }
1089        if(empty($visuparametros)){ // Sin parametros
1090                $bgcolor="#cedcec";
1091                $html.='<TR id="'.$oA->sesion.'" value="A">';
1092                $html.='<TD align=right style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=2>'.$comando.'</TD>';
1093                $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';">&nbsp;</TD>';
1094                $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=9>&nbsp;</TD>';
1095                $html.='</TR>';
1096        }
1097        return($html);
1098}
1099//________________________________________________________________________________________________________
1100
1101function escribiendoParametros($comando,$descripcion,$valor,$oA)
1102{
1103        $sw=true;
1104        $html="";
1105       
1106        $bgcolor="#cedcec";
1107        $html.='<TR id="'.$oA->sesion.'" value="A">';
1108        if($sw){
1109                $html.='<TD align=right style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=2>'.$comando.'</TD>';
1110                $sw=false;
1111        }
1112        else
1113                $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=2>&nbsp;</TD>';
1114        $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';">&nbsp;</TD>';
1115        $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=4><b>'.$descripcion.'</b>:
1116        '.$valor.'</TD>';
1117        $html.='<TD style="BACKGROUND-COLOR: '.$bgcolor.';" colspan=5 >&nbsp;</TD>';
1118        $html.='</TR>';
1119        return($html); 
1120}
1121//________________________________________________________________________________________________________
1122
1123function escribeCheck()
1124{
1125        echo'
1126        <TABLE class="tabla_busquedas" align=center border=0 cellPadding=0 cellSpacing=0>
1127                <TR>
1128                TH height=15 align="center" colspan=14><? echo $TbMsg[18]?></TH>
1129                </TR>
1130                <TR>
1131                        <TD align=right><? echo $TbMsg[30]?></TD>
1132                        <TD align=center><INPUT type="checkbox" checked></TD>
1133                        <TD width="20" align=center>&nbsp;</TD>
1134                </TR>
1135        </TABLE>';     
1136}
1137//________________________________________________________________________________________________________
1138
1139function ContextualXMLAcciones()
1140{
1141        global $TbMsg;
1142        global $sesion;
1143
1144        $layerXML='<MENUCONTEXTUAL';
1145        $layerXML.=' idctx="flo_acciones"';
1146        $layerXML.=' maxanchu=140';
1147        $layerXML.=' swimg=1';
1148        $layerXML.=' clase="menu_contextual"';
1149        $layerXML.='>';
1150       
1151        $layerXML.='<ITEM';
1152        if(empty($sesion)){
1153                $layerXML.=' alpulsar="filtroAccion(1)"';
1154                $layerXML.=' imgitem="../images/iconos/filtroaccion.gif"';
1155                $layerXML.=' textoitem='.$TbMsg[41];
1156                }
1157        else{
1158                $layerXML.=' alpulsar="filtroAccion(0)"';
1159                $layerXML.=' imgitem="../images/iconos/filtro_off.gif"';
1160                $layerXML.=' textoitem='.$TbMsg[43];           
1161        }       
1162               
1163        $layerXML.=' textoitem='.$TbMsg[41];
1164        $layerXML.='></ITEM>';
1165       
1166        $layerXML.='<SEPARADOR>';
1167        $layerXML.='</SEPARADOR>';
1168        $layerXML.=ContextualXMLComun();
1169        return($layerXML);     
1170}       
1171//________________________________________________________________________________________________________
1172
1173function ContextualXMLNotificaciones()
1174{       
1175
1176        $layerXML='<MENUCONTEXTUAL';
1177        $layerXML.=' idctx="flo_notificaciones"';
1178        $layerXML.=' maxanchu=140';
1179        $layerXML.=' swimg=1';
1180        $layerXML.=' clase="menu_contextual"';
1181        $layerXML.='>';
1182       
1183        $layerXML.=ContextualXMLComun();
1184        return($layerXML);     
1185}       
1186//________________________________________________________________________________________________________
1187
1188function ContextualXMLComun()
1189{       
1190        global $TbMsg;
1191        global $idcmdtskwrk;
1192        global $codtipoaccion;
1193        global $accionid;
1194        global $EJECUCION_TAREA;
1195        global $sesion;
1196       
1197        $layerXML="";
1198       
1199        $layerXML.='<ITEM';
1200        $layerXML.=' alpulsar="eleccion(1,document.facciones.localaccion)"';
1201        $layerXML.=' imgitem="../images/iconos/eliminar.gif"';
1202        $layerXML.=' textoitem='.$TbMsg[46];
1203        $layerXML.='></ITEM>';
1204
1205        $layerXML.='<ITEM';
1206        $layerXML.=' alpulsar="eleccion(2,document.facciones.localaccion)"';
1207        $layerXML.=' imgitem="../images/iconos/reiniciar.gif"';
1208        $layerXML.=' textoitem='.$TbMsg[45];
1209        $layerXML.='></ITEM>';
1210       
1211        $layerXML.='<SEPARADOR>';
1212        $layerXML.='</SEPARADOR>';
1213       
1214        $layerXML.='<ITEM';
1215        $layerXML.=' alpulsar="eleccion(3,document.facciones.localaccion)"';
1216        $layerXML.=' imgitem="../images/iconos/acDetenida.gif"';
1217        $layerXML.=' textoitem='.$TbMsg[14];
1218        $layerXML.='></ITEM>';
1219       
1220        $layerXML.='<ITEM';
1221        $layerXML.=' alpulsar="eleccion(4,document.facciones.localaccion)"';
1222        $layerXML.=' imgitem="../images/iconos/acIniciada.gif"';
1223        $layerXML.=' textoitem='.$TbMsg[15];
1224        $layerXML.='></ITEM>'; 
1225
1226        $layerXML.='<SEPARADOR>';
1227        $layerXML.='</SEPARADOR>';     
1228       
1229        $layerXML.='<ITEM';
1230        $layerXML.=' alpulsar="eleccion(5,document.facciones.localaccion)"';
1231        $layerXML.=' imgitem="../images/iconos/acExitosa.gif"';
1232        $layerXML.=' textoitem="'.$TbMsg[55].'"';
1233        $layerXML.='></ITEM>';
1234
1235        $layerXML.='<ITEM';
1236        $layerXML.=' alpulsar="eleccion(6,document.facciones.localaccion)"';
1237        $layerXML.=' imgitem="../images/iconos/acFallida.gif"';
1238        $layerXML.=' textoitem="'.$TbMsg[56].'"';
1239        $layerXML.='></ITEM>'; 
1240        $layerXML.='</MENUCONTEXTUAL>';
1241        return($layerXML);
1242}
1243while (!$rs->EOF){
1244echo $rs['descripcion'];
1245};
1246?>
Note: See TracBrowser for help on using the repository browser.