本文整理汇总了PHP中CRM_Core_DAO_UFJoin::copyValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO_UFJoin::copyValues方法的具体用法?PHP CRM_Core_DAO_UFJoin::copyValues怎么用?PHP CRM_Core_DAO_UFJoin::copyValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO_UFJoin
的用法示例。
在下文中一共展示了CRM_Core_DAO_UFJoin::copyValues方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
function preProcess()
{
$this->_id = CRM_Utils_Request::retrieve('id', 'Integer', $this);
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Integer', $this);
if (!isset($this->_contactID)) {
$this->_contactID = 0;
}
if (!$this->_id) {
CRM_Core_Error::fatal(ts('There is no related Vacancy to apply'));
}
$ufJoinParams = array('module' => 'Vacancy', 'entity_id' => $this->_id, 'module_data' => 'application_profile');
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->copyValues($ufJoinParams);
$ufJoin->find(TRUE);
$this->_profileID = $ufJoin->uf_group_id;
}
示例2:
/**
* Takes an associative array and creates a uf join object.
*
* @param array $params
* (reference) an assoc array of name/value pairs.
*
* @return CRM_Core_DAO_UFJoin
*/
public static function &create($params)
{
// see if a record exists with the same weight
$id = self::findJoinEntryId($params);
if ($id) {
$params['id'] = $id;
}
$dao = new CRM_Core_DAO_UFJoin();
$dao->copyValues($params);
if ($params['uf_group_id']) {
$dao->save();
} else {
$dao->delete();
}
return $dao;
}
示例3: postProcess
/**
* Process the form when submitted
*
* @return void
* @access public
*/
public function postProcess()
{
require_once 'CRM/Core/Transaction.php';
$transaction = new CRM_Core_Transaction();
// first delete the join entries associated with this contribution page
require_once 'CRM/Core/DAO/UFJoin.php';
$dao = new CRM_Core_DAO_UFJoin();
$params = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
$dao->copyValues($params);
$dao->delete();
require_once 'CRM/Core/OptionGroup.php';
$groupName = "civicrm_contribution_page.amount.{$this->_id}";
CRM_Core_OptionGroup::deleteAssoc($groupName);
//next delete the membership block fields
require_once 'CRM/Member/DAO/MembershipBlock.php';
$dao = new CRM_Member_DAO_MembershipBlock();
$dao->entity_table = 'civicrm_contribution_page';
$dao->entity_id = $this->_id;
$dao->delete();
//next delete the pcp block fields
require_once 'CRM/Contribute/DAO/PCPBlock.php';
$dao = new CRM_Contribute_DAO_PCPBlock();
$dao->entity_table = 'civicrm_contribution_page';
$dao->entity_id = $this->_id;
$dao->delete();
// need to delete premiums. CRM-4586
require_once 'CRM/Contribute/BAO/Premium.php';
CRM_Contribute_BAO_Premium::deletePremium($this->_id);
// price set cleanup, CRM-5527
require_once 'CRM/Price/BAO/Set.php';
CRM_Price_BAO_Set::removeFrom('civicrm_contribution_page', $this->_id);
// finally delete the contribution page
require_once 'CRM/Contribute/DAO/ContributionPage.php';
$dao = new CRM_Contribute_DAO_ContributionPage();
$dao->id = $this->_id;
$dao->delete();
$transaction->commit();
CRM_Core_Session::setStatus(ts('The contribution page \'%1\' has been deleted.', array(1 => $this->_title)));
}
示例4: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$config = CRM_Core_Config::singleton();
$session = CRM_Core_Session::singleton();
// current contribution page id
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
if (!$this->_id) {
// seems like the session is corrupted and/or we lost the id trail
// lets just bump this to a regular session error and redirect user to main page
$this->controller->invalidKeyRedirect();
}
// this was used prior to the cleverer this_>getContactID - unsure now
$this->_userID = $session->get('userID');
//Check if honor block is enabled for current contribution
$ufJoinParams = array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->copyValues($ufJoinParams);
$ufJoin->find(TRUE);
$this->_honor_block_is_active = $ufJoin->is_active;
$this->_contactID = $this->_membershipContactID = $this->getContactID();
$this->_mid = NULL;
if ($this->_contactID) {
$this->_mid = CRM_Utils_Request::retrieve('mid', 'Positive', $this);
if ($this->_mid) {
$membership = new CRM_Member_DAO_Membership();
$membership->id = $this->_mid;
if ($membership->find(TRUE)) {
$this->_defaultMemTypeId = $membership->membership_type_id;
if ($membership->contact_id != $this->_contactID) {
$validMembership = FALSE;
$employers = CRM_Contact_BAO_Relationship::getPermissionedEmployer($this->_userID);
if (!empty($employers) && array_key_exists($membership->contact_id, $employers)) {
$this->_membershipContactID = $membership->contact_id;
$this->assign('membershipContactID', $this->_membershipContactID);
$this->assign('membershipContactName', $employers[$this->_membershipContactID]['name']);
$validMembership = TRUE;
} else {
$membershipType = new CRM_Member_BAO_MembershipType();
$membershipType->id = $membership->membership_type_id;
if ($membershipType->find(TRUE)) {
// CRM-14051 - membership_type.relationship_type_id is a CTRL-A padded string w one or more ID values.
// Convert to commma separated list.
$inheritedRelTypes = implode(CRM_Utils_Array::explodePadded($membershipType->relationship_type_id), ',');
$permContacts = CRM_Contact_BAO_Relationship::getPermissionedContacts($this->_userID, $membershipType->relationship_type_id);
if (array_key_exists($membership->contact_id, $permContacts)) {
$this->_membershipContactID = $membership->contact_id;
$validMembership = TRUE;
}
}
}
if (!$validMembership) {
CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."), ts('Membership Invalid'), 'alert');
}
}
} else {
CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."), ts('Membership Invalid'), 'alert');
}
unset($membership);
}
}
// we do not want to display recently viewed items, so turn off
$this->assign('displayRecent', FALSE);
// Contribution page values are cleared from session, so can't use normal Printer Friendly view.
// Use Browser Print instead.
$this->assign('browserPrint', TRUE);
// action
$this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
$this->assign('action', $this->_action);
// current mode
$this->_mode = $this->_action == 1024 ? 'test' : 'live';
$this->_values = $this->get('values');
$this->_fields = $this->get('fields');
$this->_bltID = $this->get('bltID');
$this->_paymentProcessor = $this->get('paymentProcessor');
$this->_priceSetId = $this->get('priceSetId');
$this->_priceSet = $this->get('priceSet');
if (!$this->_values) {
// get all the values from the dao object
$this->_values = array();
$this->_fields = array();
CRM_Contribute_BAO_ContributionPage::setValues($this->_id, $this->_values);
// check if form is active
if (empty($this->_values['is_active'])) {
// form is inactive, die a fatal death
CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.'));
}
// also check for billing informatin
// get the billing location type
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
// CRM-8108 remove ts around Billing location type
//$this->_bltID = array_search( ts('Billing'), $locationTypes );
$this->_bltID = array_search('Billing', $locationTypes);
if (!$this->_bltID) {
CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
//.........这里部分代码省略.........
示例5: delUFJoin
/**
* Delete the uf join record for an uf group.
*
* @param array $params
* (reference) an assoc array of name/value pairs.
*/
public static function delUFJoin(&$params)
{
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->copyValues($params);
$ufJoin->delete();
}
示例6: setValues
/**
* Load values for a contribution page.
*
* @param int $id
* @param array $values
*/
public static function setValues($id, &$values)
{
$modules = array('CiviContribute', 'soft_credit', 'on_behalf');
$values['custom_pre_id'] = $values['custom_post_id'] = NULL;
$params = array('id' => $id);
CRM_Core_DAO::commonRetrieve('CRM_Contribute_DAO_ContributionPage', $params, $values);
// get the profile ids
$ufJoinParams = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $id);
// retrieve profile id as also unserialize module_data corresponding to each $module
foreach ($modules as $module) {
$ufJoinParams['module'] = $module;
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->copyValues($ufJoinParams);
if ($module == 'CiviContribute') {
$ufJoin->orderBy('weight asc');
$ufJoin->find();
while ($ufJoin->fetch()) {
if ($ufJoin->weight == 1) {
$values['custom_pre_id'] = $ufJoin->uf_group_id;
} else {
$values['custom_post_id'] = $ufJoin->uf_group_id;
}
}
} else {
$ufJoin->find(TRUE);
if (!$ufJoin->is_active) {
continue;
}
$params = CRM_Contribute_BAO_ContributionPage::formatModuleData($ufJoin->module_data, TRUE, $module);
$values = array_merge($params, $values);
if ($module == 'soft_credit') {
$values['honoree_profile_id'] = $ufJoin->uf_group_id;
$values['honor_block_is_active'] = $ufJoin->is_active;
} else {
$values['onbehalf_profile_id'] = $ufJoin->uf_group_id;
}
}
}
}
示例7: postProcess
/**
* Process the form when submitted
*
* @return void
* @access public
*/
public function postProcess()
{
$transaction = new CRM_Core_Transaction();
// first delete the join entries associated with this contribution page
$dao = new CRM_Core_DAO_UFJoin();
$params = array('entity_table' => 'civicrm_contribution_page', 'entity_id' => $this->_id);
$dao->copyValues($params);
$dao->delete();
//next delete the membership block fields
$dao = new CRM_Member_DAO_MembershipBlock();
$dao->entity_table = 'civicrm_contribution_page';
$dao->entity_id = $this->_id;
$dao->delete();
//next delete the pcp block fields
$dao = new CRM_PCP_DAO_PCPBlock();
$dao->entity_table = 'civicrm_contribution_page';
$dao->entity_id = $this->_id;
$dao->delete();
// need to delete premiums. CRM-4586
CRM_Contribute_BAO_Premium::deletePremium($this->_id);
// price set cleanup, CRM-5527
CRM_Price_BAO_PriceSet::removeFrom('civicrm_contribution_page', $this->_id);
// finally delete the contribution page
$dao = new CRM_Contribute_DAO_ContributionPage();
$dao->id = $this->_id;
$dao->delete();
$transaction->commit();
CRM_Core_Session::setStatus(ts("The contribution page '%1' has been deleted.", array(1 => $this->_title)), ts('Deleted'), 'success');
}
示例8: delUFJoin
/**
* Function to delete the uf join record for an uf group
*
* @param array $params (reference) an assoc array of name/value pairs
*
* @return void
* @access public
* @static
*/
static function delUFJoin(&$params)
{
require_once 'CRM/Core/DAO/UFJoin.php';
$ufJoin = new CRM_Core_DAO_UFJoin();
$ufJoin->copyValues($params);
$ufJoin->delete();
}