Yii Framework Forum: [Extension] Menubuilder - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[Extension] Menubuilder Rate Topic: ***** 1 Votes

#1 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 678
  • Joined: 12-September 10
  • Location:Austria

Posted 23 June 2013 - 06:19 AM

Discuss the extension menubuilder here.
0

#2 User is offline   Argenis Bolivar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 27-February 11

Posted 27 June 2013 - 10:37 AM

Hi, i have this error try access index.php/menubuilder with the basic configuration "usort(): Array was modified by the user comparison function" in menubuilder/components/EMBFileAdapter.php

Any idea?
0

#3 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 678
  • Joined: 12-September 10
  • Location:Austria

Posted 28 June 2013 - 03:50 AM

See the comment at the extensions documentation.

menubuilder is now available on github too.
You also can report issues there.
0

#4 User is offline   leo4all 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 01-April 13
  • Location:Alajuela, Costa Rica

Posted 12 July 2013 - 02:07 AM

Screenshot?? demo page???
0

#5 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 678
  • Joined: 12-September 10
  • Location:Austria

Posted 12 July 2013 - 02:09 AM

screenshot is at the extensions documentation, no demo available
0

#6 User is offline   Bamidele Alegbe 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 13-January 13
  • Location:NIgeria

Posted 11 August 2013 - 02:27 PM

hello, how can i simulate a menu to show different menuitem for different access
this is my issue:
i have 3 access.. isGuest(not logged in) , isAdmin(loggedin as admin) and authenticated(logged in as normal user ,eg demo). i want to create one menu that will display different menuitem for different access. pls help
0

#7 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 678
  • Joined: 12-September 10
  • Location:Austria

Posted 12 August 2013 - 01:32 AM

You can find a similiar topic in the online documentation - see Advanced/Customizing

1. You have to create a 'Datafilter' component that extends EMBDataFilter. Place it in your menubuilder module/components.

You have to override the methods
- getSupportedUserRoles()
- getCurrentUserRoles()


class AdminRoleDataFilter extends EMBDataFilter
        {
            public static function getSupportedUserRoles() //returns guest, authenticated, admin roles
            {
                return array_merge(parent::getSupportedUserRoles(),array('admin'=>'Admin'));
            }

            public static function getCurrentUserRoles() //returns guest or authenticated, admin ... roles
            {
                if(Yii::app()->user->id == 'admin') //check your admin-role here
                      return array('authenticated'=>'Authenticated user','admin'=>'Admin');
                else
                      return parent::getCurrentUserRoles(); //authenticated or guest       
            }
       }             
             


Install the AdminRoleDataFilter instead of the default in config/main.php



'modules'=>array(
 
        'menubuilder'=>array(
            ...
            'dataFilterClass'=>'AdminRoleDataFilter',
 
        ),
)


0

#8 User is offline   Bamidele Alegbe 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 13-January 13
  • Location:NIgeria

Posted 12 August 2013 - 04:42 AM

thanks so much, i did that but implementing it in the menu is the issue,
FROM THE DUMMY MENU INSTALLED , LETS SAY
yiiframework menu item should be seen by admin only
resources should be seen by authenticated users only
contact should be seen by guest only
while home should be seen by all,
how can implement that..
i would love to hear from you!
0

#9 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 678
  • Joined: 12-September 10
  • Location:Austria

Posted 12 August 2013 - 01:24 PM

If you have installed the 3 roles, you will find this roles in the menu- and menuitem form.
You can add one or more roles to a whole menu or single menuitems.
If you don't add roles, the menu/item will be visible for all users, otherwise for the users with the assigned roles only.

So you should be able to build your menu as wish.
But I would split it into two menus - 'main' and 'admin' with a 'Admin' label as root (no url assigned, add all admin-subitems, assign the admin role in the menu, not to every admin-item) and merge these menus in the layout view, like described in the documentation.
0

#10 User is offline   Bamidele Alegbe 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 13-January 13
  • Location:NIgeria

Posted 13 August 2013 - 08:57 AM

hello i did is you said, but when i create a menu called 'admin' with only 'admin' userrole selected, i get an error,

this is the error
Error 500
Trying to get property of non-object

should i select authenticated and admin as my userrole?
0

#11 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 678
  • Joined: 12-September 10
  • Location:Austria

Posted 13 August 2013 - 09:09 AM

Maybe a bug?
It's hard to reproduce without more information: error 500, which line, which object ....?

- Where is the error: In menubuilder admin-form or on rendering the menu?
- Can you debug the project?

Maybe you can upload your modified menubuilder module code (not the core) and the zip-file of your exported menu here.
0

#12 User is offline   za_al 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 06-March 12

Posted 30 September 2013 - 02:29 PM

Hi All

i install this module and Browse to the menubuilder module (yourapp/index.php/menubuilder). some interface

display. but didn't installed the menus from data/installmenus.php and data/installmenuitems.php On the first run.

my questions are :

1- how to install menue in data/installmenus.php and data/installmenuitems.php ? or how to create new menu?

2- this module works file to store menue items or db?

following file that attached is screen shot pic that i see.

Attached File(s)


0

#13 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 678
  • Joined: 12-September 10
  • Location:Austria

Posted 01 October 2013 - 09:01 AM

It seems, that the files data/installmenu-items are not found.
The demo-data should be installed at the first usage.

Did you follow the install-instructions correctly?
The default value of dataFilePath='menubuilder.data' (=moduleId.data),
but you can assign this property of the module in the config/main.php - as alias path.

What happens if you execute 'Utilities'->reinstall?

It seems to be a bug, that if you are not able to create a menu manually, if the default menus could not be created from data/installmenus.
I will investigate this issue.
0

#14 User is offline   za_al 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 06-March 12

Posted 04 October 2013 - 01:13 AM

View PostJoblo, on 01 October 2013 - 09:01 AM, said:

It seems, that the files data/installmenu-items are not found.
The demo-data should be installed at the first usage.

Did you follow the install-instructions correctly?
The default value of dataFilePath='menubuilder.data' (=moduleId.data),
but you can assign this property of the module in the config/main.php - as alias path.

What happens if you execute 'Utilities'->reinstall?

It seems to be a bug, that if you are not able to create a menu manually, if the default menus could not be created from data/installmenus.
I will investigate this issue.



Hi

1-Tanks for your reply. I followed install-instructions step by step.
2-yes The default value of dataFilePath='menubuilder.data' is :

class EMBMenubuilderModule extends CWebModule
{
...
    protected $_dataFilePath='menubuilder.data'; //allow set





3- when i try 'Utilities'->reinstall i get this error
"No menu found: Please create a menu" .Attached file show this.

I going to create new app and then install menubuilder module . I try to report you any result. :)

Attached File(s)


0

#15 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 678
  • Joined: 12-September 10
  • Location:Austria

Posted 04 October 2013 - 01:21 AM

- is the module property $checkInstall=true ?

- In EMBAdminController::actionIndex there are the lines

  if ($module->checkInstall)
        {
            $this->install();
        }



Are you able to debug the code here, why the installfiles are not found?
0

#16 User is offline   bandpay 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 20-June 13
  • Location:Denmark

Posted 08 October 2013 - 02:52 AM

Hi,

First of all thanks for the nice and powerfull extension. I love it, but I have a small question.

Can anyone please explain why I have to define the userRoles explicitly to force the menu to show?

Here is my implementation

$userRoles = array('Guest');

if(!empty(Yii::app()->user->id)):
	$userRoles = array();
	$roles=Rights::getAssignedRoles(Yii::app()->user->Id);
	foreach($roles as $authItem)
		$userRoles[] = $authItem->name;
endif;

/* Menubuilder begins */
$items=$this->createWidget('ext.menubuilder.widgets.EMBMenu', array(
	//'menuIds'=>'main',
	'scenarios'=>array('frontend'),
	'userRoles'=>$userRoles,
	'menuBuilderItemsBefore' => false,
	'menuOptions'=> array(
			'items'=>array(
				array('url'=>array('/menubuilder'),'label'=>'Menubuilder'),
			)
		),
	)
)->getItems();
 
$this->widget('bootstrap.widgets.TbNavbar', array(
	'collapse' => true,
	'items' => array(
		array(
			'class' => 'bootstrap.widgets.TbMenu',
			'encodeLabel'=>false,
			'items' => $items,
		)
	)
));



Here is my config

/* Menubuilder */
		'menubuilder'=>array(
            'theme'=>'bootstrap', //comment for bluegrid theme (=default)
            'checkInstall'=>false, //uncomment after first usage
            'cacheDuration'=> -1, //uncomment for disabling the menucaching
            'languages'=>array('en_us','da'),
            'supportedScenarios'=>array('backend' => 'Backend', 'frontend' => 'Frontend', 'dashboard' => 'Dashboard'),
			'dataFilterClass'=>'Datafilter',
            //set EMBDbAdapter to switch to mysql (checkInstall=>true on first run)
            //'dataAdapterClass'=> 'EMBDbAdapter', //'EMBMongoDbAdapter',

            //the available menus/lists for the preview
            'previewMenus'=>array(
               // 'superfish'=>'Superfish',
               // 'mbmenu'=>'MbMenu',
                'bootstrapnavbar'=>'Bootstrap Navbar',
                'bootstrapmenu'=>'Bootstrap Menu',
              // 'dropdownlist'=>'Dropdownlist',
                'unorderedlist'=>'Unordered list'
            )
        ),


Have a nice day friends :)
Babak

/*
May
The Life
Be Good To You
*******************
*******************
SincerelYii
Babak Bandpey
*/

0

#17 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 678
  • Joined: 12-September 10
  • Location:Austria

Posted 08 October 2013 - 08:46 AM

You don't have (and should not) assign the userroles when rendering the menu.
This property is for simulate mode only.

But the menubuilder should know the roles of the current user (and all supported roles, for displaying in the dropdown of the menubuilder admin).

So you have to install your own datafilter component, as described here:
http://www.yiiframew...enubuilder/#hh9

The YourDataFilter::getCurrentUserRoles should contain your lines from above
 
$userRoles = array();
$roles=Rights::getAssignedRoles(Yii::app()->user->Id);
        foreach($roles as $authItem)
                $userRoles[] = $authItem->name;
return $userRoles;


YourDataFilter::getSupportedUserRoles should return all available roles (to assign to a menu/item).

Place your component in your modules working copy in the components folder and register it in config/main.php as your datafilter.

But you have to install the current version of the EMBDataFilter from Github before, because of a bug (using static::getCurrentUserRoles() instead of self::getCurrentUserRoles() in the method checkRoles.
0

#18 User is offline   masdib.banget 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 02-July 13

Posted 09 May 2014 - 04:23 AM

Hi Joblo,
I was run data/installmenus.php and data/installmenuitems.php
but not working anymore, can you post demo like multimodelform??
:rolleyes:
thanks
0

#19 User is offline   Joblo 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 678
  • Joined: 12-September 10
  • Location:Austria

Posted 09 May 2014 - 04:46 AM

Yes there is an issue with installing.
The next release of menubuilder will come soon.
Ok, maybe with demo.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users