本文整理汇总了PHP中CRM_Event_Form_ManageEvent::endPostProcess方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_Form_ManageEvent::endPostProcess方法的具体用法?PHP CRM_Event_Form_ManageEvent::endPostProcess怎么用?PHP CRM_Event_Form_ManageEvent::endPostProcess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Event_Form_ManageEvent
的用法示例。
在下文中一共展示了CRM_Event_Form_ManageEvent::endPostProcess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess()
{
$params = $this->exportValues();
$params['id'] = $this->_id;
CRM_Event_BAO_Event::add($params);
parent::endPostProcess();
}
示例2: postProcess
/**
* Process the form submission.
*
* @return void
*/
public function postProcess()
{
// TODO:: is this required?
$params = $this->controller->exportValues($this->_name);
$existParams['page_id'] = $this->_id;
$existParams['page_category'] = "civicrm_event";
$existingEnrty = array();
CRM_WebTracking_BAO_WebTracking::retrieve($existParams, $existingEnrty);
// Setting up the params array with the values obtained from the form
if (!empty($existingEnrty)) {
$params['id'] = $existingEnrty['id'];
}
$params['page_id'] = $this->_id;
$params['page_category'] = "civicrm_event";
$params['enable_tracking'] = CRM_Utils_Array::value('enable_tracking', $params, FALSE);
$params['tracking_id'] = CRM_Utils_Array::value('tracking_id', $params, NULL);
$params['ga_event_tracking'] = CRM_Utils_Array::value('ga_event_tracking', $params, FALSE);
$params['track_info'] = CRM_Utils_Array::value('track_info', $params, FALSE);
$params['track_register'] = CRM_Utils_Array::value('track_register', $params, FALSE);
$params['track_confirm_register'] = CRM_Utils_Array::value('track_confirm_register', $params, FALSE);
$params['track_thank_you'] = CRM_Utils_Array::value('track_thank_you', $params, FALSE);
$params['track_price_change'] = CRM_Utils_Array::value('track_price_change', $params, FALSE);
$params['track_ecommerce'] = CRM_Utils_Array::value('track_ecommerce', $params, FALSE);
$params['is_experiment'] = CRM_Utils_Array::value('is_experiment', $params, FALSE);
$params['experiment_id'] = CRM_Utils_Array::value('experiment_id', $params, NULL);
// Updating the database with the new entry
$event = CRM_WebTracking_BAO_WebTracking::add($params);
parent::endPostProcess();
}
示例3: postProcess
//.........这里部分代码省略.........
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
$profileIds = array(CRM_Utils_Array::value('custom_pre_id', $params), CRM_Utils_Array::value('custom_post_id', $params));
$additionalProfileIds = array(CRM_Utils_Array::value('additional_custom_pre_id', $params), CRM_Utils_Array::value('additional_custom_post_id', $params));
// additional profile fields default to main if not set
if (!is_numeric($additionalProfileIds[0])) {
$additionalProfileIds[0] = $profileIds[0];
}
if (!is_numeric($additionalProfileIds[1])) {
$additionalProfileIds[1] = $profileIds[1];
}
//add multiple profiles if set
self::addMultipleProfiles($profileIds, $params, 'custom_post_id_multiple');
self::addMultipleProfiles($additionalProfileIds, $params, 'additional_custom_post_id_multiple');
$cantDedupe = FALSE;
$rgId = CRM_Utils_Array::value('dedupe_rule_group_id', $params, 0);
switch (self::canProfilesDedupe($profileIds, $rgId)) {
case 0:
$dedupeTitle = 'Duplicate Matching Impossible';
$cantDedupe = ts("The selected profiles do not contain the fields necessary to match registrations with existing contacts. This means all anonymous registrations will result in a new contact.");
break;
case 1:
$dedupeTitle = 'Duplicate Contacts Possible';
$cantDedupe = ts("The selected profiles can collect enough information to match registrations with existing contacts, but not all of the relevant fields are required. Anonymous registrations may result in duplicate contacts.");
}
if (!empty($params['is_multiple_registrations'])) {
switch (self::canProfilesDedupe($additionalProfileIds, $rgId)) {
case 0:
$dedupeTitle = 'Duplicate Matching Impossible';
if ($cantDedupe) {
$cantDedupe = ts("The selected profiles do not contain the fields necessary to match registrations with existing contacts. This means all anonymous registrations will result in a new contact.");
} else {
$cantDedupe = ts("The selected profiles do not contain the fields necessary to match additional participants with existing contacts. This means all additional participants will result in a new contact.");
}
break;
case 1:
if (!$cantDedupe) {
$dedupeTitle = 'Duplicate Contacts Possible';
$cantDedupe = ts("The selected profiles can collect enough information to match additional participants with existing contacts, but not all of the relevant fields are required. This may result in duplicate contacts.");
}
}
}
if ($cantDedupe) {
CRM_Core_Session::setStatus($cantDedupe, $dedupeTitle, 'alert dedupenotify', array('expires' => 0));
}
// Update tab "disabled" css class
$this->ajaxResponse['tabValid'] = !empty($params['is_online_registration']);
parent::endPostProcess();
}
示例4: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
//format params
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time']);
$params['end_date'] = CRM_Utils_Date::processDate($params['end_date'], $params['end_date_time'], true);
$params['has_waitlist'] = CRM_Utils_Array::value('has_waitlist', $params, false);
$params['is_map'] = CRM_Utils_Array::value('is_map', $params, false);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, false);
$params['is_public'] = CRM_Utils_Array::value('is_public', $params, false);
$params['default_role_id'] = CRM_Utils_Array::value('default_role_id', $params, false);
$params['id'] = $this->_id;
//new event, so lets set the created_id
if ($this->_action & CRM_Core_Action::ADD) {
$session =& CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$params['created_date'] = date('YmdHis');
}
$customFields = CRM_Core_BAO_CustomField::getFields('Event', false, false, CRM_Utils_Array::value('event_type_id', $params));
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_id, 'Event');
require_once 'CRM/Event/BAO/Event.php';
// copy all not explicitely set $params keys from the template (if it should be sourced)
if (CRM_Utils_Array::value('template_id', $params)) {
$defaults = array();
$templateParams = array('id' => $params['template_id']);
CRM_Event_BAO_Event::retrieve($templateParams, $defaults);
unset($defaults['id']);
unset($defaults['default_fee_id']);
unset($defaults['default_discount_fee_id']);
foreach ($defaults as $key => $value) {
if (!isset($params[$key])) {
$params[$key] = $value;
}
}
}
$event = CRM_Event_BAO_Event::create($params);
// now that we have the event’s id, do some more template-based stuff
if (CRM_Utils_Array::value('template_id', $params)) {
// copy event fees
$ogParams = array('name' => "civicrm_event.amount.{$event->id}");
$defaults = array();
require_once 'CRM/Core/BAO/OptionGroup.php';
if (is_null(CRM_Core_BAO_OptionGroup::retrieve($ogParams, $defaults))) {
// Copy the Main Event Fees
CRM_Core_BAO_OptionGroup::copyValue('event', $params['template_id'], $event->id);
// Copy the Discount option Group and Values
require_once 'CRM/Core/BAO/Discount.php';
$optionGroupIds = CRM_Core_BAO_Discount::getOptionGroup($params['template_id'], "civicrm_event");
foreach ($optionGroupIds as $id) {
$discountSuffix = '.discount.' . CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $id, 'label');
CRM_Core_BAO_OptionGroup::copyValue('event', $params['template_id'], $event->id, false, $discountSuffix);
}
}
// copy price sets if any
require_once 'CRM/Price/BAO/Set.php';
$priceSetId = CRM_Price_BAO_Set::getFor('civicrm_event', $params['template_id']);
if ($priceSetId) {
CRM_Price_BAO_Set::addTo('civicrm_event', $event->id, $priceSetId);
}
// link profiles if none linked
$ufParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id);
require_once 'CRM/Core/BAO/UFJoin.php';
if (!CRM_Core_BAO_UFJoin::findUFGroupId($ufParams)) {
CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin', array('entity_id' => $params['template_id'], 'entity_table' => 'civicrm_event'), array('entity_id' => $event->id));
}
// if no Tell-a-Friend defined, check whether there’s one for template and copy if so
$tafParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id);
require_once 'CRM/Friend/BAO/Friend.php';
if (!CRM_Friend_BAO_Friend::getValues($tafParams)) {
$tafParams['entity_id'] = $params['template_id'];
if (CRM_Friend_BAO_Friend::getValues($tafParams)) {
$tafParams['entity_id'] = $event->id;
CRM_Friend_BAO_Friend::addTellAFriend($tafParams);
}
}
}
$this->set('id', $event->id);
if ($this->_action & CRM_Core_Action::ADD) {
$urlParam = "action=update&reset=1&subPage=Location&id={$event->id}";
// special case for 'Save and Done' consistency.
if ($this->controller->getButtonName('submit') == "_qf_EventInfo_upload_done") {
$urlParam = "action=update&reset=1&id={$event->id}";
CRM_Core_Session::setStatus(ts("'%1' information has been saved.", array(1 => $this->getTitle())));
}
CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), $urlParam));
}
parent::endPostProcess();
}
示例5: postProcess
/**
* Function to process the form. Enables/disables Volunteer Project. If the
* Project does not already exist, it is created, along with a "flexible" Need.
*
* @access public
*
* @return None
*/
public function postProcess()
{
$form = $this->exportValues();
$form['is_active'] = CRM_Utils_Array::value('is_active', $form, 0);
$params = array('entity_id' => $this->_id, 'entity_table' => CRM_Event_DAO_Event::$_tableName);
// see if this project already exists
$projects = CRM_Volunteer_BAO_Project::retrieve($params);
if (count($projects)) {
// force an update rather than an insert
$params['id'] = current($projects)->id;
}
// save the project record
$params += array('is_active' => $form['is_active'], 'target_contact_id' => $form['target_contact_id']);
$project = CRM_Volunteer_BAO_Project::create($params);
// if the project doesn't already exist and the user enabled vol management,
// create the flexible need
if (count($projects) !== 1 && $form['is_active'] === '1') {
$need = array('project_id' => $project->id, 'is_flexible' => '1', 'visibility_id' => CRM_Core_OptionGroup::getValue('visibility', 'public', 'name'));
CRM_Volunteer_BAO_Need::create($need);
}
parent::endPostProcess();
}
示例6: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
public function postProcess()
{
// get the submitted form values.
$formValues = $this->controller->exportValues($this->_name);
// let's unset event id
unset($formValues['id']);
$formValues['entity_table'] = 'civicrm_event';
$formValues['entity_id'] = $this->_id;
$formValues['title'] = $formValues['tf_title'];
$formValues['is_active'] = CRM_Utils_Array::value('tf_is_active', $formValues, false);
if ($this->_action & CRM_Core_Action::UPDATE && $this->_friendId) {
$formValues['id'] = $this->_friendId;
}
CRM_Friend_BAO_Friend::addTellAFriend($formValues);
parent::endPostProcess();
}
示例7: postProcess
//.........这里部分代码省略.........
CRM_Price_BAO_Set::addTo('civicrm_event', $this->_id, $priceSet->id);
$fieldParams['option_label'] = $params['label'];
$fieldParams['option_amount'] = $params['value'];
foreach ($options as $value) {
$fieldParams['option_weight'][$value['weight']] = $value['weight'];
}
$fieldParams['default_option'] = $params['default'];
$priceField = CRM_Price_BAO_Field::create($fieldParams);
}
}
}
$discountPriceSets = CRM_Utils_Array::value('discount_price_set', $this->_defaultValues) ? $this->_defaultValues['discount_price_set'] : array();
$discountFieldIDs = CRM_Utils_Array::value('discount_option_id', $this->_defaultValues) ? $this->_defaultValues['discount_option_id'] : array();
if (CRM_Utils_Array::value('is_discount', $params) == 1) {
// if there are discounted set of label / values,
// create custom options for them
$labels = CRM_Utils_Array::value('discounted_label', $params);
$values = CRM_Utils_Array::value('discounted_value', $params);
$default = CRM_Utils_Array::value('discounted_default', $params);
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
for ($j = 1; $j <= self::NUM_DISCOUNT; $j++) {
$discountOptions = array();
for ($i = 1; $i < self::NUM_OPTION; $i++) {
if (!empty($labels[$i]) && !empty($values[$i][$j])) {
$discountOptions[] = array('label' => trim($labels[$i]), 'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i][$j])), 'weight' => $i, 'is_active' => 1, 'is_default' => $default == $i);
}
}
if (!empty($discountOptions)) {
$fieldParams = array();
$params['default_discount_fee_id'] = NULL;
$keyCheck = $j - 1;
if (!CRM_Utils_Array::value($keyCheck, $discountPriceSets)) {
if (!$eventTitle) {
$eventTitle = strtolower(CRM_Utils_String::munge($this->_defaultValues['title'], '_', 200));
}
$setParams['title'] = $params['discount_name'][$j];
if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $eventTitle . '_' . $params['discount_name'][$j], 'id', 'name')) {
$setParams['name'] = $eventTitle . '_' . $params['discount_name'][$j];
} elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $eventTitle . '_' . $params['discount_name'][$j] . '_' . $this->_id, 'id', 'name')) {
$setParams['name'] = $eventTitle . '_' . $params['discount_name'][$j] . '_' . $this->_id;
} else {
$timeSec = explode(".", microtime(true));
$setParams['name'] = $eventTitle . '_' . $params['discount_name'][$j] . '_' . date('is', $timeSec[0]) . $timeSec[1];
}
$setParams['is_quick_config'] = 1;
$setParams['extends'] = CRM_Core_Component::getComponentID('CiviEvent');
$priceSet = CRM_Price_BAO_Set::create($setParams);
$priceSetID = $priceSet->id;
} else {
$priceSetID = $discountPriceSets[$j - 1];
unset($discountPriceSets[$j - 1]);
$fieldParams['id'] = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Field', $priceSetID, 'id', 'price_set_id');
}
$fieldParams['name'] = $fieldParams['label'] = $params['fee_label'];
$fieldParams['is_required'] = 1;
$fieldParams['price_set_id'] = $priceSetID;
$fieldParams['html_type'] = 'Radio';
foreach ($discountOptions as $value) {
$fieldParams['option_label'][$value['weight']] = $value['label'];
$fieldParams['option_amount'][$value['weight']] = $value['value'];
$fieldParams['option_weight'][$value['weight']] = $value['weight'];
if (CRM_Utils_Array::value('is_default', $value)) {
$fieldParams['default_option'] = $value['weight'];
}
if (CRM_Utils_Array::value($j, $discountFieldIDs) && CRM_Utils_Array::value($value['weight'] - 1, $discountFieldIDs[$j])) {
$fieldParams['option_id'][$value['weight']] = $discountFieldIDs[$j][$value['weight'] - 1];
unset($discountFieldIDs[$j][$value['weight'] - 1]);
}
}
//create discount priceset
$priceField = CRM_Price_BAO_Field::create($fieldParams);
if (!empty($discountFieldIDs)) {
foreach ($discountFieldIDs as $fID) {
CRM_Price_BAO_FieldValue::setIsActive($fID, '0');
}
}
$discountParams = array('entity_table' => 'civicrm_event', 'entity_id' => $this->_id, 'option_group_id' => $priceSetID, 'start_date' => CRM_Utils_Date::processDate($params["discount_start_date"][$j]), 'end_date' => CRM_Utils_Date::processDate($params["discount_end_date"][$j]));
CRM_Core_BAO_Discount::add($discountParams);
}
}
}
}
if (!empty($discountPriceSets)) {
foreach ($discountPriceSets as $setId) {
CRM_Price_BAO_Set::setIsQuickConfig($setId, 0);
}
}
}
} else {
if (CRM_Utils_Array::value('price_field_id', $params)) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', $params['price_field_id'], 'price_set_id');
CRM_Price_BAO_Set::setIsQuickConfig($priceSetID, 0);
}
$params['contribution_type_id'] = '';
}
//update events table
$params['id'] = $this->_id;
CRM_Event_BAO_Event::add($params);
parent::endPostProcess();
}
示例8: postProcess
//.........这里部分代码省略.........
$default = CRM_Utils_Array::value('discounted_default', $params);
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
for ($j = 1; $j <= self::NUM_DISCOUNT; $j++) {
$discountOptions = array();
for ($i = 1; $i < self::NUM_OPTION; $i++) {
if (!empty($labels[$i]) && !CRM_Utils_System::isNull(CRM_Utils_Array::value($j, $values[$i]))) {
$discountOptions[] = array('label' => trim($labels[$i]), 'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i][$j])), 'weight' => $i, 'is_active' => 1, 'is_default' => $default == $i);
}
}
if (!empty($discountOptions)) {
$fieldParams = array();
$params['default_discount_fee_id'] = NULL;
$keyCheck = $j - 1;
$setParams = array();
if (empty($discountPriceSets[$keyCheck])) {
if (!$eventTitle) {
$eventTitle = strtolower(CRM_Utils_String::munge($this->_defaultValues['title'], '_', 200));
}
$setParams['title'] = $params['discount_name'][$j];
if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle . '_' . $params['discount_name'][$j], 'id', 'name')) {
$setParams['name'] = $eventTitle . '_' . $params['discount_name'][$j];
} elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceSet', $eventTitle . '_' . $params['discount_name'][$j] . '_' . $this->_id, 'id', 'name')) {
$setParams['name'] = $eventTitle . '_' . $params['discount_name'][$j] . '_' . $this->_id;
} else {
$timeSec = explode('.', microtime(TRUE));
$setParams['name'] = $eventTitle . '_' . $params['discount_name'][$j] . '_' . date('is', $timeSec[0]) . $timeSec[1];
}
$setParams['is_quick_config'] = 1;
$setParams['financial_type_id'] = $params['financial_type_id'];
$setParams['extends'] = CRM_Core_Component::getComponentID('CiviEvent');
$priceSet = CRM_Price_BAO_PriceSet::create($setParams);
$priceSetID = $priceSet->id;
} else {
$priceSetID = $discountPriceSets[$j - 1];
$setParams = array('title' => $params['discount_name'][$j], 'id' => $priceSetID);
if ($this->_defaultValues['financial_type_id'] != $params['financial_type_id']) {
$setParams['financial_type_id'] = $params['financial_type_id'];
}
CRM_Price_BAO_PriceSet::create($setParams);
unset($discountPriceSets[$j - 1]);
$fieldParams['id'] = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceField', $priceSetID, 'id', 'price_set_id');
}
$fieldParams['name'] = $fieldParams['label'] = $params['fee_label'];
$fieldParams['is_required'] = 1;
$fieldParams['price_set_id'] = $priceSetID;
$fieldParams['html_type'] = 'Radio';
$fieldParams['financial_type_id'] = $params['financial_type_id'];
foreach ($discountOptions as $value) {
$fieldParams['option_label'][$value['weight']] = $value['label'];
$fieldParams['option_amount'][$value['weight']] = $value['value'];
$fieldParams['option_weight'][$value['weight']] = $value['weight'];
if (!empty($value['is_default'])) {
$fieldParams['default_option'] = $value['weight'];
}
if (!empty($discountFieldIDs[$j]) && !empty($discountFieldIDs[$j][$value['weight']])) {
$fieldParams['option_id'][$value['weight']] = $discountFieldIDs[$j][$value['weight']];
unset($discountFieldIDs[$j][$value['weight']]);
}
}
//create discount priceset
$priceField = CRM_Price_BAO_PriceField::create($fieldParams);
if (!empty($discountFieldIDs[$j])) {
foreach ($discountFieldIDs[$j] as $fID) {
CRM_Price_BAO_PriceFieldValue::setIsActive($fID, '0');
}
}
$discountParams = array('entity_table' => 'civicrm_event', 'entity_id' => $this->_id, 'price_set_id' => $priceSetID, 'start_date' => CRM_Utils_Date::processDate($params['discount_start_date'][$j]), 'end_date' => CRM_Utils_Date::processDate($params['discount_end_date'][$j]));
CRM_Core_BAO_Discount::add($discountParams);
}
}
}
}
if (!empty($discountPriceSets)) {
foreach ($discountPriceSets as $setId) {
CRM_Price_BAO_PriceSet::setIsQuickConfig($setId, 0);
}
}
}
} else {
if (!empty($params['price_field_id'])) {
$priceSetID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceField', $params['price_field_id'], 'price_set_id');
CRM_Price_BAO_PriceSet::setIsQuickConfig($priceSetID, 0);
}
$params['financial_type_id'] = '';
$params['is_pay_later'] = 0;
$params['is_billing_required'] = 0;
}
//update 'is_billing_required'
if (empty($params['is_pay_later'])) {
$params['is_billing_required'] = FALSE;
}
//update events table
$params['id'] = $this->_id;
// skip update of financial type in price set
$params['skipFinancialType'] = TRUE;
CRM_Event_BAO_Event::add($params);
// Update tab "disabled" css class
$this->ajaxResponse['tabValid'] = !empty($params['is_monetary']);
parent::endPostProcess();
}
示例9: postProcess
/**
* Process the form submission.
*
*
* @return void
*/
public function postProcess()
{
// get the submitted form values.
$params = $this->controller->exportValues($this->_name);
// Source
$params['entity_table'] = 'civicrm_event';
$params['entity_id'] = $this->_id;
// Target
$params['target_entity_type'] = CRM_Utils_Array::value('target_entity_type', $params, 'event');
if ($params['target_entity_type'] == 'event') {
$params['target_entity_id'] = $this->_id;
} else {
$params['target_entity_id'] = CRM_Utils_Array::value('target_entity_id', $params, $this->_id);
}
$dao = new CRM_PCP_DAO_PCPBlock();
$dao->entity_table = $params['entity_table'];
$dao->entity_id = $this->_id;
$dao->find(TRUE);
$params['id'] = $dao->id;
$params['is_active'] = CRM_Utils_Array::value('pcp_active', $params, FALSE);
$params['is_approval_needed'] = CRM_Utils_Array::value('is_approval_needed', $params, FALSE);
$params['is_tellfriend_enabled'] = CRM_Utils_Array::value('is_tellfriend_enabled', $params, FALSE);
$dao = CRM_PCP_BAO_PCP::add($params);
// Update tab "disabled" css class
$this->ajaxResponse['tabValid'] = !empty($params['is_active']);
parent::endPostProcess();
}
示例10: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
$params = array();
$params = $this->exportValues();
$this->set('discountSection', 0);
if (CRM_Utils_Array::value('_qf_Fee_submit', $_POST)) {
$this->buildAmountLabel();
$this->set('discountSection', 1);
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/event/manage', '#isDiscount'));
return;
}
$params['is_pay_later'] = CRM_Utils_Array::value('is_pay_later', $params, 0);
if ($this->_id) {
require_once 'CRM/Price/BAO/Set.php';
// delete all the prior label values or discounts in the custom options table
// and delete a price set if one exists
if (!CRM_Price_BAO_Set::removeFrom('civicrm_event', $this->_id)) {
require_once 'CRM/Core/OptionGroup.php';
CRM_Core_OptionGroup::deleteAssoc("civicrm_event.amount.{$this->_id}");
CRM_Core_OptionGroup::deleteAssoc("civicrm_event.amount.{$this->_id}.discount.%", "LIKE");
}
}
if ($params['is_monetary']) {
if ($params['price_set_id']) {
CRM_Price_BAO_Set::addTo('civicrm_event', $this->_id, $params['price_set_id']);
} else {
// if there are label / values, create custom options for them
$labels = CRM_Utils_Array::value('label', $params);
$values = CRM_Utils_Array::value('value', $params);
$default = CRM_Utils_Array::value('default', $params);
$options = array();
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
for ($i = 1; $i < self::NUM_OPTION; $i++) {
if (!empty($labels[$i]) && !CRM_Utils_System::isNull($values[$i])) {
$options[] = array('label' => trim($labels[$i]), 'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i])), 'weight' => $i, 'is_active' => 1, 'is_default' => $default == $i);
}
}
if (!empty($options)) {
$params['default_fee_id'] = null;
CRM_Core_OptionGroup::createAssoc("civicrm_event.amount.{$this->_id}", $options, $params['default_fee_id']);
}
}
if (CRM_Utils_Array::value('is_discount', $params) == 1) {
// if there are discounted set of label / values,
// create custom options for them
$labels = CRM_Utils_Array::value('discounted_label', $params);
$values = CRM_Utils_Array::value('discounted_value', $params);
$default = CRM_Utils_Array::value('discounted_default', $params);
if (!CRM_Utils_System::isNull($labels) && !CRM_Utils_System::isNull($values)) {
for ($j = 1; $j <= self::NUM_DISCOUNT; $j++) {
$discountOptions = array();
for ($i = 1; $i < self::NUM_OPTION; $i++) {
if (!empty($labels[$i]) && CRM_Utils_Array::value($j, $values[$i])) {
$discountOptions[] = array('label' => trim($labels[$i]), 'value' => CRM_Utils_Rule::cleanMoney(trim($values[$i][$j])), 'weight' => $i, 'is_active' => 1, 'is_default' => $default == $i);
}
}
if (!empty($discountOptions)) {
$params['default_discount_fee_id'] = null;
$discountOptionsGroupId = CRM_Core_OptionGroup::createAssoc("civicrm_event.amount.{$this->_id}.discount.{$params['discount_name'][$j]}", $discountOptions, $params['default_discount_fee_id'], $params['discount_name'][$j]);
$discountParams = array('entity_table' => 'civicrm_event', 'entity_id' => $this->_id, 'option_group_id' => $discountOptionsGroupId, 'start_date' => CRM_Utils_Date::format($params["discount_start_date"][$j]), 'end_date' => CRM_Utils_Date::format($params["discount_end_date"][$j]));
require_once 'CRM/Core/BAO/Discount.php';
CRM_Core_BAO_Discount::add($discountParams);
}
}
}
}
}
} else {
$params['contribution_type_id'] = '';
}
//update events table
require_once 'CRM/Event/BAO/Event.php';
$params['id'] = $this->_id;
CRM_Event_BAO_Event::add($params);
parent::endPostProcess();
}
示例11: postProcess
/**
* Function to process the form
*
* @access public
* @return None
*/
public function postProcess()
{
$params = $this->exportValues();
$delteOldBlock = false;
// if 'use existing location' option is selected -
if ($params['location_option'] == 2 && CRM_Utils_Array::value('loc_event_id', $params) && $params['loc_event_id'] != $this->_oldLocBlockId) {
// if new selected loc is different from old loc, update the loc_block_id
// so that loc update would affect the selected loc and not the old one.
$delteOldBlock = true;
CRM_Core_DAO::setFieldValue('CRM_Event_DAO_Event', $this->_id, 'loc_block_id', $params['loc_event_id']);
}
// if 'create new loc' option is selected, set the loc_block_id for this event to null
// so that an update would result in creating a new loc.
if ($this->_oldLocBlockId && $params['location_option'] == 1) {
$delteOldBlock = true;
CRM_Core_DAO::setFieldValue('CRM_Event_DAO_Event', $this->_id, 'loc_block_id', 'null');
}
// if 'create new loc' optioin is selected OR selected new loc is different
// from old one, go ahead and delete the old loc provided thats not being
// used by any other event
if ($this->_oldLocBlockId && $delteOldBlock) {
CRM_Event_BAO_Event::deleteEventLocBlock($this->_oldLocBlockId, $this->_id);
}
// get ready with location block params
$params['entity_table'] = 'civicrm_event';
$params['entity_id'] = $this->_id;
require_once 'CRM/Core/BAO/LocationType.php';
$defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
foreach (array('address', 'phone', 'email') as $block) {
if (!CRM_Utils_Array::value($block, $params) || !is_array($params[$block])) {
continue;
}
foreach ($params[$block] as $count => &$values) {
if ($count == 1) {
$values['is_primary'] = 1;
}
$values['location_type_id'] = $defaultLocationType->id ? $defaultLocationType->id : 1;
}
}
// create/update event location
require_once 'CRM/Core/BAO/Location.php';
$location = CRM_Core_BAO_Location::create($params, true, 'event');
$params['loc_block_id'] = $location['id'];
// finally update event params
$params['id'] = $this->_id;
require_once 'CRM/Event/BAO/Event.php';
CRM_Event_BAO_Event::add($params);
parent::endPostProcess();
}
示例12: 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();
//.........这里部分代码省略.........
示例13: postProcess
/**
* Function to process the form
*
* @access public
*
* @return void
*/
public function postProcess()
{
// get the submitted form values.
$formValues = $this->controller->exportValues($this->_name);
// let's unset event id
unset($formValues['id']);
$formValues['entity_table'] = 'civicrm_event';
$formValues['entity_id'] = $this->_id;
$formValues['title'] = $formValues['tf_title'];
$formValues['is_active'] = CRM_Utils_Array::value('tf_is_active', $formValues, FALSE);
$formValues['thankyou_title'] = CRM_Utils_Array::value('tf_thankyou_title', $formValues);
$formValues['thankyou_text'] = CRM_Utils_Array::value('tf_thankyou_text', $formValues);
if ($this->_action & CRM_Core_Action::UPDATE && $this->_friendId) {
$formValues['id'] = $this->_friendId;
}
CRM_Friend_BAO_Friend::addTellAFriend($formValues);
// Update tab "disabled" css class
$this->ajaxResponse['tabValid'] = !empty($formValues['tf_is_active']);
parent::endPostProcess();
}
示例14: postProcess
/**
* Function to process the form
*
* @access public
*
* @return None
*/
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
//format params
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time']);
$params['end_date'] = CRM_Utils_Date::processDate(CRM_Utils_Array::value('end_date', $params), CRM_Utils_Array::value('end_date_time', $params), TRUE);
$params['has_waitlist'] = CRM_Utils_Array::value('has_waitlist', $params, FALSE);
$params['is_map'] = CRM_Utils_Array::value('is_map', $params, FALSE);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_public'] = CRM_Utils_Array::value('is_public', $params, FALSE);
$params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
$params['default_role_id'] = CRM_Utils_Array::value('default_role_id', $params, FALSE);
$params['id'] = $this->_id;
$customFields = CRM_Core_BAO_CustomField::getFields('Event', FALSE, FALSE, CRM_Utils_Array::value('event_type_id', $params));
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $customFields, $this->_id, 'Event');
//merge params with defaults from templates
if (CRM_Utils_Array::value('template_id', $params)) {
$params = array_merge(CRM_Event_BAO_Event::getTemplateDefaultValues($params['template_id']), $params);
}
$event = CRM_Event_BAO_Event::create($params);
// now that we have the event’s id, do some more template-based stuff
if (CRM_Utils_Array::value('template_id', $params)) {
// copy price sets if any
$priceSetId = CRM_Price_BAO_Set::getFor('civicrm_event', $params['template_id']);
if ($priceSetId) {
$isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $priceSetId, 'is_quick_config');
if ($isQuickConfig) {
$copyPriceSet =& CRM_Price_BAO_Set::copy($priceSetId);
$priceSetId = $copyPriceSet->id;
}
CRM_Price_BAO_Set::addTo('civicrm_event', $event->id, $priceSetId);
}
// link profiles if none linked
$ufParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id);
if (!CRM_Core_BAO_UFJoin::findUFGroupId($ufParams)) {
CRM_Core_DAO::copyGeneric('CRM_Core_DAO_UFJoin', array('entity_id' => $params['template_id'], 'entity_table' => 'civicrm_event'), array('entity_id' => $event->id));
}
// if no Tell-a-Friend defined, check whether there’s one for template and copy if so
$tafParams = array('entity_table' => 'civicrm_event', 'entity_id' => $event->id);
if (!CRM_Friend_BAO_Friend::getValues($tafParams)) {
$tafParams['entity_id'] = $params['template_id'];
if (CRM_Friend_BAO_Friend::getValues($tafParams)) {
$tafParams['entity_id'] = $event->id;
if (isset($tafParams['id'])) {
unset($tafParams['id']);
}
CRM_Friend_BAO_Friend::addTellAFriend($tafParams);
}
}
//copy pcp settings
CRM_Core_DAO::copyGeneric('CRM_PCP_DAO_PCPBlock', array('entity_id' => $params['template_id'], 'entity_table' => 'civicrm_event'), array('entity_id' => $event->id), array('replace' => array('target_entity_id' => $event->id)));
//copy event schedule remainder
CRM_Core_DAO::copyGeneric('CRM_Core_DAO_ActionSchedule', array('entity_value' => $params['template_id']), array('entity_value' => $event->id));
}
$this->set('id', $event->id);
if ($this->_action & CRM_Core_Action::ADD) {
$url = 'civicrm/event/manage/location';
$urlParams = "action=update&reset=1&id={$event->id}";
// special case for 'Save and Done' consistency.
if ($this->controller->getButtonName('submit') == '_qf_EventInfo_upload_done') {
$url = 'civicrm/event/manage';
$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();
}
示例15: postProcess
/**
* Process the form submission.
*/
public function postProcess()
{
$params = $this->controller->exportValues($this->_name);
//format params
$params['start_date'] = CRM_Utils_Date::processDate($params['start_date'], $params['start_date_time']);
$params['end_date'] = CRM_Utils_Date::processDate(CRM_Utils_Array::value('end_date', $params), CRM_Utils_Array::value('end_date_time', $params), TRUE);
$params['has_waitlist'] = CRM_Utils_Array::value('has_waitlist', $params, FALSE);
$params['is_map'] = CRM_Utils_Array::value('is_map', $params, FALSE);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['is_public'] = CRM_Utils_Array::value('is_public', $params, FALSE);
$params['is_share'] = CRM_Utils_Array::value('is_share', $params, FALSE);
$params['default_role_id'] = CRM_Utils_Array::value('default_role_id', $params, FALSE);
$params['id'] = $this->_id;
$customFields = CRM_Core_BAO_CustomField::getFields('Event', FALSE, FALSE, CRM_Utils_Array::value('event_type_id', $params));
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params, $this->_id, 'Event');
//merge params with defaults from templates
if (!empty($params['template_id'])) {
$params = array_merge(CRM_Event_BAO_Event::getTemplateDefaultValues($params['template_id']), $params);
}
$event = CRM_Event_BAO_Event::create($params);
// now that we have the event’s id, do some more template-based stuff
if (!empty($params['template_id'])) {
CRM_Event_BAO_Event::copy($params['template_id'], $event, TRUE);
}
$this->set('id', $event->id);
$this->postProcessHook();
if ($this->_action & CRM_Core_Action::ADD) {
$url = 'civicrm/event/manage/location';
$urlParams = "action=update&reset=1&id={$event->id}";
// special case for 'Save and Done' consistency.
if ($this->controller->getButtonName('submit') == '_qf_EventInfo_upload_done') {
$url = 'civicrm/event/manage';
$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();
}