jfquestiaux
Well-Known Member
I have a table with registration for classes (one class per form).
I want to pre-filter the table so only the teachers teaching the requested class can view the application.
In the registration form, the class is chosen in a table join drop down so the recorded data in the table is the id of the class.
In the registration table, I set up the pre-filter in the following manner :
WHERE name_of_the_class IN
'global $database, $my;'
'$database->setQuery("SELECT matieresformateurs FROM #__fabrik_formdata_8 WHERE username = '" . $my->id . "' ");'
'return $database->loadResult();'
(eval on 'Yes')
Applied to SuperAdministrator
In my test, I have a registration for class "11".
Since a teacher can reach several classes, I have teacher 1 with "matieresformateurs" set to "11//..*..//12//..*..//13//..*..//14//..*..//21" and teacher 2 set to "8//..*..//9//..*..//28"
So normally, only teacher 1 should see the registration.
But in fact none of them can see it.
I tried with "CONTAINS" instead of "IN" but then I get a syntax error (Warning: Invalid argument supplied for foreach() in /var/www/vhosts/www.betterliving.be/web/cogitodemo/components/com_fabrik/views/table/view.html.php on line 450)
I want to pre-filter the table so only the teachers teaching the requested class can view the application.
In the registration form, the class is chosen in a table join drop down so the recorded data in the table is the id of the class.
In the registration table, I set up the pre-filter in the following manner :
WHERE name_of_the_class IN
'global $database, $my;'
'$database->setQuery("SELECT matieresformateurs FROM #__fabrik_formdata_8 WHERE username = '" . $my->id . "' ");'
'return $database->loadResult();'
(eval on 'Yes')
Applied to SuperAdministrator
In my test, I have a registration for class "11".
Since a teacher can reach several classes, I have teacher 1 with "matieresformateurs" set to "11//..*..//12//..*..//13//..*..//14//..*..//21" and teacher 2 set to "8//..*..//9//..*..//28"
So normally, only teacher 1 should see the registration.
But in fact none of them can see it.
I tried with "CONTAINS" instead of "IN" but then I get a syntax error (Warning: Invalid argument supplied for foreach() in /var/www/vhosts/www.betterliving.be/web/cogitodemo/components/com_fabrik/views/table/view.html.php on line 450)