示例#1
0
 /**
  * Build the form object - it consists of
  *    - displaying the QILL (query in local language)
  *    - displaying elements for saving the search
  *
  *
  * @return void
  */
 public function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Smart Group'));
     // get the qill
     $query = new CRM_Event_BAO_Query($this->get('formValues'));
     $qill = $query->qill();
     // Values from the search form
     $formValues = $this->controller->exportValues();
     // need to save qill for the smarty template
     $this->assign('qill', $qill);
     // the name and description are actually stored with the group and not the saved search
     $this->add('text', 'title', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), TRUE);
     $this->addElement('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description'));
     // get the group id for the saved search
     $groupId = NULL;
     if (isset($this->_id)) {
         $params = array('saved_search_id' => $this->_id);
         CRM_Contact_BAO_Group::retrieve($params, $values);
         $groupId = $values['id'];
         $this->addDefaultButtons(ts('Update Smart Group'));
     } else {
         $this->addDefaultButtons(ts('Save Smart Group'));
         $this->assign('partiallySelected', $formValues['radio_ts'] != 'ts_all');
     }
     $this->addRule('title', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Group', $groupId, 'title'));
 }
示例#2
0
 /**
  * Build the form - it consists of
  *    - displaying the QILL (query in local language)
  *    - displaying elements for saving the search
  *
  * @access public
  * @return void
  */
 function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Smart Group'));
     require_once "CRM/Event/BAO/Query.php";
     // get the qill
     $query = new CRM_Event_BAO_Query($this->get('formValues'));
     $qill = $query->qill();
     // need to save qill for the smarty template
     $this->assign('qill', $qill);
     // the name and description are actually stored with the group and not the saved search
     $this->add('text', 'title', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'title'), true);
     $this->addElement('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Group', 'description'));
     // get the group id for the saved search
     $groupId = null;
     if (isset($this->_id)) {
         $params = array('saved_search_id' => $this->_id);
         require_once "CRM/Contact/BAO/Group.php";
         CRM_Contact_BAO_Group::retrieve($params, $values);
         $groupId = $values['id'];
         $this->addDefaultButtons(ts('Update Smart Group'));
     } else {
         $this->addDefaultButtons(ts('Save Smart Group'));
     }
     $this->addRule('title', ts('Name already exists in Database.'), 'objectExists', array('CRM_Contact_DAO_Group', $groupId, 'title'));
 }
示例#3
0
 /**
  * Class constructor.
  *
  * @param array $queryParams
  *   Array of parameters for query.
  * @param \const|int $action - action of search basic or advanced.
  * @param string $eventClause
  *   If the caller wants to further restrict the search (used in participations).
  * @param bool $single
  *   Are we dealing only with one contact?.
  * @param int $limit
  *   How many participations do we want returned.
  *
  * @param string $context
  * @param null $compContext
  *
  * @return \CRM_Event_Selector_Search
  */
 public function __construct(&$queryParams, $action = CRM_Core_Action::NONE, $eventClause = NULL, $single = FALSE, $limit = NULL, $context = 'search', $compContext = NULL)
 {
     // submitted form values
     $this->_queryParams =& $queryParams;
     $this->_single = $single;
     $this->_limit = $limit;
     $this->_context = $context;
     $this->_compContext = $compContext;
     $this->_eventClause = $eventClause;
     // type of selector
     $this->_action = $action;
     $this->_query = new CRM_Contact_BAO_Query($this->_queryParams, CRM_Event_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_EVENT, FALSE), NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_EVENT);
     $this->_query->_distinctComponentClause = " civicrm_participant.id";
     $this->_query->_groupByComponentClause = " GROUP BY civicrm_participant.id ";
 }
示例#4
0
文件: UFField.php 项目: kidaa30/yes
 /**
  * Get a list of fields which can be added to profiles.
  *
  * @param int $gid : UF group ID
  * @param array $defaults : Form defaults
  * @return array, multidimensional; e.g. $result['FieldGroup']['field_name']['label']
  */
 public static function getAvailableFields($gid = NULL, $defaults = array())
 {
     $fields = array('Contact' => array(), 'Individual' => CRM_Contact_BAO_Contact::importableFields('Individual', FALSE, FALSE, TRUE, TRUE, TRUE), 'Household' => CRM_Contact_BAO_Contact::importableFields('Household', FALSE, FALSE, TRUE, TRUE, TRUE), 'Organization' => CRM_Contact_BAO_Contact::importableFields('Organization', FALSE, FALSE, TRUE, TRUE, TRUE));
     // include hook injected fields
     $fields['Contact'] = array_merge($fields['Contact'], CRM_Contact_BAO_Query_Hook::singleton()->getFields());
     // add current employer for individuals
     $fields['Individual']['current_employer'] = array('name' => 'organization_name', 'title' => ts('Current Employer'));
     $addressOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'address_options', TRUE, NULL, TRUE);
     if (!$addressOptions['county']) {
         unset($fields['Individual']['county'], $fields['Household']['county'], $fields['Organization']['county']);
     }
     // break out common contact fields array CRM-3037.
     // from a UI perspective this makes very little sense
     foreach ($fields['Individual'] as $key => $value) {
         if (!empty($fields['Household'][$key]) && !empty($fields['Organization'][$key])) {
             $fields['Contact'][$key] = $value;
             unset($fields['Individual'][$key], $fields['Household'][$key], $fields['Organization'][$key]);
         }
     }
     // Internal field not exposed to forms
     unset($fields['Contact']['contact_type']);
     unset($fields['Contact']['master_id']);
     // convert phone extension in to psedo-field phone + phone extension
     //unset extension
     unset($fields['Contact']['phone_ext']);
     //add psedo field
     $fields['Contact']['phone_and_ext'] = array('name' => 'phone_and_ext', 'title' => ts('Phone and Extension'), 'hasLocationType' => 1);
     // include Subtypes For Profile
     $subTypes = CRM_Contact_BAO_ContactType::subTypeInfo();
     foreach ($subTypes as $name => $val) {
         //custom fields for sub type
         $subTypeFields = CRM_Core_BAO_CustomField::getFieldsForImport($name, FALSE, FALSE, FALSE, TRUE, TRUE);
         if (array_key_exists($val['parent'], $fields)) {
             $fields[$name] = $fields[$val['parent']] + $subTypeFields;
         } else {
             $fields[$name] = $subTypeFields;
         }
     }
     if (CRM_Core_Permission::access('CiviContribute')) {
         $contribFields = CRM_Contribute_BAO_Contribution::getContributionFields(FALSE);
         if (!empty($contribFields)) {
             unset($contribFields['is_test']);
             unset($contribFields['is_pay_later']);
             unset($contribFields['contribution_id']);
             $contribFields['contribution_note'] = array('name' => 'contribution_note', 'title' => ts('Contribution Note'));
             $fields['Contribution'] = array_merge($contribFields, self::getContribBatchEntryFields());
         }
     }
     if (CRM_Core_Permission::access('CiviEvent')) {
         $participantFields = CRM_Event_BAO_Query::getParticipantFields();
         if ($participantFields) {
             // Remove fields not supported by profiles
             CRM_Utils_Array::remove($participantFields, 'external_identifier', 'event_id', 'participant_contact_id', 'participant_role_id', 'participant_status_id', 'participant_is_test', 'participant_fee_level', 'participant_id', 'participant_is_pay_later', 'participant_campaign');
             if (isset($participantFields['participant_campaign_id'])) {
                 $participantFields['participant_campaign_id']['title'] = ts('Campaign');
             }
             $fields['Participant'] = $participantFields;
         }
     }
     if (CRM_Core_Permission::access('CiviMember')) {
         $membershipFields = CRM_Member_BAO_Membership::getMembershipFields();
         // Remove fields not supported by profiles
         CRM_Utils_Array::remove($membershipFields, 'membership_id', 'membership_type_id', 'member_is_test', 'is_override', 'status_id', 'member_is_pay_later');
         if ($gid && CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gid, 'name') == 'membership_batch_entry') {
             $fields['Membership'] = array_merge($membershipFields, self::getMemberBatchEntryFields());
         } else {
             $fields['Membership'] = $membershipFields;
         }
     }
     if (CRM_Core_Permission::access('CiviCase')) {
         $caseFields = CRM_Case_BAO_Query::getFields(TRUE);
         $caseFields = array_merge($caseFields, CRM_Core_BAO_CustomField::getFieldsForImport('Case'));
         if ($caseFields) {
             // Remove fields not supported by profiles
             CRM_Utils_Array::remove($caseFields, 'case_id', 'case_type', 'case_start_date', 'case_end_date', 'case_role', 'case_status', 'case_deleted');
         }
         $fields['Case'] = $caseFields;
     }
     $activityFields = CRM_Activity_BAO_Activity::getProfileFields();
     if ($activityFields) {
         // campaign related fields.
         if (isset($activityFields['activity_campaign_id'])) {
             $activityFields['activity_campaign_id']['title'] = ts('Campaign');
         }
         $fields['Activity'] = $activityFields;
     }
     $fields['Formatting']['format_free_html_' . rand(1000, 9999)] = array('name' => 'free_html', 'import' => FALSE, 'export' => FALSE, 'title' => 'Free HTML');
     // Sort by title
     foreach ($fields as &$values) {
         $values = CRM_Utils_Array::crmArraySortByField($values, 'title');
     }
     //group selected and unwanted fields list
     $ufFields = $gid ? CRM_Core_BAO_UFGroup::getFields($gid, FALSE, NULL, NULL, NULL, TRUE, NULL, TRUE) : array();
     $groupFieldList = array_merge($ufFields, array('note', 'email_greeting_custom', 'postal_greeting_custom', 'addressee_custom', 'id'));
     //unset selected fields
     foreach ($groupFieldList as $key => $value) {
         if (is_int($key)) {
             unset($fields['Individual'][$value], $fields['Household'][$value], $fields['Organization'][$value]);
             continue;
         }
         if (!empty($defaults['field_name']) && $defaults['field_name']['0'] == $value['field_type'] && $defaults['field_name']['1'] == $key) {
             continue;
         }
         unset($fields[$value['field_type']][$key]);
     }
     return $fields;
 }
示例#5
0
 /**
  * Build the form object.
  *
  *
  * @return void
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->addSortNameField();
     if (CRM_Core_Permission::check('access deleted contacts') and Civi::settings()->get('contact_undelete')) {
         $this->addElement('checkbox', 'deleted_contacts', ts('Search in Trash') . '<br />' . ts('(deleted contacts)'));
     }
     CRM_Event_BAO_Query::buildSearchForm($this);
     $rows = $this->get('rows');
     if (is_array($rows)) {
         $lineItems = $eventIds = array();
         if (!$this->_single) {
             $this->addRowSelectors($rows);
         }
         foreach ($rows as $row) {
             $eventIds[$row['event_id']] = $row['event_id'];
             if (CRM_Event_BAO_Event::usesPriceSet($row['event_id'])) {
                 // add line item details if applicable
                 $lineItems[$row['participant_id']] = CRM_Price_BAO_LineItem::getLineItems($row['participant_id']);
             }
         }
         //get actual count only when we are dealing w/ single event.
         $participantCount = 0;
         if (count($eventIds) == 1) {
             //convert form values to clause.
             $seatClause = array();
             if (CRM_Utils_Array::value('participant_test', $this->_formValues) == '1' || CRM_Utils_Array::value('participant_test', $this->_formValues) == '0') {
                 $seatClause[] = "( participant.is_test = {$this->_formValues['participant_test']} )";
             }
             if (!empty($this->_formValues['participant_status_id'])) {
                 $seatClause[] = CRM_Contact_BAO_Query::buildClause("participant.status_id", '=', $this->_formValues['participant_status_id'], 'Int');
                 if ($status = CRM_Utils_Array::value('IN', $this->_formValues['participant_status_id'])) {
                     $this->_formValues['participant_status_id'] = $status;
                 }
             }
             if (!empty($this->_formValues['participant_role_id'])) {
                 $escapedRoles = array();
                 foreach ((array) $this->_formValues['participant_role_id'] as $participantRole) {
                     $escapedRoles[] = CRM_Utils_Type::escape($participantRole, 'String');
                 }
                 $seatClause[] = "( participant.role_id IN ( '" . implode("' , '", $escapedRoles) . "' ) )";
             }
             // CRM-15379
             if (!empty($this->_formValues['participant_fee_id'])) {
                 $participant_fee_id = $this->_formValues['participant_fee_id'];
                 foreach ($participant_fee_id as $k => &$val) {
                     $val = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label');
                     $val = CRM_Core_DAO::escapeString(trim($val));
                 }
                 $feeLabel = implode('|', $participant_fee_id);
                 $seatClause[] = "( participant.fee_level REGEXP '{$feeLabel}' )";
             }
             $seatClause = implode(' AND ', $seatClause);
             $participantCount = CRM_Event_BAO_Event::eventTotalSeats(array_pop($eventIds), $seatClause);
         }
         $this->assign('participantCount', $participantCount);
         $this->assign('lineItems', $lineItems);
         $permission = CRM_Core_Permission::getPermission();
         $tasks = CRM_Event_Task::permissionedTaskTitles($permission);
         if (isset($this->_ssID)) {
             if ($permission == CRM_Core_Permission::EDIT) {
                 $tasks = $tasks + CRM_Event_Task::optionalTaskTitle();
             }
             $savedSearchValues = array('id' => $this->_ssID, 'name' => CRM_Contact_BAO_SavedSearch::getName($this->_ssID, 'title'));
             $this->assign_by_ref('savedSearch', $savedSearchValues);
             $this->assign('ssID', $this->_ssID);
         }
         $this->addTaskMenu($tasks);
     }
 }
示例#6
0
 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  * @return void
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $config = CRM_Core_Config::singleton();
     require_once 'CRM/Event/BAO/Query.php';
     require_once 'CRM/Contact/BAO/Query.php';
     $returnProperties =& CRM_Event_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_EVENT);
     $additionalFields = array('first_name', 'last_name', 'middle_name', 'current_employer');
     foreach ($additionalFields as $field) {
         $returnProperties[$field] = 1;
     }
     if ($this->_single) {
         $queryParams = null;
     } else {
         $queryParams = $this->get('queryParams');
     }
     $query = new CRM_Contact_BAO_Query($queryParams, $returnProperties, null, false, false, CRM_Contact_BAO_Query::MODE_EVENT);
     list($select, $from, $where) = $query->query();
     if (empty($where)) {
         $where = "WHERE {$this->_componentClause}";
     } else {
         $where .= " AND {$this->_componentClause}";
     }
     $queryString = "{$select} {$from} {$where}";
     $dao = CRM_Core_DAO::executeQuery($queryString);
     $rows = array();
     while ($dao->fetch()) {
         $rows[$dao->participant_id] = array();
         foreach ($returnProperties as $key => $dontCare) {
             $rows[$dao->participant_id][$key] = isset($dao->{$key}) ? $dao->{$key} : null;
         }
     }
     // get the class name from the participantListingID
     require_once 'CRM/Core/OptionGroup.php';
     $className = CRM_Core_OptionGroup::getValue('event_badge', $params['badge_id'], 'value', 'Integer', 'name');
     $classFile = str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
     $error = (include_once $classFile);
     if ($error == false) {
         CRM_Core_Error::fatal('Event Badge code file: ' . $classFile . ' does not exist. Please verify your custom event badge settings in CiviCRM administrative panel.');
     }
     eval("\$eventBadgeClass = new {$className}( );");
     $eventBadgeClass->run($rows);
 }
示例#7
0
文件: Field.php 项目: bhirsch/civicrm
 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete Profile Field'), 'spacing' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     if (isset($this->_id)) {
         $params = array('id' => $this->_id);
         CRM_Core_BAO_UFField::retrieve($params, $defaults);
         // set it to null if so (avoids crappy E_NOTICE errors below
         $defaults['location_type_id'] = CRM_Utils_Array::value('location_type_id', $defaults);
         $specialFields = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'postal_code', 'postal_code_suffix', 'geo_code_1', 'geo_code_2', 'state_province', 'country', 'county', 'phone', 'email', 'im', 'address_name');
         if (!$defaults['location_type_id'] && in_array($defaults['field_name'], $specialFields)) {
             $defaults['location_type_id'] = 0;
         }
         $defaults['field_name'] = array($defaults['field_type'], $defaults['field_name'], $defaults['location_type_id'], CRM_Utils_Array::value('phone_type_id', $defaults));
         $this->_gid = $defaults['uf_group_id'];
     } else {
         $defaults['is_active'] = 1;
     }
     if ($this->_action & CRM_Core_Action::ADD) {
         $fieldValues = array('uf_group_id' => $this->_gid);
         $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_UFField', $fieldValues);
     }
     // lets trim all the whitespace
     $this->applyFilter('__ALL__', 'trim');
     //hidden field to catch the group id in profile
     $this->add('hidden', 'group_id', $this->_gid);
     //hidden field to catch the field id in profile
     $this->add('hidden', 'field_id', $this->_id);
     $fields = array();
     $fields['Individual'] =& CRM_Contact_BAO_Contact::importableFields('Individual', false, false, true);
     $fields['Household'] =& CRM_Contact_BAO_Contact::importableFields('Household', false, false, true);
     $fields['Organization'] =& CRM_Contact_BAO_Contact::importableFields('Organization', false, false, true);
     // add current employer for individuals
     $fields['Individual']['current_employer'] = array('name' => 'organization_name', 'title' => ts('Current Employer'));
     // unset unwanted fields
     $unsetFieldArray = array('note', 'email_greeting_custom', 'postal_greeting_custom', 'addressee_custom', 'id');
     foreach ($unsetFieldArray as $value) {
         unset($fields['Individual'][$value]);
         unset($fields['Household'][$value]);
         unset($fields['Organization'][$value]);
     }
     require_once 'CRM/Core/BAO/Preferences.php';
     $addressOptions = CRM_Core_BAO_Preferences::valueOptions('address_options', true, null, true);
     if (!$addressOptions['county']) {
         unset($fields['Individual']['county']);
         unset($fields['Household']['county']);
         unset($fields['Organization']['county']);
     }
     //build the common contact fields array CRM-3037.
     foreach ($fields['Individual'] as $key => $value) {
         if (CRM_Utils_Array::value($key, $fields['Household']) && CRM_Utils_Array::value($key, $fields['Organization'])) {
             $fields['Contact'][$key] = $value;
             //as we move common fields to contacts. There fore these fields
             //are unset from resoective array's.
             unset($fields['Individual'][$key]);
             unset($fields['Household'][$key]);
             unset($fields['Organization'][$key]);
         }
     }
     // add current employer for individuals
     $fields['Contact']['id'] = array('name' => 'id', 'title' => ts('Internal Contact ID'));
     unset($fields['Contact']['contact_type']);
     // since we need a hierarchical list to display contact types & subtypes,
     // this is what we going to display in first selector
     $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(false, false);
     unset($contactTypes['']);
     // include Subtypes For Profile
     $subTypes = CRM_Contact_BAO_ContactType::subTypeInfo();
     foreach ($subTypes as $name => $val) {
         //custom fields for sub type
         $subTypeFields = CRM_Core_BAO_CustomField::getFieldsForImport($name);
         if (array_key_exists($val['parent'], $fields)) {
             $fields[$name] = $fields[$val['parent']] + $subTypeFields;
         } else {
             $fields[$name] = $subTypeFields;
         }
     }
     unset($subTypes);
     if (CRM_Core_Permission::access('Quest')) {
         require_once 'CRM/Quest/BAO/Student.php';
         $fields['Student'] =& CRM_Quest_BAO_Student::exportableFields();
     }
     if (CRM_Core_Permission::access('CiviContribute')) {
         $contribFields =& CRM_Contribute_BAO_Contribution::getContributionFields();
         if (!empty($contribFields)) {
             unset($contribFields['is_test']);
             unset($contribFields['is_pay_later']);
             unset($contribFields['contribution_id']);
             $fields['Contribution'] =& $contribFields;
         }
     }
     if (CRM_Core_Permission::access('CiviEvent')) {
         require_once 'CRM/Event/BAO/Query.php';
         $participantFields =& CRM_Event_BAO_Query::getParticipantFields(true);
         if (!empty($participantFields)) {
             unset($participantFields['external_identifier']);
             unset($participantFields['event_id']);
             unset($participantFields['participant_contact_id']);
             unset($participantFields['participant_is_test']);
             unset($participantFields['participant_fee_level']);
             unset($participantFields['participant_id']);
             unset($participantFields['participant_is_pay_later']);
             $fields['Participant'] =& $participantFields;
         }
     }
     if (CRM_Core_Permission::access('CiviMember')) {
         require_once 'CRM/Member/BAO/Membership.php';
         $membershipFields =& CRM_Member_BAO_Membership::getMembershipFields();
         unset($membershipFields['membership_id']);
         unset($membershipFields['join_date']);
         unset($membershipFields['membership_start_date']);
         unset($membershipFields['membership_type_id']);
         unset($membershipFields['membership_end_date']);
         unset($membershipFields['member_is_test']);
         unset($membershipFields['is_override']);
         unset($membershipFields['status_id']);
         unset($membershipFields['member_is_pay_later']);
         $fields['Membership'] =& $membershipFields;
     }
     $noSearchable = array();
     foreach ($fields as $key => $value) {
         foreach ($value as $key1 => $value1) {
             //CRM-2676, replacing the conflict for same custom field name from different custom group.
             require_once 'CRM/Core/BAO/CustomField.php';
             if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($key1)) {
                 $customGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $customFieldId, 'custom_group_id');
                 $customGroupName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'title');
                 $this->_mapperFields[$key][$key1] = $value1['title'] . ' :: ' . $customGroupName;
             } else {
                 $this->_mapperFields[$key][$key1] = $value1['title'];
             }
             $hasLocationTypes[$key][$key1] = CRM_Utils_Array::value('hasLocationType', $value1);
             // hide the 'is searchable' field for 'File' custom data
             if (isset($value1['data_type']) && isset($value1['html_type']) && ($value1['data_type'] == 'File' && $value1['html_type'] == 'File' || $value1['data_type'] == 'Link' && $value1['html_type'] == 'Link')) {
                 if (!in_array($value1['title'], $noSearchable)) {
                     $noSearchable[] = $value1['title'];
                 }
             }
         }
     }
     $this->assign('noSearchable', $noSearchable);
     require_once 'CRM/Core/BAO/LocationType.php';
     $this->_location_types =& CRM_Core_PseudoConstant::locationType();
     $defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
     /* FIXME: dirty hack to make the default option show up first.  This
      * avoids a mozilla browser bug with defaults on dynamically constructed
      * selector widgets. */
     if ($defaultLocationType) {
         $defaultLocation = $this->_location_types[$defaultLocationType->id];
         unset($this->_location_types[$defaultLocationType->id]);
         $this->_location_types = array($defaultLocationType->id => $defaultLocation) + $this->_location_types;
     }
     $this->_location_types = array('Primary') + $this->_location_types;
     $contactTypes = !empty($contactTypes) ? array('Contact' => 'Contacts') + $contactTypes : array();
     $sel1 = array('' => '- select -') + $contactTypes;
     if (CRM_Core_Permission::access('Quest')) {
         $sel1['Student'] = 'Students';
     }
     if (CRM_Core_Permission::access('CiviEvent')) {
         $sel1['Participant'] = 'Participants';
     }
     if (!empty($contribFields)) {
         $sel1['Contribution'] = 'Contributions';
     }
     if (!empty($membershipFields)) {
         $sel1['Membership'] = 'Membership';
     }
     foreach ($sel1 as $key => $sel) {
         if ($key) {
             $sel2[$key] = $this->_mapperFields[$key];
         }
     }
     $sel3[''] = null;
     $phoneTypes = CRM_Core_PseudoConstant::phoneType();
     ksort($phoneTypes);
     foreach ($sel1 as $k => $sel) {
         if ($k) {
             foreach ($this->_location_types as $key => $value) {
                 $sel4[$k]['phone'][$key] =& $phoneTypes;
             }
         }
     }
     foreach ($sel1 as $k => $sel) {
         if ($k) {
             if (is_array($this->_mapperFields[$k])) {
                 foreach ($this->_mapperFields[$k] as $key => $value) {
                     if ($hasLocationTypes[$k][$key]) {
                         $sel3[$k][$key] = $this->_location_types;
                     } else {
                         $sel3[$key] = null;
                     }
                 }
             }
         }
     }
     $this->_defaults = array();
     $js = "<script type='text/javascript'>\n";
     $formName = "document.{$this->_name}";
     $alreadyMixProfile = false;
     if (CRM_Core_BAO_UFField::checkProfileType($this->_gid)) {
         $alreadyMixProfile = true;
     }
     $this->assign('alreadyMixProfile', $alreadyMixProfile);
     $attributes = array('onclick' => "showLabel();mixProfile();", 'onblur' => 'showLabel();mixProfile();');
     $sel =& $this->addElement('hierselect', "field_name", ts('Field Name'), $attributes);
     $formValues = array();
     $formValues = $this->exportValues();
     if (empty($formValues)) {
         for ($k = 1; $k < 4; $k++) {
             if (!$defaults['field_name'][$k]) {
                 $js .= "{$formName}['field_name[{$k}]'].style.display = 'none';\n";
             }
         }
     } else {
         if (!empty($formValues['field_name'])) {
             foreach ($formValues['field_name'] as $value) {
                 for ($k = 1; $k < 4; $k++) {
                     if (!isset($formValues['field_name'][$k]) || !$formValues['field_name'][$k]) {
                         $js .= "{$formName}['field_name[{$k}]'].style.display = 'none';\n";
                     } else {
                         $js .= "{$formName}['field_name[{$k}]'].style.display = '';\n";
                     }
                 }
             }
         } else {
             for ($k = 1; $k < 4; $k++) {
                 if (!isset($defaults['field_name'][$k])) {
                     $js .= "{$formName}['field_name[{$k}]'].style.display = 'none';\n";
                 }
             }
         }
     }
     foreach ($sel2 as $k => $v) {
         if (is_array($sel2[$k])) {
             asort($sel2[$k]);
         }
     }
     $sel->setOptions(array($sel1, $sel2, $sel3, $sel4));
     $js .= "</script>\n";
     $this->assign('initHideBoxes', $js);
     $this->add('select', 'visibility', ts('Visibility'), CRM_Core_SelectValues::ufVisibility(), true, array("onChange" => "showHideSeletorSearch(this.value);"));
     //CRM-4363
     $js = array('onclick' => "mixProfile();");
     // should the field appear in selectors (as a column)?
     $this->add('checkbox', 'in_selector', ts('Results Column?'), null, null, $js);
     $this->add('checkbox', 'is_searchable', ts('Searchable?'), null, null, $js);
     // weight
     $this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFField', 'weight'), true);
     $this->addRule('weight', ts('is a numeric field'), 'numeric');
     $this->add('textarea', 'help_post', ts('Field Help'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFField', 'help_post'));
     // listings title
     $this->add('text', 'listings_title', ts('Listings Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFField', 'listings_title'));
     $this->addRule('listings_title', ts('Please enter a valid title for this field when displayed in user listings.'), 'title');
     $this->add('checkbox', 'is_required', ts('Required?'));
     $this->add('checkbox', 'is_active', ts('Active?'));
     $this->add('checkbox', 'is_view', ts('View Only?'));
     // $this->add( 'checkbox', 'is_registration', ts( 'Display in Registration Form?' ) );
     //$this->add( 'checkbox', 'is_match'       , ts( 'Key to Match Contacts?'        ) );
     $this->add('text', 'label', ts('Field Label'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFField', 'label'));
     $js = null;
     if ($this->_hasSearchableORInSelector) {
         $js = array('onclick' => "return verify( );");
     }
     // add buttons
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => true, 'js' => $js), array('type' => 'next', 'name' => ts('Save and New'), 'subName' => 'new', 'js' => $js), array('type' => 'cancel', 'name' => ts('Cancel'))));
     $this->addFormRule(array('CRM_UF_Form_Field', 'formRule'), $this);
     // if view mode pls freeze it with the done button.
     if ($this->_action & CRM_Core_Action::VIEW) {
         $this->freeze();
         $this->addElement('button', 'done', ts('Done'), array('onclick' => "location.href='civicrm/admin/uf/group/field?reset=1&action=browse&gid=" . $this->_gid . "'"));
     }
     $this->setDefaults($defaults);
 }
示例#8
0
 /**
  * Build the form object.
  *
  *
  * @return void
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->addElement('text', 'sort_name', ts('Participant Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     CRM_Event_BAO_Query::buildSearchForm($this);
     $rows = $this->get('rows');
     if (is_array($rows)) {
         $lineItems = $eventIds = array();
         if (!$this->_single) {
             $this->addRowSelectors($rows);
         }
         foreach ($rows as $row) {
             $eventIds[$row['event_id']] = $row['event_id'];
             if (CRM_Event_BAO_Event::usesPriceSet($row['event_id'])) {
                 // add line item details if applicable
                 $lineItems[$row['participant_id']] = CRM_Price_BAO_LineItem::getLineItems($row['participant_id']);
             }
         }
         //get actual count only when we are dealing w/ single event.
         $participantCount = 0;
         if (count($eventIds) == 1) {
             //convert form values to clause.
             $seatClause = array();
             if (CRM_Utils_Array::value('participant_test', $this->_formValues) == '1' || CRM_Utils_Array::value('participant_test', $this->_formValues) == '0') {
                 $seatClause[] = "( participant.is_test = {$this->_formValues['participant_test']} )";
             }
             if (!empty($this->_formValues['participant_status_id'])) {
                 $seatClause[] = CRM_Contact_BAO_Query::buildClause("participant.status_id", '=', $this->_formValues['participant_status_id'], 'Int');
                 if ($status = CRM_Utils_Array::value('IN', $this->_formValues['participant_status_id'])) {
                     $this->_formValues['participant_status_id'] = $status;
                 }
             }
             if (!empty($this->_formValues['participant_role_id'])) {
                 $seatClause[] = '( participant.role_id IN ( ' . implode(' , ', (array) $this->_formValues['participant_role_id']) . ' ) )';
             }
             // CRM-15379
             if (!empty($this->_formValues['participant_fee_id'])) {
                 $participant_fee_id = $this->_formValues['participant_fee_id'];
                 $feeLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $participant_fee_id, 'label');
                 $feeLabel = CRM_Core_DAO::escapeString(trim($feeLabel));
                 $seatClause[] = "( participant.fee_level LIKE '%{$feeLabel}%' )";
             }
             $seatClause = implode(' AND ', $seatClause);
             $participantCount = CRM_Event_BAO_Event::eventTotalSeats(array_pop($eventIds), $seatClause);
         }
         $this->assign('participantCount', $participantCount);
         $this->assign('lineItems', $lineItems);
         $permission = CRM_Core_Permission::getPermission();
         $tasks = CRM_Event_Task::permissionedTaskTitles($permission);
         if (isset($this->_ssID)) {
             if ($permission == CRM_Core_Permission::EDIT) {
                 $tasks = $tasks + CRM_Event_Task::optionalTaskTitle();
             }
             $savedSearchValues = array('id' => $this->_ssID, 'name' => CRM_Contact_BAO_SavedSearch::getName($this->_ssID, 'title'));
             $this->assign_by_ref('savedSearch', $savedSearchValues);
             $this->assign('ssID', $this->_ssID);
         }
         $this->addTaskMenu($tasks);
     }
 }
示例#9
0
文件: Search.php 项目: hguru/224Civi
 /**
  * Build the form
  *
  * @access public
  *
  * @return void
  */
 function buildQuickForm()
 {
     $this->addElement('text', 'sort_name', ts('Participant Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     CRM_Event_BAO_Query::buildSearchForm($this);
     /*
      * add form checkboxes for each row. This is needed out here to conform to QF protocol
      * of all elements being declared in builQuickForm
      */
     $rows = $this->get('rows');
     if (is_array($rows)) {
         $lineItems = $eventIds = array();
         if (!$this->_single) {
             $this->addElement('checkbox', 'toggleSelect', NULL, NULL, array('onclick' => "toggleTaskAction( true ); return toggleCheckboxVals('mark_x_',this);"));
         }
         foreach ($rows as $row) {
             $eventIds[$row['event_id']] = $row['event_id'];
             if (!$this->_single) {
                 $this->addElement('checkbox', $row['checkbox'], NULL, NULL, array('onclick' => "toggleTaskAction( true ); return checkSelectedBox('" . $row['checkbox'] . "');"));
             }
             if (CRM_Event_BAO_Event::usesPriceSet($row['event_id'])) {
                 // add line item details if applicable
                 $lineItems[$row['participant_id']] = CRM_Price_BAO_LineItem::getLineItems($row['participant_id']);
             }
         }
         //get actual count only when we are dealing w/ single event.
         $participantCount = 0;
         if (count($eventIds) == 1) {
             //convert form values to clause.
             $seatClause = array();
             // Filter on is_test if specified in search form
             if (CRM_Utils_Array::value('participant_test', $this->_formValues) == '1' || CRM_Utils_Array::value('participant_test', $this->_formValues) == '0') {
                 $seatClause[] = "( participant.is_test = {$this->_formValues['participant_test']} )";
             }
             if (CRM_Utils_Array::value('participant_status_id', $this->_formValues)) {
                 $statuses = array_keys($this->_formValues['participant_status_id']);
                 $seatClause[] = '( participant.status_id IN ( ' . implode(' , ', $statuses) . ' ) )';
             }
             if (CRM_Utils_Array::value('participant_role_id', $this->_formValues)) {
                 $roles = array_keys($this->_formValues['participant_role_id']);
                 $seatClause[] = '( participant.role_id IN ( ' . implode(' , ', $roles) . ' ) )';
             }
             $clause = NULL;
             if (!empty($seatClause)) {
                 $clause = implode(' AND ', $seatClause);
             }
             $participantCount = CRM_Event_BAO_Event::eventTotalSeats(array_pop($eventIds), $clause);
         }
         $this->assign('participantCount', $participantCount);
         $this->assign('lineItems', $lineItems);
         $total = $cancel = 0;
         $permission = CRM_Core_Permission::getPermission();
         $tasks = array('' => ts('- actions -')) + CRM_Event_Task::permissionedTaskTitles($permission);
         if (isset($this->_ssID)) {
             if ($permission == CRM_Core_Permission::EDIT) {
                 $tasks = $tasks + CRM_Event_Task::optionalTaskTitle();
             }
             $savedSearchValues = array('id' => $this->_ssID, 'name' => CRM_Contact_BAO_SavedSearch::getName($this->_ssID, 'title'));
             $this->assign_by_ref('savedSearch', $savedSearchValues);
             $this->assign('ssID', $this->_ssID);
         }
         $this->add('select', 'task', ts('Actions:') . ' ', $tasks);
         $this->add('submit', $this->_actionButtonName, ts('Go'), array('class' => 'form-submit', 'id' => 'Go', 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 0);"));
         $this->add('submit', $this->_printButtonName, ts('Print'), array('class' => 'form-submit', 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 1);"));
         // need to perform tasks on all or selected items ? using radio_ts(task selection) for it
         $this->addElement('radio', 'radio_ts', NULL, '', 'ts_sel', array('checked' => 'checked'));
         $this->addElement('radio', 'radio_ts', NULL, '', 'ts_all', array('onclick' => $this->getName() . ".toggleSelect.checked = false; toggleCheckboxVals('mark_x_',this); toggleTaskAction( true );"));
     }
     // add buttons
     $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => TRUE)));
 }
示例#10
0
 /**
  * Build the form
  *
  * @access public
  * @return void
  */
 function buildQuickForm()
 {
     $this->addElement('text', 'sort_name', ts('Participant Name or Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name'));
     require_once 'CRM/Event/BAO/Query.php';
     CRM_Event_BAO_Query::buildSearchForm($this);
     /* 
      * add form checkboxes for each row. This is needed out here to conform to QF protocol 
      * of all elements being declared in builQuickForm 
      */
     $rows = $this->get('rows');
     if (is_array($rows)) {
         $lineItems = array();
         require_once 'CRM/Event/BAO/Event.php';
         if (!$this->_single) {
             $this->addElement('checkbox', 'toggleSelect', null, null, array('onclick' => "toggleTaskAction( true ); return toggleCheckboxVals('mark_x_',this);"));
         }
         foreach ($rows as $row) {
             if (!$this->_single) {
                 $this->addElement('checkbox', $row['checkbox'], null, null, array('onclick' => "toggleTaskAction( true ); return checkSelectedBox('" . $row['checkbox'] . "', '" . $this->getName() . "');"));
             }
             if (CRM_Event_BAO_Event::usesPriceSet($row['event_id'])) {
                 // add line item details if applicable
                 require_once 'CRM/Price/BAO/LineItem.php';
                 $lineItems[$row['participant_id']] = CRM_Price_BAO_LineItem::getLineItems($row['participant_id']);
             }
         }
         $this->assign('lineItems', $lineItems);
         $total = $cancel = 0;
         require_once "CRM/Core/Permission.php";
         $permission = CRM_Core_Permission::getPermission();
         require_once 'CRM/Event/Task.php';
         $tasks = array('' => ts('- more actions -')) + CRM_Event_Task::permissionedTaskTitles($permission);
         if (isset($this->_ssID)) {
             if ($permission == CRM_Core_Permission::EDIT) {
                 require_once "CRM/Contact/Task.php";
                 $tasks = $tasks + CRM_Event_Task::optionalTaskTitle();
             }
             $savedSearchValues = array('id' => $this->_ssID, 'name' => CRM_Contact_BAO_SavedSearch::getName($this->_ssID, 'title'));
             $this->assign_by_ref('savedSearch', $savedSearchValues);
             $this->assign('ssID', $this->_ssID);
         }
         $this->add('select', 'task', ts('Actions:') . ' ', $tasks);
         $this->add('submit', $this->_actionButtonName, ts('Go'), array('class' => 'form-submit', 'id' => 'Go', 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 0);"));
         $this->add('submit', $this->_printButtonName, ts('Print'), array('class' => 'form-submit', 'onclick' => "return checkPerformAction('mark_x', '" . $this->getName() . "', 1);"));
         // need to perform tasks on all or selected items ? using radio_ts(task selection) for it
         $this->addElement('radio', 'radio_ts', null, '', 'ts_sel', array('checked' => 'checked'));
         $this->addElement('radio', 'radio_ts', null, '', 'ts_all', array('onclick' => $this->getName() . ".toggleSelect.checked = false; toggleCheckboxVals('mark_x_',this); toggleTaskAction( true );"));
     }
     // add buttons
     $this->addButtons(array(array('type' => 'refresh', 'name' => ts('Search'), 'isDefault' => true)));
 }
示例#11
0
文件: Field.php 项目: kidaa30/yes
 /**
  * Set variables up before form is built.
  *
  * @return void
  */
 public function preProcess()
 {
     $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this);
     $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
     if ($this->_gid) {
         $this->_title = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'title');
         $this->setPageTitle(ts('Profile Field'));
         $url = CRM_Utils_System::url('civicrm/admin/uf/group/field', "reset=1&action=browse&gid={$this->_gid}");
         $session = CRM_Core_Session::singleton();
         $session->pushUserContext($url);
         $breadCrumb = array(array('title' => ts('CiviCRM Profile Fields'), 'url' => $url));
         CRM_Utils_System::appendBreadCrumb($breadCrumb);
     }
     $showBestResult = CRM_Utils_Request::retrieve('sbr', 'Positive', CRM_Core_DAO::$_nullArray);
     if ($showBestResult) {
         $this->assign('showBestResult', $showBestResult);
     }
     $this->_fields = CRM_Contact_BAO_Contact::importableFields('All', TRUE, TRUE, TRUE, TRUE, TRUE);
     $this->_fields = array_merge(CRM_Activity_BAO_Activity::exportableFields('Activity'), $this->_fields);
     //unset campaign related fields.
     if (isset($this->_fields['activity_campaign_id'])) {
         $this->_fields['activity_campaign_id']['title'] = ts('Campaign');
         if (isset($this->_fields['activity_campaign'])) {
             unset($this->_fields['activity_campaign']);
         }
     }
     if (CRM_Core_Permission::access('CiviContribute')) {
         $this->_fields = array_merge(CRM_Contribute_BAO_Contribution::getContributionFields(FALSE), $this->_fields);
         $this->_fields = array_merge(CRM_Core_BAO_UFField::getContribBatchEntryFields(), $this->_fields);
     }
     if (CRM_Core_Permission::access('CiviMember')) {
         $this->_fields = array_merge(CRM_Member_BAO_Membership::getMembershipFields(), $this->_fields);
     }
     if (CRM_Core_Permission::access('CiviEvent')) {
         $this->_fields = array_merge(CRM_Event_BAO_Query::getParticipantFields(), $this->_fields);
     }
     if (CRM_Core_Permission::access('CiviCase')) {
         $this->_fields = array_merge(CRM_Case_BAO_Query::getFields(), $this->_fields);
     }
     $this->_fields = array_merge($this->_fields, CRM_Contact_BAO_Query_Hook::singleton()->getFields());
     $this->_selectFields = array();
     foreach ($this->_fields as $name => $field) {
         // lets skip note for now since we dont support it
         if ($name == 'note') {
             continue;
         }
         $this->_selectFields[$name] = $field['title'];
         $this->_hasLocationTypes[$name] = CRM_Utils_Array::value('hasLocationType', $field);
     }
     // lets add group, tag and current_employer to this list
     $this->_selectFields['group'] = ts('Group(s)');
     $this->_selectFields['tag'] = ts('Tag(s)');
     $this->_selectFields['current_employer'] = ts('Current Employer');
     $this->_selectFields['phone_and_ext'] = ts('Phone and Extension');
     //CRM-4363 check for in selector or searchable fields.
     $this->_hasSearchableORInSelector = CRM_Core_BAO_UFField::checkSearchableORInSelector($this->_gid);
     $this->assign('fieldId', $this->_id);
     if ($this->_id) {
         $fieldTitle = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFField', $this->_id, 'label');
         $this->assign('fieldTitle', $fieldTitle);
     }
 }
/**
 * Retrieve a specific participant, given a set of input params
 * If more than one matching participant exists, return an error, unless
 * the client has requested to return the first found contact
 *
 * @param  array   $params           (reference ) input parameters
 *
 * @return array (reference )        array of properties, if error an array with an error id and error message
 * {@getfields participant_get}
 * @access public
 */
function civicrm_api3_participant_get($params)
{
    $options = _civicrm_api3_get_options_from_params($params, TRUE, 'participant', 'get');
    $sort = CRM_Utils_Array::value('sort', $options, NULL);
    $offset = CRM_Utils_Array::value('offset', $options);
    $rowCount = CRM_Utils_Array::value('limit', $options);
    $smartGroupCache = CRM_Utils_Array::value('smartGroupCache', $params);
    $inputParams = CRM_Utils_Array::value('input_params', $options, array());
    $returnProperties = CRM_Utils_Array::value('return', $options, NULL);
    if (empty($returnProperties)) {
        $returnProperties = CRM_Event_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_EVENT);
    }
    $newParams = CRM_Contact_BAO_Query::convertFormValues($inputParams);
    $query = new CRM_Contact_BAO_Query($newParams, $returnProperties, NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_EVENT);
    list($select, $from, $where, $having) = $query->query();
    $sql = "{$select} {$from} {$where} {$having}";
    if (!empty($sort)) {
        $sql .= " ORDER BY {$sort} ";
    }
    $sql .= " LIMIT {$offset}, {$rowCount} ";
    $dao = CRM_Core_DAO::executeQuery($sql);
    $participant = array();
    while ($dao->fetch()) {
        $participant[$dao->participant_id] = $query->store($dao);
        _civicrm_api3_custom_data_get($participant[$dao->participant_id], 'Participant', $dao->participant_id, NULL);
    }
    return civicrm_api3_create_success($participant, $params, 'participant', 'get', $dao);
}
示例#13
0
/**
 * Get contact participant record.
 * 
 * This api is used for finding an existing participant record.
 *
 * @param  array  $params     an associative array of name/value property values of civicrm_participant
 *
 * @return  participant property values.
 * @access public
 */
function &civicrm_participant_search(&$params)
{
    if (!is_array($params)) {
        return civicrm_create_error('Params need to be of type array!');
    }
    $inputParams = array();
    $returnProperties = array();
    $otherVars = array('sort', 'offset', 'rowCount');
    $sort = null;
    $offset = 0;
    $rowCount = 25;
    foreach ($params as $n => $v) {
        if (substr($n, 0, 7) == 'return.') {
            $returnProperties[substr($n, 7)] = $v;
        } elseif (in_array($n, $otherVars)) {
            ${$n} = $v;
        } else {
            $inputParams[$n] = $v;
        }
    }
    // add is_test to the clause if not present
    if (!array_key_exists('participant_test', $inputParams)) {
        $inputParams['participant_test'] = 0;
    }
    require_once 'CRM/Contact/BAO/Query.php';
    require_once 'CRM/Event/BAO/Query.php';
    if (empty($returnProperties)) {
        $returnProperties = CRM_Event_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_EVENT);
    }
    $newParams =& CRM_Contact_BAO_Query::convertFormValues($params);
    $query =& new CRM_Contact_BAO_Query($newParams, $returnProperties, null);
    list($select, $from, $where) = $query->query();
    $sql = "{$select} {$from} {$where}";
    if (!empty($sort)) {
        $sql .= " ORDER BY {$sort} ";
    }
    $sql .= " LIMIT {$offset}, {$rowCount} ";
    $dao =& CRM_Core_DAO::executeQuery($sql, CRM_Core_DAO::$_nullArray);
    $participant = array();
    while ($dao->fetch()) {
        $participant[$dao->participant_id] = $query->store($dao);
    }
    $dao->free();
    return $participant;
}