Before I start I'm french so please be kind with my english

I'm triyng to use xataface into a joomla website (with a wrapper to display xataface in my webpage).
For this, no problems, xataface is displaying fine in Joomla.
I use the joomla user identification (with the jos_users mysql table) to let the users log in the web site.
I want users to be able to add record in xataface and I want them just to be able to see there own records in the list view. Is it possible ?
My table users can record in gets a "join" with the id field in the jos_users table. So how could I add the user's id in my record in my table when a user add a new record ?
I think it could be defined in the delegate classes of my table.
The function init(&$table) may be configured to display only records linked to the right user but how ? with a sql select query ?
The function afterInsert(&$record) could be defined to add the id of the current user.
I try this code (in my delegate classes for my table) :
- Code: Select all
function afterInsert(&$record) {
$sql="update t_pilule set id=90 where num_pill=2";
mysql_query($sql);
}
In this example my table is named t_pilule, id is the joined field with the jos_users table and num_pill is the mrimary key of t_pilule table.
This example works fine but I would like to set the id with the id of the current user and not update the record with numpill=2 but the new added record.
I hope I was clear but I recap my questions :
- How to add the user's id in a new record ?
- How to display only records created by a user with his joined id ?
Thank you for your answers
