I would like to record a user’s last online time, which is the last time they loaded a page. But that’s different from logging in, and it’s also different from every access; we have several AJAX functions (such as the chat) which I do not want to trigger that, because that would only slow things down.
The main common denominator that I’ve found is actually the layout page. Any time the layout is loaded, I want the last online time to update, and any time the layout is not loaded, I don’t want it to update. And conveniently enough, I also want it recording where the last action was, which is information the layout can get.
Problem is, that’s a view, and I don’t think a database command belongs in a view. Is there some better place where I should put such a function?