Yii Framework Forum: User Activity Tracking In Yii - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

User Activity Tracking In Yii Rate Topic: -----

#1 User is offline   jatin babbar 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 25-January 13

Posted 01 February 2013 - 02:18 AM

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...
0

#2 User is offline   jodev 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 75
  • Joined: 10-January 11
  • Location:The Netherlands

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:

// 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.
}

0

#3 User is offline   Anbu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 15-March 13

Posted 15 March 2013 - 08:46 AM

View Postjatin 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/
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users