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: informacion_perfileshard.php |
---|
8 | // Descripción : |
---|
9 | // Muestra los componentes hardware que forman parte de un perfil hardware y los perfiles softwares disponibles |
---|
10 | // ************************************************************************************************************************************************* |
---|
11 | include_once("../includes/ctrlacc.php"); |
---|
12 | include_once("../clases/AdoPhp.php"); |
---|
13 | include_once("../includes/CreaComando.php"); |
---|
14 | include_once("../clases/XmlPhp.php"); |
---|
15 | include_once("../clases/ArbolVistaXML.php"); |
---|
16 | include_once("../idiomas/php/".$idioma."/informacion_perfileshard_".$idioma.".php"); |
---|
17 | //________________________________________________________________________________________________________ |
---|
18 | $idperfil=0; |
---|
19 | $descripcionperfil=""; |
---|
20 | if (isset($_GET["idperfil"])) $idperfil=$_GET["idperfil"]; // Recoge parametros |
---|
21 | if (isset($_GET["descripcionperfil"])) $descripcionperfil=$_GET["descripcionperfil"]; // Recoge parametros |
---|
22 | |
---|
23 | $cmd=CreaComando($cadenaconexion); |
---|
24 | if (!$cmd) |
---|
25 | Header('Location: '.$pagerror.'?herror=2'); // Error de conexióncon servidor B.D. |
---|
26 | else |
---|
27 | $arbolXML=CreaArbol($cmd,$idperfil); // Crea el arbol XML |
---|
28 | |
---|
29 | // Creación del árbol |
---|
30 | $baseurlimg="../images/tsignos"; |
---|
31 | $clasedefault="tabla_listados_sin"; |
---|
32 | $titulotabla=$TbMsg[3]; |
---|
33 | $arbol=new ArbolVistaXml($arbolXML,0,$baseurlimg,$clasedefault,1,20,130,1,$titulotabla); |
---|
34 | //________________________________________________________________________________________________________ |
---|
35 | ?> |
---|
36 | <HTML> |
---|
37 | <TITLE>Administración web de aulas</TITLE> |
---|
38 | <HEAD> |
---|
39 | <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
---|
40 | <LINK rel="stylesheet" type="text/css" href="../estilos.css"> |
---|
41 | <SCRIPT language="javascript" src="../clases/jscripts/ArbolVistaXML.js"></SCRIPT> |
---|
42 | </HEAD> |
---|
43 | <BODY> |
---|
44 | <P align=center class=cabeceras><?echo $TbMsg[0]?><BR> |
---|
45 | <SPAN align=center class=subcabeceras><?echo $TbMsg[1]?></SPAN> <IMG src="../images/iconos/confihard.gif"><BR><BR> |
---|
46 | <IMG src="../images/iconos/perfilhardware.gif"><SPAN class=presentaciones> <U><?echo $TbMsg[2]?></U>: <? echo $descripcionperfil?></SPAN></P> |
---|
47 | <?echo $arbol->CreaArbolVistaXml(); // Crea arbol de configuraciones?> |
---|
48 | </BODY> |
---|
49 | </HTML> |
---|
50 | <? |
---|
51 | /************************************************************************************************************************************************** |
---|
52 | Devuelve una cadena con formato XML de toda la Información de los perfiles hardwares |
---|
53 | Parametros: |
---|
54 | - cmd:Una comando ya operativo ( con conexiónabierta) |
---|
55 | - idperfil: El identificador del perfil hardware |
---|
56 | ________________________________________________________________________________________________________*/ |
---|
57 | function CreaArbol($cmd,$idperfil){ |
---|
58 | $cadenaXML=SubarbolXML_PerfilesHardwares($cmd,$idperfil); |
---|
59 | return($cadenaXML); |
---|
60 | } |
---|
61 | //________________________________________________________________________________________________________ |
---|
62 | function SubarbolXML_PerfilesHardwares($cmd,$idperfilhard){ |
---|
63 | global $TbMsg; |
---|
64 | $cadenaXML=""; |
---|
65 | $rs=new Recordset; |
---|
66 | $cmd->texto="SELECT tipohardwares.descripcion as tipohardware,perfileshard.idperfilhard , |
---|
67 | perfileshard.descripcion as pdescripcion, perfileshard.comentarios, |
---|
68 | hardwares.idhardware,hardwares.descripcion as hdescripcion,tipohardwares.urlimg |
---|
69 | FROM perfileshard "; |
---|
70 | $cmd->texto.=" LEFT OUTER JOIN perfileshard_hardwares ON perfileshard.idperfilhard=perfileshard_hardwares.idperfilhard"; |
---|
71 | $cmd->texto.=" LEFT OUTER JOIN hardwares ON hardwares.idhardware=perfileshard_hardwares.idhardware"; |
---|
72 | $cmd->texto.=" LEFT OUTER JOIN tipohardwares ON hardwares.idtipohardware=tipohardwares.idtipohardware" ; |
---|
73 | $cmd->texto.=" WHERE perfileshard.idperfilhard=".$idperfilhard; |
---|
74 | $cmd->texto.=" ORDER by tipohardwares.idtipohardware,hardwares.descripcion"; |
---|
75 | $rs->Comando=&$cmd; |
---|
76 | |
---|
77 | if (!$rs->Abrir()) return($cadenaXML); // Error al abrir recordset |
---|
78 | $rs->Primero(); |
---|
79 | $cadenaXML.='<PERFILESHARDWARES'; |
---|
80 | // Atributos` |
---|
81 | $cadenaXML.=' imagenodo="../images/iconos/perfilhardware.gif"'; |
---|
82 | $cadenaXML.=' infonodo="'.$rs->campos["pdescripcion"].'"'; |
---|
83 | $cadenaXML.='>'; |
---|
84 | if($rs->campos["comentarios"]>" "){ |
---|
85 | $cadenaXML.='<PROPIEDAD'; |
---|
86 | $cadenaXML.=' imagenodo="../images/iconos/propiedad.gif"'; |
---|
87 | $cadenaXML.=' infonodo="[b]'.$TbMsg[8].' :[/b] '.$rs->campos["comentarios"].'"'; |
---|
88 | $cadenaXML.='>'; |
---|
89 | $cadenaXML.='</PROPIEDAD>'; |
---|
90 | } |
---|
91 | $swcompo=false; |
---|
92 | while (!$rs->EOF){ |
---|
93 | if ($rs->campos["idhardware"]){ |
---|
94 | if (!$swcompo) { |
---|
95 | $cadenaXML.='<COMPONENTES'; |
---|
96 | $cadenaXML.=' imagenodo="../images/iconos/carpeta.gif"'; |
---|
97 | $cadenaXML.=' infonodo="'.$TbMsg[6].'"'; |
---|
98 | $cadenaXML.='>'; |
---|
99 | $swcompo=true; |
---|
100 | } |
---|
101 | |
---|
102 | $cadenaXML.='<PERFILHARDWARE'; |
---|
103 | // Atributos |
---|
104 | $cadenaXML.=' imagenodo='.$rs->campos["urlimg"]; |
---|
105 | $cadenaXML.=' infonodo="('.$rs->campos["tipohardware"].") ".$rs->campos["hdescripcion"].'"'; |
---|
106 | $cadenaXML.='>'; |
---|
107 | $cadenaXML.='</PERFILHARDWARE>'; |
---|
108 | } |
---|
109 | $rs->Siguiente(); |
---|
110 | } |
---|
111 | if ($swcompo) { |
---|
112 | $cadenaXML.='</COMPONENTES>'; |
---|
113 | } |
---|
114 | $cadenaXML.=SubarbolXML_Ordenadores($cmd,$idperfilhard); |
---|
115 | $cadenaXML.=SubarbolXML_ImagenesDisponibles($cmd,$idperfilhard); |
---|
116 | $cadenaXML.='</PERFILESHARDWARES>'; |
---|
117 | $rs->Cerrar(); |
---|
118 | return($cadenaXML); |
---|
119 | } |
---|
120 | //________________________________________________________________________________________________________ |
---|
121 | function SubarbolXML_Ordenadores($cmd,$idperfilhard) |
---|
122 | { |
---|
123 | global $TbMsg; |
---|
124 | |
---|
125 | $cadenaXML=""; |
---|
126 | $gidaula=0; |
---|
127 | $cmd->texto="SELECT DISTINCT aulas.idaula,aulas.nombreaula,ordenadores.idordenador,ordenadores.nombreordenador |
---|
128 | FROM ordenadores |
---|
129 | INNER JOIN aulas ON ordenadores.idaula=aulas.idaula |
---|
130 | WHERE ordenadores.idperfilhard=".$idperfilhard." ORDER BY aulas.idaula,ordenadores.nombreordenador"; |
---|
131 | $rs=new Recordset; |
---|
132 | $rs->Comando=&$cmd; |
---|
133 | if (!$rs->Abrir()) return($cadenaXML); // Error al abrir recordset |
---|
134 | $rs->Primero(); |
---|
135 | if ($rs->numeroderegistros>0){ |
---|
136 | $cadenaXML.='<ORDENADORES'; |
---|
137 | $cadenaXML.=' imagenodo="../images/iconos/carpeta.gif"'; |
---|
138 | $cadenaXML.=' infonodo="'.$TbMsg[7].'"'; |
---|
139 | $cadenaXML.='>'; |
---|
140 | } |
---|
141 | while (!$rs->EOF){ |
---|
142 | if ($gidaula!=$rs->campos["idaula"]){ |
---|
143 | if (!empty($gidaula)) |
---|
144 | $cadenaXML.='</AULA>'; |
---|
145 | $cadenaXML.='<AULA '; |
---|
146 | // Atributos |
---|
147 | |
---|
148 | $cadenaXML.=' imagenodo="../images/iconos/aula.gif"'; |
---|
149 | $cadenaXML.=' infonodo="'.$rs->campos["nombreaula"].'"'; |
---|
150 | $cadenaXML.='>'; |
---|
151 | $gidaula=$rs->campos["idaula"]; |
---|
152 | } |
---|
153 | $cadenaXML.='<ORDENADOR'; |
---|
154 | // Atributos |
---|
155 | $cadenaXML.=' imagenodo="../images/iconos/ordenador.gif"'; |
---|
156 | $cadenaXML.=' infonodo="'.$rs->campos["nombreordenador"].'"' ; |
---|
157 | $cadenaXML.='></ORDENADOR>'; |
---|
158 | $rs->Siguiente(); |
---|
159 | } |
---|
160 | if (!empty($gidaula)) |
---|
161 | $cadenaXML.='</AULA>'; |
---|
162 | if ($rs->numeroderegistros>0) |
---|
163 | $cadenaXML.='</ORDENADORES>'; |
---|
164 | $rs->Cerrar(); |
---|
165 | return($cadenaXML); |
---|
166 | } |
---|
167 | //________________________________________________________________________________________________________ |
---|
168 | function SubarbolXML_ImagenesDisponibles($cmd,$idperfilhard) |
---|
169 | { |
---|
170 | global $TbMsg; |
---|
171 | |
---|
172 | $cadenaXML=""; |
---|
173 | $gidimagen=0; |
---|
174 | |
---|
175 | $cmd->texto="SELECT DISTINCT imagenes.* FROM imagenes |
---|
176 | INNER JOIN perfilessoft ON perfilessoft.idperfilsoft=imagenes.idperfilsoft |
---|
177 | INNER JOIN ordenadores_particiones ON ordenadores_particiones.idperfilsoft=imagenes.idperfilsoft |
---|
178 | INNER JOIN ordenadores ON ordenadores.idordenador=ordenadores_particiones.idordenador |
---|
179 | INNER JOIN perfileshard ON perfileshard.idperfilhard=ordenadores.idperfilhard |
---|
180 | WHERE perfileshard.idperfilhard=".$idperfilhard." |
---|
181 | AND imagenes.codpar>0 |
---|
182 | ORDER by imagenes.descripcion"; |
---|
183 | $rs=new Recordset; |
---|
184 | $rs->Comando=&$cmd; |
---|
185 | if (!$rs->Abrir()) return($cadenaXML); // Error al abrir recordset |
---|
186 | if ($rs->numeroderegistros>0) { |
---|
187 | $cadenaXML.='<DISPONIBLESIMAGENES'; |
---|
188 | $cadenaXML.=' imagenodo="../images/iconos/carpeta.gif"'; |
---|
189 | $cadenaXML.=' infonodo="'.$TbMsg[4].'"'; |
---|
190 | $cadenaXML.='>'; |
---|
191 | } |
---|
192 | while (!$rs->EOF){ |
---|
193 | if ($gidimagen!=$rs->campos["idperfilsoft"]){ |
---|
194 | if ($gidimagen){ |
---|
195 | $cadenaXML.='</IMAGENES>'; |
---|
196 | } |
---|
197 | $gidimagen=$rs->campos["idperfilsoft"]; |
---|
198 | $cadenaXML.='<IMAGENES'; |
---|
199 | // Atributos |
---|
200 | $cadenaXML.=' imagenodo="../images/iconos/imagenes.gif"'; |
---|
201 | $cadenaXML.=' infonodo="'.$rs->campos["descripcion"].'"'; |
---|
202 | $cadenaXML.='>'; |
---|
203 | } |
---|
204 | $rs->Siguiente(); |
---|
205 | } |
---|
206 | if ($gidimagen){ |
---|
207 | $cadenaXML.='</IMAGENES>'; |
---|
208 | $cadenaXML.='</DISPONIBLESIMAGENES>'; |
---|
209 | } |
---|
210 | $rs->Cerrar(); |
---|
211 | return($cadenaXML); |
---|
212 | } |
---|
213 | ?> |
---|