Thyago,
Esse código esta funcionando:
sc_appmenu_reset("menu_dinamico")
sc_appmenu_create ("menu_dinamico");
$_sel="Select id, descricao, aplicacao, id_pai from menu order by id_pai, id";
sc_select(rs,$_sel);
if ({rs} === false)
{
echo "Erro de acesso. Mensagem = " . {rs_erro};
}
else
{
while (!$rs->EOF){
$_id = md5($rs->fields[0]);
$_id_pai=$rs->fields[3]>0?md5($rs->fields[3]):"";
$_desc=trim($rs->fields[1]);
$_app=trim($rs->fields[2]);
if ($rs->fields[2]=="app_Login") {
sc_appmenu_add_item('menu_dinamico',$_id,$_id_pai,$_desc,$_app,"","","","_parent");
}else{
sc_appmenu_add_item('menu_dinamico',$_id,$_id_pai,$_desc,$_app);
}
sc_apl_status($_app, 'on');
$rs->MoveNext();
}
$rs->Close();
}
– Adminer 4.1.0 SQLite 3 dump
DROP TABLE IF EXISTS “menu”;
CREATE TABLE [menu] (
[Id] integer NOT NULL PRIMARY KEY AUTOINCREMENT,
[Descricao] varchar(35) DEFAULT NULL,
[Aplicacao] varchar(100) DEFAULT NULL,
[Id_Pai] int(11) DEFAULT NULL);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (1, ‘Home’, ’ container_home’, ‘0’);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (2, ‘Cadastros’, ‘’, ‘0’);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (3, ‘Clientes’, ‘form_clientes’, 2);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (4, ‘Vendedores’, ‘form_vendedores’, 2);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (5, ‘Produtos’, ‘form_products’, 2);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (6, ‘Consultas’, ‘’, ‘0’);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (7, ‘Pedidos’, ‘grid_orders’, 14);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (8, ‘Produtos’, ‘form_products’, 6);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (9, ‘Vendedores’, ‘grid_vendedores’, 6);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (10, ‘Controles’, ‘control_macros’, ‘0’);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (11, ‘Administrativo’, ‘’, ‘0’);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (12, ‘Cadastro Menu’, ‘form_menu’, 11);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (13, ‘Cadastro de Pedido’, ‘form_orders’, 2);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (14, ‘Lançamentos’, ‘’, 2);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (15, ‘Sair’, ‘app_Login’, ‘0’);
INSERT INTO “menu” (“Id”, “Descricao”, “Aplicacao”, “Id_Pai”) VALUES (16, ‘Módulo de Segurança’, ‘app_menu’, 11);