You are here

private function wf_crm_webform_preprocess::loadURLEvents in Webform CiviCRM Integration 7.4

Same name and namespace in other branches
  1. 7.5 includes/wf_crm_webform_preprocess.inc \wf_crm_webform_preprocess::loadURLEvents()

Load event data for the url

Parameters

int $c:

1 call to wf_crm_webform_preprocess::loadURLEvents()
wf_crm_webform_preprocess::alterForm in includes/wf_crm_webform_preprocess.inc
Alter front-end of webforms: Called by hook_form_alter() when rendering a civicrm-enabled webform Add custom prefix. Display messages. Block users who should not have access. Set webform default values.

File

includes/wf_crm_webform_preprocess.inc, line 362

Class

wf_crm_webform_preprocess

Code

private function loadURLEvents($c) {
  $n = $this->data['participant_reg_type'] == 'separate' ? $c : 1;
  $p = wf_crm_aval($this->data, "participant:{$n}:participant");
  if ($p) {
    foreach ($p as $e => $value) {
      $event_ids = array();

      // Get the available event list from the component
      $fid = "civicrm_{$c}_participant_{$e}_participant_event_id";
      $eids = array();
      foreach ($this
        ->getExposedOptions($fid) as $eid => $title) {
        $id = explode('-', $eid);
        $eids[$id[0]] = $eid;
      }
      if ($this->data['participant_reg_type'] == 'all') {
        $urlParam = "event{$e}";
      }
      else {
        $urlParam = "c{$c}event{$e}";
      }
      foreach (explode(',', wf_crm_aval($_GET, $urlParam)) as $value) {
        if (isset($eids[$value])) {
          $event_ids[] = $eids[$value];
        }
      }
      $this->info['participant'][$c]['participant'][$e]['event_id'] = $event_ids;
    }
  }
}