Menus from models?

I’m very new to Yii. I’ve searched for an answer, but I’m probably looking in the wrong place?

Can someone point me in the right direction please??

What I want to do is to inject menu items into the Main Menu based on model permissions (I’m using Rights at the moment).

eg: I’ve got the static members of the menu: home, about, etc. I have manufacturers, products and items models that I want to set user permission rights on that will drive the menu: so that a particular menu is displayed when viewing particular pages.

Manufacturers have products and products are made up of items (for example). A user can have edit permissions to some Manufacturers. The Manufacturer edit menu displays when the logged in user has edit rights. When editting a Manufacturer, products are displayed. If a user has edit rights for product the edit product menu is displayed. A bit like this:

  • Manufacturer

[list]

  • Edit

  • View

  • Products

[list]

  • View

  • Edit

  • Manage

[/list]

[/list]

I have editted the mainmenu in views\layouts\main.php to display a menu when user has the correct rights, but that’s global and not related to the actual page being displayed. For example, the list above should only be displayed on a Manufacturer page, not every page.

Thanks

Did you find the solution to this?

No… but I’d still like to :)