Class mdm\admin\Module
| Inheritance | mdm\admin\Module » yii\base\Module » yii\di\ServiceLocator » yii\base\Component » yii\base\Object |
|---|---|
| Available since version | 1.0 |
GUI manager for RBAC.
Use yii\base\Module::$controllerMap to change property of controller. To change listed menu, use property $menus.
'layout' => 'left-menu', // default null mean use application layout.
'controllerMap' => [
'assignment' => [
'class' => 'mdm\admin\controllers\AssignmentController',
'userClassName' => 'app\models\User',
'idField' => 'id'
]
],
'menus' => [
'assignment' => [
'label' => 'Grand Access' // change label
],
'route' => null, // disable menu
],
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $aliases | array | List of path aliases to be defined. | mdm\admin\Module |
| $basePath | string | The root directory of the module. | mdm\admin\Module |
| $behaviors | yii\base\Behavior[] | List of behaviors attached to this component | mdm\admin\Module |
| $components | array | The list of the component definitions or the loaded component instances (ID => definition or instance). | mdm\admin\Module |
| $controllerMap | array | Mapping from controller ID to controller configurations. | yii\base\Module |
| $controllerNamespace | string | The namespace that controller classes are in. | yii\base\Module |
| $controllerPath | string | The directory that contains the controller classes. | mdm\admin\Module |
| $defaultRoute | mdm\admin\Module | ||
| $id | string | An ID that uniquely identifies this module among other modules which have the same parent. | yii\base\Module |
| $layout | mdm\admin\Module | ||
| $layoutPath | string | The root directory of layout files. | mdm\admin\Module |
| $mainLayout | string | mdm\admin\Module | |
| $menus | array | mdm\admin\Module | |
| $module | yii\base\Module | The parent module of this module. | yii\base\Module |
| $modules | array | The modules (indexed by their IDs) | mdm\admin\Module |
| $params | array | Custom module parameters (name => value). | yii\base\Module |
| $uniqueId | string | The unique ID of the module. | mdm\admin\Module |
| $viewPath | string | The root directory of view files. | mdm\admin\Module |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __call() | Calls the named method which is not a class method. | yii\base\Component |
| __clone() | This method is called after the object is created by cloning an existing one. | yii\base\Component |
| __construct() | Constructor. | yii\base\Module |
| __get() | Returns the value of a component property. | yii\base\Component |
| __isset() | Checks if a property value is null. | yii\base\Component |
| __set() | Sets the value of a component property. | yii\base\Component |
| __unset() | Sets a component property to be null. | yii\base\Component |
| afterAction() | This method is invoked right after an action within this module is executed. | yii\base\Module |
| attachBehavior() | Attaches a behavior to this component. | yii\base\Component |
| attachBehaviors() | Attaches a list of behaviors to the component. | yii\base\Component |
| beforeAction() | This method is invoked right before an action within this module is executed. | yii\base\Module |
| behaviors() | Returns a list of behaviors that this component should behave as. | yii\base\Component |
| canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\Component |
| canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\Component |
| className() | Returns the fully qualified name of this class. | yii\base\Object |
| clear() | Removes the component from the locator. | yii\di\ServiceLocator |
| createController() | Creates a controller instance based on the given route. | yii\base\Module |
| createControllerByID() | Creates a controller based on the given controller ID. | yii\base\Module |
| detachBehavior() | Detaches a behavior from the component. | yii\base\Component |
| detachBehaviors() | Detaches all behaviors from the component. | yii\base\Component |
| ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\base\Component |
| get() | Returns the component instance with the specified ID. | yii\di\ServiceLocator |
| getBasePath() | Returns the root directory of the module. | yii\base\Module |
| getBehavior() | Returns the named behavior object. | yii\base\Component |
| getBehaviors() | Returns all behaviors attached to this component. | yii\base\Component |
| getComponents() | Returns the list of the component definitions or the loaded component instances. | yii\di\ServiceLocator |
| getControllerPath() | Returns the directory that contains the controller classes according to $controllerNamespace. | yii\base\Module |
| getInstance() | Returns the currently requested instance of this module class. | yii\base\Module |
| getLayoutPath() | Returns the directory that contains layout view files for this module. | yii\base\Module |
| getMainLayout() | Get main layout of 'left-menu' and 'right-menu' layout. | mdm\admin\Module |
| getMenus() | Get avalible menu. | mdm\admin\Module |
| getModule() | Retrieves the child module of the specified ID. | yii\base\Module |
| getModules() | Returns the sub-modules in this module. | yii\base\Module |
| getUniqueId() | Returns an ID that uniquely identifies this module among all modules within the current application. | yii\base\Module |
| getViewPath() | Returns the directory that contains the view files for this module. | yii\base\Module |
| has() | Returns a value indicating whether the locator has the specified component definition or has instantiated the component. | yii\di\ServiceLocator |
| hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | yii\base\Component |
| hasMethod() | Returns a value indicating whether a method is defined. | yii\base\Component |
| hasModule() | Checks whether the child module of the specified ID exists. | yii\base\Module |
| hasProperty() | Returns a value indicating whether a property is defined for this component. | yii\base\Component |
| init() | Initializes the module. | yii\base\Module |
| off() | Detaches an existing event handler from this component. | yii\base\Component |
| on() | Attaches an event handler to an event. | yii\base\Component |
| runAction() | Runs a controller action specified by a route. | yii\base\Module |
| set() | Registers a component definition with this locator. | yii\di\ServiceLocator |
| setAliases() | Defines path aliases. | yii\base\Module |
| setBasePath() | Sets the root directory of the module. | yii\base\Module |
| setComponents() | Registers a set of component definitions in this locator. | yii\di\ServiceLocator |
| setInstance() | Sets the currently requested instance of this module class. | yii\base\Module |
| setLayoutPath() | Sets the directory that contains the layout files. | yii\base\Module |
| setMainLayout() | Set main layout of 'left-menu' and 'right-menu' layout. | mdm\admin\Module |
| setMenus() | Set or add avalible menu. | mdm\admin\Module |
| setModule() | Adds a sub-module to this module. | yii\base\Module |
| setModules() | Registers sub-modules in the current module. | yii\base\Module |
| setViewPath() | Sets the directory that contains the view files. | yii\base\Module |
| trigger() | Triggers an event. | yii\base\Component |
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| getCoreMenus() | Get core menu | mdm\admin\Module |
Events
| Event | Type | Description | Defined By |
|---|---|---|---|
| EVENT_AFTER_ACTION | yii\base\ActionEvent | An event raised after executing a controller action. | yii\base\Module |
| EVENT_BEFORE_ACTION | yii\base\ActionEvent | An event raised before executing a controller action. | yii\base\Module |
Property Details
List of path aliases to be defined. The array keys are alias names (must start with '@') and the array values are the corresponding paths or aliases. For example,
[
'@models' => '@app/models', // an existing alias
'@backend' => __DIR__ . '/../backend', // a directory
]
The root directory of the module.
List of behaviors attached to this component
The list of the component definitions or the loaded component instances (ID => definition or instance).
The directory that contains the controller classes.
The root directory of layout files. Defaults to "$viewPath/layouts".
The modules (indexed by their IDs)
The unique ID of the module.
The root directory of view files. Defaults to "$basePath/views".
Method Details
Get core menu
| array getCoreMenus( ) |
Get main layout of 'left-menu' and 'right-menu' layout.
| string getMainLayout( ) |
Get avalible menu.
| array getMenus( ) |
Set main layout of 'left-menu' and 'right-menu' layout.
| void setMainLayout( $layout ) | ||
| $layout | string | |
Set or add avalible menu.
| void setMenus( $menus ) | ||
| $menus | array | |