| 1 | <?php |
|---|
| 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: Noviembre-2005 |
|---|
| 7 | // Nombre del fichero: reservas.php |
|---|
| 8 | // Descripción : |
|---|
| 9 | // Administra reservas de un determinado Centro |
|---|
| 10 | // ************************************************************************************************************************************************* |
|---|
| 11 | include_once("../includes/ctrlacc.php"); |
|---|
| 12 | include_once("../clases/AdoPhp.php"); |
|---|
| 13 | include_once("../clases/XmlPhp.php"); |
|---|
| 14 | include_once("../clases/ArbolVistaXML.php"); |
|---|
| 15 | include_once("../clases/MenuContextual.php"); |
|---|
| 16 | include_once("../includes/constantes.php"); |
|---|
| 17 | include_once("../includes/CreaComando.php"); |
|---|
| 18 | include_once("../idiomas/php/".$idioma."/reservas_".$idioma.".php"); |
|---|
| 19 | //________________________________________________________________________________________________________ |
|---|
| 20 | $cmd=CreaComando($cadenaconexion); |
|---|
| 21 | if (!$cmd) |
|---|
| 22 | Header('Location: '.$pagerror.'?herror=2'); // Error de conexión con servidor B.D. |
|---|
| 23 | else |
|---|
| 24 | $arbolXML=CreaArbol($cmd,$idcentro); // Crea el arbol XML con todos las acciones registradas en el Centro |
|---|
| 25 | // Creación del árbol |
|---|
| 26 | $baseurlimg="../images/signos"; // Url de las imágenes de signo |
|---|
| 27 | $clasedefault="texto_arbol"; // Hoja de estilo (Clase por defecto) del árbol |
|---|
| 28 | $arbol=new ArbolVistaXML($arbolXML,0,$baseurlimg,$clasedefault,1,0,5); |
|---|
| 29 | //________________________________________________________________________________________________________ |
|---|
| 30 | ?> |
|---|
| 31 | <HTML> |
|---|
| 32 | <TITLE>Administración web de aulas</TITLE> |
|---|
| 33 | <HEAD> |
|---|
| 34 | <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
|---|
| 35 | <LINK rel="stylesheet" type="text/css" href="../estilos.css"> |
|---|
| 36 | <SCRIPT language="javascript" src="../clases/jscripts/ArbolVistaXML.js"></SCRIPT> |
|---|
| 37 | <SCRIPT language="javascript" src="../clases/jscripts/MenuContextual.js"></SCRIPT> |
|---|
| 38 | <SCRIPT language="javascript" src="../jscripts/reservas.js"></SCRIPT> |
|---|
| 39 | <SCRIPT language="javascript" src="../jscripts/opciones.js"></SCRIPT> |
|---|
| 40 | <SCRIPT language="javascript" src="../jscripts/constantes.js"></SCRIPT> |
|---|
| 41 | <SCRIPT language="javascript" src="../jscripts/comunes.js"></SCRIPT> |
|---|
| 42 | <SCRIPT language="javascript" src="../clases/jscripts/HttpLib.js"></SCRIPT> |
|---|
| 43 | <?php echo '<SCRIPT language="javascript" src="../idiomas/javascripts/'.$idioma.'/comunes_'.$idioma.'.js"></SCRIPT>'?> |
|---|
| 44 | <?php echo '<SCRIPT language="javascript" src="../idiomas/javascripts/'.$idioma.'/reservas_'.$idioma.'.js"></SCRIPT>'?> |
|---|
| 45 | </HEAD> |
|---|
| 46 | <BODY OnContextMenu="return false"> |
|---|
| 47 | <?php |
|---|
| 48 | //________________________________________________________________________________________________________ |
|---|
| 49 | echo $arbol->CreaArbolVistaXML(); // Crea árbol (HTML) a partir del XML |
|---|
| 50 | $flotante=new MenuContextual(); // Crea objeto MenuContextual |
|---|
| 51 | |
|---|
| 52 | // Crea contextual de las imágenes |
|---|
| 53 | $XMLcontextual=CreacontextualXMLReservas(); |
|---|
| 54 | echo $flotante->CreaMenuContextual($XMLcontextual); |
|---|
| 55 | $XMLcontextual=ContextualXMLGruposReservas(); // Grupos de reservas |
|---|
| 56 | echo $flotante->CreaMenuContextual($XMLcontextual); |
|---|
| 57 | $XMLcontextual=CreacontextualXMLReserva(); // Reervas |
|---|
| 58 | echo $flotante->CreaMenuContextual($XMLcontextual); |
|---|
| 59 | ?> |
|---|
| 60 | </BODY> |
|---|
| 61 | </HTML> |
|---|
| 62 | <?php |
|---|
| 63 | // ************************************************************************************************************************************************* |
|---|
| 64 | // Devuelve una cadena con formato XML con toda la información de las reservas registradas en un Centro concreto |
|---|
| 65 | // Parametros: |
|---|
| 66 | // - cmd:Una comando ya operativo ( con conexión abierta) |
|---|
| 67 | // - idcentro: El identificador del centro |
|---|
| 68 | //________________________________________________________________________________________________________ |
|---|
| 69 | function CreaArbol($cmd,$idcentro){ |
|---|
| 70 | global $TbMsg; |
|---|
| 71 | global $LITAMBITO_RESERVAS; |
|---|
| 72 | $cadenaXML='<RAIZ'; |
|---|
| 73 | // Atributos |
|---|
| 74 | $cadenaXML.=' imagenodo="../images/iconos/reservas.gif"'; |
|---|
| 75 | $cadenaXML.=' nodoid=Raiz'.$LITAMBITO_RESERVAS; |
|---|
| 76 | $cadenaXML.=' infonodo="'.$TbMsg[9].'"'; |
|---|
| 77 | $cadenaXML.=' clickcontextualnodo="menu_contextual(this,' ."'flo_Raiz".$LITAMBITO_RESERVAS."'".')"'; |
|---|
| 78 | $cadenaXML.='>'; |
|---|
| 79 | $cadenaXML.=SubarbolXML_grupos_reservas($cmd,$idcentro,0); |
|---|
| 80 | $cadenaXML.='</RAIZ>'; |
|---|
| 81 | return($cadenaXML); |
|---|
| 82 | } |
|---|
| 83 | //________________________________________________________________________________________________________ |
|---|
| 84 | function SubarbolXML_grupos_reservas($cmd,$idcentro,$grupoid){ |
|---|
| 85 | global $LITAMBITO_GRUPOSRESERVAS; |
|---|
| 86 | global $AMBITO_GRUPOSRESERVAS; |
|---|
| 87 | $cadenaXML=""; |
|---|
| 88 | $rs=new Recordset; |
|---|
| 89 | $cmd->texto="SELECT idgrupo,nombregrupo,grupoid FROM grupos WHERE grupoid=".$grupoid." AND idcentro=".$idcentro." AND tipo=".$AMBITO_GRUPOSRESERVAS." ORDER BY nombregrupo"; |
|---|
| 90 | $rs->Comando=&$cmd; |
|---|
| 91 | if (!$rs->Abrir()) return($cadenaXML); // Error al abrir recordset |
|---|
| 92 | $rs->Primero(); |
|---|
| 93 | while (!$rs->EOF){ |
|---|
| 94 | $cadenaXML.='<GRUPOSRESERVAS'; |
|---|
| 95 | // Atributos |
|---|
| 96 | $cadenaXML.=' clickcontextualnodo="menu_contextual(this,'. " 'flo_".$LITAMBITO_GRUPOSRESERVAS."'" .');"'; |
|---|
| 97 | $cadenaXML.=' imagenodo="../images/iconos/carpeta.gif"'; |
|---|
| 98 | $cadenaXML.=' infonodo="'.$rs->campos["nombregrupo"].'"'; |
|---|
| 99 | $cadenaXML.=' nodoid='.$LITAMBITO_GRUPOSRESERVAS.'-'.$rs->campos["idgrupo"]; |
|---|
| 100 | $cadenaXML.='>'; |
|---|
| 101 | $cadenaXML.=SubarbolXML_grupos_reservas($cmd,$idcentro,$rs->campos["idgrupo"]); |
|---|
| 102 | $cadenaXML.='</GRUPOSRESERVAS>'; |
|---|
| 103 | $rs->Siguiente(); |
|---|
| 104 | } |
|---|
| 105 | $rs->Cerrar(); |
|---|
| 106 | $cadenaXML.=SubarbolXML_Reservas($cmd,$idcentro,$grupoid); |
|---|
| 107 | return($cadenaXML); |
|---|
| 108 | } |
|---|
| 109 | //________________________________________________________________________________________________________ |
|---|
| 110 | function SubarbolXML_Reservas($cmd,$idcentro,$grupoid){ |
|---|
| 111 | global $LITAMBITO_RESERVAS; |
|---|
| 112 | global $RESERVA_PENDIENTE; |
|---|
| 113 | global $RESERVA_CONFIRMADA; |
|---|
| 114 | global $RESERVA_DENEGADA; |
|---|
| 115 | $cadenaXML=""; |
|---|
| 116 | $rs=new Recordset; |
|---|
| 117 | $cmd->texto="SELECT idreserva,descripcion,estado FROM reservas WHERE idcentro=".$idcentro." AND grupoid=".$grupoid." ORDER BY descripcion"; |
|---|
| 118 | $rs->Comando=&$cmd; |
|---|
| 119 | if (!$rs->Abrir()) return($cadenaXML); // Error al abrir recordset |
|---|
| 120 | $rs->Primero(); |
|---|
| 121 | while (!$rs->EOF){ |
|---|
| 122 | $cadenaXML.='<RESERVA'; |
|---|
| 123 | // Atributos |
|---|
| 124 | switch($rs->campos["estado"]){ |
|---|
| 125 | case $RESERVA_PENDIENTE : |
|---|
| 126 | $urlimg='../images/iconos/pendientes.gif'; |
|---|
| 127 | break; |
|---|
| 128 | case $RESERVA_CONFIRMADA : |
|---|
| 129 | $urlimg='../images/iconos/confirmadas.gif'; |
|---|
| 130 | break; |
|---|
| 131 | case $RESERVA_DENEGADA : |
|---|
| 132 | $urlimg='../images/iconos/denegadas.gif'; |
|---|
| 133 | break; |
|---|
| 134 | default: |
|---|
| 135 | $urlimg=""; |
|---|
| 136 | } |
|---|
| 137 | |
|---|
| 138 | $cadenaXML.=' imagenodo="'.$urlimg.'"'; |
|---|
| 139 | $cadenaXML.=' infonodo="'.$rs->campos["descripcion"].'"'; |
|---|
| 140 | $cadenaXML.=' nodoid='.$LITAMBITO_RESERVAS.'-'.$rs->campos["idreserva"]; |
|---|
| 141 | $cadenaXML.=' clickcontextualnodo="menu_contextual(this,' ."'flo_".$LITAMBITO_RESERVAS."'" .')"'; |
|---|
| 142 | $cadenaXML.='>'; |
|---|
| 143 | $cadenaXML.='</RESERVA>'; |
|---|
| 144 | $rs->Siguiente(); |
|---|
| 145 | } |
|---|
| 146 | $rs->Cerrar(); |
|---|
| 147 | return($cadenaXML); |
|---|
| 148 | } |
|---|
| 149 | //________________________________________________________________________________________________________ |
|---|
| 150 | // |
|---|
| 151 | // Menús Contextuales |
|---|
| 152 | //________________________________________________________________________________________________________ |
|---|
| 153 | function CreacontextualXMLReservas(){ |
|---|
| 154 | global $AMBITO_RESERVAS; |
|---|
| 155 | global $AMBITO_GRUPOSRESERVAS; |
|---|
| 156 | global $LITAMBITO_GRUPOSRESERVAS; |
|---|
| 157 | global $LITAMBITO_RESERVAS; |
|---|
| 158 | global $RESERVA_CONFIRMADA; |
|---|
| 159 | global $TbMsg; |
|---|
| 160 | |
|---|
| 161 | $layerXML='<MENUCONTEXTUAL'; |
|---|
| 162 | $layerXML.=' idctx="flo_Raiz'.$LITAMBITO_RESERVAS.'"'; |
|---|
| 163 | $layerXML.=' maxanchu=165'; |
|---|
| 164 | $layerXML.=' swimg=1'; |
|---|
| 165 | $layerXML.=' clase="menu_contextual"'; |
|---|
| 166 | $layerXML.='>'; |
|---|
| 167 | |
|---|
| 168 | $layerXML.='<ITEM'; |
|---|
| 169 | $layerXML.=' alpulsar="insertar_grupos('.$AMBITO_GRUPOSRESERVAS.',' ."'".$LITAMBITO_GRUPOSRESERVAS."'".')"'; |
|---|
| 170 | $layerXML.=' imgitem="../images/iconos/carpeta.gif"'; |
|---|
| 171 | $layerXML.=' textoitem='.$TbMsg[0]; |
|---|
| 172 | $layerXML.='></ITEM>'; |
|---|
| 173 | |
|---|
| 174 | $wLeft=140; |
|---|
| 175 | $wTop=115; |
|---|
| 176 | $wWidth=550; |
|---|
| 177 | $wHeight=500; |
|---|
| 178 | $wpages="../propiedades/propiedades_reservas.php"; |
|---|
| 179 | $wParam=$wLeft .",".$wTop.",".$wWidth.",".$wHeight.",'". $wpages."'"; |
|---|
| 180 | |
|---|
| 181 | $layerXML.='<ITEM'; |
|---|
| 182 | $layerXML.=' alpulsar="insertar('.$wParam.')"'; |
|---|
| 183 | $layerXML.=' imgitem="../images/iconos/reservas.gif"'; |
|---|
| 184 | $layerXML.=' textoitem='.$TbMsg[1]; |
|---|
| 185 | $layerXML.='></ITEM>'; |
|---|
| 186 | |
|---|
| 187 | $layerXML.='<SEPARADOR>'; |
|---|
| 188 | $layerXML.='</SEPARADOR>'; |
|---|
| 189 | |
|---|
| 190 | $wParam="../gestores/gestor_reservas.php"; |
|---|
| 191 | |
|---|
| 192 | $layerXML.='<ITEM'; |
|---|
| 193 | $layerXML.=' alpulsar="colocar('."'".$wParam."'".','.$AMBITO_RESERVAS.')"'; |
|---|
| 194 | $layerXML.=' imgitem="../images/iconos/colocar.gif"'; |
|---|
| 195 | $layerXML.=' textoitem='.$TbMsg[2]; |
|---|
| 196 | $layerXML.='></ITEM>'; |
|---|
| 197 | |
|---|
| 198 | $layerXML.='<SEPARADOR>'; |
|---|
| 199 | $layerXML.='</SEPARADOR>'; |
|---|
| 200 | |
|---|
| 201 | $layerXML.='<ITEM'; |
|---|
| 202 | $layerXML.=' alpulsar="cola_reservas('.$RESERVA_CONFIRMADA.')"'; |
|---|
| 203 | $layerXML.=' imgitem="../images/iconos/reloj.gif"'; |
|---|
| 204 | $layerXML.=' textoitem='.$TbMsg[10]; |
|---|
| 205 | $layerXML.='></ITEM>'; |
|---|
| 206 | |
|---|
| 207 | $layerXML.='</MENUCONTEXTUAL>'; |
|---|
| 208 | return($layerXML); |
|---|
| 209 | } |
|---|
| 210 | //__________________________________________________________________________________________ |
|---|
| 211 | function ContextualXMLGruposReservas(){ |
|---|
| 212 | global $AMBITO_RESERVAS; |
|---|
| 213 | global $AMBITO_GRUPOSRESERVAS; |
|---|
| 214 | global $LITAMBITO_GRUPOSRESERVAS; |
|---|
| 215 | global $RESERVA_CONFIRMADA; |
|---|
| 216 | |
|---|
| 217 | global $TbMsg; |
|---|
| 218 | |
|---|
| 219 | $layerXML='<MENUCONTEXTUAL'; |
|---|
| 220 | $layerXML.=' idctx="flo_'.$LITAMBITO_GRUPOSRESERVAS.'"'; |
|---|
| 221 | $layerXML.=' maxanchu=175'; |
|---|
| 222 | $layerXML.=' swimg=1'; |
|---|
| 223 | $layerXML.=' clase="menu_contextual"'; |
|---|
| 224 | $layerXML.='>'; |
|---|
| 225 | |
|---|
| 226 | $layerXML.='<ITEM'; |
|---|
| 227 | $layerXML.=' alpulsar="insertar_grupos('.$AMBITO_GRUPOSRESERVAS.',' ."'".$LITAMBITO_GRUPOSRESERVAS."'". ')"'; |
|---|
| 228 | $layerXML.=' imgitem="../images/iconos/carpeta.gif"'; |
|---|
| 229 | $layerXML.=' textoitem='.$TbMsg[0]; |
|---|
| 230 | $layerXML.='></ITEM>'; |
|---|
| 231 | |
|---|
| 232 | $wLeft=140; |
|---|
| 233 | $wTop=115; |
|---|
| 234 | $wWidth=550; |
|---|
| 235 | $wHeight=500; |
|---|
| 236 | $wpages="../propiedades/propiedades_reservas.php"; |
|---|
| 237 | $wParam=$wLeft .",".$wTop.",".$wWidth.",".$wHeight.",'". $wpages."'"; |
|---|
| 238 | |
|---|
| 239 | $layerXML.='<ITEM'; |
|---|
| 240 | $layerXML.=' alpulsar="insertar('.$wParam.')"'; |
|---|
| 241 | $layerXML.=' imgitem="../images/iconos/reservas.gif"'; |
|---|
| 242 | $layerXML.=' textoitem='.$TbMsg[1]; |
|---|
| 243 | $layerXML.='></ITEM>'; |
|---|
| 244 | |
|---|
| 245 | $layerXML.='<SEPARADOR>'; |
|---|
| 246 | $layerXML.='</SEPARADOR>'; |
|---|
| 247 | |
|---|
| 248 | $wParam="../gestores/gestor_reservas.php"; |
|---|
| 249 | |
|---|
| 250 | $layerXML.='<ITEM'; |
|---|
| 251 | $layerXML.=' alpulsar="colocar('."'".$wParam."'".','.$AMBITO_RESERVAS.')"'; |
|---|
| 252 | $layerXML.=' imgitem="../images/iconos/colocar.gif"'; |
|---|
| 253 | $layerXML.=' textoitem='.$TbMsg[2]; |
|---|
| 254 | $layerXML.='></ITEM>'; |
|---|
| 255 | |
|---|
| 256 | $layerXML.='<SEPARADOR>'; |
|---|
| 257 | $layerXML.='</SEPARADOR>'; |
|---|
| 258 | |
|---|
| 259 | $layerXML.='<ITEM'; |
|---|
| 260 | $layerXML.=' alpulsar="modificar_grupos()"'; |
|---|
| 261 | $layerXML.=' imgitem="../images/iconos/modificar.gif"'; |
|---|
| 262 | $layerXML.=' textoitem='.$TbMsg[7]; |
|---|
| 263 | $layerXML.='></ITEM>'; |
|---|
| 264 | |
|---|
| 265 | $layerXML.='<ITEM'; |
|---|
| 266 | $layerXML.=' alpulsar="eliminar_grupos()"'; |
|---|
| 267 | $layerXML.=' imgitem="../images/iconos/eliminar.gif"'; |
|---|
| 268 | $layerXML.=' textoitem='.$TbMsg[4]; |
|---|
| 269 | $layerXML.='></ITEM>'; |
|---|
| 270 | |
|---|
| 271 | $layerXML.='<SEPARADOR>'; |
|---|
| 272 | $layerXML.='</SEPARADOR>'; |
|---|
| 273 | |
|---|
| 274 | $layerXML.='<ITEM'; |
|---|
| 275 | $layerXML.=' alpulsar="cola_reservas('.$RESERVA_CONFIRMADA.')"'; |
|---|
| 276 | $layerXML.=' imgitem="../images/iconos/reloj.gif"'; |
|---|
| 277 | $layerXML.=' textoitem='.$TbMsg[10]; |
|---|
| 278 | $layerXML.='></ITEM>'; |
|---|
| 279 | |
|---|
| 280 | $layerXML.='</MENUCONTEXTUAL>'; |
|---|
| 281 | return($layerXML); |
|---|
| 282 | } |
|---|
| 283 | //--------------------------------------------------------------------------------------------------------------------------- |
|---|
| 284 | function CreacontextualXMLReserva(){ |
|---|
| 285 | global $EJECUCION_RESERVA; |
|---|
| 286 | global $AMBITO_RESERVAS; |
|---|
| 287 | global $LITAMBITO_RESERVAS; |
|---|
| 288 | global $TbMsg; |
|---|
| 289 | |
|---|
| 290 | $layerXML='<MENUCONTEXTUAL'; |
|---|
| 291 | $layerXML.=' idctx="flo_'.$LITAMBITO_RESERVAS.'"'; |
|---|
| 292 | $layerXML.=' maxanchu=120'; |
|---|
| 293 | $layerXML.=' swimg=1'; |
|---|
| 294 | $layerXML.='>'; |
|---|
| 295 | |
|---|
| 296 | $layerXML.='<ITEM'; |
|---|
| 297 | $layerXML.=' alpulsar="programacion('.$EJECUCION_RESERVA.')"'; |
|---|
| 298 | $layerXML.=' imgitem="../images/iconos/reloj.gif"'; |
|---|
| 299 | $layerXML.=' textoitem='.$TbMsg[10]; |
|---|
| 300 | $layerXML.='></ITEM>'; |
|---|
| 301 | |
|---|
| 302 | $layerXML.='<SEPARADOR>'; |
|---|
| 303 | $layerXML.='</SEPARADOR>'; |
|---|
| 304 | |
|---|
| 305 | $layerXML.='<ITEM'; |
|---|
| 306 | $layerXML.=' alpulsar="mover('.$AMBITO_RESERVAS.')"'; |
|---|
| 307 | $layerXML.=' imgitem="../images/iconos/mover.gif"'; |
|---|
| 308 | $layerXML.=' textoitem='.$TbMsg[6]; |
|---|
| 309 | $layerXML.='></ITEM>'; |
|---|
| 310 | |
|---|
| 311 | $layerXML.='<SEPARADOR>'; |
|---|
| 312 | $layerXML.='</SEPARADOR>'; |
|---|
| 313 | |
|---|
| 314 | $wLeft=140; |
|---|
| 315 | $wTop=115; |
|---|
| 316 | $wWidth=550; |
|---|
| 317 | $wHeight=500; |
|---|
| 318 | $wpages="../propiedades/propiedades_reservas.php"; |
|---|
| 319 | $wParam=$wLeft .",".$wTop.",".$wWidth.",".$wHeight.",'". $wpages."'"; |
|---|
| 320 | |
|---|
| 321 | $layerXML.='<ITEM'; |
|---|
| 322 | $layerXML.=' alpulsar="modificar('.$wParam.')"'; |
|---|
| 323 | $layerXML.=' textoitem='.$TbMsg[7]; |
|---|
| 324 | $layerXML.=' imgitem="../images/iconos/propiedades.gif"'; |
|---|
| 325 | $layerXML.='></ITEM>'; |
|---|
| 326 | |
|---|
| 327 | $layerXML.='<ITEM'; |
|---|
| 328 | $layerXML.=' alpulsar="eliminar('.$wParam.')"'; |
|---|
| 329 | $layerXML.=' imgitem="../images/iconos/eliminar.gif"'; |
|---|
| 330 | $layerXML.=' textoitem='.$TbMsg[8]; |
|---|
| 331 | $layerXML.='></ITEM>'; |
|---|
| 332 | |
|---|
| 333 | $layerXML.='</MENUCONTEXTUAL>'; |
|---|
| 334 | return($layerXML); |
|---|
| 335 | } |
|---|
| 336 | ?> |
|---|