/** * Create a Event * * This API is used for creating a Event * * @param array $params input parameters * Allowed @params array keys are: * {@getfields event_create} * * @return array API result Array. * @access public */ function civicrm_api3_event_create($params) { civicrm_api3_verify_one_mandatory($params, NULL, array('event_type_id', 'template_id')); // Clone event from template if (!empty($params['template_id']) && empty($params['id'])) { $copy = CRM_Event_BAO_Event::copy($params['template_id']); $params['id'] = $copy->id; unset($params['template_id']); } _civicrm_api3_event_create_legacy_support_42($params); return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Event'); }
/** * Create a Event. * * @param array $params * Input parameters. * * @return array * API result Array. */ function civicrm_api3_event_create($params) { // Required fields for creating an event if (empty($params['id']) && empty($params['is_template'])) { civicrm_api3_verify_mandatory($params, NULL, array('start_date', 'title', array('event_type_id', 'template_id'))); } elseif (empty($params['id']) && !empty($params['is_template'])) { civicrm_api3_verify_mandatory($params, NULL, array('template_title')); } // Clone event from template if (!empty($params['template_id']) && empty($params['id'])) { $copy = CRM_Event_BAO_Event::copy($params['template_id']); $params['id'] = $copy->id; unset($params['template_id']); } _civicrm_api3_event_create_legacy_support_42($params); return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Event'); }
/** * Create a Event * * This API is used for creating a Event * * @param array $params input parameters * Allowed @params array keys are: * {@getfields event_create} * * @return array API result Array. * @access public */ function civicrm_api3_event_create($params) { civicrm_api3_verify_one_mandatory($params, NULL, array('event_type_id', 'template_id')); // Clone event from template if (!empty($params['template_id']) && empty($params['id'])) { $copy = CRM_Event_BAO_Event::copy($params['template_id']); $params['id'] = $copy->id; unset($params['template_id']); if (empty($params['is_template'])) { $params['is_template'] = 0; } } _civicrm_api3_event_create_legacy_support_42($params); //format custom fields so they can be added $values = array(); _civicrm_api3_custom_format_params($params, $values, 'Event'); $params = array_merge($values, $params); $eventBAO = CRM_Event_BAO_Event::create($params); $event = array(); _civicrm_api3_object_to_array($eventBAO, $event[$eventBAO->id]); return civicrm_api3_create_success($event, $params); }
/** * 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(); }
/** * This function is to make a copy of a Event, including * all the fields in the event wizard * * @return void * @access public */ function copy() { $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, true, 0, 'GET'); require_once 'CRM/Event/BAO/Event.php'; $copyEvent = CRM_Event_BAO_Event::copy($id); $urlParams = 'reset=1'; // Redirect to Copied Event Configuration if ($copyEvent->id) { $urlParams .= '&action=update&id=' . $copyEvent->id; } return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/event/manage', $urlParams)); }
/** * make a copy of a Event, including * all the fields in the event wizard * * @return void */ public function copy() { $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE, 0, 'GET'); $urlString = 'civicrm/event/manage'; $copyEvent = CRM_Event_BAO_Event::copy($id); $urlParams = 'reset=1'; // Redirect to Copied Event Configuration if ($copyEvent->id) { $urlString = 'civicrm/event/manage/settings'; $urlParams .= '&action=update&id=' . $copyEvent->id; } return CRM_Utils_System::redirect(CRM_Utils_System::url($urlString, $urlParams)); }
/** * This function is to make a copy of a Event, including * all the fields in the event wizard * * @return void * @access public */ function copy() { $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, true, 0, 'GET'); require_once 'CRM/Event/BAO/Event.php'; CRM_Event_BAO_Event::copy($id); return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/event/manage', 'reset=1')); }