source: admin/WebConsole/principal/colasacciones.php @ 7caf5a7c

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 7caf5a7c was 3ec149c, checked in by alonso <alonso@…>, 15 years ago

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