Manage users navigation history is a common scenario developing frontend applications and BEdita comes with an integrated system to handle it.
To activate history tracking just edit config/frontend.ini.php in your frontend application and uncomment:
$config["history"] = array( "sessionEntry" => 5, "showDuplicates" => false, "trackNotLogged" => false );
where:
- sessionEntry is the number of history items you want to have in session
- showDuplicates says if duplicate history items have to show in session
- trackNotLogged says if history of unsigned users has to be active
Automatically BEdita will trace users activity in history table and fill History array in session.
In $BEAuthUser
variable (views variable for user session info) you will have for example:
['History'] => Array( [0] => Array( ['area_id'] => 1 ['object_id'] => 3 ['title'] => //This is the title of content ['url'] => //url-to-that-content ['user_id'] => 1 ['id'] => 1 ), [1] => Array(...) ... );
Ajax and Flash calls are not inserted in history and you can always control what you want to end up in history through out the AppController::historyItem
property. Setting it to null you avoids to register history in some cases.
For example if you don't want access to a content with unique name "mycontent" to be tracked, then you can add to PagesController:
protected function mycontentBeforeFilter() { $this->historyItem = null; }
If you need you can also manage users history in BEdita backend: just uncomment from bedita-app/config/bedita.cfg.php $config["history"]
array.