How to treat multiple data from a single user?

uvrenight

New Member
Hi everybody,
Joomla 2.5.6 Fabrik 3.0.6 and last SVN update from Github.

I've searched deeper in all the forum, but I didn't find any solution to my problem.

I need to collect data from a group of users every month.
I have a MySQL table like this:

Table "Data"

  • id
  • datetime
  • user_id -> DBJ to joomla users
  • month_id -> DBJ to a table with a list of months
  • data_1
  • data_2
  • ....
I have set up a menu element which calls the form to insert the data.
This menu element has the option of Row Id set to "-1" and the Keyname set to "user_id".

With this configuration, when a user attempt to insert the data for the first time, he is faced up to a blank form, and this is ok.
Instead, if a user has just stored his data for some previous month, when he opens the form, he find it filled with data with the lower id in the table.

How can I improve this situation to permit to my users to decide to insert a new data or select a previous month to modify some data?
Thanks.
 
Don't use the form menu (as you see this is only for adding/editing one user record, e.g. something like a profile) but display the list with a prefilter showing only the logged-in user's records.
Add a prefilter

user_id(raw) EQUALS {$my->id}, type text, apply to Public
OR
id >= 0 apply to special, admin... so admins can see any record
 
Just for a better use, I would try (if possible) an improvement of the situation outlined above.
When the user got the list of his records (with the use of a prefilter), he has the possibility to modify those records or to add a new one. This is an easy setup from the list's access rights.
Instead I would the user to add a new record, if he hasn't added a new one for the current month, or to update that record if it is present for the same period.
In other words I don't want the user to add more than one record per month, so when he opens the list he must not find the "add a new record" button if the record is already present in the DB.
Of course, if that record is not present in the DB, he must find the button.

Any suggestion?
Thanks.
 
Thanks Troester,
your answers always hit the target!

I start immediately to work (and study!) and try your suggestions.
 
I'm trying to change the template you have indicated (default_buttons.php), but I can't do what I want.
My problem is that I can't pass any values ??to the template to create a custom SQL query inside it.
Perhaps this is a question a bit 'silly, but how do I retrieve variables from within the template?

Thanks in advance.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top