मैं अपने स्वयं के ब्लॉक के साथ Mage_Adminhtml_Block_Page_Menu का विस्तार करता हूं। मैंने फ़ंक्शन की प्रतिलिपि बनाई है "_buildMenuArray()" और मेनू सरणी वापस करने से ठीक पहले मैं जांचता हूं कि उपयोगकर्ता में वर्तमान लॉगजेन व्यवस्थापक नहीं है या नहीं। यदि ऐसा है तो; मैं मेनू से पदानुक्रम वस्तु को हटाता हूं और पृष्ठ वस्तु को मूल्य के साथ सेट करता हूं ताकि ड्रॉप-छाया ठीक से प्रदर्शित हो।
class Xxxxx_Xxxx_Block_Adminhtml_Page_Menu extends Mage_Adminhtml_Block_Page_Menu
{
protected function _buildMenuArray(Varien_Simplexml_Element $parent=null, $path='', $level=0)
{
if (is_null($parent)) {
$parent = Mage::getSingleton('admin/config')->getAdminhtmlConfig()->getNode('menu');
}
$parentArr = array();
$sortOrder = 0;
foreach ($parent->children() as $childName => $child) {
if (1 == $child->disabled) {
continue;
}
$aclResource = 'admin/' . ($child->resource ? (string)$child->resource : $path . $childName);
if (!$this->_checkAcl($aclResource)) {
continue;
}
if ($child->depends && !$this->_checkDepends($child->depends)) {
continue;
}
$menuArr = array();
$menuArr['label'] = $this->_getHelperValue($child);
$menuArr['sort_order'] = $child->sort_order ? (int)$child->sort_order : $sortOrder;
if ($child->action) {
$menuArr['url'] = $this->_url->getUrl((string)$child->action, array('_cache_secret_key' => true));
} else {
$menuArr['url'] = '#';
$menuArr['click'] = 'return false';
}
$menuArr['active'] = ($this->getActive()==$path.$childName)
|| (strpos($this->getActive(), $path.$childName.'/')===0);
$menuArr['level'] = $level;
if ($child->children) {
$menuArr['children'] = $this->_buildMenuArray($child->children, $path.$childName.'/', $level+1);
}
$parentArr[$childName] = $menuArr;
$sortOrder++;
}
uasort($parentArr, array($this, '_sortMenu'));
while (list($key, $value) = each($parentArr)) {
$last = $key;
}
if (isset($last)) {
$parentArr[$last]['last'] = true;
}
$data = $this->_isAdmin($parentArr);
return $data;
}
protected function _isAdmin($data){
$userRole = Mage::getSingleton('admin/session')->getUser()->getRole();
$roleName = $userRole->getRoleName();
$roleId = $userRole->getRoleId();
if ($roleName == 'Administrators' || $roleId == 1) {
return $data;
} else {
if (isset($data['hierarchy'])){
unset($data['hierarchy']);
$data['page']['last'] = 1;
}
if (isset($data['enterprise_page']['children']['hierarchy'])){
unset($data['enterprise_page']['children']['hierarchy']);
$data['enterprise_page']['children']['last'] = 1;
}
return $data;
}
}
}
ठीक है, इसलिए मैंने इसे स्वयं ठीक करने में कामयाब रहा। मैंने समाधान साझा करने के लिए अपने स्थानीय Xxxxx_Xxxx_Block_Adminhtml_Page_Menu – Chris
+1 के भीतर Mage_Adminhtml_Block_Page_Menu बढ़ाया :) – JNDPNT
कृपया जितनी जल्दी हो सके उत्तर के रूप में अपना समाधान सबमिट करें। – cwallenpoole