torifat / cake-menu_builder Goto Github PK
View Code? Open in Web Editor NEW๐ซ THIS PROJECT IS NOT MAINTAINED ANYMORE : A powerful dynamic menu building helper for CakePHP
License: MIT License
๐ซ THIS PROJECT IS NOT MAINTAINED ANYMORE : A powerful dynamic menu building helper for CakePHP
License: MIT License
I'm trying to make the noLinkFormat parameter work with jQuery UI Accordion. Theoretically, I need to surround the non-linking menu entry with something distinguishable to jQuery like
tags. Here's what I tried initially:In the helper array:
'Menu.MenuBuilder' => array(
'noLinkFormat' => '
In the menu array itself:
array(
'title' => 'Learning Resources',
'permissions' => array(''),
'children' => array(
array(
'title' => 'Collections',
'url' => 'admin/collections/index',
and so
Unfortunately, that produced unclickable "Learning Resources" entry in the menu that looked like this in the source code:
So I changed my menu array to look like this:
array(
'title' => 'Learning Resources',
'url' => '#',
'permissions' => array(''),
'children' => array(
array( and so on
However, cake-menu then totally ignored my noLinkFormat parameter and produced this kind of source code:
With that, I don't see anything that I can hook jQuery UI accordion onto. Am I missing something? Is there a way to do that? Or to set the parameters to create the kind of hooks that it needs?
Can you add travis ci support to be sur your plugin is fonctionnal
thx
I wanted to ask a question about the plugin for cakephp menu builder. I configured everything correctly by following his guide and menu function without problems, but once I try to set the permissions for the users menu item with the "permsissions" disappears even though the user has permission to view it. Can you help me?. Thank you.
When I try to use 'permissions' => array('admin') or 'permissions' => array('') it doesn't seem to work, The first never displays, even if an admin user is logged in, and the second always displays even though an admin is logged in. I'm guessing that it's because there is no role or group field in the User model. Instead, there is a role_id field to a related Role model in keeping with an ACL configuration. Is there a way to restrict the display of menu items by role in this situation?
I've tried including the following settings for MenuBuilder in AppController:
'Menu.MenuBuilder' => array(
'noLinkFormat' => '<div>%s</div>',
'authField' => 'role_id',
),
In this case, I also tried using the role_id numbers as in 'permissions' => array('1', '2', '3') , but that prevents the display of the menu item even though debug shows that the logged in user has 'role_id' => '1' in his $user array.
How to integrate ACL Menu Component?
Let's say you define a route to:
'url' => array('controller' => 'images', 'action' => 'gallery')
But that gallery uses pagination
When going to /images/gallery it sets the active class correctly, but where going to
/images/gallery/page:2 it doesn't
Might be worth adding a section about Loading the Plugin to the bootstrap.php
CakePlugin::load('MenuBuilder');
if the
CakePlugin::loadAll();
is not used.
I would expect that partialMatch checks whole url-parts (separated by /), so when the url is /news it would match /news/ and /news/3/etc but not /newsitem.
Any predictions for support version 3.0 of cakephp?
Hi there. Your plugin seems to have saved my life :) I had to restructure it a bit to make it work with 2.0, though it's really just a matter of renaming stuff around. I uploaded it to http://www.morpheu5.net/public/MenuBuilder.tar.bz2 if you want to consider making it a branch.
PS. I had to use the full syntax for the build method because it seems that something has changed in the way you retrieve the menu array:
<?php echo $this->MenuBuilder->build('main-menu', array(), $menu['main-menu']) ?>
Hello!
I'm using the plugin of cakephp menu builder. I've followed the guide but i'm having troubles with the permissions for the users. The menu item with the "permsissions" disappears even though the user has permission to view it. I'm using ACL too, does it have anything to do with that problem?
Can anyone help me.
Thanks.
Hi ,
I found issue in your code:
var user : array( 'id' => '6', 'username' => 'ruslan', 'roll_id' => null, 'group' => 'admin', 'created' => '2016-02-08 12:24:15', 'modified' => '0000-00-00 00:00:00' )
in your constructor:
public $settings = array( 'activeClass' => 'active', 'firstClass' => 'first-item', 'childrenClass' => 'has-children', 'menuClass' => null, 'evenOdd' => false, 'itemFormat' => '<li%s>%s%s</li>', 'wrapperFormat' => '<ul%s>%s</ul>', 'wrapperClass' => null, 'noLinkFormat' => '<a href="#">%s</a>', 'menuVar' => 'menu', 'authVar' => 'user', 'authModel' => 'User', 'authField' => 'group', 'indentHtmlOutput' => true, ); if (isset($View->viewVars[$this->settings['authVar']]) && isset($View->viewVars[$this->settings['authVar']][$this->settings['authModel']]) && isset($View->viewVars[$this->settings['authVar']][$this->settings['authModel']][$this->settings['authField']])) { $this->_group = $View->viewVars[$this->settings['authVar']][$this->settings['authModel']][$this->settings['authField']]; }
$this->_group - Always is null;
I'm using CakePHP 2.7 with the CakeDC/Users plugin to manage authentication and access control. When I insert the 'permissions' entry into the Cake-Menu array, it has no effect. Specifically, in my controller $helpers, I have:
public $helpers = array(
'Html',
'Form',
'Session',
'Js' => array('jquery'),
'Menu.MenuBuilder' => array(
'noLinkFormat' => '<h3>%s</h3>',
'authField' => 'group_id',
'authVar' => 'user',
'authModel' => 'Users.User'),
);
In the pertinent portion of the $menu array, I have this:
array(
'title' => 'Articles',
'url' => '#',
'children' => array(
array(
'title' => 'Manage Articles',
'url' => array(
'plugin' => FALSE,
'admin' => TRUE,
'controller' => 'posts',
'action' => 'index',
'permissions' => array('512b9492-097c-462d-9c34-08b058f5bb4b'),
),
), array(
'title' => 'Add Article',
'url' => array(
'plugin' => FALSE,
'admin' => TRUE,
'controller' => 'posts',
'action' => 'add'
),
),
),
512b9492-097c-462d-9c34-08b058f5bb4b is the GUID for the admin group and is found in the group_id field for my record in the users table.
In this example, I would expect to see the Add Article menu entry even when no one is logged in, but only see the Manage Articles entry when an admin, such as me, is logged in. However, the Manage Articles entry is _always_ available -- even when no one is logged in. (I have a display in the footer that shows who is logged in so I can confirm this both ways.) Of course, if I am not logged in and click the Manage Articles menu entry, Auth blocks me from getting to admin_index for Posts, but the menu entry shouldn't show up.
Any ideas on what I may be doing wrong or what I need to do to make this work?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.