how to make a logbook module
I'm 开发者_如何学Gotrying to make a log book module in codeigniter using PHP. I have started making the CRUD.
However, my groupmate said i did the wrong thing. I don't have to add manually the activity of the user and the time.
In short, as soon as the user logs in and starts doing a specific activity, like add room, it will be automatically recorded in the logbook table.
my problem is how to create a log book that automatically records all the activities of every user and how to connect it to my db. any idea?
basically, that`s the idea there...but I needed the right code...
Here`s what I started so far. just an outline:
controller:
function addlog_entry(){
//i don`t know what code to put here to automatically add the user`s activity
}
function logbook(){
//this is the list of the log entries. i also don`t know the codes.
}
model:
function add_room(){
.
.
.
//after the user adds room, his activity will be recorded here:
$this->addlog_entry();
}
//then i have the two functions again:
function add_log_entry(){
//right codes
}
function log_book(){
//right codes
}
...never mind the view. I can handle it...so that`s the main problem i have here. hope you can help me out or give me some example of codes related to this problem which i can use as reference. thanks a lot!
you should try and record user actions in a history table
if the operation was succesful (INSERT/UPDATE/DELETE), you should log it into your history table
for instance, i made a system that manages customer telephone services, i will record what user X did at the moment of time Y regarding client Z, generally speaking
精彩评论