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


PHP CRM_Core_PseudoConstant类代码示例

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


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

示例1: buildQuickForm

 /**
  * Build the form
  *
  * @access public
  * @return void
  */
 function buildQuickForm()
 {
     // add select for tag
     $this->_tags = array('' => ' - select tag - ') + CRM_Core_PseudoConstant::tag();
     $this->add('select', 'tag_id', ts('Select Tag'), $this->_tags, true);
     $this->addDefaultButtons(ts('Tag Contacts'));
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:13,代码来源:AddToTag.php

示例2: browse

 /**
  * Browse all mail settings.
  *
  * @return void
  */
 public function browse()
 {
     //get all mail settings.
     $allMailSettings = array();
     $mailSetting = new CRM_Core_DAO_MailSettings();
     $allProtocols = CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol');
     //multi-domain support for mail settings. CRM-5244
     $mailSetting->domain_id = CRM_Core_Config::domainID();
     //find all mail settings.
     $mailSetting->find();
     while ($mailSetting->fetch()) {
         //replace protocol value with name
         $mailSetting->protocol = CRM_Utils_Array::value($mailSetting->protocol, $allProtocols);
         CRM_Core_DAO::storeValues($mailSetting, $allMailSettings[$mailSetting->id]);
         //form all action links
         $action = array_sum(array_keys($this->links()));
         // disallow the DELETE action for the default set of settings
         if ($mailSetting->is_default) {
             $action &= ~CRM_Core_Action::DELETE;
         }
         //add action links.
         $allMailSettings[$mailSetting->id]['action'] = CRM_Core_Action::formLink(self::links(), $action, array('id' => $mailSetting->id), ts('more'), FALSE, 'mailSetting.manage.action', 'MailSetting', $mailSetting->id);
     }
     $this->assign('rows', $allMailSettings);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:30,代码来源:MailSettings.php

示例3: __construct

 /**
  */
 public function __construct()
 {
     $this->_autoIncludeIndexedFieldsAsOrderBys = 1;
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array_merge(array('sort_name_linked' => array('title' => ts('Participant Name'), 'required' => TRUE, 'no_repeat' => TRUE, 'dbAlias' => 'contact_civireport.sort_name')), $this->getBasicContactFields(), array('age_at_event' => array('title' => ts('Age at Event'), 'dbAlias' => 'TIMESTAMPDIFF(YEAR, contact_civireport.birth_date, event_civireport.start_date)'))), 'grouping' => 'contact-fields', 'order_bys' => array('sort_name' => array('title' => ts('Last Name, First Name'), 'default' => '1', 'default_weight' => '0', 'default_order' => 'ASC'), 'first_name' => array('name' => 'first_name', 'title' => ts('First Name')), 'gender_id' => array('name' => 'gender_id', 'title' => ts('Gender')), 'birth_date' => array('name' => 'birth_date', 'title' => ts('Birth Date')), 'age_at_event' => array('name' => 'age_at_event', 'title' => ts('Age at Event')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype'))), 'filters' => array('sort_name' => array('title' => ts('Participant Name'), 'operator' => 'like'), 'gender_id' => array('title' => ts('Gender'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id')), 'birth_date' => array('title' => ts('Birth Date'), 'operatorType' => CRM_Report_Form::OP_DATE), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact Subtype')))), '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'))));
     $this->_columns += $this->getAddressColumns();
     $this->_columns += array('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), 'fee_currency' => array('required' => TRUE, 'no_display' => TRUE), 'registered_by_id' => array('title' => ts('Registered by Participant ID')), 'source' => array('title' => ts('Source')), 'participant_fee_level' => NULL, 'participant_fee_amount' => array('title' => ts('Participant Fee')), 'participant_register_date' => array('title' => ts('Registration Date')), 'total_paid' => array('title' => ts('Total Paid'), 'dbAlias' => 'SUM(ft.total_amount)', 'type' => 1024), 'balance' => array('title' => ts('Balance'), 'dbAlias' => 'participant_civireport.fee_amount - SUM(ft.total_amount)', 'type' => 1024)), 'grouping' => 'event-fields', 'filters' => array('event_id' => array('name' => 'event_id', 'title' => ts('Event'), 'operatorType' => CRM_Report_Form::OP_ENTITYREF, 'type' => CRM_Utils_Type::T_INT, 'attributes' => array('entity' => 'event', 'select' => array('minimumInputLength' => 0))), 'sid' => array('name' => 'status_id', 'title' => ts('Participant Status'), 'type' => CRM_Utils_Type::T_INT, '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), 'fee_currency' => array('title' => ts('Fee Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'registered_by_id' => array('title' => ts('Registered by Participant ID'), 'type' => CRM_Utils_Type::T_STRING, 'operator' => 'like'), 'source' => array('title' => ts('Source'), 'type' => CRM_Utils_Type::T_STRING, 'operator' => 'like')), 'order_bys' => array('participant_register_date' => array('title' => ts('Registration Date'), 'default_weight' => '1', 'default_order' => 'ASC'), 'event_id' => array('title' => ts('Event'), 'default_weight' => '1', 'default_order' => 'ASC'))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE, 'no_repeat' => TRUE)), 'grouping' => 'contact-fields'), 'civicrm_event' => array('dao' => 'CRM_Event_DAO_Event', 'fields' => array('event_type_id' => array('title' => ts('Event Type')), 'event_start_date' => array('title' => ts('Event Start Date'))), 'grouping' => 'event-fields', 'filters' => array('eid' => array('name' => 'event_type_id', 'title' => ts('Event Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('event_type')), 'event_start_date' => array('title' => ts('Event Start Date'), 'operatorType' => CRM_Report_Form::OP_DATE)), 'order_bys' => array('event_type_id' => array('title' => ts('Event Type'), 'default_weight' => '2', 'default_order' => 'ASC'), 'event_start_date' => array('title' => ts('Event Start Date')))), 'civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contribution_id' => array('name' => 'id', 'no_display' => TRUE, 'required' => TRUE, 'csv_display' => TRUE, 'title' => ts('Contribution ID')), 'financial_type_id' => array('title' => ts('Financial Type')), 'receive_date' => array('title' => ts('Payment Date')), 'contribution_status_id' => array('title' => ts('Contribution Status')), 'payment_instrument_id' => array('title' => ts('Payment Type')), 'contribution_source' => array('name' => 'source', 'title' => ts('Contribution Source')), 'currency' => array('required' => TRUE, 'no_display' => TRUE), 'trxn_id' => NULL, 'fee_amount' => array('title' => ts('Transaction Fee')), 'net_amount' => NULL), 'grouping' => 'contrib-fields', 'filters' => array('receive_date' => array('title' => 'Payment Date', 'operatorType' => CRM_Report_Form::OP_DATE), 'financial_type_id' => array('title' => ts('Financial Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'currency' => array('title' => ts('Contribution Currency'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Core_OptionGroup::values('currencies_enabled'), 'default' => NULL, 'type' => CRM_Utils_Type::T_STRING), 'payment_instrument_id' => array('title' => ts('Payment Type'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::paymentInstrument()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => NULL))), 'civicrm_line_item' => array('dao' => 'CRM_Price_DAO_LineItem', 'grouping' => 'priceset-fields', 'filters' => array('price_field_value_id' => array('name' => 'price_field_value_id', 'title' => ts('Fee Level'), 'type' => CRM_Utils_Type::T_INT, 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->getPriceLevels()))));
     $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'))));
     // CRM-17115 avoid duplication of sort_name - would be better to standardise name
     // & behaviour across reports but trying for no change at this point.
     $this->_columns['civicrm_contact']['fields']['sort_name']['no_display'] = TRUE;
     // If we have active campaigns add those elements to both the fields and filters
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_participant']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_participant']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns, 'type' => CRM_Utils_Type::T_INT);
         $this->_columns['civicrm_participant']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
     }
     $this->_currencyColumn = 'civicrm_participant_fee_currency';
     parent::__construct();
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:29,代码来源:ParticipantListing.php

示例4: getStore

 /**
  * Return the proper mail store implementation, based on config settings
  *
  * @param  string $name  name of the settings set from civimail_mail_settings to use (null for default)
  * @return object        mail store implementation for processing CiviMail-bound emails
  */
 function getStore($name = null)
 {
     $dao = new CRM_Core_DAO_MailSettings();
     $dao->domain_id = CRM_Core_Config::domainID();
     $name ? $dao->name = $name : ($dao->is_default = 1);
     if (!$dao->find(true)) {
         throw new Exception("Could not find entry named {$name} in civicrm_mail_settings");
     }
     $protocols =& CRM_Core_PseudoConstant::mailProtocol();
     switch ($protocols[$dao->protocol]) {
         case 'IMAP':
             require_once 'CRM/Mailing/MailStore/Imap.php';
             return new CRM_Mailing_MailStore_Imap($dao->server, $dao->username, $dao->password, (bool) $dao->is_ssl, $dao->source);
         case 'POP3':
             require_once 'CRM/Mailing/MailStore/Pop3.php';
             return new CRM_Mailing_MailStore_Pop3($dao->server, $dao->username, $dao->password, (bool) $dao->is_ssl);
         case 'Maildir':
             require_once 'CRM/Mailing/MailStore/Maildir.php';
             return new CRM_Mailing_MailStore_Maildir($dao->source);
         case 'Localdir':
             require_once 'CRM/Mailing/MailStore/Localdir.php';
             return new CRM_Mailing_MailStore_Localdir($dao->source);
             // DO NOT USE the mbox transport for anything other than testing
             // in particular, it does not clear the mbox afterwards
         // DO NOT USE the mbox transport for anything other than testing
         // in particular, it does not clear the mbox afterwards
         case 'mbox':
             require_once 'CRM/Mailing/MailStore/Mbox.php';
             return new CRM_Mailing_MailStore_Mbox($dao->source);
         default:
             throw new Exception("Unknown protocol {$dao->protocol}");
     }
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:39,代码来源:MailStore.php

示例5: buildForm

 function buildForm(&$form)
 {
     $this->setTitle(ts('Include / Exclude Search'));
     $groups = CRM_Core_PseudoConstant::group();
     $tags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
     if (count($groups) == 0 || count($tags) == 0) {
         CRM_Core_Session::setStatus(ts("At least one Group and Tag must be present for Custom Group / Tag search."), ts('Missing Group/Tag'));
         $url = CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1');
         CRM_Utils_System::redirect($url);
     }
     $inG =& $form->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $outG =& $form->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $andOr = array('1' => ts('Show contacts that meet the Groups criteria AND the Tags criteria'), '0' => ts('Show contacts that meet the Groups criteria OR  the Tags criteria'));
     $form->addRadio('andOr', ts('AND/OR'), $andOr, NULL, '<br />', TRUE);
     $int =& $form->addElement('advmultiselect', 'includeTags', ts('Include Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     $outt =& $form->addElement('advmultiselect', 'excludeTags', ts('Exclude Tag(s)') . ' ', $tags, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
     //add/remove buttons for groups
     $inG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outG->setButtonAttributes('add', array('value' => ts('Add >>')));
     $inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     //add/remove buttons for tags
     $int->setButtonAttributes('add', array('value' => ts('Add >>')));
     $outt->setButtonAttributes('add', array('value' => ts('Add >>')));
     $int->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     $outt->setButtonAttributes('remove', array('value' => ts('<< Remove')));
     /**
      * if you are using the standard template, this array tells the template what elements
      * are part of the search criteria
      */
     $form->assign('elements', array('includeGroups', 'excludeGroups', 'andOr', 'includeTags', 'excludeTags'));
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:32,代码来源:Group.php

示例6: basicXmlTestCases

 /**
  * Generate a list of basic XML test cases. Each test case creates a
  * custom-group and custom-field then compares the output to a pre-defined
  * XML file. Then, for each test-case, we reverse the process -- we
  * load the XML into a clean DB and see if it creates matching custom-group
  * and custom-field.
  */
 function basicXmlTestCases()
 {
     // a small library which we use to describe test cases
     $fixtures = array();
     $fixtures['textField'] = array('name' => 'test_textfield', 'label' => 'Name1', 'html_type' => 'Text', 'data_type' => 'String', 'default_value' => 'abc', 'weight' => 4, 'is_required' => 1, 'is_searchable' => 0, 'is_active' => 1);
     $fixtures['selectField'] = array('label' => 'Our select field', 'html_type' => 'Select', 'data_type' => 'String', 'weight' => 4, 'is_required' => 1, 'is_searchable' => 0, 'is_active' => 1, 'option_values' => array(array('weight' => 1, 'label' => 'Label1', 'value' => 1, 'is_active' => 1), array('weight' => 2, 'label' => 'Label2', 'value' => 2, 'is_active' => 1)));
     // the actual test cases
     $cases = array();
     $cases[] = array(array('extends' => 'Contact', 'title' => 'example'), $fixtures['textField'], __DIR__ . '/fixtures/Contact-text.xml');
     /*
     $cases[] = array(
       // CustomGroup params
       array(
         'extends' => 'Contact',
         'title' => 'example',
       ),
       // CustomField params
       $fixtures['selectField'],
       // expectedXmlFilePath
       __DIR__ . '/fixtures/Contact-select.xml',
     );
     */
     $cases[] = array(array('extends' => 'Individual', 'title' => 'example'), $fixtures['textField'], __DIR__ . '/fixtures/Individual-text.xml');
     $cases[] = array(array('extends' => 'Individual', 'extends_entity_column_value' => array('Student'), 'title' => 'example'), $fixtures['textField'], __DIR__ . '/fixtures/IndividualStudent-text.xml');
     $cases[] = array(array('extends' => 'Activity', 'title' => 'example'), $fixtures['textField'], __DIR__ . '/fixtures/Activity-text.xml');
     $cases[] = array(array('extends' => 'Activity', 'extends_entity_column_value' => array(array_search('Meeting', CRM_Core_PseudoConstant::activityType())), 'title' => 'example'), $fixtures['textField'], __DIR__ . '/fixtures/ActivityMeeting-text.xml');
     return $cases;
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:35,代码来源:ImportExportTest.php

示例7: __construct

 function __construct()
 {
     $yearsInPast = 10;
     $yearsInFuture = 1;
     $date = CRM_Core_SelectValues::date('custom', NULL, $yearsInPast, $yearsInFuture);
     $count = $date['maxYear'];
     while ($date['minYear'] <= $count) {
         $optionYear[$date['minYear']] = $date['minYear'];
         $date['minYear']++;
     }
     // Check if CiviCampaign is a) enabled and b) has active campaigns
     $config = CRM_Core_Config::singleton();
     $campaignEnabled = in_array("CiviCampaign", $config->enableComponents);
     if ($campaignEnabled) {
         $getCampaigns = CRM_Campaign_BAO_Campaign::getPermissionedCampaigns(NULL, NULL, TRUE, FALSE, TRUE);
         $this->activeCampaigns = $getCampaigns['campaigns'];
         asort($this->activeCampaigns);
     }
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'grouping' => 'contact-field', 'fields' => array('sort_name' => array('title' => ts('Donor Name'), 'required' => TRUE), 'first_name' => array('title' => ts('First Name')), 'last_name' => array('title' => ts('Last Name')), 'contact_type' => array('title' => ts('Contact Type')), 'contact_sub_type' => array('title' => ts('Contact SubType'))), 'filters' => array('sort_name' => array('title' => ts('Donor Name'), 'operator' => 'like'))), 'civicrm_email' => array('dao' => 'CRM_Core_DAO_Email', 'grouping' => 'contact-field', 'fields' => array('email' => array('title' => ts('Email'), 'default' => TRUE))), 'civicrm_phone' => array('dao' => 'CRM_Core_DAO_Phone', 'grouping' => 'contact-field', 'fields' => array('phone' => array('title' => ts('Phone'), 'default' => TRUE)))) + $this->addAddressFields() + array('civicrm_contribution' => array('dao' => 'CRM_Contribute_DAO_Contribution', 'fields' => array('contact_id' => array('title' => ts('contactId'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'total_amount' => array('title' => ts('Total Amount'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE), 'receive_date' => array('title' => ts('Year'), 'no_display' => TRUE, 'required' => TRUE, 'no_repeat' => TRUE)), 'filters' => array('yid' => array('name' => 'receive_date', 'title' => ts('This Year'), 'operatorType' => CRM_Report_Form::OP_SELECT, 'options' => $optionYear, 'default' => date('Y')), 'financial_type_id' => array('title' => ts('Financial Type'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::financialType()), 'contribution_status_id' => array('title' => ts('Contribution Status'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => CRM_Contribute_PseudoConstant::contributionStatus(), 'default' => array('1')))), 'civicrm_group' => array('dao' => 'CRM_Contact_DAO_GroupContact', 'alias' => 'cgroup', 'filters' => array('gid' => array('name' => 'group_id', 'title' => ts('Group'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'group' => TRUE, 'options' => CRM_Core_PseudoConstant::group()))));
     // If we have a campaign, build out the relevant elements
     if ($campaignEnabled && !empty($this->activeCampaigns)) {
         $this->_columns['civicrm_contribution']['fields']['campaign_id'] = array('title' => ts('Campaign'), 'default' => 'false');
         $this->_columns['civicrm_contribution']['filters']['campaign_id'] = array('title' => ts('Campaign'), 'operatorType' => CRM_Report_Form::OP_MULTISELECT, 'options' => $this->activeCampaigns);
     }
     $this->_tagFilter = TRUE;
     parent::__construct();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:27,代码来源:Sybunt.php

示例8: evaluateToken

 /**
  * Evaluate the content of a single token.
  *
  * @param \Civi\Token\TokenRow $row
  *   The record for which we want token values.
  * @param string $field
  *   The name of the token field.
  * @param mixed $prefetch
  *   Any data that was returned by the prefetch().
  * @return mixed
  */
 public function evaluateToken(\Civi\Token\TokenRow $row, $entity, $field, $prefetch = NULL)
 {
     $actionSearchResult = $row->context['actionSearchResult'];
     if ($field == 'location') {
         $loc = array();
         $stateProvince = \CRM_Core_PseudoConstant::stateProvince();
         $loc['street_address'] = $actionSearchResult->street_address;
         $loc['city'] = $actionSearchResult->city;
         $loc['state_province'] = \CRM_Utils_Array::value($actionSearchResult->state_province_id, $stateProvince);
         $loc['postal_code'] = $actionSearchResult->postal_code;
         //$entityTokenParams[$tokenEntity][$field] = \CRM_Utils_Address::format($loc);
         $row->tokens($entity, $field, \CRM_Utils_Address::format($loc));
     } elseif ($field == 'info_url') {
         $row->tokens($entity, $field, \CRM_Utils_System::url('civicrm/event/info', 'reset=1&id=' . $actionSearchResult->event_id, TRUE, NULL, FALSE));
     } elseif ($field == 'registration_url') {
         $row->tokens($entity, $field, \CRM_Utils_System::url('civicrm/event/register', 'reset=1&id=' . $actionSearchResult->event_id, TRUE, NULL, FALSE));
     } elseif (in_array($field, array('start_date', 'end_date'))) {
         $row->tokens($entity, $field, \CRM_Utils_Date::customFormat($actionSearchResult->{$field}));
     } elseif ($field == 'balance') {
         if ($actionSearchResult->entityTable == 'civicrm_contact') {
             $balancePay = 'N/A';
         } elseif (!empty($actionSearchResult->entityID)) {
             $info = \CRM_Contribute_BAO_Contribution::getPaymentInfo($actionSearchResult->entityID, 'event');
             $balancePay = \CRM_Utils_Array::value('balance', $info);
             $balancePay = \CRM_Utils_Money::format($balancePay);
         }
         $row->tokens($entity, $field, $balancePay);
     } elseif ($field == 'fee_amount') {
         $row->tokens($entity, $field, \CRM_Utils_Money::format($actionSearchResult->{$field}));
     } elseif (isset($actionSearchResult->{$field})) {
         $row->tokens($entity, $field, $actionSearchResult->{$field});
     } else {
         $row->tokens($entity, $field, '');
     }
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:46,代码来源:Tokens.php

示例9: civicrm_api3_domain_get

/**
 * Get CiviCRM domain details
 * {@getfields domain_create}
 * @example DomainGet.php
 */
function civicrm_api3_domain_get($params)
{
    $params['version'] = CRM_Utils_Array::value('domain_version', $params);
    unset($params['version']);
    $bao = new CRM_Core_BAO_Domain();
    if (CRM_Utils_Array::value('current_domain', $params)) {
        $domainBAO = CRM_Core_Config::domainID();
        $params['id'] = $domainBAO;
    }
    _civicrm_api3_dao_set_filter($bao, $params, true, 'domain');
    $domains = _civicrm_api3_dao_to_array($bao, $params, true, 'domain');
    foreach ($domains as $domain) {
        if (!empty($domain['contact_id'])) {
            $values = array();
            $locparams = array('contact_id' => $domain['contact_id']);
            $values['location'] = CRM_Core_BAO_Location::getValues($locparams, TRUE);
            $address_array = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'state_province_id', 'postal_code', 'country_id', 'geo_code_1', 'geo_code_2');
            if (!empty($values['location']['email'])) {
                $domain['domain_email'] = CRM_Utils_Array::value('email', $values['location']['email'][1]);
            }
            if (!empty($values['location']['phone'])) {
                $domain['domain_phone'] = array('phone_type' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Phone', 'phone_type_id', CRM_Utils_Array::value('phone_type_id', $values['location']['phone'][1])), 'phone' => CRM_Utils_Array::value('phone', $values['location']['phone'][1]));
            }
            if (!empty($values['location']['address'])) {
                foreach ($address_array as $value) {
                    $domain['domain_address'][$value] = CRM_Utils_Array::value($value, $values['location']['address'][1]);
                }
            }
            list($domain['from_name'], $domain['from_email']) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE);
            $domains[$domain['id']] = array_merge($domains[$domain['id']], $domain);
        }
    }
    return civicrm_api3_create_success($domains, $params, 'domain', 'get', $bao);
}
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:39,代码来源:Domain.php

示例10: __construct

 function __construct()
 {
     $this->activityTypes = CRM_Core_PseudoConstant::activityType(true, true);
     asort($this->activityTypes);
     $this->_columns = array('civicrm_contact' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('display_name' => array('title' => ts('Modified By'), 'required' => true), 'id' => array('no_display' => true, 'required' => true)), 'filters' => array('sort_name' => array('title' => ts('Modified By'))), 'grouping' => 'contact-fields'), 'civicrm_contact_touched' => array('dao' => 'CRM_Contact_DAO_Contact', 'fields' => array('display_name_touched' => array('title' => ts('Touched Contact'), 'name' => 'display_name', 'required' => true), 'id' => array('no_display' => true, 'required' => true)), 'filters' => array('sort_name_touched' => array('title' => ts('Touched Contact'), 'name' => 'sort_name')), 'grouping' => 'contact-fields'), 'civicrm_activity' => array('dao' => 'CRM_Activity_DAO_Activity', 'fields' => array('id' => array('title' => ts('Activity'), 'no_display' => true, 'required' => true), 'subject' => array('title' => ts('Touched Activity'), 'required' => true), 'activity_type_id' => array('title' => ts('Activity Type'), 'required' => true), 'source_contact_id' => array('no_display' => true, 'required' => true))), 'civicrm_log' => array('dao' => 'CRM_Core_DAO_Log', 'fields' => array('modified_date' => array('title' => ts('Modified Date'), 'required' => true), 'data' => array('title' => ts('Description'))), 'filters' => array('modified_date' => array('title' => ts('Modified Date'), 'operatorType' => CRM_Report_Form::OP_DATE, 'type' => CRM_Utils_Type::T_DATE, 'default' => 'this.week'))));
     parent::__construct();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:7,代码来源:RecentChanges.php

示例11: array

 /**
  * Get all groups from database, filtered by permissions
  * for this user
  *
  * @param string $groupType     type of group(Access/Mailing)
  * @param boolen $excludeHidden exclude hidden groups.
  *
  * @access public
  * @static
  *
  * @return array - array reference of all groups.
  *
  */
 public static function &group($groupType = NULL, $excludeHidden = TRUE)
 {
     if (!isset(self::$_viewPermissionedGroups)) {
         self::$_viewPermissionedGroups = self::$_editPermissionedGroups = array();
         $groups =& CRM_Core_PseudoConstant::allGroup($groupType, $excludeHidden);
         if (self::check('edit all contacts')) {
             // this is the most powerful permission, so we return
             // immediately rather than dilute it further
             self::$_editAdminUser = self::$_viewAdminUser = TRUE;
             self::$_editPermission = self::$_viewPermission = TRUE;
             self::$_editPermissionedGroups = $groups;
             self::$_viewPermissionedGroups = $groups;
             return self::$_viewPermissionedGroups;
         } elseif (self::check('view all contacts')) {
             self::$_viewAdminUser = TRUE;
             self::$_viewPermission = TRUE;
             self::$_viewPermissionedGroups = $groups;
         }
         $ids = CRM_ACL_API::group(CRM_Core_Permission::VIEW, NULL, 'civicrm_saved_search', $groups);
         foreach (array_values($ids) as $id) {
             $title = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $id, 'title');
             self::$_viewPermissionedGroups[$id] = $title;
             self::$_viewPermission = TRUE;
         }
         $ids = CRM_ACL_API::group(CRM_Core_Permission::EDIT, NULL, 'civicrm_saved_search', $groups);
         foreach (array_values($ids) as $id) {
             $title = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $id, 'title');
             self::$_editPermissionedGroups[$id] = $title;
             self::$_viewPermissionedGroups[$id] = $title;
             self::$_editPermission = TRUE;
             self::$_viewPermission = TRUE;
         }
     }
     return self::$_viewPermissionedGroups;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:48,代码来源:Drupal6.php

示例12: onCaseChange

 /**
  * @param \Civi\CCase\Event\CaseChangeEvent $event
  *
  * @throws \CiviCRM_API3_Exception
  */
 public function onCaseChange(\Civi\CCase\Event\CaseChangeEvent $event)
 {
     /** @var \Civi\CCase\Analyzer $analyzer */
     $analyzer = $event->analyzer;
     $activitySetXML = $this->getSequenceXml($analyzer->getXml());
     if (!$activitySetXML) {
         return;
     }
     $actTypes = array_flip(\CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'name'));
     $actStatuses = array_flip(\CRM_Core_PseudoConstant::activityStatus('name'));
     $actIndex = $analyzer->getActivityIndex(array('activity_type_id', 'status_id'));
     foreach ($activitySetXML->ActivityTypes->ActivityType as $actTypeXML) {
         $actTypeId = $actTypes[(string) $actTypeXML->name];
         if (empty($actIndex[$actTypeId])) {
             // Haven't tried this step yet!
             $this->createActivity($analyzer, $actTypeXML);
             return;
         } elseif (empty($actIndex[$actTypeId][$actStatuses['Completed']])) {
             // Haven't gotten past this step yet!
             return;
         }
     }
     // OK, the activity has completed every step in the sequence!
     civicrm_api3('Case', 'create', array('id' => $analyzer->getCaseId(), 'status_id' => 'Closed'));
     $analyzer->flush();
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:31,代码来源:SequenceListener.php

示例13: browse

 function browse()
 {
     CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
     $campaigns = CRM_Campaign_BAO_Campaign::getCampaignSummary();
     if (!empty($campaigns)) {
         $campaignType = CRM_Core_PseudoConstant::campaignType();
         $campaignStatus = CRM_Core_PseudoConstant::campaignStatus();
         foreach ($campaigns as $cmpid => $campaign) {
             $campaigns[$cmpid]['campaign_id'] = $campaign['id'];
             $campaigns[$cmpid]['title'] = $campaign['title'];
             $campaigns[$cmpid]['name'] = $campaign['name'];
             $campaigns[$cmpid]['description'] = $campaign['description'];
             $campaigns[$cmpid]['campaign_type_id'] = $campaignType[$campaign['campaign_type_id']];
             $campaigns[$cmpid]['status_id'] = $campaignStatus[$campaign['status_id']];
             $action = array_sum(array_keys($this->actionLinks()));
             if ($campaign['is_active']) {
                 $action -= CRM_Core_Action::ENABLE;
             } else {
                 $action -= CRM_Core_Action::DISABLE;
             }
             $campaigns[$cmpid]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $campaign['id']), ts('more'), FALSE, 'campaign.selector.row', 'Campaign', $campaign['id']);
         }
     }
     $this->assign('campaigns', $campaigns);
     $this->assign('addCampaignUrl', CRM_Utils_System::url('civicrm/campaign/add', 'reset=1&action=add'));
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:26,代码来源:Campaign.php

示例14: getStore

 /**
  * Return the proper mail store implementation, based on config settings
  *
  * @param string $name
  *   Name of the settings set from civimail_mail_settings to use (null for default).
  *
  * @throws Exception
  * @return object
  *   mail store implementation for processing CiviMail-bound emails
  */
 public static function getStore($name = NULL)
 {
     $dao = new CRM_Core_DAO_MailSettings();
     $dao->domain_id = CRM_Core_Config::domainID();
     $name ? $dao->name = $name : ($dao->is_default = 1);
     if (!$dao->find(TRUE)) {
         throw new Exception("Could not find entry named {$name} in civicrm_mail_settings");
     }
     $protocols = CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol');
     if (empty($protocols[$dao->protocol])) {
         throw new Exception("Empty mail protocol");
     }
     switch ($protocols[$dao->protocol]) {
         case 'IMAP':
             return new CRM_Mailing_MailStore_Imap($dao->server, $dao->username, $dao->password, (bool) $dao->is_ssl, $dao->source);
         case 'POP3':
             return new CRM_Mailing_MailStore_Pop3($dao->server, $dao->username, $dao->password, (bool) $dao->is_ssl);
         case 'Maildir':
             return new CRM_Mailing_MailStore_Maildir($dao->source);
         case 'Localdir':
             return new CRM_Mailing_MailStore_Localdir($dao->source);
             // DO NOT USE the mbox transport for anything other than testing
             // in particular, it does not clear the mbox afterwards
         // DO NOT USE the mbox transport for anything other than testing
         // in particular, it does not clear the mbox afterwards
         case 'mbox':
             return new CRM_Mailing_MailStore_Mbox($dao->source);
         default:
             throw new Exception("Unknown protocol {$dao->protocol}");
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:41,代码来源:MailStore.php

示例15: setUp

 public function setUp()
 {
     $this->_apiversion = 3;
     CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name');
     parent::setUp();
     $this->useTransaction(TRUE);
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:7,代码来源:ActivityTypeTest.php


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