本文整理汇总了PHP中CRM_Contact_BAO_Contact类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact类的具体用法?PHP CRM_Contact_BAO_Contact怎么用?PHP CRM_Contact_BAO_Contact使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Contact_BAO_Contact类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: validateData
/**
* Validate incoming data. This function is intended to ensure that incoming data matches
* It provides a form of pseudo-authentication - by checking the calling fn already knows
* the correct contact id & contribution id (this can be problematic when that has changed in
* the meantime for transactions that are delayed & contacts are merged in-between. e.g
* Paypal allows you to resend Instant Payment Notifications if you, for example, moved site
* and didn't update your IPN URL.
*
* @param array $input interpreted values from the values returned through the IPN
* @param array $ids more interpreted values (ids) from the values returned through the IPN
* @param array $objects an empty array that will be populated with loaded object
* @param boolean $required boolean Return FALSE if the relevant objects don't exist
* @param integer $paymentProcessorID Id of the payment processor ID in use
* @return boolean
*/
function validateData(&$input, &$ids, &$objects, $required = TRUE, $paymentProcessorID = NULL)
{
// make sure contact exists and is valid
$contact = new CRM_Contact_BAO_Contact();
$contact->id = $ids['contact'];
if (!$contact->find(TRUE)) {
CRM_Core_Error::debug_log_message("Could not find contact record: {$ids['contact']} in IPN request: " . print_r($input, TRUE));
echo "Failure: Could not find contact record: {$ids['contact']}<p>";
return FALSE;
}
// make sure contribution exists and is valid
$contribution = new CRM_Contribute_BAO_Contribution();
$contribution->id = $ids['contribution'];
if (!$contribution->find(TRUE)) {
CRM_Core_Error::debug_log_message("Could not find contribution record: {$contribution->id} in IPN request: " . print_r($input, TRUE));
echo "Failure: Could not find contribution record for {$contribution->id}<p>";
return FALSE;
}
$contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date);
$objects['contact'] =& $contact;
$objects['contribution'] =& $contribution;
if (!$this->loadObjects($input, $ids, $objects, $required, $paymentProcessorID)) {
return FALSE;
}
return TRUE;
}
开发者ID:hguru,项目名称:224Civi,代码行数:41,代码来源:BaseIPN.php
示例2: preProcess
function preProcess()
{
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
$this->assign('contactId', $this->_contactId);
$contact = new CRM_Contact_BAO_Contact();
$contact->get('id', $this->_contactId);
$this->_apiKey = $contact->api_key;
$this->assign('apiKey', $this->_apiKey);
// check logged in url permission
CRM_Contact_Page_View::checkUserPermission($this);
// set page title
CRM_Contact_Page_View::setTitle($this->_contactId);
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$this->assign('action', $this->_action);
$isAdmin = CRM_Core_Permission::check('administer CiviCRM') && CRM_Core_Permission::check('edit all contacts');
$session = CRM_Core_Session::singleton();
$isMyself = $this->_contactId && $this->_contactId == $session->get('userID');
$this->assign('isAdmin', $isAdmin);
$this->assign('isMyself', $isMyself);
$urlParam = 'reset=1&action=add&cid=' . $this->_contactId;
if ($this->_apiKey) {
$urlParam = 'reset=1&action=edit&cid=' . $this->_contactId;
}
$this->assign('addApiKeyUrl', CRM_Utils_System::url('civicrm/contact/apikey', $urlParam));
}
开发者ID:Beltline,项目名称:com.cividesk.apikey,代码行数:25,代码来源:APIKey.php
示例3: run
/**
* Run the page.
*
* This method is called after the page is created.
*/
public function run()
{
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name'));
$phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
$entityBlock = array('contact_id' => $contactId);
$phones = CRM_Core_BAO_Phone::getValues($entityBlock);
if (!empty($phones)) {
foreach ($phones as $key => &$value) {
$value['location_type'] = $locationTypes[$value['location_type_id']];
$value['phone_type'] = $phoneTypes[$value['phone_type_id']];
}
}
$contact = new CRM_Contact_BAO_Contact();
$contact->id = $contactId;
$contact->find(TRUE);
$privacy = array();
foreach (CRM_Contact_BAO_Contact::$_commPrefs as $name) {
if (isset($contact->{$name})) {
$privacy[$name] = $contact->{$name};
}
}
$this->assign('contactId', $contactId);
$this->assign('phone', $phones);
$this->assign('privacy', $privacy);
// check logged in user permission
CRM_Contact_Page_View::checkUserPermission($this, $contactId);
// finally call parent
parent::run();
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:36,代码来源:Phone.php
示例4: run
/**
* Run the page.
*
* This method is called after the page is created.
*/
public function run()
{
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$addressId = CRM_Utils_Request::retrieve('aid', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, NULL, $_REQUEST);
$address = array();
if ($addressId > 0) {
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name'));
$entityBlock = array('id' => $addressId);
$address = CRM_Core_BAO_Address::getValues($entityBlock, FALSE, 'id');
if (!empty($address)) {
foreach ($address as $key => &$value) {
$value['location_type'] = $locationTypes[$value['location_type_id']];
}
}
}
// we just need current address block
$currentAddressBlock['address'][$locBlockNo] = array_pop($address);
if (!empty($currentAddressBlock['address'][$locBlockNo])) {
// get contact name of shared contact names
$sharedAddresses = array();
$shareAddressContactNames = CRM_Contact_BAO_Contact_Utils::getAddressShareContactNames($currentAddressBlock['address']);
foreach ($currentAddressBlock['address'] as $key => $addressValue) {
if (!empty($addressValue['master_id']) && !$shareAddressContactNames[$addressValue['master_id']]['is_deleted']) {
$sharedAddresses[$key]['shared_address_display'] = array('address' => $addressValue['display'], 'name' => $shareAddressContactNames[$addressValue['master_id']]['name']);
}
}
$idValue = $currentAddressBlock['address'][$locBlockNo]['id'];
if (!empty($currentAddressBlock['address'][$locBlockNo]['master_id'])) {
$idValue = $currentAddressBlock['address'][$locBlockNo]['master_id'];
}
// add custom data of type address
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Address', $this, $idValue);
// we setting the prefix to dnc_ below so that we don't overwrite smarty's grouptree var.
$currentAddressBlock['address'][$locBlockNo]['custom'] = CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, "dnc_");
$this->assign("dnc_viewCustomData", NULL);
$this->assign('add', $currentAddressBlock['address'][$locBlockNo]);
$this->assign('sharedAddresses', $sharedAddresses);
}
$contact = new CRM_Contact_BAO_Contact();
$contact->id = $contactId;
$contact->find(TRUE);
$privacy = array();
foreach (CRM_Contact_BAO_Contact::$_commPrefs as $name) {
if (isset($contact->{$name})) {
$privacy[$name] = $contact->{$name};
}
}
$this->assign('contactId', $contactId);
$this->assign('locationIndex', $locBlockNo);
$this->assign('addressId', $addressId);
$this->assign('privacy', $privacy);
// check logged in user permission
CRM_Contact_Page_View::checkUserPermission($this, $contactId);
// finally call parent
parent::run();
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:63,代码来源:Address.php
示例5: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
parent::preProcess();
$details = CRM_Booking_BAO_Booking::getBookingDetails($this->_id);
$this->_values['slots'] = CRM_Utils_Array::value('slots', $details);
$this->_values['sub_slots'] = CRM_Utils_Array::value('sub_slots', $details);
$this->_values['adhoc_charges'] = CRM_Utils_Array::value('adhoc_charges', $details);
$this->_values['cancellation_charges'] = CRM_Utils_Array::value('cancellation_charges', $details);
$this->_values['contribution'] = CRM_Utils_Array::value('contribution', $details);
$this->_values['sub_total'] = CRM_Utils_Array::value('total_amount', $this->_values) + CRM_Utils_Array::value('discount_amount', $this->_values);
//total_amount has been deducted from discount
$this->assign($this->_values);
$displayName = CRM_Contact_BAO_Contact::displayName($this->_values['primary_contact_id']);
$secondaryContactDisplayName = CRM_Contact_BAO_Contact::displayName(CRM_Utils_Array::value('secondary_contact_id', $this->_values));
$this->assign('displayName', $displayName);
$this->assign('secondaryContactDisplayName', $secondaryContactDisplayName);
$this->assign('contact_id', $this->_cid);
$params = array('option_group_name' => CRM_Booking_Utils_Constants::OPTION_BOOKING_STATUS, 'name' => CRM_Booking_Utils_Constants::OPTION_VALUE_CANCELLED);
$result = civicrm_api3('OptionValue', 'get', $params);
$this->_cancelStatusId = $cancelStatus = CRM_Utils_Array::value('value', CRM_Utils_Array::value($result['id'], $result['values']));
if ($this->_values['status_id'] == $cancelStatus) {
$this->assign('is_cancelled', TRUE);
}
// omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
CRM_Utils_System::setTitle(ts('View Booking for') . ' ' . $displayName);
self::registerScripts($this);
}
开发者ID:sushantpaste,项目名称:civibooking,代码行数:33,代码来源:View.php
示例6: run
/**
* Run the page.
*
* This method is called after the page is created.
*
* @return void
* @access public
*
*/
function run()
{
// get the callback, module and activity id
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
$id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$dao = new CRM_Core_DAO_ActivityHistory();
$dao->activity_id = $id;
$dao->activity_type = ts('SMS Sent');
if ($dao->find(TRUE)) {
$cid = $dao->entity_id;
}
$dao = new CRM_SMS_DAO_History();
$dao->id = $id;
if ($dao->find(TRUE)) {
$this->assign('fromName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $dao->contact_id, 'display_name'));
$this->assign('toName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name'));
$this->assign('sentDate', $dao->sent_date);
$this->assign('message', $dao->message);
// get the display name and images for the contact
list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($dao->contact_id);
CRM_Utils_System::setTitle($contactImage . ' ' . $displayName);
// also add the cid params to the Menu array
CRM_Core_Menu::addParam('cid', $cid);
}
return parent::run();
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:35,代码来源:SMS.php
示例7: setDefaultValues
function setDefaultValues()
{
// check if the user is registered and we have a contact ID
$session =& CRM_Core_Session::singleton();
$contactID = $session->get('userID');
if ($contactID) {
$options = array();
$fields = array();
foreach ($this->_fields as $name => $dontCare) {
$fields[$name] = 1;
}
$fields['state_province'] = $fields['country'] = $fields['email'] = 1;
$contact =& CRM_Contact_BAO_Contact::contactDetails($contactID, $options, $fields);
foreach ($fields as $name => $dontCare) {
if ($contact->{$name}) {
if (substr($name, 0, 7) == 'custom_') {
$id = substr($name, 7);
$this->_defaults[$name] = CRM_Core_BAO_CustomField::getDefaultValue($contact->{$name}, $id, $options);
} else {
$this->_defaults[$name] = $contact->{$name};
}
}
}
}
// hack to simplify credit card entry for testing
/**
$this->_defaults['credit_card_type'] = 'Visa';
$this->_defaults['credit_card_number'] = '4807731747657838';
$this->_defaults['cvv2'] = '000';
$this->_defaults['credit_card_exp_date'] = array( 'Y' => '2008', 'M' => '01' );
**/
return $this->_defaults;
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:33,代码来源:Main.php
示例8: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$this->_contactID = $this->get('cid');
$this->_caseID = $this->get('id');
$this->assign('caseID', $this->_caseID);
$this->assign('contactID', $this->_contactID);
//retrieve details about case
$params = array('id' => $this->_caseID);
$returnProperties = array('case_type_id', 'subject', 'status_id', 'start_date');
CRM_Core_DAO::commonRetrieve('CRM_Case_BAO_Case', $params, $values, $returnProperties);
$values['case_type_id'] = explode(CRM_Case_BAO_Case::VALUE_SEPERATOR, CRM_Utils_Array::value('case_type_id', $values));
$statuses = CRM_Case_PseudoConstant::caseStatus();
$caseTypeName = CRM_Case_PseudoConstant::caseTypeName($this->_caseID);
$caseType = CRM_Core_OptionGroup::getLabel('case_type', $caseTypeName['id']);
$this->_caseDetails = array('case_type' => $caseType, 'case_status' => $statuses[$values['case_status_id']], 'case_subject' => CRM_Utils_Array::value('subject', $values), 'case_start_date' => $values['case_start_date']);
$this->_caseType = $caseTypeName['name'];
$this->assign('caseDetails', $this->_caseDetails);
$newActivityUrl = CRM_Utils_System::url('civicrm/case/activity', "action=add&reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&atype=", false, null, false);
$this->assign('newActivityUrl', $newActivityUrl);
$reportUrl = CRM_Utils_System::url('civicrm/case/report', "reset=1&cid={$this->_contactID}&caseid={$this->_caseID}&asn=", false, null, false);
$this->assign('reportUrl', $reportUrl);
// add to recently viewed
require_once 'CRM/Utils/Recent.php';
require_once 'CRM/Contact/BAO/Contact.php';
$url = CRM_Utils_System::url('civicrm/contact/view/case', "action=view&reset=1&id={$this->_caseID}&cid={$this->_contactID}&context=home");
$displayName = CRM_Contact_BAO_Contact::displayName($this->_contactID);
$this->assign('displayName', $displayName);
$title = $displayName . ' - ' . $caseType;
// add the recently created case
CRM_Utils_Recent::add($title, $url, $this->_caseID, 'Case', $this->_contactID, null);
}
开发者ID:bhirsch,项目名称:civicrm,代码行数:37,代码来源:CaseView.php
示例9: fileDisplay
function fileDisplay()
{
// Display evidence file
$postParams = $_POST;
$fileID = CRM_Core_BAO_File::getEntityFile($postParams['entityTable'], $postParams['entityID']);
if ($fileID) {
foreach ($fileID as $k => $v) {
$fileType = $v['mime_type'];
$fid = $v['fileID'];
$eid = $postParams['entityID'];
if ($fileType == 'image/jpeg' || $fileType == 'image/pjpeg' || $fileType == 'image/gif' || $fileType == 'image/x-png' || $fileType == 'image/png') {
list($path) = CRM_Core_BAO_File::path($fid, $eid, NULL, NULL);
list($imageWidth, $imageHeight) = getimagesize($path);
list($imageThumbWidth, $imageThumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($imageWidth, $imageHeight);
$url = CRM_Utils_System::url('civicrm/file', "reset=1&id={$fid}&eid={$eid}", FALSE, NULL, TRUE, TRUE);
$file_url = "\n <a href=\"{$url}\" class='crm-image-popup'>\n <img src=\"{$url}\" width={$imageThumbWidth} height={$imageThumbHeight}/>\n </a>";
// for non image files
} else {
$uri = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_File', $fid, 'uri');
$url = CRM_Utils_System::url('civicrm/file', "reset=1&id={$fid}&eid={$eid}");
$file_url = "<a href=\"{$url}\">{$uri}</a>";
}
if (isset($fid)) {
$deleteurl = "<div class=file-delete><a class='action-item crm-hover-button' href='javascript:void(0)' id=file_{$fid}>Delete Attached File</a></div>";
echo "<div id='del_{$fid}'>{$file_url}{$deleteurl}</div>";
}
}
}
CRM_Utils_System::civiExit();
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:30,代码来源:Files.php
示例10: run
function run()
{
$contactID = CRM_Utils_Request::retrieve('cid', 'Integer');
if (!empty($contactID)) {
if (!self::checkPermissions($contactID, 'viewWidget')) {
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm'));
CRM_Core_Error::statusBounce(ts('You do not have permission to access this page'));
}
CRM_Utils_System::setTitle(ts('Absences for %1', array(1 => CRM_Contact_BAO_Contact::displayName($contactID))));
self::registerResources($contactID);
} else {
$session = CRM_Core_Session::singleton();
if (is_numeric($session->get('userID'))) {
if (!self::checkPermissions($session->get('userID'), 'viewWidget')) {
CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm'));
CRM_Core_Error::statusBounce(ts('You do not have permission to access this page'));
}
CRM_Utils_System::setTitle(ts('My Absences'));
self::registerResources($session->get('userID'));
} else {
throw new CRM_Core_Exception("Failed to determine contact ID");
}
}
parent::run();
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:25,代码来源:EmployeeAbsencePage.php
示例11: createUser
/**
* @inheritDoc
*/
public function createUser(&$params, $mail)
{
$baseDir = JPATH_SITE;
require_once $baseDir . '/components/com_users/models/registration.php';
$userParams = JComponentHelper::getParams('com_users');
$model = new UsersModelRegistration();
$ufID = NULL;
// get the default usertype
$userType = $userParams->get('new_usertype');
if (!$userType) {
$userType = 2;
}
if (isset($params['name'])) {
$fullname = trim($params['name']);
} elseif (isset($params['contactID'])) {
$fullname = trim(CRM_Contact_BAO_Contact::displayName($params['contactID']));
} else {
$fullname = trim($params['cms_name']);
}
// Prepare the values for a new Joomla user.
$values = array();
$values['name'] = $fullname;
$values['username'] = trim($params['cms_name']);
$values['password1'] = $values['password2'] = $params['cms_pass'];
$values['email1'] = $values['email2'] = trim($params[$mail]);
$lang = JFactory::getLanguage();
$lang->load('com_users', $baseDir);
$register = $model->register($values);
$ufID = JUserHelper::getUserId($values['username']);
return $ufID;
}
开发者ID:nyimbi,项目名称:civicrm-core,代码行数:34,代码来源:Joomla.php
示例12: preProcess
/**
* Build all the data structures needed to build the form.
*/
public function preProcess()
{
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
//get current client name.
$this->assign('currentClientName', CRM_Contact_BAO_Contact::displayName($cid));
//set the context.
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$cid}&selectedChild=case");
if ($context == 'search') {
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
//validate the qfKey
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$url = CRM_Utils_System::url('civicrm/case/search', $urlParams);
} elseif ($context == 'dashboard') {
$url = CRM_Utils_System::url('civicrm/case', 'reset=1');
} elseif (in_array($context, array('dashlet', 'dashletFullscreen'))) {
$url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
}
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:28,代码来源:EditClient.php
示例13: run
/**
* Run the page.
*
* This method is called after the page is created.
*
* @return void
* @access public
*
*/
function run()
{
// get the callback, module and activity id
$action = CRM_Utils_Request::retrieve('action', $this, false, 'browse');
$id = CRM_Utils_Request::retrieve('id', $this);
$dao =& new CRM_Core_DAO_ActivityHistory();
$dao->activity_id = $id;
$dao->activity_type = ts('SMS Sent');
if ($dao->find(true)) {
$cid = $dao->entity_id;
}
require_once 'CRM/SMS/DAO/History.php';
$dao =& new CRM_SMS_DAO_History();
$dao->id = $id;
if ($dao->find(true)) {
$this->assign('fromName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $dao->contact_id, 'display_name'));
$this->assign('toName', CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name'));
$this->assign('sentDate', $dao->sent_date);
$this->assign('message', $dao->message);
// get the display name and images for the contact
list($displayName, $contactImage) = CRM_Contact_BAO_Contact::getDisplayAndImage($dao->contact_id);
CRM_Utils_System::setTitle($contactImage . ' ' . $displayName);
require_once 'CRM/Utils/Menu.php';
// also add the cid params to the Menu array
CRM_Utils_Menu::addParam('cid', $cid);
// create menus ..
$startWeight = CRM_Utils_Menu::getMaxWeight('civicrm/contact/view');
$startWeight++;
require_once 'CRM/Core/BAO/CustomGroup.php';
CRM_Core_BAO_CustomGroup::addMenuTabs(CRM_Contact_BAO_Contact::getContactType($cid), 'civicrm/contact/view/cd', $startWeight);
}
parent::run();
}
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:42,代码来源:SMS.php
示例14: postProcess
static function postProcess(&$form)
{
$values = $form->exportValues();
$teamId = $values['pcp_team_contact'];
$teampcpId = CRM_Pcpteams_Utils::getPcpIdByContactAndEvent($form->get('component_page_id'), $teamId);
$userId = CRM_Pcpteams_Utils::getloggedInUserId();
// Create Team Member of relation to this Team
$cfpcpab = CRM_Pcpteams_Utils::getPcpABCustomFieldId();
$cfpcpba = CRM_Pcpteams_Utils::getPcpBACustomFieldId();
$customParams = array("custom_{$cfpcpab}" => $form->get('page_id'), "custom_{$cfpcpba}" => $teampcpId);
CRM_Pcpteams_Utils::createTeamRelationship($userId, $teamId, $customParams);
$form->_teamName = CRM_Contact_BAO_Contact::displayName($teamId);
$form->set('teamName', $form->_teamName);
$form->set('teamContactID', $teamId);
$form->set('teamPcpId', $teampcpId);
$teamAdminId = CRM_Pcpteams_Utils::getTeamAdmin($teampcpId);
// Team Join: create activity
$actParams = array('target_contact_id' => $teamId, 'assignee_contact_id' => $teamAdminId);
CRM_Pcpteams_Utils::createPcpActivity($actParams, CRM_Pcpteams_Constant::C_AT_REQ_MADE);
CRM_Core_Session::setStatus(ts('A notification has been sent to the team. Once approved, team should be visible on your page.'), ts('Team Request Sent'));
//send email once the team request has done.
list($teamAdminName, $teamAdminEmail) = CRM_Contact_BAO_Contact::getContactDetails($teamAdminId);
$contactDetails = civicrm_api('Contact', 'get', array('version' => 3, 'sequential' => 1, 'id' => $userId));
$emailParams = array('tplParams' => array('teamAdminName' => $teamAdminName, 'userFirstName' => $contactDetails['values'][0]['first_name'], 'userlastName' => $contactDetails['values'][0]['last_name'], 'teamName' => $form->_teamName, 'pageURL' => CRM_Utils_System::url('civicrm/pcp/manage', "reset=1&id={$teampcpId}", TRUE, NULL, FALSE, TRUE)), 'email' => array($teamAdminName => array('first_name' => $teamAdminName, 'last_name' => $teamAdminName, 'email-Primary' => $teamAdminEmail, 'display_name' => $teamAdminName)), 'valueName' => CRM_Pcpteams_Constant::C_MSG_TPL_JOIN_REQUEST);
$sendEmail = CRM_Pcpteams_Utils::sendMail($userId, $emailParams);
}
开发者ID:eruraindil,项目名称:uk.co.vedaconsulting.pcpteams,代码行数:26,代码来源:TeamJoin.php
示例15: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
public function preProcess()
{
$this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$this->_caseId = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
//get current client name.
require_once 'CRM/Contact/BAO/Contact.php';
$this->assign('currentClientName', CRM_Contact_BAO_Contact::displayName($this->_contactId));
//set the context.
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$this->_contactId}&selectedChild=case");
if ($context == 'search') {
$qfKey = CRM_Utils_Request::retrieve('key', 'String', $this);
//validate the qfKey
require_once 'CRM/Utils/Rule.php';
$urlParams = 'force=1';
if (CRM_Utils_Rule::qfKey($qfKey)) {
$urlParams .= "&qfKey={$qfKey}";
}
$url = CRM_Utils_System::url('civicrm/case/search', $urlParams);
} else {
if ($context == 'dashboard') {
$url = CRM_Utils_System::url('civicrm/case', 'reset=1');
}
}
$session = CRM_Core_Session::singleton();
$session->pushUserContext($url);
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:33,代码来源:EditClient.php
示例16: testCreate
/**
* Check method create()
*/
public function testCreate()
{
$firstName = 'Shane';
$lastName = 'Whatson';
$params = array('first_name' => $firstName, 'last_name' => $lastName, 'contact_type' => 'Individual');
$contact = CRM_Contact_BAO_Contact::add($params);
$price = 100.0;
$cParams = array('contact_id' => $contact->id, 'total_amount' => $price, 'financial_type_id' => 1, 'is_active' => 1, 'skipLineItem' => 1);
$defaults = array();
$contribution = CRM_Contribute_BAO_Contribution::add($cParams, $defaults);
$lParams = array('entity_id' => $contribution->id, 'entity_table' => 'civicrm_contribution', 'price_field_id' => 1, 'qty' => 1, 'label' => 'Contribution Amount', 'unit_price' => $price, 'line_total' => $price, 'price_field_value_id' => 1, 'financial_type_id' => 1);
$lineItem = CRM_Price_BAO_LineItem::create($lParams);
$fParams = array('contact_id' => $contact->id, 'description' => 'Contribution Amount', 'amount' => $price, 'financial_account_id' => 1, 'status_id' => 1, 'transaction_date' => date('YmdHis'), 'entity_id' => $lineItem->id, 'entity_table' => 'civicrm_line_item');
CRM_Financial_BAO_FinancialItem::create($fParams);
$entityTrxn = new CRM_Financial_DAO_EntityFinancialTrxn();
$entityTrxn->entity_table = 'civicrm_contribution';
$entityTrxn->entity_id = $contribution->id;
$entityTrxn->amount = $price;
if ($entityTrxn->find(TRUE)) {
$entityId = $entityTrxn->entity_id;
}
$result = $this->assertDBNotNull('CRM_Financial_DAO_FinancialItem', $lineItem->id, 'amount', 'entity_id', 'Database check on added financial item record.');
$this->assertEquals($result, $price, 'Verify Amount for Financial Item');
$entityResult = $this->assertDBNotNull('CRM_Financial_DAO_EntityFinancialTrxn', $entityId, 'amount', 'entity_id', 'Database check on added entity financial trxn record.');
$this->assertEquals($entityResult, $price, 'Verify Amount for Financial Item');
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:29,代码来源:FinancialItemTest.php
示例17: run
/**
* Run the page.
*
* This method is called after the page is created.
*/
public function run()
{
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$cgId = CRM_Utils_Request::retrieve('groupID', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
$customRecId = CRM_Utils_Request::retrieve('customRecId', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1, $_REQUEST);
$cgcount = CRM_Utils_Request::retrieve('cgcount', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1, $_REQUEST);
//custom groups Inline
$entityType = CRM_Contact_BAO_Contact::getContactType($contactId);
$entitySubType = CRM_Contact_BAO_Contact::getContactSubType($contactId);
$groupTree =& CRM_Core_BAO_CustomGroup::getTree($entityType, $this, $contactId, $cgId, $entitySubType);
$details = CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree, FALSE, NULL, NULL, NULL, $contactId);
//get the fields of single custom group record
if ($customRecId == 1) {
$fields = reset($details[$cgId]);
} else {
$fields = CRM_Utils_Array::value($customRecId, $details[$cgId]);
}
$this->assign('cgcount', $cgcount);
$this->assign('customRecId', $customRecId);
$this->assign('contactId', $contactId);
$this->assign('customGroupId', $cgId);
$this->assign_by_ref('cd_edit', $fields);
// check logged in user permission
CRM_Contact_Page_View::checkUserPermission($this, $contactId);
// finally call parent
parent::run();
}
开发者ID:scardinius,项目名称:civicrm-core,代码行数:33,代码来源:CustomData.php
示例18: array
/**
* combine all the importable fields from the lower levels object
*
* The ordering is important, since currently we do not have a weight
* scheme. Adding weight is super important
*
* @param int $contactType contact Type
* @param boolean $status status is used to manipulate first title
* @param boolean $showAll if true returns all fields (includes disabled fields)
* @param boolean $isProfile if its profile mode
* @param boolean $checkPermission if false, do not include permissioning clause (for custom data)
*
* @return array array of importable Fields
* @access public
* @static
*/
static function &importableFields($contactType = 'Individual', $status = FALSE, $showAll = FALSE, $isProfile = FALSE, $checkPermission = TRUE, $withMultiCustomFields = FALSE)
{
$contactType = 'Individual';
$fields = CRM_Hrjobcontract_DAO_HRJobContract::import();
$tmpContactField = $contactFields = array();
$contactFields = array();
$contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, NULL);
// Using new Dedupe rule.
$ruleParams = array('contact_type' => $contactType, 'used' => 'Unsupervised');
$fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
if (is_array($fieldsArray)) {
foreach ($fieldsArray as $value) {
$customFieldId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $value, 'id', 'column_name');
$value = $customFieldId ? 'custom_' . $customFieldId : $value;
$tmpContactField[trim($value)] = CRM_Utils_Array::value(trim($value), $contactFields);
if (!$status) {
$title = $tmpContactField[trim($value)]['title'] . ' (match to contact)';
} else {
$title = $tmpContactField[trim($value)]['title'];
}
$tmpContactField[trim($value)]['title'] = $title;
}
}
$extIdentifier = CRM_Utils_Array::value('external_identifier', $contactFields);
if ($extIdentifier) {
$tmpContactField['external_identifier'] = $extIdentifier;
$tmpContactField['external_identifier']['title'] = CRM_Utils_Array::value('title', $extIdentifier) . ' (match to contact)';
}
$fields = array_merge($fields, $tmpContactField);
self::$_importableFields = $fields;
return self::$_importableFields;
//$fields;
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:49,代码来源:HRJobContract.php
示例19: preProcess
/**
* build all the data structures needed to build the form
*
* @return void
* @access public
*/
function preProcess()
{
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false);
if ($cid) {
// not sure why this is needed :(
// also add the cid params to the Menu array
CRM_Core_Menu::addParam('cid', $cid);
// create menus ..
$startWeight = CRM_Core_Menu::getMaxWeight('civicrm/contact/view');
$startWeight++;
CRM_Core_BAO_CustomGroup::addMenuTabs(CRM_Contact_BAO_Contact::getContactType($cid), 'civicrm/contact/view/cd', $startWeight);
$this->_contactIds = array($cid);
$this->_single = true;
$smsNumbers = CRM_Contact_BAO_Contact::allPhones($cid, 'Mobile');
$this->_emails = array();
$toName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $cid, 'display_name');
foreach ($smsNumbers as $number => $item) {
$this->_smsNumbers[$number] = '"' . $toName . '" <' . $number . '> ' . $item['locationType'];
if ($item['is_primary']) {
$this->_smsNumbers[$number] .= ' ' . ts('(preferred)');
}
$this->_smsNumbers[$number] = htmlspecialchars($this->_emails[$email]);
}
} else {
parent::preProcess();
}
$this->assign('single', $this->_single);
}
开发者ID:ksecor,项目名称:civicrm,代码行数:34,代码来源:SMS.php
示例20: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
parent::buildQuickForm();
$this->setPageTitle(ts('Financial Batch'));
if (isset($this->_id)) {
$this->_title = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'title');
CRM_Utils_System::setTitle($this->_title . ' - ' . ts('Accounting Batch'));
$this->assign('batchTitle', $this->_title);
$contactID = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'created_id');
$contactName = CRM_Contact_BAO_Contact::displayName($contactID);
$this->assign('contactName', $contactName);
}
$this->applyFilter('__ALL__', 'trim');
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'next', 'name' => ts('Save and New'), 'subName' => 'new'), array('type' => 'cancel', 'name' => ts('Cancel'))));
if ($this->_action & CRM_Core_Action::UPDATE && $this->_id) {
$batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id');
//unset exported status
$exportedStatusId = CRM_Utils_Array::key('Exported', $batchStatus);
unset($batchStatus[$exportedStatusId]);
$this->add('select', 'status_id', ts('Batch Status'), array('' => ts('- select -')) + $batchStatus, TRUE);
$this->freeze(array('status_id'));
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Batch_DAO_Batch');
$this->add('text', 'title', ts('Batch Name'), $attributes['name'], TRUE);
$this->add('textarea', 'description', ts('Description'), $attributes['description']);
$this->add('select', 'payment_instrument_id', ts('Payment Method'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(), FALSE);
$this->add('text', 'total', ts('Total Amount
|
请发表评论