Track Controller And Action

Hi, I want to track what the users did in the system.

So I write this in my controller:




protected function beforeAction($action) {

		

		//......

		

		if (!Yii::app()->user->isGuest) {

			$monitor = new Monitor;

			$monitor->user_id = Yii::app()->user->id;

			$monitor->controllor = $this->id;

			$monitor->action = $action->id;

			$monitor->create_at = date('Y-m-d H:i:s', time());

			$monitor->save();

		}

		

		return true;


		//......

	}



In this way, I can store info about controller and action, but this is not enough. I also need to store params from request of post and get and other params, for instance:




http://127.0.0.1/pro/index.php/concept/24

//how to get '24'?






//.......

$.ajax({

    //.......

    data: {id: id},

    //.......

});

//.......

//how to get 'id'?



All the parameters should be in $_GET or $_POST ;)

You could use that:

$n=1;

foreach ($_REQUEST as $key=>$val) {

//for secure issues

$yourdataName = ‘mydat’.$n;

$yourdataValue = ‘myval’.$n;

$monitor->$yourdataName= $key;

$monitor->$yourdataValue= $val;

$n++;

}

//if you have to read the above parameters

the key

$monitor->mydat1

and the respective value is in

$monitor->myval1

thanks,

the way that i can imagine to get data is below, but:




if(isset($_POST['?name?']))  //there are too many different 'name' in the request process, how can i know which the 'name' is?

    // do-sth



cool!!!

i ll try.

many thanks :)