本文整理汇总了PHP中CRM_Event_Form_ManageEvent类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_Form_ManageEvent类的具体用法?PHP CRM_Event_Form_ManageEvent怎么用?PHP CRM_Event_Form_ManageEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Event_Form_ManageEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: process
/**
* @param CRM_Event_Form_ManageEvent $form
*
* @return array
* @throws Exception
*/
public static function process(&$form)
{
if ($form->getVar('_id') <= 0) {
return NULL;
}
$default = array('link' => NULL, 'valid' => TRUE, 'active' => TRUE, 'current' => FALSE, 'class' => 'ajaxForm');
$tabs = array();
$tabs['settings'] = array('title' => ts('Info and Settings'), 'class' => 'ajaxForm livePage') + $default;
$tabs['location'] = array('title' => ts('Event Location')) + $default;
$tabs['fee'] = array('title' => ts('Fees')) + $default;
$tabs['registration'] = array('title' => ts('Online Registration')) + $default;
if (CRM_Core_Permission::check('administer CiviCRM') || CRM_Event_BAO_Event::checkPermission(NULL, CRM_Core_Permission::EDIT)) {
$tabs['reminder'] = array('title' => ts('Schedule Reminders'), 'class' => 'livePage') + $default;
}
$tabs['conference'] = array('title' => ts('Conference Slots')) + $default;
$tabs['friend'] = array('title' => ts('Tell a Friend')) + $default;
$tabs['pcp'] = array('title' => ts('Personal Campaigns')) + $default;
$tabs['repeat'] = array('title' => ts('Repeat')) + $default;
// Repeat tab must refresh page when switching repeat mode so js & vars will get set-up
if (!$form->_isRepeatingEvent) {
unset($tabs['repeat']['class']);
}
// check if we're in shopping cart mode for events
$enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
if (!$enableCart) {
unset($tabs['conference']);
}
$eventID = $form->getVar('_id');
if ($eventID) {
// disable tabs based on their configuration status
$sql = "\nSELECT e.loc_block_id as is_location, e.is_online_registration, e.is_monetary, taf.is_active, pcp.is_active as is_pcp, sch.id as is_reminder, re.id as is_repeating_event\nFROM civicrm_event e\nLEFT JOIN civicrm_tell_friend taf ON ( taf.entity_table = 'civicrm_event' AND taf.entity_id = e.id )\nLEFT JOIN civicrm_pcp_block pcp ON ( pcp.entity_table = 'civicrm_event' AND pcp.entity_id = e.id )\nLEFT JOIN civicrm_action_mapping map ON ( map.entity_value = 'civicrm_event' )\nLEFT JOIN civicrm_action_schedule sch ON ( sch.mapping_id = map.id AND sch.entity_value = %1 )\nLEFT JOIN civicrm_recurring_entity re ON ( e.id = re.entity_id AND re.entity_table = 'civicrm_event' )\nWHERE e.id = %1\n";
//Check if repeat is configured
$eventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($eventID, 'civicrm_event');
$params = array(1 => array($eventID, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($sql, $params);
if (!$dao->fetch()) {
CRM_Core_Error::fatal();
}
if (!$dao->is_location) {
$tabs['location']['valid'] = FALSE;
}
if (!$dao->is_online_registration) {
$tabs['registration']['valid'] = FALSE;
}
if (!$dao->is_monetary) {
$tabs['fee']['valid'] = FALSE;
}
if (!$dao->is_active) {
$tabs['friend']['valid'] = FALSE;
}
if (!$dao->is_pcp) {
$tabs['pcp']['valid'] = FALSE;
}
if (!$dao->is_reminder) {
$tabs['reminder']['valid'] = FALSE;
}
if (!$dao->is_repeating_event) {
$tabs['repeat']['valid'] = FALSE;
}
}
// see if any other modules want to add any tabs
// note: status of 'valid' flag of any injected tab, needs to be taken care in the hook implementation.
CRM_Utils_Hook::tabset('civicrm/event/manage', $tabs, array('event_id' => $eventID));
$fullName = $form->getVar('_name');
$className = CRM_Utils_String::getClassName($fullName);
$new = '';
// hack for special cases.
switch ($className) {
case 'Event':
$attributes = $form->getVar('_attributes');
$class = strtolower(basename(CRM_Utils_Array::value('action', $attributes)));
break;
case 'EventInfo':
$class = 'settings';
break;
case 'ScheduleReminders':
$class = 'reminder';
break;
default:
$class = strtolower($className);
break;
}
if (array_key_exists($class, $tabs)) {
$tabs[$class]['current'] = TRUE;
$qfKey = $form->get('qfKey');
if ($qfKey) {
$tabs[$class]['qfKey'] = "&qfKey={$qfKey}";
}
}
if ($eventID) {
$reset = !empty($_GET['reset']) ? 'reset=1&' : '';
foreach ($tabs as $key => $value) {
if (!isset($tabs[$key]['qfKey'])) {
$tabs[$key]['qfKey'] = NULL;
//.........这里部分代码省略.........
开发者ID:agloa,项目名称:tournament,代码行数:101,代码来源:TabHeader.php
示例2: preProcess
/**
* Set variables up before form is built.
*
* @return void
*/
public function preProcess()
{
parent::preProcess();
$setTab = CRM_Utils_Request::retrieve('setTab', 'Int', $this, FALSE, 0);
$mapping = CRM_Utils_Array::first(CRM_Core_BAO_ActionSchedule::getMappings(array('id' => $this->_isTemplate ? CRM_Event_ActionMapping::EVENT_TPL_MAPPING_ID : CRM_Event_ActionMapping::EVENT_NAME_MAPPING_ID)));
$reminderList = CRM_Core_BAO_ActionSchedule::getList(FALSE, $mapping, $this->_id);
if ($reminderList && is_array($reminderList)) {
// Add action links to each of the reminders
foreach ($reminderList as &$format) {
$action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE;
if ($format['is_active']) {
$action += CRM_Core_Action::DISABLE;
} else {
$action += CRM_Core_Action::ENABLE;
}
$scheduleReminder = new CRM_Admin_Page_ScheduleReminders();
$links = $scheduleReminder->links();
$links[CRM_Core_Action::DELETE]['qs'] .= "&context=event&compId={$this->_id}";
$links[CRM_Core_Action::UPDATE]['qs'] .= "&context=event&compId={$this->_id}";
$format['action'] = CRM_Core_Action::formLink($links, $action, array('id' => $format['id']), ts('more'), FALSE, 'actionSchedule.manage.action', 'ActionSchedule', $this->_id);
}
}
$this->assign('rows', $reminderList);
$this->assign('setTab', $setTab);
$this->assign('component', 'event');
// Update tab "disabled" css class
$this->ajaxResponse['tabValid'] = is_array($reminderList) && count($reminderList) > 0;
$this->setPageTitle(ts('Scheduled Reminder'));
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:34,代码来源:ScheduleReminders.php
示例3: postProcess
public function postProcess()
{
$params = $this->exportValues();
$params['id'] = $this->_id;
CRM_Event_BAO_Event::add($params);
parent::endPostProcess();
}
开发者ID:agloa,项目名称:tournament,代码行数:7,代码来源:Conference.php
示例4: preProcess
/**
* Set variables up before form is built.
*
* @return void
*/
public function preProcess()
{
parent::preProcess();
if ($this->_isTemplate) {
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'template_title');
} else {
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'title');
}
if (!CRM_Event_BAO_Event::checkPermission($this->_id, CRM_Core_Permission::DELETE)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
}
}
开发者ID:agloa,项目名称:tournament,代码行数:17,代码来源:Delete.php
示例5: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
parent::preProcess();
//check for delete
if (!CRM_Core_Permission::checkActionPermission('CiviEvent', $this->_action)) {
CRM_Core_Error::fatal(ts('You do not have permission to access this page'));
}
if ($this->_isTemplate) {
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'template_title');
} else {
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'title');
}
}
开发者ID:ksecor,项目名称:civicrm,代码行数:19,代码来源:Delete.php
示例6: 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();
}
开发者ID:VishalAgarwal,项目名称:org.civicrm.webtracking,代码行数:34,代码来源:Event.php
示例7: 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
示例8: 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();
}
开发者ID:relldoesphp,项目名称:civivolunteer,代码行数:30,代码来源:Volunteer.php
示例9: 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();
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:94,代码来源:EventInfo.php
示例10: postProcess
/**
* Process the form submission. 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->getSubmitValues();
$form['is_active'] = CRM_Utils_Array::value('is_active', $form, 0);
$params = array();
if ($this->getProject()) {
// force an update rather than an insert
$params['id'] = $this->getProject()->id;
}
// save the project record
$params += array('is_active' => $form['is_active'], 'target_contact_id' => $form['target_contact_id']);
/* @var $project CRM_Volunteer_BAO_Project */
$project = $this->saveProject($params);
$this->saveProfileSelections($form['custom_signup_profiles']);
self::validateProfileForDedupe($form['custom_signup_profiles']);
parent::endPostProcess();
}
开发者ID:adam-edison,项目名称:org.civicrm.volunteer,代码行数:25,代码来源:Volunteer.php
示例11: 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();
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:22,代码来源:Event.php
示例12: postProcess
public function postProcess()
{
$params = array();
$params = $this->exportValues();
if (trim($params['parent_event_name']) === '') {
# believe me...
$params['parent_event_id'] = '';
}
//update events table
$params['id'] = $this->_id;
CRM_Event_BAO_Event::add($params);
parent::endPostProcess();
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:13,代码来源:Conference.php
示例13: postProcess
/**
* Function to process the form
*
* @access public
*
* @return void
*/
public function postProcess()
{
if ($this->_action & CRM_Core_Action::DELETE) {
// delete reminder
CRM_Core_BAO_ActionSchedule::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected Reminder has been deleted.'), ts('Record Deleted'), 'success');
return;
}
$values = $this->controller->exportValues($this->getName());
$keys = array('title', 'subject', 'absolute_date', 'group_id', 'record_activity', 'limit_to');
foreach ($keys as $key) {
$params[$key] = CRM_Utils_Array::value($key, $values);
}
$moreKeys = array('start_action_offset', 'start_action_unit', 'start_action_condition', 'start_action_date', 'repetition_frequency_unit', 'repetition_frequency_interval', 'end_frequency_unit', 'end_frequency_interval', 'end_action', 'end_date');
if ($absoluteDate = CRM_Utils_Array::value('absolute_date', $params)) {
$params['absolute_date'] = CRM_Utils_Date::processDate($absoluteDate);
foreach ($moreKeys as $mkey) {
$params[$mkey] = 'null';
}
} else {
$params['absolute_date'] = 'null';
foreach ($moreKeys as $mkey) {
$params[$mkey] = CRM_Utils_Array::value($mkey, $values);
}
}
$params['body_text'] = CRM_Utils_Array::value('text_message', $values);
$params['body_html'] = CRM_Utils_Array::value('html_message', $values);
if (CRM_Utils_Array::value('recipient', $values) == 'manual') {
$params['recipient_manual'] = CRM_Utils_Array::value('recipient_manual_id', $values);
$params['group_id'] = $params['recipient'] = $params['recipient_listing'] = 'null';
} elseif (CRM_Utils_Array::value('recipient', $values) == 'group') {
$params['group_id'] = $values['group_id'];
$params['recipient_manual'] = $params['recipient'] = $params['recipient_listing'] = 'null';
} elseif (!CRM_Utils_System::isNull($values['recipient_listing'])) {
$params['recipient'] = CRM_Utils_Array::value('recipient', $values);
$params['recipient_listing'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('recipient_listing', $values));
$params['group_id'] = $params['recipient_manual'] = 'null';
} else {
$params['recipient'] = CRM_Utils_Array::value('recipient', $values);
$params['group_id'] = $params['recipient_manual'] = $params['recipient_listing'] = 'null';
}
$params['mapping_id'] = $this->_mappingID;
$params['entity_value'] = $this->_id;
$params['entity_status'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $values['entity']);
$params['is_active'] = CRM_Utils_Array::value('is_active', $values, 0);
$params['is_repeat'] = CRM_Utils_Array::value('is_repeat', $values, 0);
if (CRM_Utils_Array::value('is_repeat', $values) == 0) {
$params['repetition_frequency_unit'] = 'null';
$params['repetition_frequency_interval'] = 'null';
$params['end_frequency_unit'] = 'null';
$params['end_frequency_interval'] = 'null';
$params['end_action'] = 'null';
$params['end_date'] = 'null';
}
$params['name'] = CRM_Utils_String::munge($params['title'], '_', 64);
$composeFields = array('template', 'saveTemplate', 'updateTemplate', 'saveTemplateName');
$msgTemplate = NULL;
//mail template is composed
$composeParams = array();
foreach ($composeFields as $key) {
if (!empty($values[$key])) {
$composeParams[$key] = $values[$key];
}
}
if (!empty($composeParams['updateTemplate'])) {
$templateParams = array('msg_text' => $params['body_text'], 'msg_html' => $params['body_html'], 'msg_subject' => $params['subject'], 'is_active' => TRUE);
$templateParams['id'] = $values['template'];
$msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
}
if (!empty($composeParams['saveTemplate'])) {
$templateParams = array('msg_text' => $params['body_text'], 'msg_html' => $params['body_html'], 'msg_subject' => $params['subject'], 'is_active' => TRUE);
$templateParams['msg_title'] = $composeParams['saveTemplateName'];
$msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
}
if (isset($msgTemplate->id)) {
$params['msg_template_id'] = $msgTemplate->id;
} else {
$params['msg_template_id'] = CRM_Utils_Array::value('template', $values);
}
CRM_Core_BAO_ActionSchedule::add($params, $ids);
$status = ts("Your new Reminder titled %1 has been saved.", array(1 => "<strong>{$values['title']}</strong>"));
CRM_Core_Session::setStatus($status, ts('Saved'), 'success');
parent::endPostProcess();
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:91,代码来源:ScheduleReminders.php
示例14: 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();
}
开发者ID:ksecor,项目名称:civicrm,代码行数:55,代码来源:Location.php
示例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();
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:42,代码来源:EventInfo.php
示例16: postProcess
/**
* Process the form
*
* @return void
* @access public
*/
public function postProcess()
{
$params = array();
$eventTitle = '';
$params = $this->exportValues();
$this->set('discountSection', 0);
if (CRM_Utils_Array::value('_qf_Fee_submit', $_POST)) {
$this->buildAmountLabel();
$this->set('discountSection', 2);
return;
}
if (array_key_exists('payment_processor', $params) && !CRM_Utils_System::isNull($params['payment_processor'])) {
$params['payment_processor'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['payment_processor']));
} else {
$params['payment_processor'] = 'null';
}
$params['is_pay_later'] = CRM_Utils_Array::value('is_pay_later', $params, 0);
if ($this->_id) {
// 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)) {
CRM_Core_BAO_Discount::del($this->_id, 'civicrm_event');
}
}
if ($params['is_monetary']) {
if (CRM_Utils_Array::value('price_set_id', $params)) {
CRM_Price_BAO_Set::addTo('civicrm_event', $this->_id, $params['price_set_id']);
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);
}
} 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;
if (!CRM_Utils_Array::value('price_set_id', $params)) {
if (!CRM_Utils_Array::value('price_field_id', $params)) {
$eventTitle = $this->_isTemplate ? $this->_defaultValues['template_title'] : $this->_defaultValues['title'];
if (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $eventTitle, 'id', 'title')) {
$setParams['name'] = $setParams['title'] = $eventTitle;
} elseif (!CRM_Core_DAO::getFieldValue('CRM_Price_BAO_Set', $eventTitle . '_' . $this->_id, 'id', 'title')) {
$setParams['name'] = $setParams['title'] = $eventTitle . '_' . $this->_id;
} else {
$timeSec = explode(".", microtime(true));
$setParams['name'] = $setParams['title'] = $eventTitle . '_' . 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);
$fieldParams['name'] = $fieldParams['label'] = $params['fee_label'];
$fieldParams['price_set_id'] = $priceSet->id;
} else {
foreach ($params['price_field_value'] as $arrayID => $fieldValueID) {
if (empty($params['label'][$arrayID]) && empty($params['value'][$arrayID]) && !empty($fieldValueID)) {
CRM_Price_BAO_FieldValue::setIsActive($fieldValueID, '0');
unset($params['price_field_value'][$arrayID]);
}
}
$fieldParams['id'] = CRM_Utils_Array::value('price_field_id', $params);
$fieldParams['option_id'] = $params['price_field_value'];
$priceSet->id = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Field', CRM_Utils_Array::value('price_field_id', $params), 'price_set_id');
}
$fieldParams['html_type'] = 'Radio';
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++) {
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Fee.php
示例17: 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::val
|
请发表评论