本文整理匯總了PHP中CRM_Event_DAO_Participant::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Event_DAO_Participant::find方法的具體用法?PHP CRM_Event_DAO_Participant::find怎麽用?PHP CRM_Event_DAO_Participant::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CRM_Event_DAO_Participant
的用法示例。
在下文中一共展示了CRM_Event_DAO_Participant::find方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deleteParticipantStatusType
/**
* @param int $id
*
* @return bool
*/
public static function deleteParticipantStatusType($id)
{
// return early if there are participants with this status
$participant = new CRM_Event_DAO_Participant();
$participant->status_id = $id;
if ($participant->find()) {
return FALSE;
}
CRM_Utils_Weight::delWeight('CRM_Event_DAO_ParticipantStatusType', $id);
$dao = new CRM_Event_DAO_ParticipantStatusType();
$dao->id = $id;
$dao->find(TRUE);
$dao->delete();
return TRUE;
}
示例2: postProcess
/**
* Process the form when submitted.
*
* @return void
*/
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');
}
}
示例3: deleteParticipantStatusType
static function deleteParticipantStatusType($id)
{
// return early if there are participants with this status
require_once 'CRM/Event/DAO/Participant.php';
$participant = new CRM_Event_DAO_Participant();
$participant->status_id = $id;
if ($participant->find()) {
return false;
}
require_once 'CRM/Utils/Weight.php';
CRM_Utils_Weight::delWeight('CRM_Event_DAO_ParticipantStatusType', $id);
$dao = new CRM_Event_DAO_ParticipantStatusType();
$dao->id = $id;
$dao->find(true);
$dao->delete();
return true;
}
示例4: deleteContactParticipant
/**
* Delete participants of contact.
*
* CRM-12155
*
* @param int $contactId
* Contact id.
*
*/
public static function deleteContactParticipant($contactId)
{
$participant = new CRM_Event_DAO_Participant();
$participant->contact_id = $contactId;
$participant->find();
while ($participant->fetch()) {
self::deleteParticipant($participant->id);
}
}
示例5: updateRecords
/**
* Updates contacts affected by the option value passed.
*
* @param int $optionValueId
* The option value id.
* @param int $action
* The action describing whether prefix/suffix was UPDATED or DELETED.
*
* @return bool
*/
public static function updateRecords(&$optionValueId, $action)
{
//finding group name
$optionValue = new CRM_Core_DAO_OptionValue();
$optionValue->id = $optionValueId;
$optionValue->find(TRUE);
$optionGroup = new CRM_Core_DAO_OptionGroup();
$optionGroup->id = $optionValue->option_group_id;
$optionGroup->find(TRUE);
// group name
$gName = $optionGroup->name;
// value
$value = $optionValue->value;
// get the proper group name & affected field name
// todo: this may no longer be needed for individuals - check inputs
$individuals = array('gender' => 'gender_id', 'individual_prefix' => 'prefix_id', 'individual_suffix' => 'suffix_id', 'communication_style' => 'communication_style_id');
$contributions = array('payment_instrument' => 'payment_instrument_id');
$activities = array('activity_type' => 'activity_type_id');
$participant = array('participant_role' => 'role_id');
$eventType = array('event_type' => 'event_type_id');
$aclRole = array('acl_role' => 'acl_role_id');
$all = array_merge($individuals, $contributions, $activities, $participant, $eventType, $aclRole);
$fieldName = '';
foreach ($all as $name => $id) {
if ($gName == $name) {
$fieldName = $id;
}
}
if ($fieldName == '') {
return TRUE;
}
if (array_key_exists($gName, $individuals)) {
$contactDAO = new CRM_Contact_DAO_Contact();
$contactDAO->{$fieldName} = $value;
$contactDAO->find();
while ($contactDAO->fetch()) {
if ($action == CRM_Core_Action::DELETE) {
$contact = new CRM_Contact_DAO_Contact();
$contact->id = $contactDAO->id;
$contact->find(TRUE);
// make sure dates doesn't get reset
$contact->birth_date = CRM_Utils_Date::isoToMysql($contact->birth_date);
$contact->deceased_date = CRM_Utils_Date::isoToMysql($contact->deceased_date);
$contact->{$fieldName} = 'NULL';
$contact->save();
}
}
return TRUE;
}
if (array_key_exists($gName, $contributions)) {
$contribution = new CRM_Contribute_DAO_Contribution();
$contribution->{$fieldName} = $value;
$contribution->find();
while ($contribution->fetch()) {
if ($action == CRM_Core_Action::DELETE) {
$contribution->{$fieldName} = 'NULL';
$contribution->save();
}
}
return TRUE;
}
if (array_key_exists($gName, $activities)) {
$activity = new CRM_Activity_DAO_Activity();
$activity->{$fieldName} = $value;
$activity->find();
while ($activity->fetch()) {
$activity->delete();
}
return TRUE;
}
//delete participant role, type and event type option value
if (array_key_exists($gName, $participant)) {
$participantValue = new CRM_Event_DAO_Participant();
$participantValue->{$fieldName} = $value;
if ($participantValue->find(TRUE)) {
return FALSE;
}
return TRUE;
}
//delete event type option value
if (array_key_exists($gName, $eventType)) {
$event = new CRM_Event_DAO_Event();
$event->{$fieldName} = $value;
if ($event->find(TRUE)) {
return FALSE;
}
return TRUE;
}
//delete acl_role option value
if (array_key_exists($gName, $aclRole)) {
//.........這裏部分代碼省略.........
示例6: _assignMessageVariablesToTemplate
/**
* Apply variables for message to smarty template - this function is part of analysing what is in the huge
* function & breaking it down into manageable chunks. Eventually it will be refactored into something else
* Note we send directly from this function in some cases because it is only partly refactored
* Don't call this function directly as the signature will change
*
* @param $values
* @param $input
* @param CRM_Core_SMARTY $template
* @param bool $recur
* @param bool $returnMessageText
*
* @return mixed
*/
public function _assignMessageVariablesToTemplate(&$values, $input, &$template, $recur = FALSE, $returnMessageText = TRUE)
{
$template->assign('first_name', $this->_relatedObjects['contact']->first_name);
$template->assign('last_name', $this->_relatedObjects['contact']->last_name);
$template->assign('displayName', $this->_relatedObjects['contact']->display_name);
if (!empty($values['lineItem']) && !empty($this->_relatedObjects['membership'])) {
$template->assign('useForMember', TRUE);
}
//assign honor information to receipt message
$softRecord = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($this->id);
if (isset($softRecord['soft_credit'])) {
//if id of contribution page is present
if (!empty($values['id'])) {
$values['honor'] = array('honor_profile_values' => array(), 'honor_profile_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFJoin', $values['id'], 'uf_group_id', 'entity_id'), 'honor_id' => $softRecord['soft_credit'][1]['contact_id']);
$softCreditTypes = CRM_Core_OptionGroup::values('soft_credit_type');
$template->assign('soft_credit_type', $softRecord['soft_credit'][1]['soft_credit_type_label']);
$template->assign('honor_block_is_active', CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFJoin', $values['id'], 'is_active', 'entity_id'));
} else {
//offline contribution
$softCreditTypes = $softCredits = array();
foreach ($softRecord['soft_credit'] as $key => $softCredit) {
$softCreditTypes[$key] = $softCredit['soft_credit_type_label'];
$softCredits[$key] = array('Name' => $softCredit['contact_name'], 'Amount' => CRM_Utils_Money::format($softCredit['amount'], $softCredit['currency']));
}
$template->assign('softCreditTypes', $softCreditTypes);
$template->assign('softCredits', $softCredits);
}
}
$dao = new CRM_Contribute_DAO_ContributionProduct();
$dao->contribution_id = $this->id;
if ($dao->find(TRUE)) {
$premiumId = $dao->product_id;
$template->assign('option', $dao->product_option);
$productDAO = new CRM_Contribute_DAO_Product();
$productDAO->id = $premiumId;
$productDAO->find(TRUE);
$template->assign('selectPremium', TRUE);
$template->assign('product_name', $productDAO->name);
$template->assign('price', $productDAO->price);
$template->assign('sku', $productDAO->sku);
}
$template->assign('title', CRM_Utils_Array::value('title', $values));
$amount = CRM_Utils_Array::value('total_amount', $input, CRM_Utils_Array::value('amount', $input), NULL);
if (empty($amount) && isset($this->total_amount)) {
$amount = $this->total_amount;
}
$template->assign('amount', $amount);
// add the new contribution values
if (strtolower($this->_component) == 'contribute') {
//PCP Info
$softDAO = new CRM_Contribute_DAO_ContributionSoft();
$softDAO->contribution_id = $this->id;
if ($softDAO->find(TRUE)) {
$template->assign('pcpBlock', TRUE);
$template->assign('pcp_display_in_roll', $softDAO->pcp_display_in_roll);
$template->assign('pcp_roll_nickname', $softDAO->pcp_roll_nickname);
$template->assign('pcp_personal_note', $softDAO->pcp_personal_note);
//assign the pcp page title for email subject
$pcpDAO = new CRM_PCP_DAO_PCP();
$pcpDAO->id = $softDAO->pcp_id;
if ($pcpDAO->find(TRUE)) {
$template->assign('title', $pcpDAO->title);
}
}
}
if ($this->financial_type_id) {
$values['financial_type_id'] = $this->financial_type_id;
}
$template->assign('trxn_id', $this->trxn_id);
$template->assign('receive_date', CRM_Utils_Date::mysqlToIso($this->receive_date));
$template->assign('contributeMode', 'notify');
$template->assign('action', $this->is_test ? 1024 : 1);
$template->assign('receipt_text', CRM_Utils_Array::value('receipt_text', $values));
$template->assign('is_monetary', 1);
$template->assign('is_recur', (bool) $recur);
$template->assign('currency', $this->currency);
$template->assign('address', CRM_Utils_Address::format($input));
if (!empty($values['customGroup'])) {
$template->assign('customGroup', $values['customGroup']);
}
if ($this->_component == 'event') {
$template->assign('title', $values['event']['title']);
$participantRoles = CRM_Event_PseudoConstant::participantRole();
$viewRoles = array();
foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->_relatedObjects['participant']->role_id) as $k => $v) {
$viewRoles[] = $participantRoles[$v];
//.........這裏部分代碼省略.........
示例7: checkRegistration
function checkRegistration($params)
{
$alreadyRegistered = false;
if (!CRM_Utils_Array::value('contact_id', $params)) {
return $alreadyRegistered;
}
require_once 'CRM/Event/PseudoConstant.php';
require_once 'CRM/Event/DAO/Participant.php';
$statusTypes = CRM_Event_PseudoConstant::participantStatus(null, "is_counted = 1");
$participant = new CRM_Event_DAO_Participant();
$participant->copyValues($params);
$participant->is_test = CRM_Utils_Array::value('is_test', $params, 0);
$participant->selectAdd();
$participant->selectAdd('status_id');
if ($participant->find(true) && array_key_exists($participant->status_id, $statusTypes)) {
$alreadyRegistered = true;
}
return $alreadyRegistered;
}
示例8: checkRegistration
/**
* @param $params
*
* @return bool
*/
static function checkRegistration($params)
{
$alreadyRegistered = FALSE;
if (empty($params['contact_id'])) {
return $alreadyRegistered;
}
$statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, 'is_counted = 1');
$participant = new CRM_Event_DAO_Participant();
$participant->copyValues($params);
$participant->is_test = CRM_Utils_Array::value('is_test', $params, 0);
$participant->selectAdd();
$participant->selectAdd('status_id');
if ($participant->find(TRUE) && array_key_exists($participant->status_id, $statusTypes)) {
$alreadyRegistered = TRUE;
}
return $alreadyRegistered;
}
示例9: isPrimaryParticipant
/**
* check for whether participant is primary or not
* @param $participantId
* @return true if participant is primary
* @access public
*/
static function isPrimaryParticipant($participantId)
{
$participant = new CRM_Event_DAO_Participant();
$participant->registered_by_id = $participantId;
if ($participant->find(true)) {
return true;
}
return false;
}
示例10: isPrimaryParticipant
/**
* check for whether participant is primary or not
*
* @param $participantId
*
* @return true if participant is primary
* @access public
*/
static function isPrimaryParticipant($participantId)
{
$participant = new CRM_Event_DAO_Participant();
$participant->registered_by_id = $participantId;
if ($participant->find(TRUE)) {
return TRUE;
}
return FALSE;
}
示例11: sendMail
function sendMail(&$input, &$ids, &$objects, &$values, $recur = false, $returnMessageText = false)
{
$contribution =& $objects['contribution'];
$membership =& $objects['membership'];
$participant =& $objects['participant'];
$event =& $objects['event'];
if (empty($values)) {
$values = array();
$contribID = $ids['contribution'];
if ($input['component'] == 'contribute') {
require_once 'CRM/Contribute/BAO/ContributionPage.php';
if (isset($contribution->contribution_page_id)) {
CRM_Contribute_BAO_ContributionPage::setValues($contribution->contribution_page_id, $values);
} else {
// Handle re-print receipt for offline contributions (call from PDF.php - no contribution_page_id)
$values['is_email_receipt'] = 1;
$values['title'] = 'Contribution';
}
// set lineItem for contribution
require_once 'CRM/Price/BAO/Set.php';
if ($contribID && ($pId = CRM_Price_BAO_Set::getFor('civicrm_contribution', $contribID))) {
require_once 'CRM/Price/BAO/LineItem.php';
$values['lineItem'][0] = CRM_Price_BAO_LineItem::getLineItems($contribID, 'contribution');
$values['priceSetID'] = $pId;
}
require_once 'CRM/Contribute/BAO/Contribution.php';
$relatedContact = CRM_Contribute_BAO_Contribution::getOnbehalfIds($contribID, $contribution->contact_id);
// if this is onbehalf of contribution then set related contact
if ($relatedContactId = $relatedContact['individual_id']) {
$values['related_contact'] = $ids['related_contact'] = $relatedContactId;
}
} else {
// event
$eventParams = array('id' => $objects['event']->id);
$values['event'] = array();
require_once 'CRM/Event/BAO/Event.php';
CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
//get location details
$locationParams = array('entity_id' => $objects['event']->id, 'entity_table' => 'civicrm_event');
require_once 'CRM/Core/BAO/Location.php';
require_once 'CRM/Event/Form/ManageEvent/Location.php';
$values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
require_once 'CRM/Core/BAO/UFJoin.php';
$ufJoinParams = array('entity_table' => 'civicrm_event', 'entity_id' => $ids['event'], 'weight' => 1);
$values['custom_pre_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
$ufJoinParams['weight'] = 2;
$values['custom_post_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
// set lineItem for event contribution
if ($contribID) {
require_once 'CRM/Event/BAO/Participant.php';
$participantIds = CRM_Event_BAO_Participant::getParticipantIds($contribID);
require_once 'CRM/Price/BAO/LineItem.php';
if (!empty($participantIds)) {
foreach ($participantIds as $pIDs) {
$lineItem = CRM_Price_BAO_LineItem::getLineItems($pIDs);
if (!CRM_Utils_System::isNull($lineItem)) {
$values['lineItem'][] = $lineItem;
}
}
}
}
}
// set receipt from e-mail and name in value
if (!$returnMessageText) {
require_once 'CRM/Contact/BAO/Contact/Location.php';
$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
list($userName, $userEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($userID);
$values['receipt_from_email'] = $userEmail;
$values['receipt_from_name'] = $userName;
}
// set display address of contributor
if ($contribution->address_id) {
require_once 'CRM/Core/BAO/Address.php';
$addressParams = array('id' => $contribution->address_id);
$addressDetails = CRM_Core_BAO_Address::getValues($addressParams, false, 'id');
$addressDetails = array_values($addressDetails);
$values['address'] = $addressDetails[0]['display'];
}
}
$template =& CRM_Core_Smarty::singleton();
// CRM_Core_Error::debug('tpl',$template);
//assign honor infomation to receiptmessage
if ($honarID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contribution->id, 'honor_contact_id')) {
$honorDefault = array();
$honorIds = array();
$honorIds['contribution'] = $contribution->id;
$idParams = array('id' => $honarID, 'contact_id' => $honarID);
require_once "CRM/Contact/BAO/Contact.php";
CRM_Contact_BAO_Contact::retrieve($idParams, $honorDefault, $honorIds);
require_once "CRM/Core/PseudoConstant.php";
$honorType = CRM_Core_PseudoConstant::honor();
$prefix = CRM_Core_PseudoConstant::individualPrefix();
$template->assign('honor_block_is_active', 1);
$template->assign('honor_prefix', $prefix[$honorDefault["prefix_id"]]);
$template->assign('honor_first_name', CRM_Utils_Array::value("first_name", $honorDefault));
$template->assign('honor_last_name', CRM_Utils_Array::value("last_name", $honorDefault));
$template->assign('honor_email', CRM_Utils_Array::value("email", $honorDefault["email"][1]));
$template->assign('honor_type', $honorType[$contribution->honor_type_id]);
}
//.........這裏部分代碼省略.........