function preProcess()
 {
     parent::preProcess();
     $this->cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     if (!isset($this->cid) || $this->cid > 0) {
         //TODO users with permission can default to another contact
         $this->cid = self::getContactID();
     }
 }
    function preProcess()
    {
        parent::preProcess();
        $matches = array();
        preg_match("/.*_(\\d+)_(\\d+)/", $this->getAttribute('name'), $matches);
        $event_id = $matches[1];
        $participant_id = $matches[2];
        $event_in_cart = $this->cart->get_event_in_cart_by_event_id($event_id);
        $this->conference_event = $event_in_cart->event;
        $this->main_participant = $event_in_cart->get_participant_by_id($participant_id);
        $this->contact_id = $this->main_participant->contact_id;
        $this->main_participant->display_name = CRM_Contact_BAO_Contact::displayName($this->contact_id);
        $events = new CRM_Event_BAO_Event();
        $query = <<<EOS
\t  SELECT
               civicrm_event.*,
               slot.label AS slot_label
          FROM
               civicrm_event
          JOIN
                civicrm_option_value slot ON civicrm_event.slot_label_id = slot.value
          JOIN
                civicrm_option_group og ON slot.option_group_id = og.id
\t  WHERE
\t\tparent_event_id = {$this->conference_event->id}
                AND civicrm_event.is_active = 1
                AND COALESCE(civicrm_event.is_template, 0) = 0
                AND og.name = 'conference_slot'
\t  ORDER BY
\t\tslot.weight, start_date
EOS;
        $events->query($query);
        while ($events->fetch()) {
            if (!array_key_exists($events->slot_label, $this->events_by_slot)) {
                $this->events_by_slot[$events->slot_label] = array();
            }
            $this->events_by_slot[$events->slot_label][] = clone $events;
        }
    }
Exemple #3
0
 public function preProcess()
 {
     $params = $this->_submitValues;
     $this->is_pay_later = CRM_Utils_Array::value('is_pay_later', $params, FALSE) && !CRM_Utils_Array::value('payment_completed', $params);
     parent::preProcess();
 }