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


PHP CRM_Core_BAO_UFJoin::create方法代码示例

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


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

示例1: crm_add_uf_join

/**
 * takes an associative array and creates a uf join object
 *
 * @param array $params assoc array of name/value pairs
 *
 * @return object CRM_Core_DAO_UFJoin object 
 * @access public
 * 
 */
function crm_add_uf_join($params)
{
    if (!is_array($params)) {
        return _crm_error("params is not an array");
    }
    if (empty($params)) {
        return _crm_error("params is an empty array");
    }
    if (!isset($params['uf_group_id'])) {
        return _crm_error("uf_group_id is required field");
    }
    return CRM_Core_BAO_UFJoin::create($params);
}
开发者ID:ksecor,项目名称:civicrm,代码行数:22,代码来源:UFJoin.php

示例2: civicrm_uf_join_edit

/**
 * takes an associative array and updates a uf join array
 *
 * @param array $params assoc array of name/value pairs
 *
 * @return array  updated CRM_Core_DAO_UFJoin Array
 * @access public
 * 
 */
function civicrm_uf_join_edit($params)
{
    if (!is_array($params)) {
        return civicrm_create_error("params is not an array");
    }
    if (empty($params)) {
        return civicrm_create_error("params is an empty array");
    }
    if (!isset($params['uf_group_id'])) {
        return civicrm_create_error("uf_group_id is required field");
    }
    $ufJoin = CRM_Core_BAO_UFJoin::create($params);
    _civicrm_object_to_array($ufJoin, $ufJoinArray);
    return $ufJoinArray;
}
开发者ID:ksecor,项目名称:civicrm,代码行数:24,代码来源:UFJoin.php

示例3: migrateOnBehalfOfInfo

 /**
  * Migrate on-behalf information to uf_join.module_data as on-behalf columns will be dropped
  * on DB upgrade
  *
  * @param CRM_Queue_TaskContext $ctx
  *
  * @return bool
  *   TRUE for success
  */
 public static function migrateOnBehalfOfInfo(CRM_Queue_TaskContext $ctx)
 {
     $domain = new CRM_Core_DAO_Domain();
     $domain->find(TRUE);
     // fetch onBehalf entry in UFJoin table
     $ufGroupDAO = new CRM_Core_DAO_UFJoin();
     $ufGroupDAO->module = 'OnBehalf';
     $ufGroupDAO->find(TRUE);
     $forOrgColums = array();
     if ($domain->locales) {
         $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
         foreach ($locales as $locale) {
             $forOrgColums[] = "for_organization_{$locale}";
         }
     } else {
         $forOrgColums[] = "for_organization";
     }
     $query = "\n      SELECT " . implode(", ", $forOrgColums) . ", uj.id as join_id, uj.uf_group_id as uf_group_id\n      FROM civicrm_contribution_page cp\n       INNER JOIN civicrm_uf_join uj ON uj.entity_id = cp.id AND uj.module = 'OnBehalf'";
     $dao = CRM_Core_DAO::executeQuery($query, array(), TRUE, NULL, FALSE, FALSE);
     if ($dao->N) {
         while ($dao->fetch()) {
             $onBehalfParams['on_behalf'] = array('is_for_organization' => $dao->is_for_organization);
             if ($domain->locales) {
                 foreach ($locales as $locale) {
                     $for_organization = "for_organization_{$locale}";
                     $onBehalfParams['on_behalf'] += array($locale => array('for_organization' => $dao->{$for_organization}));
                 }
             } else {
                 $onBehalfParams['on_behalf'] += array('default' => array('for_organization' => $dao->for_organization));
             }
             $ufJoinParam = array('id' => $dao->join_id, 'module' => 'on_behalf', 'uf_group_id' => $dao->uf_group_id, 'module_data' => json_encode($onBehalfParams));
             CRM_Core_BAO_UFJoin::create($ufJoinParam);
         }
     }
     return TRUE;
 }
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:45,代码来源:FourSeven.php

示例4: postProcess

 /**
  * Process the form submission.
  *
  *
  * @return void
  */
 public function postProcess()
 {
     $params = $this->exportValues();
     $params['id'] = $this->_id;
     // format params
     $params['is_online_registration'] = CRM_Utils_Array::value('is_online_registration', $params, FALSE);
     $params['is_confirm_enabled'] = CRM_Utils_Array::value('is_confirm_enabled', $params, FALSE);
     // CRM-11182
     $params['is_multiple_registrations'] = CRM_Utils_Array::value('is_multiple_registrations', $params, FALSE);
     $params['allow_same_participant_emails'] = CRM_Utils_Array::value('allow_same_participant_emails', $params, FALSE);
     $params['requires_approval'] = CRM_Utils_Array::value('requires_approval', $params, FALSE);
     // reset is_email confirm if not online reg
     if (!$params['is_online_registration']) {
         $params['is_email_confirm'] = FALSE;
     }
     if (!$this->_isTemplate) {
         $params['registration_start_date'] = CRM_Utils_Date::processDate($params['registration_start_date'], $params['registration_start_date_time'], TRUE);
         $params['registration_end_date'] = CRM_Utils_Date::processDate($params['registration_end_date'], $params['registration_end_date_time'], TRUE);
     }
     CRM_Event_BAO_Event::add($params);
     // also update the ProfileModule tables
     $ufJoinParams = array('is_active' => 1, 'module' => 'CiviEvent', 'entity_table' => 'civicrm_event', 'entity_id' => $this->_id);
     // first delete all past entries
     CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);
     $uf = array();
     $wt = 2;
     if (!empty($params['custom_pre_id'])) {
         $uf[1] = $params['custom_pre_id'];
         $wt = 1;
     }
     if (!empty($params['custom_post_id'])) {
         $uf[2] = $params['custom_post_id'];
     }
     if (!empty($params['custom_post_id_multiple'])) {
         $uf = array_merge($uf, $params['custom_post_id_multiple']);
     }
     $uf = array_values($uf);
     if (!empty($uf)) {
         foreach ($uf as $weight => $ufGroupId) {
             $ufJoinParams['weight'] = $weight + $wt;
             $ufJoinParams['uf_group_id'] = $ufGroupId;
             CRM_Core_BAO_UFJoin::create($ufJoinParams);
             unset($ufJoinParams['id']);
         }
     }
     // also update the ProfileModule tables
     $ufJoinParamsAdd = array('is_active' => 1, 'module' => 'CiviEvent_Additional', 'entity_table' => 'civicrm_event', 'entity_id' => $this->_id);
     // first delete all past entries
     CRM_Core_BAO_UFJoin::deleteAll($ufJoinParamsAdd);
     if (!empty($params['is_multiple_registrations'])) {
         $ufAdd = array();
         $wtAdd = 2;
         if (array_key_exists('additional_custom_pre_id', $params)) {
             if (empty($params['additional_custom_pre_id'])) {
                 $ufAdd[1] = $params['custom_pre_id'];
                 $wtAdd = 1;
             } elseif (CRM_Utils_Array::value('additional_custom_pre_id', $params) == 'none') {
             } else {
                 $ufAdd[1] = $params['additional_custom_pre_id'];
                 $wtAdd = 1;
             }
         }
         if (array_key_exists('additional_custom_post_id', $params)) {
             if (empty($params['additional_custom_post_id'])) {
                 $ufAdd[2] = $params['custom_post_id'];
             } elseif (CRM_Utils_Array::value('additional_custom_post_id', $params) == 'none') {
             } else {
                 $ufAdd[2] = $params['additional_custom_post_id'];
             }
         }
         if (!empty($params['additional_custom_post_id_multiple'])) {
             $additionalPostMultiple = array();
             foreach ($params['additional_custom_post_id_multiple'] as $key => $value) {
                 if (is_null($value) && !empty($params['custom_post_id'])) {
                     $additionalPostMultiple[$key] = $params['custom_post_id'];
                 } elseif ($value == 'none') {
                     continue;
                 } elseif ($value) {
                     $additionalPostMultiple[$key] = $value;
                 }
             }
             $ufAdd = array_merge($ufAdd, $additionalPostMultiple);
         }
         $ufAdd = array_values($ufAdd);
         if (!empty($ufAdd)) {
             foreach ($ufAdd as $weightAdd => $ufGroupIdAdd) {
                 $ufJoinParamsAdd['weight'] = $weightAdd + $wtAdd;
                 $ufJoinParamsAdd['uf_group_id'] = $ufGroupIdAdd;
                 CRM_Core_BAO_UFJoin::create($ufJoinParamsAdd);
                 unset($ufJoinParamsAdd['id']);
             }
         }
     }
     // get the profiles to evaluate what they collect
//.........这里部分代码省略.........
开发者ID:vakeesan26,项目名称:civicrm-core,代码行数:101,代码来源:Registration.php

示例5: postProcess

 /**
  * Process the form
  *
  * @param null
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     // store the submitted values in an array
     $params = $this->controller->exportValues($this->_name);
     // also update the ProfileModule tables
     $ufJoinParams = array('is_active' => 1, 'module' => 'CiviCampaign', 'entity_table' => 'civicrm_survey', 'entity_id' => $this->_surveyId);
     // first delete all past entries
     CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);
     $uf = array();
     $wt = 2;
     if (!empty($params['contact_profile_id'])) {
         $uf[1] = $params['contact_profile_id'];
         $wt = 1;
     }
     if (!empty($params['activity_profile_id'])) {
         $uf[2] = $params['activity_profile_id'];
     }
     $uf = array_values($uf);
     if (!empty($uf)) {
         foreach ($uf as $weight => $ufGroupId) {
             $ufJoinParams['weight'] = $weight + $wt;
             $ufJoinParams['uf_group_id'] = $ufGroupId;
             CRM_Core_BAO_UFJoin::create($ufJoinParams);
             unset($ufJoinParams['id']);
         }
     }
     parent::endPostProcess();
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:36,代码来源:Questions.php

示例6: postProcess

 /**
  * Process the form.
  */
 public function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     // we do this in case the user has hit the forward/back button
     if ($this->_id) {
         $params['id'] = $this->_id;
     } else {
         $session = CRM_Core_Session::singleton();
         $params['created_id'] = $session->get('userID');
         $params['created_date'] = date('YmdHis');
         $config = CRM_Core_Config::singleton();
         $params['currency'] = $config->defaultCurrency;
     }
     $params['is_confirm_enabled'] = CRM_Utils_Array::value('is_confirm_enabled', $params, FALSE);
     $params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
     $params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, FALSE);
     $params['honor_block_is_active'] = CRM_Utils_Array::value('honor_block_is_active', $params, FALSE);
     $params['is_for_organization'] = !empty($params['is_organization']) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
     $params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time'], TRUE);
     $params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], TRUE);
     $params['goal_amount'] = CRM_Utils_Rule::cleanMoney($params['goal_amount']);
     if (!$params['honor_block_is_active']) {
         $params['honor_block_title'] = NULL;
         $params['honor_block_text'] = NULL;
     }
     $dao = CRM_Contribute_BAO_ContributionPage::create($params);
     $ufJoinParams = array('is_organization' => array('module' => 'on_behalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $dao->id), 'honor_block_is_active' => array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $dao->id));
     foreach ($ufJoinParams as $index => $ufJoinParam) {
         if (!empty($params[$index])) {
             // first delete all past entries
             CRM_Core_BAO_UFJoin::deleteAll($ufJoinParam);
             $ufJoinParam['uf_group_id'] = $params[$index];
             $ufJoinParam['weight'] = 1;
             $ufJoinParam['is_active'] = 1;
             if ($index == 'honor_block_is_active') {
                 $ufJoinParam['uf_group_id'] = $params['honoree_profile'];
                 $ufJoinParam['module_data'] = CRM_Contribute_BAO_ContributionPage::formatModuleData($params, FALSE, 'soft_credit');
             } else {
                 $ufJoinParam['uf_group_id'] = $params['onbehalf_profile_id'];
                 $ufJoinParam['module_data'] = CRM_Contribute_BAO_ContributionPage::formatModuleData($params, FALSE, 'on_behalf');
             }
             CRM_Core_BAO_UFJoin::create($ufJoinParam);
         } else {
             if ($index == 'honor_block_is_active') {
                 $params['honor_block_title'] = NULL;
                 $params['honor_block_text'] = NULL;
             } else {
                 $params['for_organization'] = NULL;
             }
             //On subsequent honor_block_is_active uncheck, disable(don't delete)
             //that particular honoree profile entry in UFjoin table, CRM-13981
             $ufId = CRM_Core_BAO_UFJoin::findJoinEntryId($ufJoinParam);
             if ($ufId) {
                 $ufJoinParam['uf_group_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParam);
                 $ufJoinParam['is_active'] = 0;
                 CRM_Core_BAO_UFJoin::create($ufJoinParam);
             }
         }
     }
     $this->set('id', $dao->id);
     if ($this->_action & CRM_Core_Action::ADD) {
         $url = 'civicrm/admin/contribute/amount';
         $urlParams = "action=update&reset=1&id={$dao->id}";
         // special case for 'Save and Done' consistency.
         if ($this->controller->getButtonName('submit') == '_qf_Amount_upload_done') {
             $url = 'civicrm/admin/contribute';
             $urlParams = 'reset=1';
             CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $this->getTitle())), ts('Saved'), 'success');
         }
         CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
     }
     parent::endPostProcess();
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:78,代码来源:Settings.php

示例7: civicrm_api3_uf_join_create

/**
 * Takes an associative array and creates a uf join in the database.
 *
 * @param array $params
 *   Array per getfields metadata.
 *
 * @return array
 *   CRM_Core_DAO_UFJoin Array
 */
function civicrm_api3_uf_join_create($params)
{
    $ufJoin = CRM_Core_BAO_UFJoin::create($params);
    _civicrm_api3_object_to_array($ufJoin, $ufJoinArray[]);
    return civicrm_api3_create_success($ufJoinArray, $params, 'UFJoin', 'create');
}
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:15,代码来源:UFJoin.php

示例8: postProcess

 /**
  * Process the form.
  *
  * @return void
  */
 public function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $params['id'] = $this->_id;
     }
     $transaction = new CRM_Core_Transaction();
     // also update uf join table
     $ufJoinParams = array('is_active' => 1, 'module' => 'CiviContribute', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
     // first delete all past entries
     CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);
     if (!empty($params['custom_pre_id'])) {
         $ufJoinParams['weight'] = 1;
         $ufJoinParams['uf_group_id'] = $params['custom_pre_id'];
         CRM_Core_BAO_UFJoin::create($ufJoinParams);
     }
     unset($ufJoinParams['id']);
     if (!empty($params['custom_post_id'])) {
         $ufJoinParams['weight'] = 2;
         $ufJoinParams['uf_group_id'] = $params['custom_post_id'];
         CRM_Core_BAO_UFJoin::create($ufJoinParams);
     }
     $transaction->commit();
     parent::endPostProcess();
 }
开发者ID:vakeesan26,项目名称:civicrm-core,代码行数:31,代码来源:Custom.php

示例9: postProcess

 /**
  * Function to process the form
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     $params = array();
     $params = $this->exportValues();
     $params['id'] = $this->_id;
     //format params
     $params['is_online_registration'] = CRM_Utils_Array::value('is_online_registration', $params, false);
     $params['is_multiple_registrations'] = CRM_Utils_Array::value('is_multiple_registrations', $params, false);
     $params['allow_same_participant_emails'] = CRM_Utils_Array::value('allow_same_participant_emails', $params, false);
     $params['requires_approval'] = CRM_Utils_Array::value('requires_approval', $params, false);
     // reset is_email confirm if not online reg
     if (!$params['is_online_registration']) {
         $params['is_email_confirm'] = false;
     }
     if (!$this->_isTemplate) {
         $params['registration_start_date'] = CRM_Utils_Date::processDate($params['registration_start_date'], $params['registration_start_date_time'], true);
         $params['registration_end_date'] = CRM_Utils_Date::processDate($params['registration_end_date'], $params['registration_end_date_time'], true);
     }
     require_once 'CRM/Event/BAO/Event.php';
     CRM_Event_BAO_Event::add($params);
     // also update the ProfileModule tables
     $ufJoinParams = array('is_active' => 1, 'module' => 'CiviEvent', 'entity_table' => 'civicrm_event', 'entity_id' => $this->_id);
     require_once 'CRM/Core/BAO/UFJoin.php';
     // first delete all past entries
     CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);
     if (!empty($params['custom_pre_id'])) {
         $ufJoinParams['weight'] = 1;
         $ufJoinParams['uf_group_id'] = $params['custom_pre_id'];
         CRM_Core_BAO_UFJoin::create($ufJoinParams);
     }
     unset($ufJoinParams['id']);
     if (!empty($params['custom_post_id'])) {
         $ufJoinParams['weight'] = 2;
         $ufJoinParams['uf_group_id'] = $params['custom_post_id'];
         CRM_Core_BAO_UFJoin::create($ufJoinParams);
     }
     // CRM-4377: also update the profiles for additional participants
     $ufJoinParams['module'] = 'CiviEvent_Additional';
     $ufJoinParams['weight'] = 1;
     $ufJoinParams['uf_group_id'] = $params['custom_pre_id'];
     if ($params['additional_custom_pre_id'] == 'none') {
         $ufJoinParams['is_active'] = 0;
     } elseif ($params['additional_custom_pre_id']) {
         $ufJoinParams['uf_group_id'] = $params['additional_custom_pre_id'];
     }
     CRM_Core_BAO_UFJoin::create($ufJoinParams);
     $ufJoinParams['weight'] = 2;
     $ufJoinParams['uf_group_id'] = $params['custom_post_id'];
     if ($params['additional_custom_post_id'] == 'none') {
         $ufJoinParams['is_active'] = 0;
     } elseif ($params['additional_custom_post_id']) {
         //minor fix for CRM-4377
         $ufJoinParams['is_active'] = 1;
         $ufJoinParams['uf_group_id'] = $params['additional_custom_post_id'];
     }
     CRM_Core_BAO_UFJoin::create($ufJoinParams);
     parent::endPostProcess();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:64,代码来源:Registration.php

示例10: postProcess

 /**
  * Process the form
  * 
  * @param null
  * 
  * @return void
  * @access public
  */
 public function postProcess()
 {
     // store the submitted values in an array
     $params = $this->controller->exportValues($this->_name);
     $session = CRM_Core_Session::singleton();
     $params['last_modified_id'] = $session->get('userID');
     $params['last_modified_date'] = date('YmdHis');
     require_once 'CRM/Core/BAO/OptionValue.php';
     require_once 'CRM/Core/BAO/OptionGroup.php';
     $updateResultSet = false;
     if (CRM_Utils_Array::value('option_type', $params) == 2 && CRM_Utils_Array::value('option_group_id', $params)) {
         if ($params['option_group_id'] == CRM_Utils_Array::value('result_id', $this->_values)) {
             $updateResultSet = true;
         }
     }
     if ($this->_surveyId) {
         if ($this->_action & CRM_Core_Action::DELETE) {
             CRM_Campaign_BAO_Survey::del($this->_surveyId);
             CRM_Core_Session::setStatus(ts(' Survey has been deleted.'));
             $session->replaceUserContext(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=survey'));
             return;
         }
         $params['id'] = $this->_surveyId;
     } else {
         $params['created_id'] = $session->get('userID');
         $params['created_date'] = date('YmdHis');
     }
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, 0);
     $params['is_default'] = CRM_Utils_Array::value('is_default', $params, 0);
     $recontactInterval = array();
     if ($updateResultSet) {
         $optionValue = new CRM_Core_DAO_OptionValue();
         $optionValue->option_group_id = $this->_values['result_id'];
         $optionValue->delete();
         $params['result_id'] = $this->_values['result_id'];
     } else {
         $opGroupName = 'civicrm_survey_' . rand(10, 1000) . '_' . date('YmdHis');
         $optionGroup = new CRM_Core_DAO_OptionGroup();
         $optionGroup->name = $opGroupName;
         $optionGroup->label = $params['title'] . ' Response Set';
         $optionGroup->is_active = 1;
         $optionGroup->save();
         $params['result_id'] = $optionGroup->id;
     }
     foreach ($params['option_value'] as $k => $v) {
         if (strlen(trim($v))) {
             $optionValue = new CRM_Core_DAO_OptionValue();
             $optionValue->option_group_id = $params['result_id'];
             $optionValue->label = $params['option_label'][$k];
             $optionValue->name = CRM_Utils_String::titleToVar($params['option_label'][$k]);
             $optionValue->value = trim($v);
             $optionValue->weight = $params['option_weight'][$k];
             $optionValue->is_active = 1;
             if (CRM_Utils_Array::value('default_option', $params) && $params['default_option'] == $k) {
                 $optionValue->is_default = 1;
             }
             $optionValue->save();
             if (CRM_Utils_Array::value($k, $params['option_interval'])) {
                 $recontactInterval[$optionValue->label] = $params['option_interval'][$k];
             }
         }
     }
     $params['recontact_interval'] = serialize($recontactInterval);
     $surveyId = CRM_Campaign_BAO_Survey::create($params);
     if (CRM_Utils_Array::value('result_id', $this->_values) && !$updateResultSet) {
         $query = "SELECT COUNT(*) FROM civicrm_survey WHERE result_id = %1";
         $countSurvey = CRM_Core_DAO::singleValueQuery($query, array(1 => array($this->_values['result_id'], 'Integer')));
         // delete option group if no any survey is using it.
         if (!($countSurvey >= 1)) {
             CRM_Core_BAO_OptionGroup::del($this->_values['result_id']);
         }
     }
     require_once 'CRM/Core/BAO/UFJoin.php';
     // also update the ProfileModule tables
     $ufJoinParams = array('is_active' => 1, 'module' => 'CiviCampaign', 'entity_table' => 'civicrm_survey', 'entity_id' => $surveyId->id);
     // first delete all past entries
     if ($this->_surveyId) {
         CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);
     }
     if (CRM_Utils_Array::value('profile_id', $params)) {
         $ufJoinParams['weight'] = 1;
         $ufJoinParams['uf_group_id'] = $params['profile_id'];
         CRM_Core_BAO_UFJoin::create($ufJoinParams);
     }
     if (!is_a($surveyId, 'CRM_Core_Error')) {
         CRM_Core_Session::setStatus(ts('Survey %1 has been saved.', array(1 => $params['title'])));
     }
     if ($this->_context == 'dialog') {
         $returnArray = array('returnSuccess' => true);
         echo json_encode($returnArray);
         CRM_Utils_System::civiExit();
     }
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Survey.php

示例11: migrateHonoreeInfo

 /**
  * Migrate honoree information to uf_join.module_data as honoree columns (text and title) will be dropped
  * on DB upgrade
  *
  * @param CRM_Queue_TaskContext $ctx
  *
  * @return bool
  *   TRUE for success
  */
 public static function migrateHonoreeInfo(CRM_Queue_TaskContext $ctx)
 {
     $query = "ALTER TABLE `civicrm_uf_join`\n    ADD COLUMN `module_data` longtext COMMENT 'Json serialized array of data used by the ufjoin.module'";
     CRM_Core_DAO::executeQuery($query);
     $honorTypes = array_keys(CRM_Core_OptionGroup::values('honor_type'));
     $ufGroupDAO = new CRM_Core_DAO_UFGroup();
     $ufGroupDAO->name = 'new_individual';
     $ufGroupDAO->find(TRUE);
     $query = "SELECT * FROM civicrm_contribution_page";
     $dao = CRM_Core_DAO::executeQuery($query);
     if ($dao->N) {
         $domain = new CRM_Core_DAO_Domain();
         $domain->find(TRUE);
         while ($dao->fetch()) {
             $honorParams = array('soft_credit' => array('soft_credit_types' => $honorTypes));
             if ($domain->locales) {
                 $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales);
                 foreach ($locales as $locale) {
                     $honor_block_title = "honor_block_title_{$locale}";
                     $honor_block_text = "honor_block_text_{$locale}";
                     $honorParams['soft_credit'] += array($locale => array('honor_block_title' => $dao->{$honor_block_title}, 'honor_block_text' => $dao->{$honor_block_text}));
                 }
             } else {
                 $honorParams['soft_credit'] += array('default' => array('honor_block_title' => $dao->honor_block_title, 'honor_block_text' => $dao->honor_block_text));
             }
             $ufJoinParam = array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'is_active' => $dao->honor_block_is_active, 'entity_id' => $dao->id, 'uf_group_id' => $ufGroupDAO->id, 'module_data' => json_encode($honorParams));
             CRM_Core_BAO_UFJoin::create($ufJoinParam);
         }
     }
     return TRUE;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:40,代码来源:FourFive.php

示例12: postProcess

 public function postProcess()
 {
     // store the submitted values in an array
     $params = $this->controller->exportValues($this->_name);
     $session = CRM_Core_Session::singleton();
     $params['last_modified_id'] = $session->get('userID');
     $params['last_modified_date'] = date('YmdHis');
     $params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
     if ($this->_surveyId) {
         if ($this->_action & CRM_Core_Action::DELETE) {
             CRM_Campaign_BAO_Survey::del($this->_surveyId);
             CRM_Core_Session::setStatus(ts(' Petition has been deleted.'), ts('Record Deleted'), 'success');
             $session->replaceUserContext(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=petition'));
             return;
         }
         $params['id'] = $this->_surveyId;
     } else {
         $params['created_id'] = $session->get('userID');
         $params['created_date'] = date('YmdHis');
     }
     $params['bypass_confirm'] = CRM_Utils_Array::value('bypass_confirm', $params, 0);
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, 0);
     $params['is_default'] = CRM_Utils_Array::value('is_default', $params, 0);
     $surveyId = CRM_Campaign_BAO_Survey::create($params);
     // also update the ProfileModule tables
     $ufJoinParams = array('is_active' => 1, 'module' => 'CiviCampaign', 'entity_table' => 'civicrm_survey', 'entity_id' => $surveyId->id);
     // first delete all past entries
     if ($this->_surveyId) {
         CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);
     }
     if (!empty($params['profile_id'])) {
         $ufJoinParams['weight'] = 1;
         $ufJoinParams['uf_group_id'] = $params['profile_id'];
         CRM_Core_BAO_UFJoin::create($ufJoinParams);
     }
     if (!empty($params['contact_profile_id'])) {
         $ufJoinParams['weight'] = 2;
         $ufJoinParams['uf_group_id'] = $params['contact_profile_id'];
         CRM_Core_BAO_UFJoin::create($ufJoinParams);
     }
     if (!is_a($surveyId, 'CRM_Core_Error')) {
         CRM_Core_Session::setStatus(ts('Petition has been saved.'), ts('Saved'), 'success');
     }
     $buttonName = $this->controller->getButtonName();
     if ($buttonName == $this->getButtonName('next', 'new')) {
         CRM_Core_Session::setStatus(ts(' You can add another Petition.'), '', 'info');
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/petition/add', 'reset=1&action=add'));
     } else {
         $session->replaceUserContext(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=petition'));
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:51,代码来源:Petition.php

示例13: postProcess

 /**
  * Process the form
  *
  * @return void
  * @access public
  */
 public function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     // we do this in case the user has hit the forward/back button
     if ($this->_id) {
         $params['id'] = $this->_id;
     } else {
         $session = CRM_Core_Session::singleton();
         $params['created_id'] = $session->get('userID');
         $params['created_date'] = date('YmdHis');
         $config = CRM_Core_Config::singleton();
         $params['currency'] = $config->defaultCurrency;
     }
     $params['is_confirm_enabled'] = CRM_Utils_Array::value('is_confirm_enabled', $params, FALSE);
     $params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
     $params['is_credit_card_only'] = CRM_Utils_Array::value('is_credit_card_only', $params, FALSE);
     $params['honor_block_is_active'] = CRM_Utils_Array::value('honor_block_is_active', $params, FALSE);
     $params['is_for_organization'] = CRM_Utils_Array::value('is_organization', $params) ? CRM_Utils_Array::value('is_for_organization', $params, FALSE) : 0;
     $params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time'], TRUE);
     $params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], TRUE);
     $params['goal_amount'] = CRM_Utils_Rule::cleanMoney($params['goal_amount']);
     if (!$params['honor_block_is_active']) {
         $params['honor_block_title'] = NULL;
         $params['honor_block_text'] = NULL;
     }
     $dao = CRM_Contribute_BAO_ContributionPage::create($params);
     // make entry in UF join table for onbehalf of org profile
     $ufJoinParams = array('is_active' => 1, 'module' => 'OnBehalf', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $dao->id);
     // first delete all past entries
     CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);
     if (CRM_Utils_Array::value('onbehalf_profile_id', $params)) {
         $ufJoinParams['weight'] = 1;
         $ufJoinParams['uf_group_id'] = $params['onbehalf_profile_id'];
         CRM_Core_BAO_UFJoin::create($ufJoinParams);
     }
     $this->set('id', $dao->id);
     if ($this->_action & CRM_Core_Action::ADD) {
         $url = 'civicrm/admin/contribute/amount';
         $urlParams = "action=update&reset=1&id={$dao->id}";
         // special case for 'Save and Done' consistency.
         if ($this->controller->getButtonName('submit') == '_qf_Amount_upload_done') {
             $url = 'civicrm/admin/contribute';
             $urlParams = 'reset=1';
             CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $this->getTitle())));
         }
         CRM_Utils_System::redirect(CRM_Utils_System::url($url, $urlParams));
     }
     parent::endPostProcess();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:57,代码来源:Settings.php

示例14: postProcess

 /**
  * Function to process the form
  *
  * @access public
  *
  * @return None
  */
 public function postProcess()
 {
     $params = array();
     $params = $this->exportValues();
     $params['id'] = $this->_id;
     //format params
     $params['is_online_registration'] = CRM_Utils_Array::value('is_online_registration', $params, FALSE);
     $params['is_multiple_registrations'] = CRM_Utils_Array::value('is_multiple_registrations', $params, FALSE);
     $params['allow_same_participant_emails'] = CRM_Utils_Array::value('allow_same_participant_emails', $params, FALSE);
     $params['requires_approval'] = CRM_Utils_Array::value('requires_approval', $params, FALSE);
     // reset is_email confirm if not online reg
     if (!$params['is_online_registration']) {
         $params['is_email_confirm'] = FALSE;
     }
     if (!$this->_isTemplate) {
         $params['registration_start_date'] = CRM_Utils_Date::processDate($params['registration_start_date'], $params['registration_start_date_time'], TRUE);
         $params['registration_end_date'] = CRM_Utils_Date::processDate($params['registration_end_date'], $params['registration_end_date_time'], TRUE);
     }
     CRM_Event_BAO_Event::add($params);
     // also update the ProfileModule tables
     $ufJoinParams = array('is_active' => 1, 'module' => 'CiviEvent', 'entity_table' => 'civicrm_event', 'entity_id' => $this->_id);
     // first delete all past entries
     CRM_Core_BAO_UFJoin::deleteAll($ufJoinParams);
     $uf = array();
     $wt = 2;
     if (!empty($params['custom_pre_id'])) {
         $uf[1] = $params['custom_pre_id'];
         $wt = 1;
     }
     if (!empty($params['custom_post_id'])) {
         $uf[2] = $params['custom_post_id'];
     }
     if (CRM_Utils_Array::value('custom_post_id_multiple', $params)) {
         $uf = array_merge($uf, $params['custom_post_id_multiple']);
     }
     $uf = array_values($uf);
     if (!empty($uf)) {
         foreach ($uf as $weight => $ufGroupId) {
             $ufJoinParams['weight'] = $weight + $wt;
             $ufJoinParams['uf_group_id'] = $ufGroupId;
             CRM_Core_BAO_UFJoin::create($ufJoinParams);
             unset($ufJoinParams['id']);
         }
     }
     // also update the ProfileModule tables
     $ufJoinParamsAdd = array('is_active' => 1, 'module' => 'CiviEvent_Additional', 'entity_table' => 'civicrm_event', 'entity_id' => $this->_id);
     // first delete all past entries
     CRM_Core_BAO_UFJoin::deleteAll($ufJoinParamsAdd);
     if (CRM_Utils_Array::value('is_multiple_registrations', $params)) {
         $ufAdd = array();
         $wtAdd = 2;
         if (array_key_exists('additional_custom_pre_id', $params)) {
             if (!CRM_Utils_Array::value('additional_custom_pre_id', $params)) {
                 $ufAdd[1] = $params['custom_pre_id'];
                 $wtAdd = 1;
             } elseif (CRM_Utils_Array::value('additional_custom_pre_id', $params) == 'none') {
             } else {
                 $ufAdd[1] = $params['additional_custom_pre_id'];
                 $wtAdd = 1;
             }
         }
         if (array_key_exists('additional_custom_post_id', $params)) {
             if (!CRM_Utils_Array::value('additional_custom_post_id', $params)) {
                 $ufAdd[2] = $params['custom_post_id'];
             } elseif (CRM_Utils_Array::value('additional_custom_post_id', $params) == 'none') {
             } else {
                 $ufAdd[2] = $params['additional_custom_post_id'];
             }
         }
         if (CRM_Utils_Array::value('additional_custom_post_id_multiple', $params)) {
             $additionalPostMultiple = array();
             foreach ($params['additional_custom_post_id_multiple'] as $key => $value) {
                 if (!$value && CRM_Utils_Array::value('custom_post_id', $params)) {
                     $additionalPostMultiple[$key] = $params['custom_post_id'];
                 } elseif ($value == 'none') {
                     continue;
                 } elseif ($value) {
                     $additionalPostMultiple[$key] = $value;
                 }
             }
             $ufAdd = array_merge($ufAdd, $additionalPostMultiple);
         }
         $ufAdd = array_values($ufAdd);
         if (!empty($ufAdd)) {
             foreach ($ufAdd as $weightAdd => $ufGroupIdAdd) {
                 $ufJoinParamsAdd['weight'] = $weightAdd + $wtAdd;
                 $ufJoinParamsAdd['uf_group_id'] = $ufGroupIdAdd;
                 CRM_Core_BAO_UFJoin::create($ufJoinParamsAdd);
                 unset($ufJoinParamsAdd['id']);
             }
         }
     }
     parent::endPostProcess();
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Registration.php

示例15: postProcess

 /**
  * Process the form
  *
  * @return void
  * @access public
  */
 function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     if ($this->_action & CRM_CORE_ACTION_UPDATE) {
         $params['id'] = $this->_id;
     }
     $params['domain_id'] = CRM_Core_Config::domainID();
     CRM_Core_DAO::transaction('BEGIN');
     // also update the ProfileModule tables
     $ufJoinParams = array('is_active' => 1, 'module' => 'CiviContribute', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id, 'weight' => 1, 'uf_group_id' => $params['custom_pre_id']);
     require_once 'CRM/Core/BAO/UFJoin.php';
     CRM_Core_BAO_UFJoin::create($ufJoinParams);
     unset($ufJoinParams['id']);
     $ufJoinParams['weight'] = 2;
     $ufJoinParams['uf_group_id'] = $params['custom_post_id'];
     CRM_Core_BAO_UFJoin::create($ufJoinParams);
     CRM_Core_DAO::transaction('COMMIT');
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:25,代码来源:Custom.php


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