public void BuildMenu(Literal ltlMenu) { StringBuilder sbMenu = new StringBuilder(); try { sbMenu.Append("<div class='d-block main-menu'>"); foreach (bug_tracker_menu_header menu_header in MenusDB.GetMenu()) { sbMenu.Append("<div class='main-menu-header'>"); if (menu_header.has_submenu == true) { sbMenu.AppendFormat("<a class='d-flex menu-title' data-sub='{0}'>", menu_header.id); sbMenu.Append("<i class='material-icons menu-right'>keyboard_arrow_right</i>"); sbMenu.Append("<i class='material-icons menu-down' style='display:none;'>keyboard_arrow_down</i>"); sbMenu.AppendFormat("<span>{0}</span>", menu_header.menu_title); sbMenu.Append("</a>"); sbMenu.Append(BuildSubMenus(menu_header)); sbMenu.Append(BuildMenuPages(menu_header)); } else { sbMenu.AppendFormat("<a href='{0}' class='d-flex menu-title'><i class='material-icons'>keyboard_arrow_right</i><span>{1}</span></a>", MenusDB.GetMenuHeaderPage(menu_header.id).page_url, menu_header.menu_title); } sbMenu.Append("</div>"); } sbMenu.Append("</div>"); } catch (Exception ex) { LogsDB.AddLog("Error building main side menu", LogsDB.GetLogType("error").id, ex); } ltlMenu.Text = sbMenu.ToString(); }
private string BuildSubMenus(bug_tracker_menu_header menu_item) { StringBuilder sb = new StringBuilder(); List <bug_tracker_menu_header> sub_menus = MenusDB.GetSubMenus(menu_item.id); if (sub_menus.Count > 0) { sb.Append("<div class='menu-holder'>"); foreach (bug_tracker_menu_header sub_menu in MenusDB.GetSubMenus(menu_item.id)) { sb.Append("<div class='menu-submenu'>"); if (sub_menu.has_submenu == true) { sb.AppendFormat("<a class='d-flex menu-title' data-sub='{0}'>", sub_menu.id); sb.Append("<i class='material-icons menu-right'>keyboard_arrow_right</i>"); sb.Append("<i class='material-icons menu-down' style='display:none;'>keyboard_arrow_down</i>"); sb.AppendFormat("<span>{0}</span>", sub_menu.menu_title); sb.Append("</a>"); sb.Append(BuildSubMenus(sub_menu)); sb.Append(BuildMenuPages(sub_menu)); } else { sb.AppendFormat("<div class='d-flex'><a href='{0}' class='d-flex menu-title'><i class='material-icons'>keyboard_arrow_right</i><span>{1}</span></a></div>", MenusDB.GetMenuHeaderPage(sub_menu.id).page_url, sub_menu.menu_title); } sb.Append("</div>"); } sb.Append("</div>"); } return(sb.ToString()); }
private string BuildMenuPages(bug_tracker_menu_header menu_item) { StringBuilder sb = new StringBuilder(); List <bug_tracker_page> pages = MenusDB.GetMenuPages(menu_item.id); if (pages.Count > 0) { sb.Append("<div class='menu-holder'>"); foreach (bug_tracker_page page in MenusDB.GetMenuPages(menu_item.id)) { sb.Append("<div class='menu-item'>"); sb.AppendFormat("<a href='{0}' class='d-flex menu-title'><span>{1}<span></a>", page.page_url, page.name); sb.Append("</div>"); } sb.Append("</div>"); } return(sb.ToString()); }