1 | <? |
---|
2 | // ************************************************************************************************************************************************* |
---|
3 | // Aplicación WEB: ogAdmWebCon |
---|
4 | // Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla |
---|
5 | |
---|
6 | // Fecha Creación: Año 2003-2004 |
---|
7 | // Fecha Última modificación: Febrero-2005 |
---|
8 | // Nombre del fichero: tareascomandos.php |
---|
9 | // Descripción : |
---|
10 | // Administra los comandos que forman parte de una tarea |
---|
11 | // ************************************************************************************************************************************************* |
---|
12 | include_once("../includes/ctrlacc.php"); |
---|
13 | include_once("../clases/AdoPhp.php"); |
---|
14 | include_once("../includes/constantes.php"); |
---|
15 | include_once("../includes/comunes.php"); |
---|
16 | include_once("../includes/CreaComando.php"); |
---|
17 | include_once("../includes/TomaDato.php"); |
---|
18 | include_once("../idiomas/php/".$idioma."/tareascomandos_".$idioma.".php"); |
---|
19 | //________________________________________________________________________________________________________ |
---|
20 | $idtarea=0; |
---|
21 | $descripciontarea=""; |
---|
22 | if (isset($_GET["idtarea"])) $idtarea=$_GET["idtarea"]; // Recoge parametros |
---|
23 | if (isset($_GET["descripciontarea"])) $descripciontarea=$_GET["descripciontarea"]; // Recoge parametros |
---|
24 | |
---|
25 | $cmd=CreaComando($cadenaconexion); // Crea objeto comando |
---|
26 | if (!$cmd) |
---|
27 | Header('Location: '.$pagerror.'?herror=2'); // Error de conexión con servidor B.D. |
---|
28 | //________________________________________________________________________________________________________ |
---|
29 | ?> |
---|
30 | <HTML> |
---|
31 | <HEAD> |
---|
32 | <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
---|
33 | <LINK rel="stylesheet" type="text/css" href="../estilos.css"> |
---|
34 | <SCRIPT language="javascript" src="../jscripts/tareascomandos.js"></SCRIPT> |
---|
35 | <SCRIPT language="javascript" src="../jscripts/opciones.js"></SCRIPT> |
---|
36 | <? echo '<SCRIPT language="javascript" src="../idiomas/javascripts/'.$idioma.'/tareascomandos_'.$idioma.'.js"></SCRIPT>'?> |
---|
37 | </HEAD> |
---|
38 | <BODY> |
---|
39 | <FORM name="fdatos"> |
---|
40 | <INPUT type=hidden value="<? echo $idcentro?>" id=idcentro> |
---|
41 | <P align=center class=cabeceras><IMG src="../images/iconos/tareas.gif"> <?echo $TbMsg[0]?><BR> |
---|
42 | <SPAN align=center class=subcabeceras><?echo $TbMsg[1]?></SPAN> <IMG src="../images/iconos/comandos.gif"><BR><BR> |
---|
43 | <SPAN align=center class=presentaciones><B><?echo $TbMsg[2]?>: </B><? echo $descripciontarea?></SPAN></P> |
---|
44 | <DIV align=center id="Layer_componentes"> |
---|
45 | <TABLE class="tabla_listados" cellspacing=1 cellpadding=0 id="TABLACOMANDOS" width="90%"> |
---|
46 | <TR height=20> |
---|
47 | <TH> </TH> |
---|
48 | <TH><IMG src="../images/iconos/eliminar.gif"></TH> |
---|
49 | <TH colspan=2 align=left> <?echo $TbMsg[3]?></TH> |
---|
50 | <TH><?echo $TbMsg[4]?></TH> |
---|
51 | <TH>A</TH> |
---|
52 | </TR> |
---|
53 | <? |
---|
54 | $rs=new Recordset; |
---|
55 | $cmd->texto='SELECT tareas_comandos.*, comandos.descripcion,comandos.visuparametros FROM tareas_comandos INNER JOIN comandos ON tareas_comandos.idcomando = comandos.idcomando WHERE tareas_comandos.idtarea='.$idtarea.' ORDER BY tareas_comandos.orden'; |
---|
56 | $rs->Comando=&$cmd; |
---|
57 | if ($rs->Abrir()){ |
---|
58 | $rs->Primero(); |
---|
59 | $tabla_parametros=""; // Tabla para localizar parametros |
---|
60 | $cont_parametros=0; // Contador de la tabla |
---|
61 | CreaTablaParametros($cmd); // Crea tabla especificaciones de parametros |
---|
62 | while (!$rs->EOF){ |
---|
63 | echo '<TR style="display:block" id=TR-'.$rs->campos["idtareacomando"].'>'; |
---|
64 | echo '<TD align=center><IMG onclick="ver_parametros(this,0,'.$rs->campos["idtareacomando"].');" style="cursor:hand;display:block" src="../images/tsignos/contra.gif"><IMG onclick="ver_parametros(this,1,'.$rs->campos["idtareacomando"].');"style="cursor:hand;display:none" src="../images/tsignos/desple.gif"></TD>'; |
---|
65 | echo '<TD align=center ><INPUT id=checkbox-'.$rs->campos["idtareacomando"].' type=checkbox onclick="gestion_comandos('.$rs->campos["idtareacomando"].',this)" checked ></INPUT></TD>'; |
---|
66 | // Descripcion de la comando |
---|
67 | echo '<TD colspan=2> '.$rs->campos["descripcion"].'</TD>'; |
---|
68 | // Orden del item del item |
---|
69 | echo '<TD align=center > <INPUT class="formulariodatos" id=orden-'.$rs->campos["idtareacomando"].' style="WIDTH:20px" type=text value="'.$rs->campos["orden"].'"></INPUT></TD>'; |
---|
70 | echo '<TD width="10%" align=center id="imgact-'.$rs->campos["idtareacomando"].'"><IMG src="../images/iconos/actualizar.gif" style="cursor:hand" onclick="ActualizarAccion('.$rs->campos["idtareacomando"].')"></TD>'; |
---|
71 | echo '</TR>'; |
---|
72 | pintacomandos($cmd,$rs); |
---|
73 | $rs->Siguiente(); |
---|
74 | } |
---|
75 | } |
---|
76 | $rs->Cerrar(); |
---|
77 | ?> |
---|
78 | </TABLE> |
---|
79 | </DIV> |
---|
80 | <DIV id="Layer_nota" align=center> |
---|
81 | <br> |
---|
82 | <span align=left class=notas><I><?echo $TbMsg[7]?>.</I></span> |
---|
83 | </DIV> |
---|
84 | </FORM> |
---|
85 | <? |
---|
86 | //________________________________________________________________________________________________________ |
---|
87 | include_once("../includes/iframecomun.php"); |
---|
88 | //________________________________________________________________________________________________________ |
---|
89 | ?> |
---|
90 | </BODY> |
---|
91 | </HTML> |
---|
92 | <? |
---|
93 | // ************************************************************************************************************************************************* |
---|
94 | function pintacomandos($cmd,$rs){ |
---|
95 | global $TbMsg; |
---|
96 | global $AMBITO_CENTROS; |
---|
97 | global $AMBITO_GRUPOSAULAS; |
---|
98 | global $AMBITO_AULAS; |
---|
99 | global $AMBITO_GRUPOSORDENADORES; |
---|
100 | global $AMBITO_ORDENADORES; |
---|
101 | global $tabla_parametros; |
---|
102 | global $cont_parametros; |
---|
103 | |
---|
104 | $HTMLparametros='<TR id="PAR-'.$rs->campos["idtareacomando"].'" style="display:block">'.chr(13); |
---|
105 | $HTMLparametros.= '<TD> </TD>'.chr(13); |
---|
106 | $HTMLparametros.= '<TD> </TD>'.chr(13); |
---|
107 | $HTMLparametros.= '<TH style="FONT-WEIGHT: 700;COLOR: #000000;BACKGROUND-COLOR: #D4D4D4; " >'.$TbMsg[5].'</TH>'.chr(13); |
---|
108 | $HTMLparametros.= '<TH style="FONT-WEIGHT: 700;COLOR: #000000;BACKGROUND-COLOR: #D4D4D4;" >'.$TbMsg[6].'</TH>'.chr(13); |
---|
109 | $HTMLparametros.= '<TH style="FONT-WEIGHT: 700;COLOR: #000000;BACKGROUND-COLOR: #D4D4D4;" > </TH>'.chr(13); |
---|
110 | $HTMLparametros.= '<TH style="FONT-WEIGHT: 700;COLOR: #000000;BACKGROUND-COLOR: #D4D4D4;" > </TH>'.chr(13); |
---|
111 | $HTMLparametros.= '</TR>'.chr(13); |
---|
112 | |
---|
113 | $textambito=""; |
---|
114 | $urlimg=""; |
---|
115 | $nombre=""; |
---|
116 | switch($rs->campos["ambito"]){ |
---|
117 | case $AMBITO_CENTROS : |
---|
118 | $urlimg='../images/iconos/centros.gif'; |
---|
119 | $textambito="Center"; |
---|
120 | $nombre=TomaDato($cmd,0,'centros',$rs->campos["idambito"],'idcentro','nombrecentro'); |
---|
121 | break; |
---|
122 | case $AMBITO_GRUPOSAULAS : |
---|
123 | $urlimg='../images/iconos/carpeta.gif'; |
---|
124 | $textambito="Group of labs"; |
---|
125 | $nombre=TomaDato($cmd,0,'grupos',$rs->campos["idambito"],'idgrupo','nombregrupo'); |
---|
126 | break; |
---|
127 | case $AMBITO_AULAS : |
---|
128 | $urlimg='../images/iconos/aula.gif'; |
---|
129 | $textambito="Labs"; |
---|
130 | $nombre=TomaDato($cmd,0,'aulas',$rs->campos["idambito"],'idaula','nombreaula'); |
---|
131 | break; |
---|
132 | case $AMBITO_GRUPOSORDENADORES : |
---|
133 | $urlimg='../images/iconos/carpeta.gif'; |
---|
134 | $textambito="Group of computers"; |
---|
135 | $nombre=TomaDato($cmd,0,'gruposordenadores',$rs->campos["idambito"],'idgrupo','nombregrupoordenador'); |
---|
136 | break; |
---|
137 | case $AMBITO_ORDENADORES : |
---|
138 | $urlimg='../images/iconos/ordenador.gif'; |
---|
139 | $textambito="Computers"; |
---|
140 | $nombre=TomaDato($cmd,0,'ordenadores',$rs->campos["idambito"],'idordenador','nombreordenador'); |
---|
141 | break; |
---|
142 | } |
---|
143 | $HTMLparametros.='<TR id="PAR-'.$rs->campos["idtareacomando"].'" style="display:block">'.chr(13); |
---|
144 | $HTMLparametros.= '<TD> </TD>'.chr(13); |
---|
145 | $HTMLparametros.= '<TD> </TD>'.chr(13); |
---|
146 | $HTMLparametros.= '<TD style="BACKGROUND-COLOR: #b5daad;"> Environment </TD>'.chr(13); |
---|
147 | $HTMLparametros.= '<TD style="BACKGROUND-COLOR: #b5daad;"> '.$textambito.' '; |
---|
148 | $HTMLparametros.= '<IMG src="'.$urlimg.'"> </TD>'.chr(13); |
---|
149 | $HTMLparametros.= '<TH style="FONT-WEIGHT: 700;COLOR: #000000;BACKGROUND-COLOR: #b5daad;" > </TH>'.chr(13); |
---|
150 | $HTMLparametros.= '<TH style="FONT-WEIGHT: 700;COLOR: #000000;BACKGROUND-COLOR: #b5daad;" > </TH>'.chr(13); |
---|
151 | $HTMLparametros.= '</TR>'; |
---|
152 | |
---|
153 | $HTMLparametros.='<TR id="PAR-'.$rs->campos["idtareacomando"].'" style="display:block">'.chr(13); |
---|
154 | $HTMLparametros.= '<TD> </TD>'.chr(13); |
---|
155 | $HTMLparametros.= '<TD> </TD>'.chr(13); |
---|
156 | $HTMLparametros.= '<TD style="BACKGROUND-COLOR: #b5daad;"> Name </TD>'.chr(13); |
---|
157 | $HTMLparametros.= '<TD style="BACKGROUND-COLOR: #b5daad;"> '.$nombre.' </TD>'.chr(13); |
---|
158 | $HTMLparametros.= '<TH style="FONT-WEIGHT: 700;COLOR: #000000;BACKGROUND-COLOR: #b5daad;" > </TH>'.chr(13); |
---|
159 | $HTMLparametros.= '<TH style="FONT-WEIGHT: 700;COLOR: #000000;BACKGROUND-COLOR: #b5daad;" > </TH>'.chr(13); |
---|
160 | $HTMLparametros.= '</TR>'; |
---|
161 | |
---|
162 | $auxVP=split(";",$rs->campos["visuparametros"]); // Parametros visualizables |
---|
163 | $auxP=split(chr(13),$rs->campos["parametros"]); // Recorre parametros para visualizar los que así sean |
---|
164 | for ($i=0;$i<sizeof($auxP);$i++){ |
---|
165 | $dualparam=split("=",$auxP[$i]); |
---|
166 | for ($k=0;$k<sizeof($auxVP);$k++){ |
---|
167 | if($auxVP[$k]==$dualparam[0]){ |
---|
168 | $posp=busca_indicebinariodual($dualparam[0],$tabla_parametros,$cont_parametros); // Busca datos del parámetro en la tabla cargada previamentre con todos los parámetros |
---|
169 | if ($posp>=0){ |
---|
170 | $auxtabla_parametros=$tabla_parametros[$posp][1]; |
---|
171 | $HTMLparametros.='<TR id="PAR-'.$rs->campos["idtareacomando"].'" style="display:block">'.chr(13); |
---|
172 | $HTMLparametros.= '<TD> </TD>'.chr(13); |
---|
173 | $HTMLparametros.= '<TD> </TD>'.chr(13); |
---|
174 | $HTMLparametros.= '<TD style="BACKGROUND-COLOR: #b5daad;"> '.$auxtabla_parametros["descripcion"].' </TD>'.chr(13); |
---|
175 | if($auxtabla_parametros["tipopa"]==1){ |
---|
176 | $valor=TomaDato($cmd,0,$auxtabla_parametros["nomtabla"],$dualparam[1],$auxtabla_parametros["nomidentificador"],$auxtabla_parametros["nomliteral"]); |
---|
177 | }else |
---|
178 | $valor=$dualparam[1]; |
---|
179 | if($dualparam[0]!="iph") |
---|
180 | $HTMLparametros.= '<TD style="BACKGROUND-COLOR: #b5daad;"> '.$valor.' </TD>'.chr(13); |
---|
181 | else{ |
---|
182 | $tablaipes=PintaOrdenadores($cmd,$valor); |
---|
183 | $HTMLparametros.= '<TD style="BACKGROUND-COLOR: #b5daad;"> '.$tablaipes.' </TD>'.chr(13); |
---|
184 | } |
---|
185 | $HTMLparametros.= '<TH style="FONT-WEIGHT: 700;COLOR: #000000;BACKGROUND-COLOR: #b5daad;" > </TH>'.chr(13); |
---|
186 | $HTMLparametros.= '<TH style="FONT-WEIGHT: 700;COLOR: #000000;BACKGROUND-COLOR: #b5daad;" > </TH>'.chr(13); |
---|
187 | $HTMLparametros.= '</TR>'.chr(13); |
---|
188 | } |
---|
189 | } |
---|
190 | } |
---|
191 | } |
---|
192 | echo $HTMLparametros; |
---|
193 | } |
---|
194 | //________________________________________________________________________________________________________ |
---|
195 | function PintaOrdenadores($cmd,$cadenaip){ |
---|
196 | $auxP=split(";",$cadenaip); |
---|
197 | if(sizeof($auxP)<1) return(""); |
---|
198 | $clauslaIN="'".$auxP[0]."'"; |
---|
199 | for ($i=1;$i<sizeof($auxP);$i++) |
---|
200 | $clauslaIN.=",'".$auxP[$i]."'"; |
---|
201 | $rs=new Recordset; |
---|
202 | $contor=0; |
---|
203 | $maxord=7; // Máximos ordenadores por linea |
---|
204 | $cmd->texto=" SELECT nombreordenador,ip FROM ordenadores INNER JOIN aulas ON aulas.idaula=ordenadores.idaula WHERE ip IN(".$clauslaIN.") ORDER by nombreaula,nombreordenador"; |
---|
205 | $rs->Comando=&$cmd; |
---|
206 | if (!$rs->Abrir()) return(""); // Error al abrir recordset |
---|
207 | $tablaHtml='<TABLE align=left border=0><TR>'; |
---|
208 | while (!$rs->EOF){ |
---|
209 | $contor++; |
---|
210 | $tablaHtml.= '<TD align=center style="BACKGROUND-COLOR: #b5daad;FONT-FAMILY: Arial, Helvetica, sans-serif; BORDER-BOTTOM:#000000 none;FONT-SIZE: 8px"><IMG src="../images/iconos/ordenador.gif"><br><span style="FONT-SIZE:9px" >'.$rs->campos["nombreordenador"].'</TD>'; |
---|
211 | if($contor>$maxord){ |
---|
212 | $contor=0; |
---|
213 | $tablaHtml.='</TR><TR>'; |
---|
214 | } |
---|
215 | $rs->Siguiente(); |
---|
216 | } |
---|
217 | $tablaHtml.='</TR>'; |
---|
218 | $tablaHtml.= '</TR></TABLE>'; |
---|
219 | return($tablaHtml); |
---|
220 | } |
---|