management-module This ext is to dynamic management modules,you can decide whether to enable module,you can also add params by dynamic

  1. Requirements
  2. Usage

If you want to dynamic management modules,you must need it.You can dynamically add modules with params.

Requirements

Yii 1.1 or above

Usage

[STEP1]

tar the module under protected/modules/moduleManage and modify the following to your main config

return array(
..............
'modules'=>include(dirname(__FILE__).DIRECTORY_SEPARATOR.'modules.php'),
..............
);

Done,you must add the modules.php in the config folder,and add the following to your modules.php

'moduleManage'=>array(
	'moduleConfigFile'=>__FILE__//config the modules folder
),

Last,you should create a table with module_managel.sql. Now,you should configure the commpents of db ,and sure it to connect the db.and then,you visit the yourdomain/index.php?r=moduleManage.

[STEP2]

If step1 success ,now you can create a module. but before you create a module,you must use gii to generate the module's folder you want.if you complete it,you can click the create module tag,and write something to this form.It should be noted when you configure the module config,you must use PHP ARRAY Format,and you can use any key/value for it.

[STEP3] If step2 success,you can in your module to use these params ans status.For example:there is a testModule in my project,and open the module's config file (moduleName+Module.php)

class TestModule extends CWebModule
{
	public function init()
	{
           //add hook
           //default 'status' is reserved keyword you can get it by $this->params['status']
           //you can get other cofing params by use $this->params[key]
           // such as $this->params['maintain']
		if($this->params['status']===0){
			//do something here
		}else{
			//do something here
		}
		// this method is called when the module is being created
		// you may place code here to customize the module or the application

		// import the module-level models and components
		$this->setImport(array(
			'test.models.*',
			'test.components.*',
		));
	}
}

Github

my blog

1 0
4 followers
355 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Others
Developed by: Fan_Ye
Created on: Jan 31, 2013
Last updated: 11 years ago

Downloads

show all

Related Extensions