本文整理汇总了PHP中CRM_Event_BAO_Event类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_BAO_Event类的具体用法?PHP CRM_Event_BAO_Event怎么用?PHP CRM_Event_BAO_Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Event_BAO_Event类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: retrieveEvent
protected function retrieveEvent($eventID)
{
$bao = new CRM_Event_BAO_Event();
if ($bao->get('id', $eventID)) {
return $bao;
}
return NULL;
}
开发者ID:hguru,项目名称:224Civi,代码行数:8,代码来源:Badge.php
示例2: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
/**
* You can define a custom title for the search form
*/
$this->setTitle('Find Totals for Events');
/**
* Define the search form fields here
*/
$form->addElement('checkbox', 'paid_online', ts('Only show Credit Card Payments'));
$form->addElement('checkbox', 'show_payees', ts('Show payees'));
$event_type = CRM_Core_OptionGroup::values('event_type', FALSE);
foreach ($event_type as $eventId => $eventName) {
$form->addElement('checkbox', "event_type_id[{$eventId}]", 'Event Type', $eventName);
}
$events = CRM_Event_BAO_Event::getEvents(1);
$form->add('select', 'event_id', ts('Event Name'), array('' => ts('- select -')) + $events);
$form->addDate('start_date', ts('Payments Date From'), FALSE, array('formatType' => 'custom'));
$form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
$form->assign('elements', array('paid_online', 'start_date', 'end_date', 'show_payees', 'event_type_id', 'event_id'));
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:28,代码来源:EventAggregate.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: registerParticipant
/**
* @param array $params
* @param $participant
* @param $event
*
* @return mixed
*/
public function registerParticipant($params, &$participant, $event)
{
$transaction = new CRM_Core_Transaction();
// handle register date CRM-4320
$registerDate = date('YmdHis');
$participantParams = array('id' => $participant->id, 'event_id' => $event->id, 'register_date' => $registerDate, 'source' => CRM_Utils_Array::value('participant_source', $params, $this->description), 'is_pay_later' => $this->is_pay_later, 'fee_amount' => CRM_Utils_Array::value('amount', $params, 0), 'fee_currency' => CRM_Utils_Array::value('currencyID', $params));
if ($participant->must_wait) {
$participant_status = 'On waitlist';
} elseif (CRM_Utils_Array::value('is_pay_later', $params, FALSE)) {
$participant_status = 'Pending from pay later';
} else {
$participant_status = 'Registered';
}
$participant_statuses = CRM_Event_PseudoConstant::participantStatus();
$participantParams['status_id'] = array_search($participant_status, $participant_statuses);
$participant_status_label = CRM_Utils_Array::value($participantParams['status_id'], CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'));
$participantParams['participant_status'] = $participant_status_label;
$this->assign('isOnWaitlist', $participant->must_wait);
if ($this->_action & CRM_Core_Action::PREVIEW || CRM_Utils_Array::value('mode', $params) == 'test') {
$participantParams['is_test'] = 1;
} else {
$participantParams['is_test'] = 0;
}
if (self::is_administrator()) {
if (!empty($params['note'])) {
$note_params = array('participant_id' => $participant->id, 'contact_id' => self::getContactID(), 'note' => $params['note']);
CRM_Event_BAO_Participant::update_note($note_params);
}
}
$participant->copyValues($participantParams);
$participant->save();
if (!empty($params['contributionID'])) {
$payment_params = array('participant_id' => $participant->id, 'contribution_id' => $params['contributionID']);
$ids = array();
$paymentParticpant = CRM_Event_BAO_ParticipantPayment::create($payment_params, $ids);
}
$transaction->commit();
$event_values = array();
CRM_Core_DAO::storeValues($event, $event_values);
$location = array();
if (CRM_Utils_Array::value('is_show_location', $event_values) == 1) {
$locationParams = array('entity_id' => $participant->event_id, 'entity_table' => 'civicrm_event');
$location = CRM_Core_BAO_Location::getValues($locationParams, TRUE);
CRM_Core_BAO_Address::fixAddress($location['address'][1]);
}
list($pre_id, $post_id) = CRM_Event_Cart_Form_MerParticipant::get_profile_groups($participant->event_id);
$payer_values = array('email' => '', 'name' => '');
if ($this->payer_contact_id) {
$payer_contact_details = CRM_Contact_BAO_Contact::getContactDetails($this->payer_contact_id);
$payer_values = array('email' => $payer_contact_details[1], 'name' => $payer_contact_details[0]);
}
$values = array('params' => array($participant->id => $participantParams), 'event' => $event_values, 'location' => $location, 'custom_pre_id' => $pre_id, 'custom_post_id' => $post_id, 'payer' => $payer_values);
CRM_Event_BAO_Event::sendMail($participant->contact_id, $values, $participant->id);
return $participant;
}
开发者ID:agloa,项目名称:tournament,代码行数:62,代码来源:Payment.php
示例5: validate
function validate()
{
parent::validate();
if ($this->_errors) {
return FALSE;
}
$this->cart->load_associations();
$fields = $this->_submitValues;
foreach ($this->cart->get_main_events_in_carts() as $event_in_cart) {
$price_set_id = CRM_Event_BAO_Event::usesPriceSet($event_in_cart->event_id);
if ($price_set_id) {
$priceField = new CRM_Price_DAO_PriceField();
$priceField->price_set_id = $price_set_id;
$priceField->find();
$check = array();
while ($priceField->fetch()) {
if (!empty($fields["event_{$event_in_cart->event_id}_price_{$priceField->id}"])) {
$check[] = $priceField->id;
}
}
//XXX
if (empty($check)) {
$this->_errors['_qf_default'] = ts("Select at least one option from Price Levels.");
}
$lineItem = array();
if (is_array($this->_values['fee']['fields'])) {
CRM_Price_BAO_PriceSet::processAmount($this->_values['fee']['fields'], $fields, $lineItem);
//XXX total...
if ($fields['amount'] < 0) {
$this->_errors['_qf_default'] = ts("Price Levels can not be less than zero. Please select the options accordingly");
}
}
}
foreach ($event_in_cart->participants as $mer_participant) {
$participant_fields = $fields['event'][$event_in_cart->event_id]['participant'][$mer_participant->id];
//TODO what to do when profile responses differ for the same contact?
$contact_id = self::find_contact($participant_fields);
if ($contact_id) {
$participant = new CRM_Event_BAO_Participant();
$participant->event_id = $event_in_cart->event_id;
$participant->contact_id = $contact_id;
$statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
$participant->find();
while ($participant->fetch()) {
if (array_key_exists($participant->status_id, $statusTypes)) {
$form = $mer_participant->get_form();
$this->_errors[$form->html_field_name('email')] = ts("The participant %1 is already registered for %2 (%3).", array(1 => $participant_fields['email'], 2 => $event_in_cart->event->title, 3 => $event_in_cart->event->start_date));
}
}
}
}
}
return empty($this->_errors);
}
开发者ID:hguru,项目名称:224Civi,代码行数:54,代码来源:ParticipantsAndPrices.php
示例6: preProcess
function preProcess()
{
parent::preProcess();
$matches = array();
preg_match("/.*_(\\d+)_(\\d+)/", $this->getAttribute('name'), $matches);
$event_id = $matches[1];
$participant_id = $matches[2];
$event_in_cart = $this->cart->get_event_in_cart_by_event_id($event_id);
$this->conference_event = $event_in_cart->event;
$this->main_participant = $event_in_cart->get_participant_by_id($participant_id);
$this->contact_id = $this->main_participant->contact_id;
$this->main_participant->display_name = CRM_Contact_BAO_Contact::displayName($this->contact_id);
$events = new CRM_Event_BAO_Event();
$query = <<<EOS
\t SELECT
civicrm_event.*,
slot.label AS slot_label
FROM
civicrm_event
JOIN
civicrm_option_value slot ON civicrm_event.slot_label_id = slot.value
JOIN
civicrm_option_group og ON slot.option_group_id = og.id
\t WHERE
\t\tparent_event_id = {$this->conference_event->id}
AND civicrm_event.is_active = 1
AND COALESCE(civicrm_event.is_template, 0) = 0
AND og.name = 'conference_slot'
\t ORDER BY
\t\tslot.weight, start_date
EOS;
$events->query($query);
while ($events->fetch()) {
if (!array_key_exists($events->slot_label, $this->events_by_slot)) {
$this->events_by_slot[$events->slot_label] = array();
}
$this->events_by_slot[$events->slot_label][] = clone $events;
}
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:39,代码来源:ConferenceEvents.php
示例7: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*
* @return void
* @access public
*
*/
function preProcess()
{
CRM_Utils_System::setTitle(ts('CiviEvent'));
$eventSummary = CRM_Event_BAO_Event::getEventSummary();
$actionColumn = FALSE;
if (!empty($eventSummary) && isset($eventSummary['events']) && is_array($eventSummary['events'])) {
foreach ($eventSummary['events'] as $e) {
if (isset($e['isMap']) || isset($e['configure'])) {
$actionColumn = TRUE;
break;
}
}
}
$this->assign('actionColumn', $actionColumn);
$this->assign('eventSummary', $eventSummary);
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:24,代码来源:DashBoard.php
示例8: postProcess
/**
* Process the form when submitted.
*/
public function postProcess()
{
$participant = new CRM_Event_DAO_Participant();
$participant->event_id = $this->_id;
if ($participant->find()) {
$searchURL = CRM_Utils_System::url('civicrm/event/search', 'reset=1');
CRM_Core_Session::setStatus(ts('This event cannot be deleted because there are participant records linked to it. If you want to delete this event, you must first find the participants linked to this event and delete them. You can use use <a href=\'%1\'> CiviEvent >> Find Participants page </a>.', array(1 => $searchURL)), ts('Deletion Error'), 'error');
return;
}
CRM_Event_BAO_Event::del($this->_id);
if ($this->_isTemplate) {
CRM_Core_Session::setStatus(ts("'%1' has been deleted.", array(1 => $this->_title)), ts('Template Deleted'), 'success');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/eventTemplate', 'reset=1'));
} else {
CRM_Core_Session::setStatus(ts("'%1' has been deleted.", array(1 => $this->_title)), ts('Event Deleted'), 'success');
}
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:20,代码来源:Delete.php
示例9: run
/**
* Heart of the iCalendar data assignment process. The runner gets all the meta
* data for the event and calls the method to output the iCalendar
* to the user. If gData param is passed on the URL, outputs gData XML format.
* Else outputs iCalendar format per IETF RFC2445. Page param true means send
* to browser as inline content. Else, we send .ics file as attachment.
*
* @return void
*/
function run()
{
require_once "CRM/Utils/Request.php";
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false, null, 'GET');
$type = CRM_Utils_Request::retrieve('type', 'Positive', $this, false, 0);
$start = CRM_Utils_Request::retrieve('start', 'Positive', $this, false, 0);
$end = CRM_Utils_Request::retrieve('end', 'Positive', $this, false, 0);
$iCalPage = CRM_Utils_Request::retrieve('page', 'Positive', $this, false, 0);
$gData = CRM_Utils_Request::retrieve('gData', 'Positive', $this, false, 0);
$html = CRM_Utils_Request::retrieve('html', 'Positive', $this, false, 0);
$rss = CRM_Utils_Request::retrieve('rss', 'Positive', $this, false, 0);
require_once "CRM/Event/BAO/Event.php";
$info = CRM_Event_BAO_Event::getCompleteInfo($start, $type, $id, $end);
$this->assign('events', $info);
// Send data to the correct template for formatting (iCal vs. gData)
$template = CRM_Core_Smarty::singleton();
$config = CRM_Core_Config::singleton();
if ($rss) {
// rss 2.0 requires lower case dash delimited locale
$this->assign('rssLang', str_replace('_', '-', strtolower($config->lcMessages)));
$calendar = $template->fetch('CRM/Core/Calendar/Rss.tpl');
} else {
if ($gData) {
$calendar = $template->fetch('CRM/Core/Calendar/GData.tpl');
} else {
if ($html) {
return parent::run();
} else {
$calendar = $template->fetch('CRM/Core/Calendar/ICal.tpl');
}
}
}
// Push output for feed or download
require_once "CRM/Utils/ICalendar.php";
if ($iCalPage == 1) {
if ($gData || $rss) {
CRM_Utils_ICalendar::send($calendar, 'text/xml', 'utf-8');
} else {
CRM_Utils_ICalendar::send($calendar, 'text/plain', 'utf-8');
}
} else {
CRM_Utils_ICalendar::send($calendar, 'text/calendar', 'utf-8', 'civicrm_ical.ics', 'attachment');
}
CRM_Utils_System::civiExit();
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:54,代码来源:ICalendar.php
示例10: run
/**
* Heart of the iCalendar data assignment process. The runner gets all the meta
* data for the event and calls the method to output the iCalendar
* to the user. If gData param is passed on the URL, outputs gData XML format.
* Else outputs iCalendar format per IETF RFC2445. Page param true means send
* to browser as inline content. Else, we send .ics file as attachment.
*
* @return void
*/
public function run()
{
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, NULL, 'GET');
$type = CRM_Utils_Request::retrieve('type', 'Positive', $this, FALSE, 0);
$start = CRM_Utils_Request::retrieve('start', 'Positive', $this, FALSE, 0);
$end = CRM_Utils_Request::retrieve('end', 'Positive', $this, FALSE, 0);
$iCalPage = CRM_Utils_Request::retrieve('list', 'Positive', $this, FALSE, 0);
$gData = CRM_Utils_Request::retrieve('gData', 'Positive', $this, FALSE, 0);
$html = CRM_Utils_Request::retrieve('html', 'Positive', $this, FALSE, 0);
$rss = CRM_Utils_Request::retrieve('rss', 'Positive', $this, FALSE, 0);
$info = CRM_Event_BAO_Event::getCompleteInfo($start, $type, $id, $end, false);
$this->assign('events', $info);
$this->assign('timezone', @date_default_timezone_get());
// Send data to the correct template for formatting (iCal vs. gData)
$template = CRM_Core_Smarty::singleton();
$config = CRM_Core_Config::singleton();
if ($rss) {
// rss 2.0 requires lower case dash delimited locale
$this->assign('rssLang', str_replace('_', '-', strtolower($config->lcMessages)));
$calendar = $template->fetch('CRM/Core/Calendar/Rss.tpl');
} elseif ($gData) {
$calendar = $template->fetch('CRM/Core/Calendar/GData.tpl');
} elseif ($html) {
// check if we're in shopping cart mode for events
$enable_cart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
if ($enable_cart) {
$this->assign('registration_links', TRUE);
}
return parent::run();
} else {
$calendar = $template->fetch('CRM/Core/Calendar/ICal.tpl');
$calendar = preg_replace('/(?<!\\r)\\n/', "\r\n", $calendar);
}
// Push output for feed or download
if ($iCalPage == 1) {
if ($gData || $rss) {
CRM_Utils_ICalendar::send($calendar, 'text/xml', 'utf-8');
} else {
CRM_Utils_ICalendar::send($calendar, 'text/plain', 'utf-8');
}
} else {
CRM_Utils_ICalendar::send($calendar, 'text/calendar', 'utf-8', 'civicrm_ical.ics', 'attachment');
}
CRM_Utils_System::civiExit();
}
开发者ID:CiviCooP,项目名称:org.civicoop.eventprivateical,代码行数:54,代码来源:Ical.php
示例11: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*
* @return void
*/
public function preProcess()
{
CRM_Utils_System::setTitle(ts('CiviEvent'));
$eventSummary = CRM_Event_BAO_Event::getEventSummary();
$enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart');
$eventSummary['tab'] = CRM_Event_Page_ManageEvent::tabs($enableCart);
$actionColumn = FALSE;
if (!empty($eventSummary) && isset($eventSummary['events']) && is_array($eventSummary['events'])) {
foreach ($eventSummary['events'] as $e) {
if (isset($e['isMap']) || isset($e['configure'])) {
$actionColumn = TRUE;
break;
}
}
}
$this->assign('actionColumn', $actionColumn);
$this->assign('eventSummary', $eventSummary);
}
开发者ID:agloa,项目名称:tournament,代码行数:24,代码来源:DashBoard.php
示例12: init
/**
* The initializer code, called before the processing.
*/
public function init()
{
$fields = CRM_Event_BAO_Participant::importableFields($this->_contactType, FALSE);
$fields['event_id']['title'] = 'Event ID';
$eventfields =& CRM_Event_BAO_Event::fields();
$fields['event_title'] = $eventfields['event_title'];
foreach ($fields as $name => $field) {
$field['type'] = CRM_Utils_Array::value('type', $field, CRM_Utils_Type::T_INT);
$field['dataPattern'] = CRM_Utils_Array::value('dataPattern', $field, '//');
$field['headerPattern'] = CRM_Utils_Array::value('headerPattern', $field, '//');
$this->addField($name, $field['title'], $field['type'], $field['headerPattern'], $field['dataPattern']);
}
$this->_newParticipants = array();
$this->setActiveFields($this->_mapperKeys);
// FIXME: we should do this in one place together with Form/MapField.php
$this->_contactIdIndex = -1;
$this->_eventIndex = -1;
$this->_participantStatusIndex = -1;
$this->_participantRoleIndex = -1;
$this->_eventTitleIndex = -1;
$index = 0;
foreach ($this->_mapperKeys as $key) {
switch ($key) {
case 'participant_contact_id':
$this->_contactIdIndex = $index;
break;
case 'event_id':
$this->_eventIndex = $index;
break;
case 'participant_status':
case 'participant_status_id':
$this->_participantStatusIndex = $index;
break;
case 'participant_role_id':
$this->_participantRoleIndex = $index;
break;
case 'event_title':
$this->_eventTitleIndex = $index;
break;
}
$index++;
}
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:46,代码来源:Participant.php
示例13: init
/**
* the initializer code, called before the processing
*
* @return void
* @access public
*/
function init()
{
require_once 'CRM/Event/BAO/Participant.php';
$fields =& CRM_Event_BAO_Participant::importableFields($this->_contactType, false);
$fields['event_id']['title'] = "Event ID";
require_once 'CRM/Event/BAO/Event.php';
$eventfields =& CRM_Event_BAO_Event::fields();
$fields['event_title'] = $eventfields['event_title'];
foreach ($fields as $name => $field) {
$this->addField($name, $field['title'], $field['type'], $field['headerPattern'], $field['dataPattern']);
}
$this->_newParticipants = array();
$this->setActiveFields($this->_mapperKeys);
// FIXME: we should do this in one place together with Form/MapField.php
$this->_contactIdIndex = -1;
$this->_eventIndex = -1;
$this->_participantStatusIndex = -1;
$this->_participantRoleIndex = -1;
$this->_eventTitleIndex = -1;
$index = 0;
foreach ($this->_mapperKeys as $key) {
switch ($key) {
case 'participant_contact_id':
$this->_contactIdIndex = $index;
break;
case 'event_id':
$this->_eventIndex = $index;
break;
case 'participant_status':
case 'participant_status_id':
$this->_participantStatusIndex = $index;
break;
case 'participant_role_id':
$this->_participantRoleIndex = $index;
break;
case 'event_title':
$this->_eventTitleIndex = $index;
break;
}
$index++;
}
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:48,代码来源:Participant.php
示例14: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*
* @return void
* @access public
*
*/
function preProcess()
{
CRM_Utils_System::setTitle(ts('CiviEvent'));
$admin = false;
if (CRM_Core_Permission::check('access CiviEvent') && CRM_Core_Permission::check('administer CiviCRM')) {
$admin = true;
}
require_once 'CRM/Event/BAO/Event.php';
$eventSummary = CRM_Event_BAO_Event::getEventSummary($admin);
$eventMap = false;
if (!empty($eventSummary) && isset($eventSummary['events']) && is_array($eventSummary['events'])) {
foreach ($eventSummary['events'] as $e) {
if (isset($e['isMap'])) {
$eventMap = true;
}
}
}
$this->assign('eventAdmin', $admin);
$this->assign('eventMap', $eventMap);
$this->assign('eventSummary', $eventSummary);
}
开发者ID:ksecor,项目名称:civicrm,代码行数:29,代码来源:DashBoard.php
示例15: preProcess
public function preProcess()
{
parent::preProcess();
$this->assign('currentEventId', $this->_id);
$checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor($this->_id, 'civicrm_event');
//If this ID has parent, send parent id
if ($checkParentExistsForThisId) {
/**
* Get connected event information list
*/
//Get all connected event ids
$allEventIdsArray = CRM_Core_BAO_RecurringEntity::getEntitiesForParent($checkParentExistsForThisId, 'civicrm_event');
$allEventIds = array();
if (!empty($allEventIdsArray)) {
foreach ($allEventIdsArray as $key => $val) {
$allEventIds[] = $val['id'];
}
if (!empty($allEventIds)) {
$params = array();
$query = "\n SELECT *\n FROM civicrm_event\n WHERE id IN (" . implode(",", $allEventIds) . ")\n ORDER BY start_date asc\n ";
$dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, 'CRM_Event_DAO_Event');
$permissions = CRM_Event_BAO_Event::checkPermission();
while ($dao->fetch()) {
if (in_array($dao->id, $permissions[CRM_Core_Permission::VIEW])) {
$manageEvent[$dao->id] = array();
CRM_Core_DAO::storeValues($dao, $manageEvent[$dao->id]);
}
}
}
$this->assign('rows', $manageEvent);
}
}
$parentEventParams = array('id' => $this->_id);
$parentEventValues = array();
$parentEventReturnProperties = array('start_date', 'end_date');
$parentEventAttributes = CRM_Core_DAO::commonRetrieve('CRM_Event_DAO_Event', $parentEventParams, $parentEventValues, $parentEventReturnProperties);
$this->_parentEventStartDate = $parentEventAttributes->start_date;
$this->_parentEventEndDate = $parentEventAttributes->end_date;
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:39,代码来源:Repeat.php
示例16: buildQuickForm
function buildQuickForm()
{
$events = CRM_Event_BAO_Event::getEvents(0);
$additionalOptions = array(1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9', 10 => '10');
if ($this->_soInstance) {
$soInstances = (array) $this->_soInstance;
$numString = $this->_soInstance;
$aEvents = array();
foreach ($events as $eventId => $eventVal) {
if (!array_key_exists($eventId, $this->_getreturn)) {
$aEvents[$eventId] = $eventVal;
}
}
$events = $aEvents;
} elseif (!empty($this->_getreturn)) {
$soInstances = range(1, count($this->_getreturn), 1);
$numString = 2;
} else {
$soInstances = array(1);
$numString = 1;
}
$allEvents = CRM_Event_BAO_Event::getEvents(0);
if ($soInstances[0] <= count($allEvents)) {
foreach ($soInstances as $instance) {
$this->addElement('select', "event_id_{$instance}", ts('Event Name'), array('' => ts('- select -')) + $events);
$this->addElement('select', "additional_participants_{$instance}", ts('Max_Participants'), $additionalOptions);
}
}
$this->assign('numStrings', $numString);
$cancelURL = CRM_Utils_System::url('civicrm/participant/config', 'reset=1');
$this->assign('elementNames', $this->getRenderableElementNames());
if ($this->_soInstance) {
return;
}
$cancelURL = CRM_Utils_System::url('civicrm/participant/config', 'reset=1');
$this->addButtons(array(array('type' => 'submit', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'), 'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"))));
$this->addFormRule(array('CRM_maxadditionalparticipants_Form_Admin', 'formRule'), $this);
}
开发者ID:Kajakaran,项目名称:uk.co.vedaconsulting.maxadditionalparticipants,代码行数:38,代码来源:Admin.php
示例17: completeTransaction
//.........这里部分代码省略.........
$logStartDate = $formatedParams['start_date'];
if (CRM_Utils_Array::value('log_start_date', $dates)) {
$logStartDate = CRM_Utils_Date::customFormat($dates['log_start_date'], $format);
$logStartDate = CRM_Utils_Date::isoToMysql($logStartDate);
}
$membershipLog['start_date'] = $logStartDate;
$membershipLog['membership_id'] = $membership->id;
$membershipLog['modified_id'] = $membership->contact_id;
$membershipLog['modified_date'] = date('Ymd');
$membershipLog['membership_type_id'] = $membership->membership_type_id;
CRM_Member_BAO_MembershipLog::add($membershipLog, CRM_Core_DAO::$_nullArray);
//update related Memberships.
CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $formatedParams);
//update the membership type key of membership relatedObjects array
//if it has changed after membership update
if ($membershipTypeIdKey != $membership->membership_type_id) {
$membershipsUpdate[$membership->membership_type_id] = $membership;
$contribution->_relatedObjects['membership'][$membership->membership_type_id] = $membership;
unset($contribution->_relatedObjects['membership'][$membershipTypeIdKey]);
unset($memberships[$membershipTypeIdKey]);
}
}
}
//update the memberships object with updated membershipTypeId data
//if membershipTypeId has changed after membership update
if (!empty($membershipsUpdate)) {
$memberships = $memberships + $membershipsUpdate;
}
}
} else {
// event
$eventParams = array('id' => $objects['event']->id);
$values['event'] = array();
CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
//get location details
$locationParams = array('entity_id' => $objects['event']->id, 'entity_table' => 'civicrm_event');
$values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
$ufJoinParams = array('entity_table' => 'civicrm_event', 'entity_id' => $ids['event'], 'module' => 'CiviEvent');
list($custom_pre_id, $custom_post_ids) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
$values['custom_pre_id'] = $custom_pre_id;
$values['custom_post_id'] = $custom_post_ids;
//for tasks 'Change Participant Status' and 'Batch Update Participants Via Profile' case
//and cases involving status updation through ipn
$values['totalAmount'] = $input['amount'];
$contribution->source = ts('Online Event Registration') . ': ' . $values['event']['title'];
if ($values['event']['is_email_confirm']) {
$contribution->receipt_date = self::$_now;
$values['is_email_receipt'] = 1;
}
if (!CRM_Utils_Array::value('skipComponentSync', $input)) {
$participant->status_id = 1;
}
$participant->save();
}
if (CRM_Utils_Array::value('net_amount', $input, 0) == 0 && CRM_Utils_Array::value('fee_amount', $input, 0) != 0) {
$input['net_amount'] = $input['amount'] - $input['fee_amount'];
}
// This complete transaction function is being overloaded to create new contributions too.
// here we record if it is a new contribution.
// @todo separate the 2 more appropriately.
$isNewContribution = FALSE;
if (empty($contribution->id)) {
$isNewContribution = TRUE;
if (!empty($input['amount']) && $input['amount'] != $contribution->total_amount) {
$contribution->total_amount = $input['amount'];
// The BAO does this stuff but we are actually kinda bypassing it here (bad code! go sit in the corner)
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:67,代码来源:BaseIPN.php
示例18: 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();
}
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:101,代码来源:Fee.php
|
请发表评论