I'm trying to create a action helper for creating a menu. But I don't know how why it doesn't know the function isAllowed. I get the following error message:
Call to a member function isAllowed() on a non-object
<?php
class Zend_Controller_Action_Helper_Menu extends Zend_Controller_Action_Helper_Abstract
{
private $_acl;
public function createSubMenu($request,$identity){
$controller = $request->getControllerName();
$action = $request->getActionName();
$identity = $identity->user_role;
$access = $this->hasAccess($identity,$action,$controller);
$return;
$return .= "<ul>";
$return .= "<li><a href=''>".$identity."</a></li>";
$return .= "</ul>";
return $access;
}
private function hasAccess($role, $action, $controller)
{
$this->_acl = new Zend_Acl();
if (!$this->_acl) {
$this->_acl = Zend_Controller_Front::getInstance()->getPlugin('Acl');
}
return $this->_acl->isAllowed($role, $controller, $action);
}
}