• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_Core_BAO_UFGroup类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: buildQuickForm

 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Settings - Search Preferences'));
     // @todo remove the following adds in favour of setting via the settings array (above).
     $this->addYesNo('includeWildCardInName', ts('Automatic Wildcard'));
     $this->addYesNo('includeEmailInName', ts('Include Email'));
     $this->addYesNo('includeNickNameInName', ts('Include Nickname'));
     $this->addYesNo('includeAlphabeticalPager', ts('Include Alphabetical Pager'));
     $this->addYesNo('includeOrderByClause', ts('Include Order By Clause'));
     $this->addElement('text', 'smartGroupCacheTimeout', ts('Smart group cache timeout'), array('size' => 3, 'maxlength' => 5));
     $types = array('Contact', 'Individual', 'Organization', 'Household');
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
     $this->add('select', 'defaultSearchProfileID', ts('Default Contact Search Profile'), array('' => ts('- none -')) + $profiles, FALSE, array('class' => 'crm-select2 huge'));
     // Autocomplete for Contact Search (quick search etc.)
     $options = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', FALSE, FALSE, TRUE));
     $this->addCheckBox('autocompleteContactSearch', ts('Autocomplete Contact Search'), $options, NULL, NULL, NULL, NULL, array('  '));
     $element = $this->getElement('autocompleteContactSearch');
     $element->_elements[0]->_flagFrozen = TRUE;
     // Autocomplete for Contact Reference (custom fields)
     $optionsCR = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_reference_options', FALSE, FALSE, TRUE));
     $this->addCheckBox('autocompleteContactReference', ts('Contact Reference Options'), $optionsCR, NULL, NULL, NULL, NULL, array('  '));
     $element = $this->getElement('autocompleteContactReference');
     $element->_elements[0]->_flagFrozen = TRUE;
     parent::buildQuickForm();
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:28,代码来源:Search.php


示例2: preProcess

 /**
  * Pre processing work done here.
  *
  * gets session variables for group or field id
  *
  * @param
  *
  * @return void
  */
 public function preProcess()
 {
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         // CRM_Core_Controller validates qfKey for POST requests, but not necessarily
         // for GET requests. Allowing GET would therefore be CSRF vulnerability.
         CRM_Core_Error::fatal(ts('Preview only supports HTTP POST'));
     }
     // Inline forms don't get menu-level permission checks
     $checkPermission = array(array('administer CiviCRM', 'manage event profiles'));
     if (!CRM_Core_Permission::check($checkPermission)) {
         CRM_Core_Error::fatal(ts('Permission Denied'));
     }
     $content = json_decode($_REQUEST['ufData'], TRUE);
     foreach (array('ufGroup', 'ufFieldCollection') as $key) {
         if (!is_array($content[$key])) {
             CRM_Core_Error::fatal("Missing JSON parameter, {$key}");
         }
     }
     //echo '<pre>'.htmlentities(var_export($content, TRUE)) .'</pre>';
     //CRM_Utils_System::civiExit();
     $fields = CRM_Core_BAO_UFGroup::formatUFFields($content['ufGroup'], $content['ufFieldCollection']);
     //$fields = CRM_Core_BAO_UFGroup::getFields(1);
     $this->setProfile($fields);
     //echo '<pre>'.htmlentities(var_export($fields, TRUE)) .'</pre>';CRM_Utils_System::civiExit();
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:34,代码来源:Preview.php


示例3: preProcess

 /**
  * Heart of the viewing process. The runner gets all the meta data for
  * the contact and calls the appropriate type of page to view.
  *
  * @return void
  * @access public
  *
  */
 function preProcess()
 {
     $id = CRM_Utils_Request::retrieve('cid', $this, true);
     $gid = CRM_Utils_Request::retrieve('gid', $this);
     if ($gid) {
         require_once 'CRM/Profile/Page/Dynamic.php';
         $page =& new CRM_Profile_Page_Dynamic($id, $gid);
         $profileGroup = array();
         $profileGroup['title'] = $title;
         $profileGroup['content'] = $page->run();
         $profileGroups[] = $profileGroup;
     } else {
         $ufGroups =& CRM_Core_BAO_UFGroup::getModuleUFGroup('Profile');
         $profileGroups = array();
         foreach ($ufGroups as $groupid => $group) {
             require_once 'CRM/Profile/Page/Dynamic.php';
             $page =& new CRM_Profile_Page_Dynamic($id, $groupid);
             $profileGroup = array();
             $profileGroup['title'] = $group['title'];
             $profileGroup['content'] = $page->run();
             $profileGroups[] = $profileGroup;
         }
     }
     $this->assign('profileGroups', $profileGroups);
     $this->assign('recentlyViewed', false);
     CRM_Utils_System::setTitle(ts('Contact\'s Profile'));
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:35,代码来源:View.php


示例4: civicrm_api3_uf_group_create

/**
 * Use this API to create a new group. See the CRM Data Model for uf_group property definitions
 *
 * @param $params  array   Associative array of property name/value pairs to insert in group.
 *
 * @return   Newly create $ufGroupArray array
 * {@getfields UFGroup_create}
 * @example UFGroupCreate.php
 * @access public
 */
function civicrm_api3_uf_group_create($params)
{
    $ids = array();
    $ids['ufgroup'] = $params['id'];
    $ufGroup = CRM_Core_BAO_UFGroup::add($params, $ids);
    _civicrm_api3_object_to_array($ufGroup, $ufGroupArray[$ufGroup->id]);
    return civicrm_api3_create_success($ufGroupArray, $params);
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:18,代码来源:UFGroup.php


示例5: preProcess

 /**
  * pre processing work done here.
  *
  * gets session variables for group or field id
  *
  * @param
  *
  * @return void
  *
  * @access public
  *
  */
 function preProcess()
 {
     // Inline forms don't get menu-level permission checks
     if (!CRM_Core_Permission::check('access CiviCRM')) {
         CRM_Core_Error::fatal(ts('Permission denied'));
     }
     $gid = CRM_Utils_Request::retrieve('id', 'Positive');
     $fields = CRM_Core_BAO_UFGroup::getFields($gid);
     $this->setProfile($fields);
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:22,代码来源:PreviewById.php


示例6: buildQuickForm

 /**
  * Build the form object.
  *
  *
  * @return void
  */
 public function buildQuickForm()
 {
     $types = array('Membership');
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
     if (empty($profiles)) {
         CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Batch update memberships via profile. Navigate to Administer CiviCRM >> CiviCRM Profile to configure a Profile. Consult the online Administrator documentation for more information.", array(1 => $types[0])), ts('Batch Update Error'), 'error');
         CRM_Utils_System::redirect($this->_userContext);
     }
     $ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'), array('' => ts('- select profile -')) + $profiles, TRUE);
     $this->addDefaultButtons(ts('Continue'));
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:17,代码来源:PickProfile.php


示例7: buildQuickForm

 /**
  * Build the form object.
  *
  *
  * @return void
  */
 public function buildQuickForm()
 {
     $types = array('Participant');
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
     if (empty($profiles)) {
         CRM_Core_Session::setStatus("To use Update multiple participants, you need to configure a profile containing only Participant fields (e.g. Participant Status, Participant Role, etc.). Configure a profile at 'Administer CiviCRM >> Customize >> CiviCRM Profile'.");
         CRM_Utils_System::redirect($this->_userContext);
     }
     $ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'), array('' => ts('- select profile -')) + $profiles, TRUE);
     $this->addDefaultButtons(ts('Continue'));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:17,代码来源:PickProfile.php


示例8: setDefaultValues

 function setDefaultValues()
 {
     $defaults = array($this->html_field_name('email') => $this->participant->email);
     list($custom_fields_pre, $custom_fields_post) = $this->get_participant_custom_data_fields($this->participant->event_id);
     $all_fields = $custom_fields_pre + $custom_fields_post;
     $flat = array();
     CRM_Core_BAO_UFGroup::setProfileDefaults($this->participant->contact_id, $all_fields, $flat);
     foreach ($flat as $name => $field) {
         $defaults["field[{$this->participant->id}][{$name}]"] = $field;
     }
     return $defaults;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:12,代码来源:MerParticipant.php


示例9: buildQuickForm

 function buildQuickForm()
 {
     $this->add('text', 'email', ts('Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'email'), true);
     $fields = CRM_Core_BAO_UFGroup::getFields($this->_profileID, false, CRM_Core_Action::ADD, null, null, false, null, true);
     $this->assign('custom', $fields);
     require_once 'CRM/Profile/Form.php';
     foreach ($fields as $key => $field) {
         CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE);
         $this->_fields[$key] = $field;
     }
     $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:12,代码来源:Register.php


示例10: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     require_once "CRM/Core/BAO/UFGroup.php";
     $types = array('Contact', 'Individual', 'Contribution', 'Membership');
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
     if (empty($profiles)) {
         $this->assign('noProfile', true);
     }
     $this->add('select', 'custom_pre_id', ts('Include Profile') . '<br />' . ts('(top of page)'), array('' => ts('- select -')) + $profiles);
     $this->add('select', 'custom_post_id', ts('Include Profile') . '<br />' . ts('(bottom of page)'), array('' => ts('- select -')) + $profiles);
     $this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Custom', 'formRule'), $this->_id);
     parent::buildQuickForm();
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:19,代码来源:Custom.php


示例11: buildQuickForm

 function buildQuickForm(&$form)
 {
     // call to build contact autocomplete
     $attributes = array('width' => '200px');
     $form->add('text', "contact", ts('Select Contact'), $attributes);
     $form->addElement('hidden', "contact_select_id");
     if (CRM_Core_Permission::check('edit all contacts') || CRM_Core_Permission::check('add contacts')) {
         // build select for new contact
         require_once 'CRM/Core/BAO/UFGroup.php';
         $contactProfiles = CRM_Core_BAO_UFGroup::getReservedProfiles();
         $form->add('select', 'profiles', ts('Create New Contact'), array('' => ts('- create new contact -')) + $contactProfiles, false, array('onChange' => "if (this.value) newContact( this.value );"));
     }
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:13,代码来源:NewContact.php


示例12: preProcess

 /**
  * @param CRM_Contribute_Form_Contribution_Main|CRM_Event_Form_Registration_Register|CRM_Financial_Form_Payment $form
  * @param null $type
  * @param null $mode
  *
  * @throws Exception
  */
 public static function preProcess(&$form, $type = NULL, $mode = NULL)
 {
     if ($type) {
         $form->_type = $type;
     } else {
         $form->_type = CRM_Utils_Request::retrieve('type', 'String', $form);
     }
     if ($form->_type) {
         $form->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($form->_type, $form->_mode);
     }
     if (empty($form->_paymentProcessor)) {
         // This would happen when hitting the back-button on a multi-page form with a $0 selection in play.
         return;
     }
     $form->set('paymentProcessor', $form->_paymentProcessor);
     $form->_paymentObject = System::singleton()->getByProcessor($form->_paymentProcessor);
     $form->assign('suppressSubmitButton', $form->_paymentObject->isSuppressSubmitButtons());
     $form->assign('currency', CRM_Utils_Array::value('currency', $form->_values));
     // also set cancel subscription url
     if (!empty($form->_paymentProcessor['is_recur']) && !empty($form->_values['is_recur'])) {
         $form->_values['cancelSubscriptionUrl'] = $form->_paymentObject->subscriptionURL(NULL, NULL, 'cancel');
     }
     if (!empty($form->_values['custom_pre_id'])) {
         $profileAddressFields = array();
         $fields = CRM_Core_BAO_UFGroup::getFields($form->_values['custom_pre_id'], FALSE, CRM_Core_Action::ADD, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL);
         foreach ((array) $fields as $key => $value) {
             CRM_Core_BAO_UFField::assignAddressField($key, $profileAddressFields, array('uf_group_id' => $form->_values['custom_pre_id']));
         }
         if (count($profileAddressFields)) {
             $form->set('profileAddressFields', $profileAddressFields);
         }
     }
     //checks after setting $form->_paymentProcessor
     // we do this outside of the above conditional to avoid
     // saving the country/state list in the session (which could be huge)
     CRM_Core_Payment_Form::setPaymentFieldsByProcessor($form, $form->_paymentProcessor, CRM_Utils_Request::retrieve('billing_profile_id', 'String'));
     $form->assign_by_ref('paymentProcessor', $form->_paymentProcessor);
     // check if this is a paypal auto return and redirect accordingly
     //@todo - determine if this is legacy and remove
     if (CRM_Core_Payment::paypalRedirect($form->_paymentProcessor)) {
         $url = CRM_Utils_System::url('civicrm/contribute/transact', "_qf_ThankYou_display=1&qfKey={$form->controller->_key}");
         CRM_Utils_System::redirect($url);
     }
     // make sure we have a valid payment class, else abort
     if (!empty($form->_values['is_monetary']) && !$form->_paymentProcessor['class_name'] && empty($form->_values['is_pay_later'])) {
         CRM_Core_Error::fatal(ts('Payment processor is not set for this page'));
     }
     if (!empty($form->_membershipBlock) && !empty($form->_membershipBlock['is_separate_payment']) && (!empty($form->_paymentProcessor['class_name']) && !$form->_paymentObject->supports('MultipleConcurrentPayments'))) {
         CRM_Core_Error::fatal(ts('This contribution page is configured to support separate contribution and membership payments. This %1 plugin does not currently support multiple simultaneous payments, or the option to "Execute real-time monetary transactions" is disabled. Please contact the site administrator and notify them of this error', array(1 => $form->_paymentProcessor['payment_processor_type'])));
     }
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:58,代码来源:ProcessorForm.php


示例13: buildQuickForm

 /**
  * Function used to build form element for new contact or select contact widget
  *
  * @param object   $form form object
  * @param int      $blocNo by default it is one, except for address block where it is
  * build for each block
  * @param array    $extrProfiles extra profiles that should be included besides reserved
  *
  * @access public
  *
  * @return void
  */
 static function buildQuickForm(&$form, $blockNo = 1, $extraProfiles = NULL, $required = FALSE, $prefix = '')
 {
     // call to build contact autocomplete
     $attributes = array('width' => '200px');
     $form->add('text', "{$prefix}contact[{$blockNo}]", ts('Select Contact'), $attributes, $required);
     $form->addElement('hidden', "{$prefix}contact_select_id[{$blockNo}]");
     if (CRM_Core_Permission::check('edit all contacts') || CRM_Core_Permission::check('add contacts')) {
         // build select for new contact
         $contactProfiles = CRM_Core_BAO_UFGroup::getReservedProfiles('Contact', $extraProfiles);
         $form->add('select', "{$prefix}profiles[{$blockNo}]", ts('Create New Contact'), array('' => ts('- create new contact -')) + $contactProfiles, FALSE, array('onChange' => "if (this.value) {  newContact{$prefix}{$blockNo}( this.value, {$blockNo}, '{$prefix}' );}"));
     }
     $form->assign('blockNo', $blockNo);
     $form->assign('prefix', $prefix);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:26,代码来源:NewContact.php


示例14: preProcess

 /**
  * Set variables up before form is built.
  *
  * @param CRM_Core_Form $form
  *
  * @return void
  */
 public static function preProcess(&$form)
 {
     $contriDAO = new CRM_Contribute_DAO_Contribution();
     $contriDAO->id = $form->_id;
     $contriDAO->find(TRUE);
     if ($contriDAO->contribution_page_id) {
         $ufJoinParams = array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $contriDAO->contribution_page_id);
         $profileId = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
         //check if any honree profile is enabled if yes then assign its profile type to $_honoreeProfileType
         // which will be used to constraint soft-credit contact type in formRule, CRM-13981
         if ($profileId[0]) {
             $form->_honoreeProfileType = CRM_Core_BAO_UFGroup::getContactType($profileId[0]);
         }
     }
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:22,代码来源:SoftCredit.php


示例15: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     $types = array_merge(array('Contact', 'Individual', 'Contribution', 'Membership'), CRM_Contact_BAO_ContactType::subTypes('Individual'));
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
     $excludeTypes = array('Organization', 'Household', 'Participant', 'Activity');
     $excludeProfiles = CRM_Core_BAO_UFGroup::getProfiles($excludeTypes);
     foreach ($excludeProfiles as $key => $value) {
         if (array_key_exists($key, $profiles)) {
             unset($profiles[$key]);
         }
     }
     if (empty($profiles)) {
         $this->assign('noProfile', TRUE);
     }
     $this->add('select', 'custom_pre_id', ts('Include Profile') . '<br />' . ts('(top of page)'), array('' => ts('- select -')) + $profiles);
     $this->add('select', 'custom_post_id', ts('Include Profile') . '<br />' . ts('(bottom of page)'), array('' => ts('- select -')) + $profiles);
     $this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Custom', 'formRule'), $this->_id);
     parent::buildQuickForm();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:25,代码来源:Custom.php


示例16: buildQuickForm

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function buildQuickForm()
 {
     CRM_Utils_System::setTitle(ts('Settings - Search'));
     $this->addYesNo('includeWildCardInName', ts('Automatic Wildcard'));
     $this->addYesNo('includeEmailInName', ts('Include Email'));
     $this->addYesNo('includeNickNameInName', ts('Include Nickname'));
     $this->addYesNo('includeAlphabeticalPager', ts('Include Alphabetical Pager'));
     $this->addYesNo('includeOrderByClause', ts('Include Order By Clause'));
     $this->addElement('text', 'smartGroupCacheTimeout', ts('Smart group cache timeout'), array('size' => 3, 'maxlength' => 5));
     require_once "CRM/Core/BAO/UFGroup.php";
     $types = array('Contact', 'Individual', 'Organization', 'Household');
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
     $this->add('select', 'defaultSearchProfileID', ts('Default Contact Search Profile'), array('' => ts('- select -')) + $profiles);
     require_once 'CRM/Core/OptionGroup.php';
     $options = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', false, false, true));
     $this->addCheckBox('autocompleteContactSearch', 'Autocomplete Contact Search', $options, null, null, null, null, array('&nbsp;&nbsp;'));
     $element = $this->getElement('autocompleteContactSearch');
     $element->_elements[0]->_flagFrozen = true;
     parent::buildQuickForm();
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:26,代码来源:Search.php


示例17: array

 /**
  * Register a subscription event.  Create a new contact if one does not
  * already exist.
  *
  * @param int $domain_id        The domain id of the new subscription
  * @param int $group_id         The group id to subscribe to
  * @param string $email         The email address of the (new) contact
  * @return int|null $se_id      The id of the subscription event, null on failure
  * @access public
  * @static
  */
 function &subscribe($domain_id, $group_id, $email)
 {
     /* First, find out if the contact already exists */
     $params = array('email' => $email, 'domain_id' => $domain_id);
     require_once 'CRM/Core/BAO/UFGroup.php';
     $contact_id = CRM_Core_BAO_UFGroup::findContact($params);
     CRM_Core_DAO::transaction('BEGIN');
     if (is_a($contact_id, CRM_Core_Error)) {
         require_once 'CRM/Core/BAO/LocationType.php';
         /* If the contact does not exist, create one. */
         $formatted = array('contact_type' => 'Individual');
         $value = array('email' => $email, 'location_type' => CRM_Core_BAO_LocationType::getDefaultID());
         _crm_add_formatted_param($value, $formatted);
         $contact =& crm_create_contact_formatted($formatted, CRM_IMPORT_PARSER_DUPLICATE_SKIP);
         if (is_a($contact, CRM_Core_Error)) {
             return null;
         }
         $contact_id = $contact->id;
     }
     require_once 'CRM/Core/BAO/Email.php';
     require_once 'CRM/Core/BAO/Location.php';
     require_once 'CRM/Contact/BAO/Contact.php';
     /* Get the primary email id from the contact to use as a hash input */
     $dao =& new CRM_Core_DAO();
     $emailTable = CRM_Core_BAO_Email::getTableName();
     $locTable = CRM_Core_BAO_Location::getTableName();
     $contactTable = CRM_Contact_BAO_Contact::getTableName();
     $dao->query("SELECT {$emailTable}.id as email_id\n                    FROM {$emailTable}\n                    INNER JOIN {$locTable}\n                        ON  {$emailTable}.location_id = {$locTable}.id\n                    WHERE   {$emailTable}.is_primary = 1\n                    AND     {$locTable}.is_primary = 1\n                    AND     {$locTable}.entity_table = '{$contactTable}'\n                    AND     {$locTable}.entity_id = " . CRM_Utils_Type::escape($contact_id, 'Integer'));
     $dao->fetch();
     $se =& new CRM_Mailing_Event_BAO_Subscribe();
     $se->group_id = $group_id;
     $se->contact_id = $contact_id;
     $se->time_stamp = date('YmdHis');
     $se->hash = sha1("{$group_id}:{$contact_id}:{$dao->email_id}");
     $se->save();
     $contacts = array($contact_id);
     require_once 'CRM/Contact/BAO/GroupContact.php';
     CRM_Contact_BAO_GroupContact::addContactsToGroup($contacts, $group_id, 'Email', 'Pending', $se->id);
     CRM_Core_DAO::transaction('COMMIT');
     return $se;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:52,代码来源:Subscribe.php


示例18: preProcess

 /**
  * pre processing work done here.
  *
  * gets session variables for group or field id
  *
  * @param
  * @return void
  *
  * @access public
  *
  */
 function preProcess()
 {
     require_once 'CRM/Core/BAO/UFGroup.php';
     $flag = false;
     $field = CRM_Utils_Request::retrieve('field', $this, true, 0);
     $fid = $this->get('fieldId');
     $this->_gid = $this->get('id');
     if ($field) {
         $this->_fields = CRM_Core_BAO_UFGroup::getFields($this->_gid, false, null, null, null, true);
     } else {
         $this->_fields = CRM_Core_BAO_UFGroup::getFields($this->_gid);
     }
     // preview for field
     if ($field) {
         $fieldDAO =& new CRM_Core_DAO_UFField();
         $fieldDAO->id = $fid;
         $fieldDAO->find(true);
         $name = $fieldDAO->field_name;
         if ($fieldDAO->location_type_id) {
             $name .= '-' . $fieldDAO->location_type_id;
         }
         if ($fieldDAO->phone_type) {
             $name .= '-' . $fieldDAO->phone_type;
         }
         $fieldArray[$name] = $this->_fields[$name];
         $this->_fields = $fieldArray;
         if (!is_array($this->_fields[$name])) {
             $flag = true;
         }
         $this->assign('previewField', true);
     }
     if ($flag) {
         $this->assign('viewOnly', false);
     } else {
         $this->assign('viewOnly', true);
     }
     $this->set('fieldId', null);
     $this->assign("fields", $this->_fields);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:50,代码来源:Preview.php


示例19: buildQuickForm

 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     $types = array('Activity');
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
     $activityTypeIds = array_flip(CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name'));
     $nonEditableActivityTypeIds = array($activityTypeIds['Email'], $activityTypeIds['Bulk Email'], $activityTypeIds['Contribution'], $activityTypeIds['Inbound Email'], $activityTypeIds['Pledge Reminder'], $activityTypeIds['Membership Signup'], $activityTypeIds['Membership Renewal'], $activityTypeIds['Event Registration'], $activityTypeIds['Pledge Acknowledgment']);
     $notEditable = FALSE;
     foreach ($this->_activityHolderIds as $activityId) {
         $typeId = CRM_Core_DAO::getFieldValue("CRM_Activity_DAO_Activity", $activityId, 'activity_type_id');
         if (in_array($typeId, $nonEditableActivityTypeIds)) {
             $notEditable = TRUE;
             break;
         }
     }
     if (empty($profiles)) {
         CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Update multiple activities. Navigate to Administer > Customize Data and Screens > Profiles to configure a Profile. Consult the online Administrator documentation for more information.", array(1 => $types[0])), ts("No Profile Configured"), "alert");
         CRM_Utils_System::redirect($this->_userContext);
     } elseif ($notEditable) {
         CRM_Core_Session::setStatus("", ts("Some of the selected activities are not editable."), "alert");
         CRM_Utils_System::redirect($this->_userContext);
     }
     $ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'), array('' => ts('- select profile -')) + $profiles, TRUE);
     $this->addDefaultButtons(ts('Continue'));
 }
开发者ID:sarehag,项目名称:civicrm-core,代码行数:27,代码来源:PickProfile.php


示例20: buildCustom

 /**
  * Add the custom fields.
  *
  * @param int $id
  * @param string $name
  * @param bool $viewOnly
  */
 public function buildCustom($id, $name, $viewOnly = FALSE)
 {
     if ($id) {
         $button = substr($this->controller->getButtonName(), -4);
         $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
         $session = CRM_Core_Session::singleton();
         $contactID = $session->get('userID');
         // we don't allow conflicting fields to be
         // configured via profile
         $fieldsToIgnore = array('participant_fee_amount' => 1, 'participant_fee_level' => 1);
         if ($contactID) {
             //FIX CRM-9653
             if (is_array($id)) {
                 $fields = array();
                 foreach ($id as $profileID) {
                     $field = CRM_Core_BAO_UFGroup::getFields($profileID, FALSE, CRM_Core_Action::ADD, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::CREATE, 'field_name', TRUE);
                     $fields = array_merge($fields, $field);
                 }
             } else {
                 if (CRM_Core_BAO_UFGroup::filterUFGroups($id, $contactID)) {
                     $fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::CREATE, 'field_name', TRUE);
                 }
             }
         } else {
             $fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::CREATE, 'field_name', TRUE);
         }
         if (array_intersect_key($fields, $fieldsToIgnore)) {
             $fields = array_diff_key($fields, $fieldsToIgnore);
             CRM_Core_Session::setStatus(ts('Some of the profile fields cannot be configured for this page.'));
         }
         $addCaptcha = FALSE;
         if (!empty($this->_fields)) {
             $fields = @array_diff_assoc($fields, $this->_fields);
         }
         if (empty($this->_params[0]['additional_participants']) && is_null($cid)) {
             CRM_Core_BAO_Address::checkContactSharedAddressFields($fields, $contactID);
         }
         $this->assign($name, $fields);
         if (is_array($fields)) {
             foreach ($fields as $key => $field) {
                 if ($viewOnly && isset($field['data_type']) && $field['data_type'] == 'File' || $viewOnly && $field['name'] == 'image_URL') {
                     // ignore file upload fields
                     continue;
                 }
                 //make the field optional if primary participant
                 //have been skip the additional participant.
                 if ($button == 'skip') {
                     $field['is_required'] = FALSE;
                 } elseif ($field['add_captcha'] && !$contactID) {
                     // only add captcha for first page
                     $addCaptcha = TRUE;
                 }
                 list($prefixName, $index) = CRM_Utils_System::explode('-', $key, 2);
                 CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE, $contactID, TRUE);
                 $this->_fields[$key] = $field;
             }
         }
         if ($addCaptcha && !$viewOnly) {
             $captcha = CRM_Utils_ReCAPTCHA::singleton();
             $captcha->add($this);
             $this->assign('isCaptcha', TRUE);
         }
     }
 }
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:71,代码来源:Registration.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Core_BAO_UFJoin类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Core_BAO_UFField类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap