Hi! .. i need to create a functionality in which each and every user activity can be tracked and can be stored into the database. Please let me know if there is any default functionality available in Yii for this task...
Page 1 of 1
User Activity Tracking In Yii
#2
Posted 01 February 2013 - 05:03 AM
I don't have a development machine at hand right now, so the below is from the top of my head.
One solution could be to implement the beforeAction() or afterAction() methods in the base controller (protected/controllers/Controller.php) The controller has some properties that might be useful for tracking what page the user navigated to and what parameters where supplied. So in (pseudo)code it would look something like this in its basic form:
One solution could be to implement the beforeAction() or afterAction() methods in the base controller (protected/controllers/Controller.php) The controller has some properties that might be useful for tracking what page the user navigated to and what parameters where supplied. So in (pseudo)code it would look something like this in its basic form:
// protected/controllers/Controller/php
public function beforeAction($action)
{
$target = $action->controller->uniqueId . '/' . $action->id;
// for a blog module, listing all comments, $target could look like:
// blog/comments/index
$params = $action->controller->actionParams;
// returns $_GET by default, see controller documentation for more details
// Log $target and $params to database.
return true; // Important. If false, the action will not be executed.
}
#3
Posted 15 March 2013 - 08:46 AM
jatin babbar, on 01 February 2013 - 02:18 AM, said:
Hi! .. i need to create a functionality in which each and every user activity can be tracked and can be stored into the database. Please let me know if there is any default functionality available in Yii for this task...
hi
user activity is best method is aftersave.i have use in aftersave method is working fine.in this method using very simple.refer this link is very useful http://www.yiiframew...tersave-method/
Share this topic:
Page 1 of 1

Help












