Ya lo solucione, te copio la funcion para que lo apliques.
Código PHP:
if (!function_exists("Submodulos")) {
function Submodulos(
$niveles,
$enlace2,
$hostname_obras,
$database_obras,
$username_obras,
$password_obras) {
$obras = mysql_pconnect($hostname_obras, $username_obras, $password_obras) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database_obras, $obras);
$menu_4 = "
";
$menu_4 .= "MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {
";
$query_menus = "SELECT
DISTINCT `us_rolesmenus`.`optmenu` ,
`ag_menuspad`.`padmenu` ,
`ag_menuspad`.`formularioweb` ,
`ag_menuspad`.`etiqueta` ,
`ag_menuspad`.`opttexto` ,
`ag_menuspad`.`images`
FROM `us_rolesmenus`
INNER JOIN `ag_menuspad` ON `us_rolesmenus`.`optmenu` = `ag_menuspad`.`optmenu`
WHERE `us_rolesmenus`.`idrol` LIKE '".$niveles."' ";
$menus = mysql_query($query_menus, $obras) or die(mysql_error());
$row_menus = mysql_fetch_assoc($menus);
$totalRows_menus = mysql_num_rows($menus);
do {
mysql_select_db($database_obras, $obras);
$query_menus2 = "SELECT DISTINCT * FROM `ag_menusopt` WHERE `optmenu` LIKE '".$row_menus['optmenu']."' AND `padmenu` LIKE '".$row_menus['padmenu']."'";
$menus2 = mysql_query($query_menus2, $obras) or die(mysql_error());
$row_menus2 = mysql_fetch_assoc($menus2);
$totalRows_menus2 = mysql_num_rows($menus2);
do {
if(!empty($row_menus2['formularioweb'])) {
$menu_4 .= " init : function(){
";
$menu_4 .= " ".$row_menus2['formularioweb'].".launcher = {
";
$menu_4 .= " text: 'icon-grid',
";
$menu_4 .= " iconCls:'".$row_menus['formularioweb']."',
";
$menu_4 .= " handler : ".$row_menus2['formularioweb'].".createWindow_".$row_menus2['formularioweb'].",
";
$menu_4 .= " scope: ".$row_menus2['formularioweb'].",
";
$menu_4 .= " windowId: '".$row_menus2['formularioweb']."'
";
$menu_4 .= " }
";
$menu_4 .= "},
";
$menu_4 .= " createWindow_".$row_menus2['formularioweb']." : function(src){
";
$menu_4 .= " var desktop_".$row_menus2['formularioweb']." = this.app.getDesktop();
";
$menu_4 .= " var win_".$row_menus2['formularioweb']." = desktop_".$row_menus2['formularioweb'].".getWindow('".$row_menus2['formularioweb']."');
";
$menu_4 .= " if(!win_".$row_menus2['formularioweb']."){
";
$menu_4 .= " win_".$row_menus2['formularioweb']." = desktop_".$row_menus2['formularioweb'].".createWindow({
";
$menu_4 .= " id: '".$row_menus2['formularioweb']."',
";
$menu_4 .= " title: '".$row_menus2['etiqueta']."',
";
$menu_4 .= " width:900,
";
$menu_4 .= " height:700,
";
$menu_4 .= " html : '<iframe id=\"container\" src=\"".$enlace2.$row_menus2['formularioweb'].".php\" style=\"width:100%;height:100%;border:none\"></iframe>',
";
$menu_4 .= " iconCls: '".$row_menus['formularioweb']."',
";
$menu_4 .= " shim:false,
";
$menu_4 .= " animCollapse:false,
";
$menu_4 .= " constrainHeader:true,
";
/*
$menu_4 .= " closable: false,
";
$menu_4 .= " maximizable: false,
";
$menu_4 .= " minimizable : false
";
*/
$menu_4 .= " });
";
$menu_4 .= "}
";
$menu_4 .= "win_".$row_menus2['formularioweb'].".show();
";
$menu_4 .= "},
";
}
} while ($row_menus2 = mysql_fetch_assoc($menus2));
} while ($row_menus = mysql_fetch_assoc($menus));
$menu_4 .= "});
";
return $menu_4;
#return $query_menus2;
}
}
Se explica que genero las funciones a partir de la base de datos de menus, y submenus.