private void LoadCategories()
 {
     const int countCells = 2;
     HtmlTableRow row = new HtmlTableRow();
     Category c = new Category();
     //c.Where.IsGallery.Value = true;
     if(c.Query.Load())
     {
         do
         {
             string title = "";
             if (!c.IsColumnNull("Title" + Utils.LangPrefix))
             {
                 title = c.GetColumn("Title" + Utils.LangPrefix).ToString();
             }
             if (title.Trim() == "")
             {
                 title = c.GetColumn("Name" + Utils.LangPrefix).ToString();
             }
             if (row.Cells.Count < countCells)
             {
                 row.Cells.Add(AddCategoryCellInnerHTML(c.CategoryID, title));
             }
             else
             {
                 tblCategory.Rows.Add(row);
                 row = new HtmlTableRow();
                 row.Cells.Add(AddCategoryCellInnerHTML(c.CategoryID, title));
             }
         } while (c.MoveNext());
     }
     for (int i = row.Cells.Count; i < countCells; i++)
     {
         row.Cells.Add(AddTableCell("&nbsp;"));
     }
     tblCategory.Rows.Add(row);
 }
Beispiel #2
0
    public static void InitMenu(Menu menu, bool onlyTopLevel, bool ukr, bool adminMenu)
    {
        Hashtable catTitles = new Hashtable();
        Hashtable catTitlesEng = new Hashtable();
        Category cat = new Category();
        if (cat.LoadAll())
        {
            do
            {
                catTitles.Add(cat.CategoryID, cat.GetColumn("Name" + (ukr ? "" : LangPrefix)).ToString().ToUpper());
                catTitlesEng.Add(cat.CategoryID, cat.GetColumn("Name_en").ToString().ToUpper());
            } while (cat.MoveNext());
        }

        menu.Items.Clear();
        if (adminMenu)
        {
            menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 1, catTitles, catTitlesEng, adminMenu));
        }
        menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 2, catTitles, catTitlesEng, adminMenu));
        if (!onlyTopLevel)
        {
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 28, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 3, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 5, catTitles, catTitlesEng, adminMenu));
        }
        menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 7, catTitles, catTitlesEng, adminMenu));
        if (!onlyTopLevel)
        {
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 8, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 9, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 10, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 11, catTitles, catTitlesEng, adminMenu));
        }
        menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 12, catTitles, catTitlesEng, adminMenu));
        if (!onlyTopLevel)
        {
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 13, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 14, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 15, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 16, catTitles, catTitlesEng, adminMenu));
        }
        menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 18, catTitles, catTitlesEng, adminMenu));
        if (!onlyTopLevel)
        {
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 19, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 20, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 21, catTitles, catTitlesEng, adminMenu));
        }
        menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 22, catTitles, catTitlesEng, adminMenu));
        if (!onlyTopLevel)
        {

            menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 23, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 24, catTitles, catTitlesEng, adminMenu));
            menu.Items[menu.Items.Count - 1].ChildItems.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 25, catTitles, catTitlesEng, adminMenu));
        }
        else
        {
            menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 24, catTitles, catTitlesEng, adminMenu));
            menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 25, catTitles, catTitlesEng, adminMenu));
        }
        menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=CategoryEdit", 27, catTitles, catTitlesEng, adminMenu));
        if (adminMenu)
        {
            menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=RoomList", "НОМЕРИ"));
            menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=RoomCategoryList", "КАТЕГОРІЇ НОМЕРІВ"));
            menu.Items.Add(AddMenuItem("~/Office/Office.aspx?content=SettingsEdit&SettingID=1", "НАЛАШТУВАННЯ"));
        }
    }