Mage_Admin_Model_Roles Class Reference

Inheritance diagram for Mage_Admin_Model_Roles:

Mage_Core_Model_Abstract Varien_Object

List of all members.

Public Member Functions

 update ()
 getUsersCollection ()
 getResourcesTree ()
 getResourcesList ()
 getResourcesList2D ()
 getRoleUsers ()

Protected Member Functions

 _construct ()
 _buildResourcesArray (Varien_Simplexml_Element $resource=null, $parentName=null, $level=0, $represent2Darray=null, $rawNodes=false, $module= 'adminhtml')

Protected Attributes

 $_eventPrefix = 'admin_roles'


Detailed Description

Definition at line 27 of file Roles.php.


Member Function Documentation

_buildResourcesArray ( Varien_Simplexml_Element resource = null,
parentName = null,
level = 0,
represent2Darray = null,
rawNodes = false,
module = 'adminhtml' 
) [protected]

Definition at line 70 of file Roles.php.

00071     {
00072         static $result;
00073         if (is_null($resource)) {
00074             $resource = Mage::getConfig()->getNode('adminhtml/acl/resources');
00075             $resourceName = null;
00076             $level = -1;
00077         } else {
00078             $resourceName = $parentName;
00079             if ($resource->getName()!='title' && $resource->getName()!='sort_order' && $resource->getName() != 'children') {
00080                 $resourceName = (is_null($parentName) ? '' : $parentName.'/').$resource->getName();
00081 
00082                 //assigning module for its' children nodes
00083                 if ($resource->getAttribute('module')) {
00084                     $module = (string)$resource->getAttribute('module');
00085                 }
00086 
00087                 if ($rawNodes) {
00088                     $resource->addAttribute("aclpath", $resourceName);
00089                     $resource->addAttribute("module_c", $module);
00090                 }
00091 
00092                 //if (!(string)$resource->title) {
00093                 //   return array();
00094                 //}
00095 
00096                 //$resource->title = Mage::helper($module)->__((string)$resource->title);
00097 
00098                 if ( is_null($represent2Darray) ) {
00099                     $result[$resourceName]['name']  = Mage::helper($module)->__((string)$resource->title);
00100                     $result[$resourceName]['level'] = $level;
00101                 } else {
00102                     $result[] = $resourceName;
00103                 }
00104             }
00105         }
00106 
00107         $children = $resource->children();
00108         if (empty($children)) {
00109             if ($rawNodes) {
00110                 return $resource;
00111             } else {
00112                 return $result;
00113             }
00114         }
00115         foreach ($children as $child) {
00116             $this->_buildResourcesArray($child, $resourceName, $level+1, $represent2Darray, $rawNodes, $module);
00117         }
00118         if ($rawNodes) {
00119             return $resource;
00120         } else {
00121             return $result;
00122         }
00123     }

_construct (  )  [protected]

Enter description here...

Reimplemented from Varien_Object.

Definition at line 34 of file Roles.php.

00035     {
00036         $this->_init('admin/roles');
00037     }

getResourcesList (  ) 

Definition at line 55 of file Roles.php.

00056     {
00057         return $this->_buildResourcesArray();
00058     }

getResourcesList2D (  ) 

Definition at line 60 of file Roles.php.

00061     {
00062         return $this->_buildResourcesArray(null, null, null, true);
00063     }

getResourcesTree (  ) 

Definition at line 50 of file Roles.php.

00051     {
00052         return $this->_buildResourcesArray(null, null, null, null, true);
00053     }

getRoleUsers (  ) 

Definition at line 65 of file Roles.php.

00066     {
00067         return $this->getResource()->getRoleUsers($this);
00068     }

getUsersCollection (  ) 

Definition at line 45 of file Roles.php.

00046     {
00047         return Mage::getResourceModel('admin/roles_user_collection');
00048     }

update (  ) 

Definition at line 39 of file Roles.php.

00040     {
00041         $this->getResource()->update($this);
00042         return $this;
00043     }


Member Data Documentation

$_eventPrefix = 'admin_roles' [protected]

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 32 of file Roles.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:41 2009 for Magento by  doxygen 1.5.8