当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_PseudoConstant::populate方法代码示例

本文整理汇总了PHP中CRM_Core_PseudoConstant::populate方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_PseudoConstant::populate方法的具体用法?PHP CRM_Core_PseudoConstant::populate怎么用?PHP CRM_Core_PseudoConstant::populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_PseudoConstant的用法示例。


在下文中一共展示了CRM_Core_PseudoConstant::populate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct()
 {
     static $_events;
     if (!isset($_events['all'])) {
         CRM_Core_PseudoConstant::populate($_events['all'], 'CRM_Event_DAO_Event', FALSE, 'title', 'is_active', "is_template IS NULL OR is_template = 0", 'end_date DESC');
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('sort_name_linked' => array('title' => ts('Participant Name'), 'required' => TRUE, 'no_repeat' => TRUE, 'dbAlias' => 'contact_civireport.sort_name'), 'id' => array('no_display' => TRUE, 'required' => TRUE), 'employer_id' => array('title' => ts('Organization'))), 'grouping' => 'contact-fields', 'filters' => array('sort_name' => array('title' => ts('Participant Name'), 'operator' => 'like')), 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'fields' => array('email' => array('title' => ts('Email'), 'no_repeat' => TRUE)), 'grouping' => 'contact-fields', 'filters' => array('email' => array('title' => ts('Participant E-mail'), 'operator' => 'like'))), 'civicrm_address' => array('dao' => 'CRM_Core_DAO_Address', 'fields' => array('street_address' => NULL, 'city' => NULL, 'postal_code' => NULL, 'state_province_id' => array('title' => ts('State/Province')), 'country_id' => array('title' => ts('Country'))), 'grouping' => 'contact-fields'), 'civicrm_participant' => array('dao' => 'CRM_Event_DAO_Participant', 'fields' => array('participant_id' => array('title' => 'Participant ID'), 'participant_record' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE), 'event_id' => array('default' => TRUE, 'type' => CRM_Utils_Type::T_STRING), 'status_id' => array('title' => ts('Status'), 'default' => TRUE), 'role_id' => array('title' => ts('Role'), 'default' => TRUE), 'participant_fee_level' => NULL, 'participant_fee_amount' => NULL, 'participant_register_date' => array('title' => ts('Registration Date'))), 'grouping' => 'event-fields', 'filters' => array('event_id' => array('name' => 'event_id', 'title' => ts('Event'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $_events['all']), 'sid' => array('name' => 'status_id', 'title' => ts('Participant Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label')), 'rid' => array('name' => 'role_id', 'title' => ts('Participant Role'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantRole()), 'participant_register_date' => array('title' => ' Registration Date', 'operatorType' => CRM_Report_Form::OP_DATE)), 'order_bys' => array('event_id' => array('title' => ts('Event'), 'default_weight' => '1', 'default_order' => 'ASC'))), 'civicrm_event' => array('dao' => 'CRM_Event_DAO_Event', 'fields' => array('event_type_id' => array('title' => ts('Event Type'))), 'grouping' => 'event-fields', 'filters' => array('eid' => array('name' => 'event_type_id', 'title' => ts('Event Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('event_type'))), 'order_bys' => array('event_type_id' => array('title' => ts('Event Type'), 'default_weight' => '2', 'default_order' => 'ASC'))));
     $this->_options = array('blank_column_begin' => array('title' => ts('Blank column at the Begining'), 'type' => 'checkbox'), 'blank_column_end' => array('title' => ts('Blank column at the End'), 'type' => 'select', 'options' => array('' => '-select-', 1 => ts('One'), 2 => ts('Two'), 3 => ts('Three'))));
     parent::__construct();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:10,代码来源:ParticipantListing.php

示例2: recordBounce

 static function recordBounce($params)
 {
     $isSpam = CRM_Utils_Array::value('is_spam', $params);
     $mailingId = CRM_Utils_Array::value('mailing_id', $params);
     //CiviCRM mailling ID
     $contactId = CRM_Utils_Array::value('contact_id', $params);
     $emailId = CRM_Utils_Array::value('email_id', $params);
     $email = CRM_Utils_Array::value('email', $params);
     $jobId = CRM_Utils_Array::value('job_id', $params);
     $eqParams = array('job_id' => $jobId, 'contact_id' => $contactId, 'email_id' => $emailId);
     $eventQueue = CRM_Mailing_Event_BAO_Queue::create($eqParams);
     $time = date('YmdHis', CRM_Utils_Array::value('date_ts', $params));
     $bounceType = array();
     CRM_Core_PseudoConstant::populate($bounceType, 'CRM_Mailing_DAO_BounceType', TRUE, 'id', NULL, NULL, NULL, 'name');
     $bounce = new CRM_Mailing_Event_BAO_Bounce();
     $bounce->time_stamp = $time;
     $bounce->event_queue_id = $eventQueue->id;
     if ($isSpam) {
         $bounce->bounce_type_id = $bounceType[CRM_Mailjet_Upgrader::SPAM];
         $bounce->bounce_reason = CRM_Utils_Array::value('source', $params);
         //bounce reason when spam occured
     } else {
         $hardBounce = CRM_Utils_Array::value('hard_bounce', $params);
         $blocked = CRM_Utils_Array::value('blocked', $params);
         //  blocked : true if this bounce leads to recipient being blocked
         if ($hardBounce && $blocked) {
             $bounce->bounce_type_id = $bounceType[CRM_Mailjet_Upgrader::BLOCKED];
         } elseif ($hardBounce && !$blocked) {
             $bounce->bounce_type_id = $bounceType[CRM_Mailjet_Upgrader::HARD_BOUNCE];
         } else {
             $bounce->bounce_type_id = $bounceType[CRM_Mailjet_Upgrader::SOFT_BOUNCE];
         }
         $bounce->bounce_reason = $params['error_related_to'] . " - " . $params['error'];
     }
     $bounce->save();
     if ($bounce->bounce_type_id != $bounceType[CRM_Mailjet_Upgrader::SOFT_BOUNCE]) {
         $params = array('id' => $contactId, 'do_not_email' => 1);
         civicrm_api3('Contact', 'create', $params);
     }
     return TRUE;
 }
开发者ID:WeMoveEU,项目名称:uk.co.compucorp.civicrm.mailjet,代码行数:41,代码来源:Event.php

示例3: alterRow

 function alterRow(&$row)
 {
     foreach ($this->_options as $fieldID => $values) {
         $customVal = $valueSeparatedArray = array();
         if (in_array($values['attributes']['html_type'], array('Radio', 'Select', 'Autocomplete-Select'))) {
             if ($values['attributes']['data_type'] == 'ContactReference' && $row["custom_{$fieldID}"]) {
                 $row["custom_{$fieldID}"] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', (int) $row["custom_{$fieldID}"], 'display_name');
             } elseif ($row["custom_{$fieldID}"] && array_key_exists($row["custom_{$fieldID}"], $values)) {
                 $row["custom_{$fieldID}"] = $values[$row["custom_{$fieldID}"]];
             }
         } elseif (in_array($values['attributes']['html_type'], array('CheckBox', 'Multi-Select', 'AdvMulti-Select'))) {
             $valueSeparatedArray = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $row["custom_{$fieldID}"]));
             foreach ($valueSeparatedArray as $val) {
                 $customVal[] = $values[$val];
             }
             $row["custom_{$fieldID}"] = implode(', ', $customVal);
         } elseif (in_array($values['attributes']['html_type'], array('Multi-Select State/Province', 'Select State/Province'))) {
             $valueSeparatedArray = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $row["custom_{$fieldID}"]));
             $stateName = CRM_Core_PseudoConstant::stateProvince();
             foreach ($valueSeparatedArray as $val) {
                 $customVal[] = $stateName[$val];
             }
             $row["custom_{$fieldID}"] = implode(', ', $customVal);
         } elseif (in_array($values['attributes']['html_type'], array('Multi-Select Country', 'Select Country'))) {
             $valueSeparatedArray = array_filter(explode(CRM_Core_DAO::VALUE_SEPARATOR, $row["custom_{$fieldID}"]));
             CRM_Core_PseudoConstant::populate($countryNames, 'CRM_Core_DAO_Country', TRUE, 'name', 'is_active');
             foreach ($valueSeparatedArray as $val) {
                 $customVal[] = $countryNames[$val];
             }
             $row["custom_{$fieldID}"] = implode(', ', $customVal);
         }
     }
 }
开发者ID:hguru,项目名称:224Civi,代码行数:33,代码来源:MultipleValues.php

示例4: caseType

 /**
  * Get all the case type.
  *
  *
  * @param string $column
  * @param bool $onlyActive
  *
  * @return array
  *   array reference of all case type
  */
 public static function caseType($column = 'title', $onlyActive = TRUE)
 {
     if ($onlyActive) {
         $condition = " is_active = 1 ";
     } else {
         $condition = NULL;
     }
     $caseType = NULL;
     // FIXME: deprecated?
     CRM_Core_PseudoConstant::populate($caseType, 'CRM_Case_DAO_CaseType', TRUE, $column, '', $condition, 'weight', 'id');
     return $caseType;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:22,代码来源:PseudoConstant.php

示例5: buildQuickForm

 /**
  * Build the form
  *
  * @access public
  *
  * @return void
  */
 function buildQuickForm()
 {
     $ufGroupId = $this->get('ufGroupId');
     if (!$ufGroupId) {
         CRM_Core_Error::fatal('ufGroupId is missing');
     }
     $this->_title = ts('Batch Update for Events') . ' - ' . CRM_Core_BAO_UFGroup::getTitle($ufGroupId);
     CRM_Utils_System::setTitle($this->_title);
     $this->addDefaultButtons(ts('Save'));
     $this->_fields = array();
     $this->_fields = CRM_Core_BAO_UFGroup::getFields($ufGroupId, FALSE, CRM_Core_Action::VIEW);
     // remove file type field and then limit fields
     $suppressFields = FALSE;
     $removehtmlTypes = array('File', 'Autocomplete-Select');
     foreach ($this->_fields as $name => $field) {
         if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name) && in_array($this->_fields[$name]['html_type'], $removehtmlTypes)) {
             $suppressFields = TRUE;
             unset($this->_fields[$name]);
         }
         //fix to reduce size as we are using this field in grid
         if (is_array($field['attributes']) && $this->_fields[$name]['attributes']['size'] > 19) {
             //shrink class to "form-text-medium"
             $this->_fields[$name]['attributes']['size'] = 19;
         }
     }
     $this->_fields = array_slice($this->_fields, 0, $this->_maxFields);
     $this->addButtons(array(array('type' => 'submit', 'name' => ts('Update Participant(s)'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
     $this->assign('profileTitle', $this->_title);
     $this->assign('componentIds', $this->_participantIds);
     $fileFieldExists = FALSE;
     //load all campaigns.
     if (array_key_exists('participant_campaign_id', $this->_fields)) {
         $this->_componentCampaigns = array();
         CRM_Core_PseudoConstant::populate($this->_componentCampaigns, 'CRM_Event_DAO_Participant', TRUE, 'campaign_id', 'id', ' id IN (' . implode(' , ', array_values($this->_participantIds)) . ' ) ');
     }
     //fix for CRM-2752
     // get the option value for custom data type
     $this->_roleCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantRole', 'name');
     $this->_eventNameCustomDataTypeID = CRM_Core_OptionGroup::getValue('custom_data_type', 'ParticipantEventName', 'name');
     // build custom data getFields array
     $customFieldsRole = CRM_Core_BAO_CustomField::getFields('Participant', FALSE, FALSE, NULL, $this->_roleCustomDataTypeID);
     $customFieldsEvent = CRM_Core_BAO_CustomField::getFields('Participant', FALSE, FALSE, NULL, $this->_eventNameCustomDataTypeID);
     $customFields = CRM_Utils_Array::crmArrayMerge($customFieldsRole, CRM_Core_BAO_CustomField::getFields('Participant', FALSE, FALSE, NULL, NULL, TRUE));
     $this->_customFields = CRM_Utils_Array::crmArrayMerge($customFieldsEvent, $customFields);
     foreach ($this->_participantIds as $participantId) {
         $roleId = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant", $participantId, 'role_id');
         $eventId = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant", $participantId, 'event_id');
         foreach ($this->_fields as $name => $field) {
             if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
                 $customValue = CRM_Utils_Array::value($customFieldID, $this->_customFields);
                 $entityColumnValue = array();
                 if (CRM_Utils_Array::value('extends_entity_column_value', $customValue)) {
                     $entityColumnValue = explode(CRM_Core_DAO::VALUE_SEPARATOR, $customValue['extends_entity_column_value']);
                 }
                 $entityColumnValueRole = CRM_Utils_Array::value($roleId, $entityColumnValue);
                 if ($this->_roleCustomDataTypeID == $customValue['extends_entity_column_id'] && $entityColumnValueRole) {
                     CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $participantId);
                 } elseif ($this->_eventNameCustomDataTypeID == $customValue['extends_entity_column_id'] && $eventId == $entityColumnValueRole) {
                     CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $participantId);
                 } elseif (CRM_Utils_System::isNull($entityColumnValueRole)) {
                     CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $participantId);
                 }
             } else {
                 if ($field['name'] == 'participant_role_id') {
                     $field['is_multiple'] = TRUE;
                 }
                 // handle non custom fields
                 CRM_Core_BAO_UFGroup::buildProfile($this, $field, NULL, $participantId);
             }
         }
     }
     $this->assign('fields', $this->_fields);
     // don't set the status message when form is submitted.
     $buttonName = $this->controller->getButtonName('submit');
     if ($suppressFields && $buttonName != '_qf_Batch_next') {
         CRM_Core_Session::setStatus("FILE or Autocomplete Select type field(s) in the selected profile are not supported for Batch Update and have been excluded.");
     }
     $this->addDefaultButtons(ts('Update Participant(s)'));
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:86,代码来源:Batch.php

示例6: getParticipantColumns

 function getParticipantColumns()
 {
     static $_events = array();
     if (!isset($_events['all'])) {
         CRM_Core_PseudoConstant::populate($_events['all'], 'CRM_Event_DAO_Event', FALSE, 'title', 'is_active', "is_template IS NULL OR is_template = 0", 'end_date DESC');
     }
     return array('civicrm_participant' => array('dao' => 'CRM_Event_DAO_Participant', 'fields' => array('participant_id' => array('title' => 'Participant ID'), 'participant_record' => array('name' => 'id', 'title' => 'Participant Id'), 'event_id' => array('title' => ts('Event ID'), 'type' => CRM_Utils_Type::T_STRING, 'alter_display' => 'alterEventID'), 'status_id' => array('title' => ts('Status'), 'alter_display' => 'alterParticipantStatus'), 'role_id' => array('title' => ts('Role'), 'alter_display' => 'alterParticipantRole'), 'participant_fee_level' => NULL, 'participant_fee_amount' => NULL, 'participant_register_date' => array('title' => ts('Registration Date'))), 'grouping' => 'event-fields', 'filters' => array('event_id' => array('name' => 'event_id', 'title' => ts('Event'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $_events['all']), 'sid' => array('name' => 'status_id', 'title' => ts('Participant Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label')), 'rid' => array('name' => 'role_id', 'title' => ts('Participant Role'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Event_PseudoConstant::participantRole()), 'participant_register_date' => array('title' => ' Registration Date', 'operatorType' => CRM_Report_Form::OP_DATE)), 'order_bys' => array('event_id' => array('title' => ts('Event'), 'default_weight' => '1', 'default_order' => 'ASC')), 'group_bys' => array('event_id' => array('title' => ts('Event')))));
 }
开发者ID:hguru,项目名称:224Civi,代码行数:8,代码来源:Extended.php

示例7: getAvailableCountries

 /**
  * @return array
  */
 public static function getAvailableCountries()
 {
     $i18n = CRM_Core_I18n::singleton();
     $country = array();
     CRM_Core_PseudoConstant::populate($country, 'CRM_Core_DAO_Country', TRUE, 'name', 'is_active');
     $i18n->localizeArray($country, array('context' => 'country'));
     asort($country);
     return $country;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:12,代码来源:Localization.php

示例8: postProcess

 /**
  * Process the form.
  *
  * @return void
  */
 public function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     $deletePriceSet = 0;
     if ($params['membership_type']) {
         // we do this in case the user has hit the forward/back button
         $dao = new CRM_Member_DAO_MembershipBlock();
         $dao->entity_table = 'civicrm_contribution_page';
         $dao->entity_id = $this->_id;
         $dao->find(TRUE);
         $membershipID = $dao->id;
         if ($membershipID) {
             $params['id'] = $membershipID;
         }
         $membershipTypes = array();
         if (is_array($params['membership_type'])) {
             foreach ($params['membership_type'] as $k => $v) {
                 if ($v) {
                     $membershipTypes[$k] = CRM_Utils_Array::value("auto_renew_{$k}", $params);
                 }
             }
         }
         if ($this->_id && !empty($params['member_price_set_id'])) {
             CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'amount_block_is_active', 0);
         }
         // check for price set.
         $priceSetID = CRM_Utils_Array::value('member_price_set_id', $params);
         if (!empty($params['member_is_active']) && is_array($membershipTypes) && !$priceSetID) {
             $usedPriceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $this->_id, 2);
             if (empty($params['mem_price_field_id']) && !$usedPriceSetId) {
                 $pageTitle = strtolower(CRM_Utils_String::munge($this->_values['title'], '_', 245));
                 $setParams['title'] = $this->_values['title'];
                 if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $pageTitle, 'id', 'name')) {
                     $setParams['name'] = $pageTitle;
                 } elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $pageTitle . '_' . $this->_id, 'id', 'name')) {
                     $setParams['name'] = $pageTitle . '_' . $this->_id;
                 } else {
                     $timeSec = explode(".", microtime(TRUE));
                     $setParams['name'] = $pageTitle . '_' . date('is', $timeSec[0]) . $timeSec[1];
                 }
                 $setParams['is_quick_config'] = 1;
                 $setParams['extends'] = CRM_Core_Component::getComponentID('CiviMember');
                 $setParams['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $this->_values);
                 $priceSet = CRM_Price_BAO_PriceSet::create($setParams);
                 $priceSetID = $priceSet->id;
                 $fieldParams['price_set_id'] = $priceSet->id;
             } elseif ($usedPriceSetId) {
                 $setParams['extends'] = CRM_Core_Component::getComponentID('CiviMember');
                 $setParams['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $this->_values);
                 $setParams['id'] = $usedPriceSetId;
                 $priceSet = CRM_Price_BAO_PriceSet::create($setParams);
                 $priceSetID = $priceSet->id;
                 $fieldParams['price_set_id'] = $priceSet->id;
             } else {
                 $fieldParams['id'] = CRM_Utils_Array::value('mem_price_field_id', $params);
                 $priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', CRM_Utils_Array::value('mem_price_field_id', $params), 'price_set_id');
             }
             $editedFieldParams = array('price_set_id' => $priceSetID, 'name' => 'membership_amount');
             $editedResults = array();
             CRM_Price_BAO_PriceField::retrieve($editedFieldParams, $editedResults);
             if (empty($editedResults['id'])) {
                 $fieldParams['name'] = strtolower(CRM_Utils_String::munge('Membership Amount', '_', 245));
                 if (empty($params['mem_price_field_id'])) {
                     CRM_Utils_Weight::updateOtherWeights('CRM_Price_DAO_PriceField', 0, 1, array('price_set_id' => $priceSetID));
                 }
                 $fieldParams['weight'] = 1;
             } else {
                 $fieldParams['id'] = CRM_Utils_Array::value('id', $editedResults);
             }
             $fieldParams['label'] = !empty($params['membership_type_label']) ? $params['membership_type_label'] : ts('Membership');
             $fieldParams['is_active'] = 1;
             $fieldParams['html_type'] = 'Radio';
             $fieldParams['is_required'] = !empty($params['is_required']) ? 1 : 0;
             $fieldParams['is_display_amounts'] = !empty($params['display_min_fee']) ? 1 : 0;
             $rowCount = 1;
             $options = array();
             if (!empty($fieldParams['id'])) {
                 CRM_Core_PseudoConstant::populate($options, 'CRM_Price_DAO_PriceFieldValue', TRUE, 'membership_type_id', NULL, " price_field_id = {$fieldParams['id']} ");
             }
             foreach ($membershipTypes as $memType => $memAutoRenew) {
                 if ($priceFieldID = CRM_Utils_Array::key($memType, $options)) {
                     $fieldParams['option_id'][$rowCount] = $priceFieldID;
                     unset($options[$priceFieldID]);
                 }
                 $membetype = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($memType);
                 $fieldParams['option_label'][$rowCount] = CRM_Utils_Array::value('name', $membetype);
                 $fieldParams['option_amount'][$rowCount] = CRM_Utils_Array::value('minimum_fee', $membetype, 0);
                 $fieldParams['option_weight'][$rowCount] = CRM_Utils_Array::value('weight', $membetype);
                 $fieldParams['option_description'][$rowCount] = CRM_Utils_Array::value('description', $membetype);
                 $fieldParams['default_option'] = CRM_Utils_Array::value('membership_type_default', $params);
                 $fieldParams['option_financial_type_id'][$rowCount] = CRM_Utils_Array::value('financial_type_id', $membetype);
                 $fieldParams['membership_type_id'][$rowCount] = $memType;
                 // [$rowCount] = $membetype[''];
                 $rowCount++;
//.........这里部分代码省略.........
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:101,代码来源:MembershipBlock.php

示例9:

 /**
  * get event template titles
  *
  * @return array  of event id → template title pairs
  */
 public static function &eventTemplates($id = null)
 {
     if (!self::$eventTemplates) {
         CRM_Core_PseudoConstant::populate(self::$eventTemplates, 'CRM_Event_DAO_Event', false, 'template_title', 'is_template');
     }
     if ($id) {
         return self::$eventTemplates[$id];
     }
     return self::$eventTemplates;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:15,代码来源:PseudoConstant.php

示例10: buildQuickForm

 public function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Sepa Direct Debit - Settings'));
     $customFields = CRM_Core_BAO_CustomField::getFields();
     $cf = array();
     foreach ($customFields as $k => $v) {
         $cf[$k] = $v['label'];
     }
     // add all form elements and validation rules
     foreach ($this->config_fields as $key => $value) {
         $elementName = $this->domainToString($value[0]);
         $elem = $this->addElement('text', $elementName, $value[1], isset($value[2]) ? $value[2] : array());
         if (!in_array($elementName, array('cycledays', 'custom_txmsg'))) {
             // integer only rules, except for cycledays (list)
             $this->addRule($this->domainToString($value[0]), sprintf(ts("Please enter the %s as number (integers only)."), $value[1]), 'positiveInteger');
             $this->addRule($this->domainToString($value[0]), sprintf(ts("Please enter the %s as number (integers only)."), $value[1]), 'required');
         }
     }
     // country drop down field
     $config = CRM_Core_Config::singleton();
     $i18n = CRM_Core_I18n::singleton();
     $climit = array();
     $cnames = array();
     $ciso = array();
     $filtered = array();
     $climit = $config->countryLimit();
     CRM_Core_PseudoConstant::populate($cnames, 'CRM_Core_DAO_Country', TRUE, 'name', 'is_active');
     CRM_Core_PseudoConstant::populate($ciso, 'CRM_Core_DAO_Country', TRUE, 'iso_code');
     foreach ($ciso as $key => $value) {
         foreach ($climit as $active_country) {
             if ($active_country == $value) {
                 $filtered[$key] = $cnames[$key];
             }
         }
     }
     $i18n->localizeArray($filtered, array('context' => 'country'));
     asort($filtered);
     // do not use array_merge() because it discards the original indizes
     $country_ids = array('' => ts('- select -')) + $filtered;
     $exw = CRM_Core_BAO_Setting::getItem('SEPA Direct Debit Preferences', 'exclude_weekends');
     if ($exw) {
         $exw = array('checked' => 'checked');
     } else {
         $exw = array();
     }
     // add creditor form elements
     $this->addElement('text', 'addcreditor_creditor_id', ts("Creditor Contact"));
     $this->addElement('text', 'addcreditor_name', ts("Name"));
     $this->addElement('text', 'addcreditor_id', ts("Identifier"));
     $this->addElement('text', 'addcreditor_address', ts("Address"));
     $this->addElement('select', 'addcreditor_country_id', ts("Country"), $country_ids);
     $this->addElement('text', 'addcreditor_bic', ts("BIC"));
     $this->addElement('text', 'addcreditor_iban', ts("IBAN"));
     $this->addElement('select', 'addcreditor_pain_version', ts("PAIN Version"), array('' => ts('- select -')) + CRM_Core_OptionGroup::values('sepa_file_format'));
     $this->addElement('checkbox', 'is_test_creditor', ts("Is a Test Creditor"), "", array('value' => '0'));
     $this->addElement('checkbox', 'exclude_weekends', ts("Exclude Weekends"), "", $exw);
     $this->addElement('hidden', 'edit_creditor_id', '', array('id' => 'edit_creditor_id'));
     $this->addElement('hidden', 'add_creditor_id', '', array('id' => 'add_creditor_id'));
     // add custom form elements and validation rules
     $index = 0;
     foreach ($this->custom_fields as $key => $value) {
         $this->addElement('text', $this->domainToString($value[0]), $value[1], array('placeholder' => CRM_Core_BAO_Setting::getItem('SEPA Direct Debit Preferences', $this->domainToString($this->config_fields[$index][0]))));
         $elementName = $this->domainToString($value[0]);
         if (!in_array($elementName, array('custom_cycledays', 'custom_txmsg'))) {
             // integer only rules, except for cycledays (list)
             $this->addRule($elementName, sprintf(ts("Please enter the %s as number (integers only)."), $value[1]), 'positiveInteger');
         }
         $index++;
     }
     // register and add extra validation rules
     $this->registerRule('sepa_cycle_day_list', 'callback', 'sepa_cycle_day_list', 'CRM_Sepa_Logic_Settings');
     $this->addRule('cycledays', ts('Please give a comma separated list of valid days.'), 'sepa_cycle_day_list');
     $this->addRule('custom_cycledays', ts('Please give a comma separated list of valid days.'), 'sepa_cycle_day_list');
     // get creditor list
     $creditors_default_list = array();
     $creditor_query = civicrm_api('SepaCreditor', 'get', array('version' => 3, 'option.limit' => 99999));
     if (!empty($creditor_query['is_error'])) {
         return civicrm_api3_create_error("Cannot get creditor list: " . $creditor_query['error_message']);
     } else {
         $creditors = array();
         foreach ($creditor_query['values'] as $creditor) {
             $creditors[] = $creditor;
             $creditors_default_list[$creditor['id']] = $creditor['name'];
         }
     }
     $this->assign('creditors', $creditors);
     $default_creditors = $this->addElement('select', 'batching_default_creditor', ts("Default Creditor"), array('' => ts('- select -')) + $creditors_default_list);
     $default_creditors->setSelected(CRM_Sepa_Logic_Settings::getSetting('batching.default.creditor'));
     // add general config options
     $amm_options = CRM_Sepa_Logic_Settings::getSetting('allow_mandate_modification') ? array('checked' => 'checked') : array();
     $this->addElement('checkbox', 'allow_mandate_modification', ts("Mandate Modifications"), NULL, $amm_options);
     parent::buildQuickForm();
 }
开发者ID:scardinius,项目名称:org.project60.sepa,代码行数:93,代码来源:SepaSettings.php

示例11: buildQuickForm

 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     parent::buildQuickForm();
     $this->setPageTitle(ts('Premium Product'));
     if ($this->_action & CRM_Core_Action::PREVIEW) {
         CRM_Contribute_BAO_Premium::buildPremiumPreviewBlock($this, $this->_id);
         return;
     }
     if ($this->_action & CRM_Core_Action::DELETE) {
         return;
     }
     $this->applyFilter('__ALL__', 'trim');
     $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'name'), TRUE);
     $this->addRule('name', ts('A product with this name already exists. Please select another name.'), 'objectExists', array('CRM_Contribute_DAO_Product', $this->_id));
     $this->add('text', 'sku', ts('SKU'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'sku'));
     $this->add('textarea', 'description', ts('Description'), 'rows=3, cols=60');
     $image['image'] = $this->createElement('radio', NULL, NULL, ts('Upload from my computer'), 'image', 'onclick="add_upload_file_block(\'image\');');
     $image['thumbnail'] = $this->createElement('radio', NULL, NULL, ts('Display image and thumbnail from these locations on the web:'), 'thumbnail', 'onclick="add_upload_file_block(\'thumbnail\');');
     $image['default_image'] = $this->createElement('radio', NULL, NULL, ts('Use default image'), 'default_image', 'onclick="add_upload_file_block(\'default\');');
     $image['noImage'] = $this->createElement('radio', NULL, NULL, ts('Do not display an image'), 'noImage', 'onclick="add_upload_file_block(\'noImage\');');
     $this->addGroup($image, 'imageOption', ts('Premium Image'));
     $this->addRule('imageOption', ts('Please select an option for the premium image.'), 'required');
     $this->addElement('text', 'imageUrl', ts('Image URL'));
     $this->addElement('text', 'thumbnailUrl', ts('Thumbnail URL'));
     $this->add('file', 'uploadFile', ts('Image File Name'), 'onChange="select_option();"');
     $this->add('text', 'price', ts('Market Value'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'price'), TRUE);
     $this->addRule('price', ts('Please enter the Market Value for this product.'), 'money');
     $this->add('text', 'cost', ts('Actual Cost of Product'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'cost'));
     $this->addRule('price', ts('Please enter the Actual Cost of Product.'), 'money');
     $this->add('text', 'min_contribution', ts('Minimum Contribution Amount'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'min_contribution'), TRUE);
     $this->addRule('min_contribution', ts('Please enter a monetary value for the Minimum Contribution Amount.'), 'money');
     $this->add('textarea', 'options', ts('Options'), 'rows=3, cols=60');
     $this->add('select', 'period_type', ts('Period Type'), array('' => '- select -', 'rolling' => 'Rolling', 'fixed' => 'Fixed'));
     $this->add('text', 'fixed_period_start_day', ts('Fixed Period Start Day'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'fixed_period_start_day'));
     $this->add('Select', 'duration_unit', ts('Duration Unit'), array('' => '- select period -') + CRM_Core_SelectValues::getPremiumUnits());
     $this->add('text', 'duration_interval', ts('Duration'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'duration_interval'));
     $this->add('Select', 'frequency_unit', ts('Frequency Unit'), array('' => '- select period -') + CRM_Core_SelectValues::getPremiumUnits());
     $this->add('text', 'frequency_interval', ts('Frequency'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'frequency_interval'));
     //Financial Type CRM-11106
     $financialType = CRM_Contribute_PseudoConstant::financialType();
     $premiumFinancialType = array();
     CRM_Core_PseudoConstant::populate($premiumFinancialType, 'CRM_Financial_DAO_EntityFinancialAccount', $all = TRUE, $retrieve = 'entity_id', $filter = NULL, 'account_relationship = 8');
     $costFinancialType = array();
     CRM_Core_PseudoConstant::populate($costFinancialType, 'CRM_Financial_DAO_EntityFinancialAccount', $all = TRUE, $retrieve = 'entity_id', $filter = NULL, 'account_relationship = 7');
     $productFinancialType = array_intersect($costFinancialType, $premiumFinancialType);
     foreach ($financialType as $key => $financialTypeName) {
         if (!in_array($key, $productFinancialType)) {
             unset($financialType[$key]);
         }
     }
     if (count($financialType)) {
         $this->assign('financialType', $financialType);
     }
     $this->add('select', 'financial_type_id', ts('Financial Type'), array('' => ts('- select -')) + $financialType);
     $this->add('checkbox', 'is_active', ts('Enabled?'));
     $this->addFormRule(array('CRM_Contribute_Form_ManagePremiums', 'formRule'));
     $this->addButtons(array(array('type' => 'upload', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
     $this->assign('productId', $this->_id);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:62,代码来源:ManagePremiums.php

示例12: array

 /**
  * Get all the membership statuss
  *
  * @access public
  * @return array - array reference of all membership statuss if any
  * @static
  */
 public static function &membershipStatus($id = null, $cond = null)
 {
     if (self::$membershipStatus === null) {
         self::$membershipStatus = array();
     }
     $index = $cond ? $cond : 'No Condition';
     if (!CRM_Utils_Array::value($index, self::$membershipStatus)) {
         CRM_Core_PseudoConstant::populate(self::$membershipStatus[$index], 'CRM_Member_DAO_MembershipStatus', false, 'name', 'is_active', $cond, 'weight');
     }
     if ($id) {
         if (array_key_exists($id, self::$membershipStatus[$index])) {
             return self::$membershipStatus[$index][$id];
         } else {
             return null;
         }
     }
     return self::$membershipStatus[$index];
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:25,代码来源:PseudoConstant.php

示例13:

 /**
  * Get all the completed mailing
  *
  * @access public
  * @return array - array reference of all mailing templates if any
  * @static
  */
 public static function &completed()
 {
     if (!self::$completed) {
         require_once 'CRM/Mailing/BAO/Mailing.php';
         $mailingACL = CRM_Mailing_BAO_Mailing::mailingACL();
         CRM_Core_PseudoConstant::populate(self::$completed, 'CRM_Mailing_DAO_Mailing', false, 'name', 'is_completed', $mailingACL);
     }
     return self::$completed;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:16,代码来源:PseudoConstant.php

示例14:

 /**
  * Get all the user framework groups
  *
  * @access public
  * @return array - array reference of all groups.
  * @static
  */
 function &ufGroup()
 {
     if (!$GLOBALS['_CRM_CORE_PSEUDOCONSTANT']['ufGroup']) {
         CRM_Core_PseudoConstant::populate($GLOBALS['_CRM_CORE_PSEUDOCONSTANT']['ufGroup'], 'CRM_Core_DAO_UFGroup', false, 'title', 'is_active', null, 'title');
     }
     return $GLOBALS['_CRM_CORE_PSEUDOCONSTANT']['ufGroup'];
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:14,代码来源:PseudoConstant.php

示例15:

 /**
  * Get all the Personal campaign pages
  *
  * @access public
  * @return array - array reference of all pcp if any
  * @static
  */
 public static function &pcPage($id = null)
 {
     if (!self::$pcPage) {
         CRM_Core_PseudoConstant::populate(self::$pcPage, 'CRM_Contribute_DAO_PCP', false, 'title');
     }
     if ($id) {
         return CRM_Utils_Array::value($id, self::$pcPage);
     }
     return self::$pcPage;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:17,代码来源:PseudoConstant.php


注:本文中的CRM_Core_PseudoConstant::populate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。