| 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: Agosto-2010 | 
|---|
| 7 | // Nombre del fichero: menus.php | 
|---|
| 8 | // Descripción : | 
|---|
| 9 | //              Administra los menus de los clientes rembo 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."/menus_".$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 los datos del 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/menus.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.'/menus_'.$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 los menus | 
|---|
| 53 | $XMLcontextual=CreacontextualXMLMenus(); | 
|---|
| 54 | echo $flotante->CreaMenuContextual($XMLcontextual); | 
|---|
| 55 | $XMLcontextual=ContextualXMLGruposMenus(); // Grupos de menus | 
|---|
| 56 | echo $flotante->CreaMenuContextual($XMLcontextual); | 
|---|
| 57 | $XMLcontextual=CreacontextualXMLMenu(); // Menús | 
|---|
| 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 los menus iniciales de los clientes rembo de un Centro | 
|---|
| 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_MENUS; | 
|---|
| 72 | $cadenaXML='<MENUS'; | 
|---|
| 73 | // Atributos | 
|---|
| 74 | $cadenaXML.=' imagenodo="../images/iconos/menus.gif"'; | 
|---|
| 75 | $cadenaXML.=' infonodo='.$TbMsg[9]; | 
|---|
| 76 | $cadenaXML.=' nodoid=Raiz'.$LITAMBITO_MENUS; | 
|---|
| 77 | $cadenaXML.=' clickcontextualnodo="menu_contextual(this,' ."'flo_Raiz".$LITAMBITO_MENUS."'".')"'; | 
|---|
| 78 | $cadenaXML.='>'; | 
|---|
| 79 | $cadenaXML.=SubarbolXML_grupos_menus($cmd,$idcentro,0); | 
|---|
| 80 | $cadenaXML.='</MENUS>'; | 
|---|
| 81 | return($cadenaXML); | 
|---|
| 82 | } | 
|---|
| 83 | //________________________________________________________________________________________________________ | 
|---|
| 84 | function SubarbolXML_grupos_menus($cmd,$idcentro,$grupoid){ | 
|---|
| 85 | global $LITAMBITO_GRUPOSMENUS; | 
|---|
| 86 | global $AMBITO_GRUPOSMENUS; | 
|---|
| 87 | $cadenaXML=""; | 
|---|
| 88 | $rs=new Recordset; | 
|---|
| 89 | $cmd->texto="SELECT idgrupo,nombregrupo,grupoid FROM grupos WHERE grupoid=".$grupoid." AND idcentro=".$idcentro." AND tipo=".$AMBITO_GRUPOSMENUS." 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.='<GRUPOSMENU'; | 
|---|
| 95 | // Atributos | 
|---|
| 96 | $cadenaXML.=' clickcontextualnodo="menu_contextual(this,'. " 'flo_".$LITAMBITO_GRUPOSMENUS."'" .');"'; | 
|---|
| 97 | $cadenaXML.=' imagenodo="../images/iconos/carpeta.gif"'; | 
|---|
| 98 | $cadenaXML.=' infonodo="'.$rs->campos["nombregrupo"].'"'; | 
|---|
| 99 | $cadenaXML.=' nodoid='.$LITAMBITO_GRUPOSMENUS.'-'.$rs->campos["idgrupo"]; | 
|---|
| 100 | $cadenaXML.='>'; | 
|---|
| 101 | $cadenaXML.=SubarbolXML_grupos_menus($cmd,$idcentro,$rs->campos["idgrupo"]); | 
|---|
| 102 | $cadenaXML.='</GRUPOSMENU>'; | 
|---|
| 103 | $rs->Siguiente(); | 
|---|
| 104 | } | 
|---|
| 105 | $rs->Cerrar(); | 
|---|
| 106 | $cadenaXML.=SubarbolXML_Menus($cmd,$idcentro,$grupoid); | 
|---|
| 107 | return($cadenaXML); | 
|---|
| 108 | } | 
|---|
| 109 | //________________________________________________________________________________________________________ | 
|---|
| 110 | function SubarbolXML_Menus($cmd,$idcentro,$grupoid){ | 
|---|
| 111 | global $LITAMBITO_MENUS; | 
|---|
| 112 | $cadenaXML=""; | 
|---|
| 113 | $rs=new Recordset; | 
|---|
| 114 | $cmd->texto="SELECT idmenu,descripcion FROM menus  WHERE idcentro=".$idcentro." AND grupoid=". $grupoid." ORDER BY descripcion"; | 
|---|
| 115 | $rs->Comando=&$cmd; | 
|---|
| 116 | if (!$rs->Abrir()) return($cadenaXML); // Error al abrir recordset | 
|---|
| 117 | $rs->Primero(); | 
|---|
| 118 | while (!$rs->EOF){ | 
|---|
| 119 | $cadenaXML.='<MENU'; | 
|---|
| 120 | // Atributos | 
|---|
| 121 | $cadenaXML.=' imagenodo="../images/iconos/menu.gif"'; | 
|---|
| 122 | $cadenaXML.=' infonodo="'.$rs->campos["descripcion"].'"'; | 
|---|
| 123 | $cadenaXML.=' nodoid='.$LITAMBITO_MENUS.'-'.$rs->campos["idmenu"]; | 
|---|
| 124 | $cadenaXML.=' clickcontextualnodo="menu_contextual(this,' ."'flo_".$LITAMBITO_MENUS."'" .')"'; | 
|---|
| 125 | $cadenaXML.=' >'; | 
|---|
| 126 | $cadenaXML.='</MENU>'; | 
|---|
| 127 | $rs->Siguiente(); | 
|---|
| 128 | } | 
|---|
| 129 | $rs->Cerrar(); | 
|---|
| 130 | return($cadenaXML); | 
|---|
| 131 | } | 
|---|
| 132 | //________________________________________________________________________________________________________ | 
|---|
| 133 | // | 
|---|
| 134 | //      Menús Contextuales | 
|---|
| 135 | //________________________________________________________________________________________________________ | 
|---|
| 136 | function CreacontextualXMLMenus(){ | 
|---|
| 137 | global $AMBITO_MENUS; | 
|---|
| 138 | global $AMBITO_GRUPOSMENUS; | 
|---|
| 139 | global $LITAMBITO_GRUPOSMENUS; | 
|---|
| 140 | global $LITAMBITO_MENUS; | 
|---|
| 141 | global $TbMsg; | 
|---|
| 142 |  | 
|---|
| 143 | $layerXML='<MENUCONTEXTUAL'; | 
|---|
| 144 | $layerXML.=' idctx="flo_Raiz'.$LITAMBITO_MENUS.'"'; | 
|---|
| 145 | $layerXML.=' maxanchu=155'; | 
|---|
| 146 | $layerXML.=' swimg=1'; | 
|---|
| 147 | $layerXML.=' clase="menu_contextual"'; | 
|---|
| 148 | $layerXML.='>'; | 
|---|
| 149 |  | 
|---|
| 150 | $layerXML.='<ITEM'; | 
|---|
| 151 | $layerXML.=' alpulsar="insertar_grupos('.$AMBITO_GRUPOSMENUS.',' . "'".$LITAMBITO_GRUPOSMENUS."'" . ')"'; | 
|---|
| 152 | $layerXML.=' imgitem="../images/iconos/carpeta.gif"'; | 
|---|
| 153 | $layerXML.=' textoitem='.$TbMsg[0]; | 
|---|
| 154 | $layerXML.='></ITEM>'; | 
|---|
| 155 |  | 
|---|
| 156 | $wLeft=140; | 
|---|
| 157 | $wTop=115; | 
|---|
| 158 | $wWidth=550; | 
|---|
| 159 | $wHeight=480; | 
|---|
| 160 | $wpages="../propiedades/propiedades_menus.php"; | 
|---|
| 161 | $wParam=$wLeft .",".$wTop.",".$wWidth.",".$wHeight.",'". $wpages."'"; | 
|---|
| 162 |  | 
|---|
| 163 | $layerXML.='<ITEM'; | 
|---|
| 164 | $layerXML.=' alpulsar="insertar('.$wParam.')"'; | 
|---|
| 165 | $layerXML.=' imgitem="../images/iconos/menu.gif"'; | 
|---|
| 166 | $layerXML.=' textoitem='.$TbMsg[1]; | 
|---|
| 167 | $layerXML.='></ITEM>'; | 
|---|
| 168 |  | 
|---|
| 169 | $layerXML.='<SEPARADOR>'; | 
|---|
| 170 | $layerXML.='</SEPARADOR>'; | 
|---|
| 171 |  | 
|---|
| 172 | $wParam="../gestores/gestor_menus.php"; | 
|---|
| 173 |  | 
|---|
| 174 | $layerXML.='<ITEM'; | 
|---|
| 175 | $layerXML.=' alpulsar="colocar('."'".$wParam."'".','.$AMBITO_MENUS.')"'; | 
|---|
| 176 | $layerXML.=' imgitem="../images/iconos/colocar.gif"'; | 
|---|
| 177 | $layerXML.=' textoitem='.$TbMsg[2]; | 
|---|
| 178 | $layerXML.='></ITEM>'; | 
|---|
| 179 |  | 
|---|
| 180 | $layerXML.='</MENUCONTEXTUAL>'; | 
|---|
| 181 | return($layerXML); | 
|---|
| 182 | } | 
|---|
| 183 | //________________________________________________________________________________________________________ | 
|---|
| 184 | function ContextualXMLGruposMenus(){ | 
|---|
| 185 | global $AMBITO_MENUS; | 
|---|
| 186 | global $AMBITO_GRUPOSMENUS; | 
|---|
| 187 | global $LITAMBITO_GRUPOSMENUS; | 
|---|
| 188 | global $TbMsg; | 
|---|
| 189 |  | 
|---|
| 190 | $layerXML='<MENUCONTEXTUAL'; | 
|---|
| 191 | $layerXML.=' idctx="flo_'.$LITAMBITO_GRUPOSMENUS.'"'; | 
|---|
| 192 | $layerXML.=' maxanchu=160'; | 
|---|
| 193 | $layerXML.=' swimg=1'; | 
|---|
| 194 | $layerXML.=' clase="menu_contextual"'; | 
|---|
| 195 | $layerXML.='>'; | 
|---|
| 196 |  | 
|---|
| 197 | $layerXML.='<ITEM'; | 
|---|
| 198 | $layerXML.=' alpulsar="insertar_grupos('.$AMBITO_GRUPOSMENUS.',' ."'".$LITAMBITO_GRUPOSMENUS."'". ')"'; | 
|---|
| 199 | $layerXML.=' imgitem="../images/iconos/carpeta.gif"'; | 
|---|
| 200 | $layerXML.=' textoitem='.$TbMsg[0]; | 
|---|
| 201 | $layerXML.='></ITEM>'; | 
|---|
| 202 |  | 
|---|
| 203 | $wLeft=140; | 
|---|
| 204 | $wTop=115; | 
|---|
| 205 | $wWidth=550; | 
|---|
| 206 | $wHeight=480; | 
|---|
| 207 |  | 
|---|
| 208 | $wpages="../propiedades/propiedades_menus.php"; | 
|---|
| 209 | $wParam=$wLeft .",".$wTop.",".$wWidth.",".$wHeight.",'". $wpages."'"; | 
|---|
| 210 |  | 
|---|
| 211 | $layerXML.='<ITEM'; | 
|---|
| 212 | $layerXML.=' alpulsar="insertar('.$wParam.')"'; | 
|---|
| 213 | $layerXML.=' imgitem="../images/iconos/menu.gif"'; | 
|---|
| 214 | $layerXML.=' textoitem='.$TbMsg[1]; | 
|---|
| 215 | $layerXML.='></ITEM>'; | 
|---|
| 216 |  | 
|---|
| 217 | $layerXML.='<SEPARADOR>'; | 
|---|
| 218 | $layerXML.='</SEPARADOR>'; | 
|---|
| 219 |  | 
|---|
| 220 | $wParam="../gestores/gestor_menus.php"; | 
|---|
| 221 |  | 
|---|
| 222 | $layerXML.='<ITEM'; | 
|---|
| 223 | $layerXML.=' alpulsar="colocar('."'".$wParam."'".','.$AMBITO_MENUS.')"'; | 
|---|
| 224 | $layerXML.=' imgitem="../images/iconos/colocar.gif"'; | 
|---|
| 225 | $layerXML.=' textoitem='.$TbMsg[2]; | 
|---|
| 226 | $layerXML.='></ITEM>'; | 
|---|
| 227 |  | 
|---|
| 228 | $layerXML.='<SEPARADOR>'; | 
|---|
| 229 | $layerXML.='</SEPARADOR>'; | 
|---|
| 230 |  | 
|---|
| 231 | $layerXML.='<ITEM'; | 
|---|
| 232 | $layerXML.=' alpulsar="modificar_grupos()"'; | 
|---|
| 233 | $layerXML.=' imgitem="../images/iconos/modificar.gif"'; | 
|---|
| 234 | $layerXML.=' textoitem='.$TbMsg[7]; | 
|---|
| 235 | $layerXML.='></ITEM>'; | 
|---|
| 236 |  | 
|---|
| 237 | $layerXML.='<ITEM'; | 
|---|
| 238 | $layerXML.=' alpulsar="eliminar_grupos()"'; | 
|---|
| 239 | $layerXML.=' imgitem="../images/iconos/eliminar.gif"'; | 
|---|
| 240 | $layerXML.=' textoitem='.$TbMsg[4]; | 
|---|
| 241 | $layerXML.='></ITEM>'; | 
|---|
| 242 |  | 
|---|
| 243 | $layerXML.='</MENUCONTEXTUAL>'; | 
|---|
| 244 | return($layerXML); | 
|---|
| 245 | } | 
|---|
| 246 | //________________________________________________________________________________________________________ | 
|---|
| 247 | function CreacontextualXMLMenu(){ | 
|---|
| 248 | global $AMBITO_MENUS; | 
|---|
| 249 | global $LITAMBITO_MENUS; | 
|---|
| 250 | global $TbMsg; | 
|---|
| 251 |  | 
|---|
| 252 | $layerXML='<MENUCONTEXTUAL'; | 
|---|
| 253 | $layerXML.=' idctx="flo_'.$LITAMBITO_MENUS.'"'; | 
|---|
| 254 | $layerXML.=' maxanchu=130'; | 
|---|
| 255 | $layerXML.=' swimg=1'; | 
|---|
| 256 | $layerXML.=' clase="menu_contextual"'; | 
|---|
| 257 | $layerXML.='>'; | 
|---|
| 258 |  | 
|---|
| 259 | $layerXML.='<ITEM'; | 
|---|
| 260 | $layerXML.=' alpulsar="gestionar_items()"'; | 
|---|
| 261 | $layerXML.=' imgitem="../images/iconos/comandos.gif"'; | 
|---|
| 262 | $layerXML.=' textoitem='.$TbMsg[10]; | 
|---|
| 263 | $layerXML.='></ITEM>'; | 
|---|
| 264 |  | 
|---|
| 265 | $layerXML.='<ITEM'; | 
|---|
| 266 | $layerXML.=' alpulsar="muestra_informacion()"'; | 
|---|
| 267 | $layerXML.=' textoitem='.$TbMsg[5]; | 
|---|
| 268 | $layerXML.=' imgitem="../images/iconos/informacion.gif"'; | 
|---|
| 269 | $layerXML.='></ITEM>'; | 
|---|
| 270 |  | 
|---|
| 271 | $layerXML.='<SEPARADOR>'; | 
|---|
| 272 | $layerXML.='</SEPARADOR>'; | 
|---|
| 273 |  | 
|---|
| 274 | $layerXML.='<ITEM'; | 
|---|
| 275 | $layerXML.=' alpulsar="mover('.$AMBITO_MENUS.')"'; | 
|---|
| 276 | $layerXML.=' imgitem="../images/iconos/mover.gif"'; | 
|---|
| 277 | $layerXML.=' textoitem='.$TbMsg[6]; | 
|---|
| 278 | $layerXML.='></ITEM>'; | 
|---|
| 279 |  | 
|---|
| 280 | $layerXML.='<SEPARADOR>'; | 
|---|
| 281 | $layerXML.='</SEPARADOR>'; | 
|---|
| 282 |  | 
|---|
| 283 | $wLeft=140; | 
|---|
| 284 | $wTop=115; | 
|---|
| 285 | $wWidth=550; | 
|---|
| 286 | $wHeight=480; | 
|---|
| 287 |  | 
|---|
| 288 | $wpages="../propiedades/propiedades_menus.php"; | 
|---|
| 289 | $wParam=$wLeft .",".$wTop.",".$wWidth.",".$wHeight.",'". $wpages."'"; | 
|---|
| 290 |  | 
|---|
| 291 | $layerXML.='<ITEM'; | 
|---|
| 292 | $layerXML.=' alpulsar="modificar('.$wParam.')"'; | 
|---|
| 293 | $layerXML.=' textoitem='.$TbMsg[7]; | 
|---|
| 294 | $layerXML.=' imgitem="../images/iconos/propiedades.gif"'; | 
|---|
| 295 | $layerXML.='></ITEM>'; | 
|---|
| 296 |  | 
|---|
| 297 | $layerXML.='<ITEM'; | 
|---|
| 298 | $layerXML.=' alpulsar="eliminar('.$wParam.')"'; | 
|---|
| 299 | $layerXML.=' imgitem="../images/iconos/eliminar.gif"'; | 
|---|
| 300 | $layerXML.=' textoitem='.$TbMsg[8]; | 
|---|
| 301 | $layerXML.='></ITEM>'; | 
|---|
| 302 |  | 
|---|
| 303 | $layerXML.='</MENUCONTEXTUAL>'; | 
|---|
| 304 | return($layerXML); | 
|---|
| 305 | } | 
|---|
| 306 | ?> | 
|---|