I am trying to get a list of all Ids of participations for a certain contact_id (to use it in JS). Currently I am using the _civicrm_buildForm
hook to do that, but to extract the contact_id from the passed in $form object I need to use reflection, since is is stored under _form_values
which is protected and $form->getFormValues()
always returns NULL.
Also CRM_Core_Resources::singleton()->addScript($script, 5, 'page-footer')
doesn't seem to have any effect, probably its too late to call it. So I'm simply echoing the script.
==> all less then ideal I assume it is possible to get the participant ids with smarty or an ajax call, but haven't found any example how to express a "Where-Clause" with those. This is the SQL-Query I'm trying to perform:
SELECT `id` FROM `civicrm_participant` WHERE `contact_id`= x
So any help to prettify the first approach or an example for the others would be much appreciated .