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


PHP CRM_Event_BAO_Participant::deleteParticipant方法代码示例

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


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

示例1: postProcess

 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  * @return None
  */
 public function postProcess()
 {
     $deletedParticipants = 0;
     require_once 'CRM/Event/BAO/Participant.php';
     foreach ($this->_participantIds as $participantId) {
         if (CRM_Event_BAO_Participant::deleteParticipant($participantId)) {
             $deletedParticipants++;
         }
     }
     $status = array(ts('Deleted Participation(s): %1', array(1 => $deletedParticipants)), ts('Total Selected Participation(s): %1', array(1 => count($this->_participantIds))));
     CRM_Core_Session::setStatus($status);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:18,代码来源:Delete.php

示例2: testCreate

 /**
  * Create() method (create and updation of participant)
  */
 public function testCreate()
 {
     $params = array('send_receipt' => 1, 'is_test' => 0, 'is_pay_later' => 0, 'event_id' => $this->_eventId, 'register_date' => date('Y-m-d') . " 00:00:00", 'role_id' => 1, 'status_id' => 1, 'source' => 'Event_' . $this->_eventId, 'contact_id' => $this->_contactId, 'note' => 'Note added for Event_' . $this->_eventId);
     $participant = CRM_Event_BAO_Participant::create($params);
     //Checking for Contact id in the participant table.
     $pid = $this->assertDBNotNull('CRM_Event_DAO_Participant', $this->_contactId, 'id', 'contact_id', 'Check DB for Participant of the contact');
     //Checking for Activity added in the table for relative participant.
     $this->assertDBCompareValue('CRM_Activity_DAO_Activity', $this->_contactId, 'source_record_id', 'source_contact_id', $participant->id, 'Check DB for activity added for the participant');
     $params = array_merge($params, array('id' => $participant->id, 'role_id' => 2, 'status_id' => 3, 'note' => 'Test Event in edit mode is running successfully ....'));
     $participant = CRM_Event_BAO_Participant::create($params);
     //Checking Edited Value of role_id in the database.
     $this->assertDBCompareValue('CRM_Event_DAO_Participant', $participant->id, 'role_id', 'id', 2, 'Check DB for updated role id of the participant');
     //Checking Edited Value of status_id in the database.
     $this->assertDBCompareValue('CRM_Event_DAO_Participant', $participant->id, 'status_id', 'id', 3, 'Check DB for updated status id  of the participant');
     //Checking for Activity added in the table for relative participant.
     $this->assertDBCompareValue('CRM_Activity_DAO_Activity', $this->_contactId, 'source_record_id', 'source_contact_id', $participant->id, 'Check DB for activity added for the participant');
     //Checking for Note added in the table for relative participant.
     $session = CRM_Core_Session::singleton();
     $id = $session->get('userID');
     if (!$id) {
         $id = $this->_contactId;
     }
     //Deleting the Participant created by create function in this function
     $deleteParticipant = CRM_Event_BAO_Participant::deleteParticipant($participant->id);
     $this->assertDBNull('CRM_Event_DAO_Participant', $this->_contactId, 'id', 'contact_id', 'Check DB for deleted participant. Should be NULL.');
     Contact::delete($this->_contactId);
     Event::delete($this->_eventId);
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:31,代码来源:ParticipantTest.php

示例3: postProcess

 /**
  * Process the form submission.
  */
 public function postProcess()
 {
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     if ($this->_action & CRM_Core_Action::DELETE) {
         if (CRM_Utils_Array::value('delete_participant', $params) == 2) {
             $additionalId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
             $participantLinks = CRM_Event_BAO_Participant::getAdditionalParticipantUrl($additionalId);
         }
         if (CRM_Utils_Array::value('delete_participant', $params) == 1) {
             $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
             foreach ($additionalIds as $value) {
                 CRM_Event_BAO_Participant::deleteParticipant($value);
             }
         }
         CRM_Event_BAO_Participant::deleteParticipant($this->_id);
         CRM_Core_Session::setStatus(ts('Selected participant was deleted successfully.'), ts('Record Deleted'), 'success');
         if (!empty($participantLinks)) {
             $status = ts('The following participants no longer have an event fee recorded. You can edit their registration and record a replacement contribution by clicking the links below:') . '<br/>' . $participantLinks;
             CRM_Core_Session::setStatus($status, ts('Group Payment Deleted'));
         }
         return;
     }
     // When adding a single contact, the formRule prevents you from adding duplicates
     // (See above in formRule()). When adding more than one contact, the duplicates are
     // removed automatically and the user receives one notification.
     if ($this->_action & CRM_Core_Action::ADD) {
         $event_id = $this->_eventId;
         if (empty($event_id) && !empty($params['event_id'])) {
             $event_id = $params['event_id'];
         }
         if (!$this->_single && !empty($event_id)) {
             $duplicateContacts = 0;
             while (list($k, $dupeCheckContactId) = each($this->_contactIds)) {
                 // Eliminate contacts that have already been assigned to this event.
                 $dupeCheck = new CRM_Event_BAO_Participant();
                 $dupeCheck->contact_id = $dupeCheckContactId;
                 $dupeCheck->event_id = $event_id;
                 $dupeCheck->find(TRUE);
                 if (!empty($dupeCheck->id)) {
                     $duplicateContacts++;
                     unset($this->_contactIds[$k]);
                 }
             }
             if ($duplicateContacts > 0) {
                 $msg = ts("%1 contacts have already been assigned to this event. They were not added a second time.", array(1 => $duplicateContacts));
                 CRM_Core_Session::setStatus($msg);
             }
             if (count($this->_contactIds) == 0) {
                 CRM_Core_Session::setStatus(ts("No participants were added."));
                 return;
             }
             // We have to re-key $this->_contactIds so each contact has the same
             // key as their corresponding record in the $participants array that
             // will be created below.
             $this->_contactIds = array_values($this->_contactIds);
         }
     }
     $participantStatus = CRM_Event_PseudoConstant::participantStatus();
     // set the contact, when contact is selected
     if (!empty($params['contact_id'])) {
         $this->_contactId = $params['contact_id'];
     }
     if ($this->_priceSetId && ($isQuickConfig = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config'))) {
         $this->_quickConfig = $isQuickConfig;
     }
     if ($this->_id) {
         $params['id'] = $this->_id;
     }
     $config = CRM_Core_Config::singleton();
     if ($this->_isPaidEvent) {
         $contributionParams = array();
         $lineItem = array();
         $additionalParticipantDetails = array();
         if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) {
             $eventStartDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'start_date');
             if ($eventStartDate) {
                 $contributionParams['revenue_recognition_date'] = date('Ymd', strtotime($eventStartDate));
             }
         }
         if ($this->_id && $this->_action & CRM_Core_Action::UPDATE && $this->_paymentId) {
             $participantBAO = new CRM_Event_BAO_Participant();
             $participantBAO->id = $this->_id;
             $participantBAO->find(TRUE);
             $contributionParams['total_amount'] = $participantBAO->fee_amount;
             $params['discount_id'] = NULL;
             //re-enter the values for UPDATE mode
             $params['fee_level'] = $params['amount_level'] = $participantBAO->fee_level;
             $params['fee_amount'] = $participantBAO->fee_amount;
             if (isset($params['priceSetId'])) {
                 $lineItem[0] = CRM_Price_BAO_LineItem::getLineItems($this->_id);
             }
             //also add additional participant's fee level/priceset
             if (CRM_Event_BAO_Participant::isPrimaryParticipant($this->_id)) {
                 $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($this->_id);
                 $hasLineItems = CRM_Utils_Array::value('priceSetId', $params, FALSE);
                 $additionalParticipantDetails = CRM_Event_BAO_Participant::getFeeDetails($additionalIds, $hasLineItems);
//.........这里部分代码省略.........
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:101,代码来源:Participant.php

示例4: postProcess

 /**
  * process the form after the input has been submitted and validated
  *
  * @access public
  *
  * @return void
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     if (CRM_Utils_Array::value('delete_participant', $params) == 2) {
         $links = array();
         foreach ($this->_participantIds as $participantId) {
             $additionalId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
             $participantLinks = CRM_Event_BAO_Participant::getAdditionalParticipantUrl($additionalId);
         }
     }
     $deletedParticipants = $additionalCount = 0;
     foreach ($this->_participantIds as $participantId) {
         if (CRM_Utils_Array::value('delete_participant', $params) == 1) {
             if (CRM_Event_BAO_Participant::isPrimaryParticipant($participantId)) {
                 $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
                 $additionalCount = count($additionalIds);
                 foreach ($additionalIds as $value) {
                     CRM_Event_BAO_Participant::deleteParticipant($value);
                 }
                 CRM_Event_BAO_Participant::deleteParticipant($participantId);
             }
             $deletedParticipants++;
         } else {
             CRM_Event_BAO_Participant::deleteParticipant($participantId);
             $deletedParticipants++;
         }
     }
     if ($additionalCount) {
         $deletedParticipants += $additionalCount;
     }
     $status = array(ts('Participant(s) Deleted: %1', array(1 => $deletedParticipants)), ts('Total Selected Participant(s): %1', array(1 => $deletedParticipants)));
     if (!empty($participantLinks)) {
         $status[] = ts('The following participants no longer have an event fee recorded. You can edit their registration and record a replacement contribution by clicking the links below:') . '<br>' . $participantLinks;
     }
     CRM_Core_Session::setStatus($status);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:43,代码来源:Delete.php

示例5: postProcess

 /** 
  * Function to process the form 
  * 
  * @access public 
  */
 public function postProcess()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         require_once "CRM/Event/BAO/Participant.php";
         CRM_Event_BAO_Participant::deleteParticipant($this->_participantId);
         return;
     }
     // get the submitted form values.
     $params = $this->controller->exportValues($this->_name);
     // set the contact, when contact is selected
     if (CRM_Utils_Array::value('contact_select_id', $params)) {
         $this->_contactID = CRM_Utils_Array::value('contact_select_id', $params);
     }
     $config =& CRM_Core_Config::singleton();
     //check if discount is selected
     if (CRM_Utils_Array::value('discount_id', $params)) {
         $discountId = $params['discount_id'];
     } else {
         $params['discount_id'] = 'null';
         $discountId = null;
     }
     if ($this->_isPaidEvent) {
         //lets carry currency, CRM-4453
         $params['fee_currency'] = $config->defaultCurrency;
         // fix for CRM-3088
         if ($discountId && !empty($this->_values['discount'][$discountId])) {
             $params['amount_level'] = $this->_values['discount'][$discountId][$params['amount']]['label'];
             $params['amount'] = $this->_values['discount'][$discountId][$params['amount']]['value'];
             $this->assign('amount_level', $params['amount_level']);
         } else {
             if (!isset($params['priceSetId'])) {
                 $params['amount_level'] = $this->_values['fee'][$params['amount']]['label'];
                 $params['amount'] = $this->_values['fee'][$params['amount']]['value'];
                 $this->assign('amount_level', $params['amount_level']);
             } else {
                 if (!$this->_online) {
                     $lineItem = array();
                     CRM_Price_BAO_Set::processAmount($this->_values['fee']['fields'], $params, $lineItem[0]);
                     $this->set('lineItem', $lineItem);
                     $this->assign('lineItem', $lineItem);
                     $this->_lineItem = $lineItem;
                 }
             }
         }
         $params['fee_level'] = $params['amount_level'];
         $contributionParams = array();
         $contributionParams['total_amount'] = $params['amount'];
     }
     //fix for CRM-3086
     $params['fee_amount'] = $params['amount'];
     $this->_params = $params;
     unset($params['amount']);
     $params['register_date'] = CRM_Utils_Date::processDate($params['register_date'], $params['register_date_time']);
     $params['receive_date'] = CRM_Utils_Date::processDate(CRM_Utils_Array::value('receive_date', $params));
     $params['contact_id'] = $this->_contactID;
     if ($this->_participantId) {
         $params['id'] = $this->_participantId;
     }
     $status = null;
     if ($this->_action & CRM_Core_Action::UPDATE) {
         $participantBAO =& new CRM_Event_BAO_Participant();
         $participantBAO->id = $this->_participantId;
         $participantBAO->find();
         while ($participantBAO->fetch()) {
             $status = $participantBAO->status_id;
             $contributionParams['total_amount'] = $participantBAO->fee_amount;
         }
         $params['discount_id'] = null;
         //re-enter the values for UPDATE mode
         $params['fee_level'] = $params['amount_level'] = $participantBAO->fee_level;
         $params['fee_amount'] = $participantBAO->fee_amount;
     }
     require_once 'CRM/Contact/BAO/Contact.php';
     // Retrieve the name and email of the current user - this will be the FROM for the receipt email
     $session =& CRM_Core_Session::singleton();
     $userID = $session->get('userID');
     list($userName, $userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($userID);
     require_once "CRM/Event/BAO/Participant.php";
     if ($this->_mode) {
         if (!$this->_isPaidEvent) {
             CRM_Core_Error::fatal(ts('Selected Event is not Paid Event '));
         }
         //modify params according to parameter used in create
         //participant method (addParticipant)
         $params['participant_status_id'] = $params['status_id'];
         $params['participant_role_id'] = $params['role_id'];
         $params['participant_register_date'] = $params['register_date'];
         $params['participant_source'] = $params['source'];
         require_once 'CRM/Core/BAO/PaymentProcessor.php';
         $this->_paymentProcessor = CRM_Core_BAO_PaymentProcessor::getPayment($this->_params['payment_processor_id'], $this->_mode);
         require_once "CRM/Contact/BAO/Contact.php";
         $now = date('YmdHis');
         $fields = array();
         // set email for primary location.
         $fields["email-Primary"] = 1;
//.........这里部分代码省略.........
开发者ID:ksecor,项目名称:civicrm,代码行数:101,代码来源:Participant.php

示例6: civicrm_api3_participant_delete

/**
 * Deletes an existing contact participant.
 *
 * This API is used for deleting a contact participant
 *
 * @param array $params
 *   Array containing Id of the contact participant to be deleted.
 *
 * @throws Exception
 * @return array
 */
function civicrm_api3_participant_delete($params)
{
    $result = CRM_Event_BAO_Participant::deleteParticipant($params['id']);
    if ($result) {
        return civicrm_api3_create_success();
    } else {
        throw new Exception('Error while deleting participant');
    }
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:20,代码来源:Participant.php

示例7: postProcess

 /**
  * Process the form after the input has been submitted and validated.
  *
  *
  * @return void
  */
 public function postProcess()
 {
     $params = $this->controller->exportValues($this->_name);
     $participantLinks = NULL;
     if (CRM_Utils_Array::value('delete_participant', $params) == 2) {
         $links = array();
         foreach ($this->_participantIds as $participantId) {
             $additionalId = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
             $participantLinks = CRM_Event_BAO_Participant::getAdditionalParticipantUrl($additionalId);
         }
     }
     $deletedParticipants = $additionalCount = 0;
     foreach ($this->_participantIds as $participantId) {
         if (CRM_Utils_Array::value('delete_participant', $params) == 1) {
             $primaryParticipantId = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant", $participantId, 'registered_by_id', 'id');
             if (CRM_Event_BAO_Participant::isPrimaryParticipant($participantId)) {
                 $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
                 $additionalCount += count($additionalIds);
                 foreach ($additionalIds as $value) {
                     CRM_Event_BAO_Participant::deleteParticipant($value);
                 }
                 CRM_Event_BAO_Participant::deleteParticipant($participantId);
                 $deletedParticipants++;
             } elseif (empty($primaryParticipantId) || !in_array($primaryParticipantId, $this->_participantIds)) {
                 CRM_Event_BAO_Participant::deleteParticipant($participantId);
                 $deletedParticipants++;
             }
         } else {
             CRM_Event_BAO_Participant::deleteParticipant($participantId);
             $deletedParticipants++;
         }
     }
     if ($additionalCount) {
         $deletedParticipants += $additionalCount;
     }
     $status = ts('%count participant deleted.', array('plural' => '%count participants deleted.', 'count' => $deletedParticipants));
     if ($participantLinks) {
         $status .= '<p>' . ts('The following participants no longer have an event fee recorded. You can edit their registration and record a replacement contribution by clicking the links below:') . '</p>' . $participantLinks;
     }
     CRM_Core_Session::setStatus($status, ts('Removed'), 'info');
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:47,代码来源:Delete.php

示例8: delete

 function delete($participantId)
 {
     require_once 'CRM/Event/BAO/Participant.php';
     return CRM_Event_BAO_Participant::deleteParticipant($participantId);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:5,代码来源:Participant.php

示例9:

/**
 * Deletes an existing contact participant
 *
 * This API is used for deleting a contact participant
 *
 * @param  Int  $participantID   Id of the contact participant to be deleted
 *
 * {@getfields participant_delete}
 * @access public
 */
function &civicrm_api3_participant_delete($params)
{
    $participant = new CRM_Event_BAO_Participant();
    $result = $participant->deleteParticipant($params['id']);
    if ($result) {
        return civicrm_api3_create_success();
    } else {
        return civicrm_api3_create_error('Error while deleting participant');
    }
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:20,代码来源:Participant.php

示例10:

/**
 * Deletes an existing contact participant
 * 
 * This API is used for deleting a contact participant
 * 
 * @param  Int  $participantID   Id of the contact participant to be deleted
 * 
 * @return boolean        true if success, else false
 * @access public
 */
function &civicrm_participant_delete(&$params)
{
    _civicrm_initialize();
    if (!is_array($params)) {
        $error = civicrm_create_error('Params is not an array');
        return $error;
    }
    if (!isset($params['id'])) {
        $error = civicrm_create_error('Required parameter missing');
        return $error;
    }
    require_once 'CRM/Event/BAO/Participant.php';
    $participant = new CRM_Event_BAO_Participant();
    $result = $participant->deleteParticipant($params['id']);
    if ($result) {
        $values = civicrm_create_success();
    } else {
        $values = civicrm_create_error('Error while deleting participant');
    }
    return $values;
}
开发者ID:ksecor,项目名称:civicrm,代码行数:31,代码来源:Participant.php


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