本文整理汇总了PHP中CRM_PCP_BAO_PCP::checkEmailProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_PCP_BAO_PCP::checkEmailProfile方法的具体用法?PHP CRM_PCP_BAO_PCP::checkEmailProfile怎么用?PHP CRM_PCP_BAO_PCP::checkEmailProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_PCP_BAO_PCP
的用法示例。
在下文中一共展示了CRM_PCP_BAO_PCP::checkEmailProfile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$id = CRM_PCP_BAO_PCP::getSupporterProfileId($this->_pageId, $this->_component);
if (CRM_PCP_BAO_PCP::checkEmailProfile($id)) {
$this->assign('profileDisplay', TRUE);
}
$fields = NULL;
if ($this->_contactID) {
if (CRM_Core_BAO_UFGroup::filterUFGroups($id, $this->_contactID)) {
$fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD);
}
$this->addFormRule(array('CRM_PCP_Form_PCPAccount', 'formRule'), $this);
} else {
CRM_Core_BAO_CMSUser::buildForm($this, $id, TRUE);
$fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD);
}
if ($fields) {
$this->assign('fields', $fields);
$addCaptcha = FALSE;
foreach ($fields as $key => $field) {
if (isset($field['data_type']) && $field['data_type'] == 'File') {
// ignore file upload fields
continue;
}
CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE);
$this->_fields[$key] = $field;
// CRM-11316 Is ReCAPTCHA enabled for this profile AND is this an anonymous visitor
if ($field['add_captcha'] && !$this->_contactID) {
$addCaptcha = TRUE;
}
}
if ($addCaptcha) {
$captcha =& CRM_Utils_ReCAPTCHA::singleton();
$captcha->add($this);
$this->assign('isCaptcha', TRUE);
}
}
if ($this->_component == 'contribute') {
$this->assign('campaignName', CRM_Contribute_PseudoConstant::contributionPage($this->_pageId));
} elseif ($this->_component == 'event') {
$this->assign('campaignName', CRM_Event_PseudoConstant::event($this->_pageId));
}
if ($this->_single) {
$button = array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')));
} else {
$button[] = array('type' => 'next', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => TRUE);
}
$this->addFormRule(array('CRM_PCP_Form_PCPAccount', 'formRule'), $this);
$this->addButtons($button);
}
示例2: formRule
/**
* Validation.
*
* @param array $params
* (ref.) an assoc array of name/value pairs.
*
* @param $files
* @param $self
*
* @return bool|array
* mixed true or array of errors
*/
public static function formRule($params, $files, $self)
{
$errors = array();
if (!empty($params['is_active'])) {
if (!empty($params['is_tellfriend_enabled']) && CRM_Utils_Array::value('tellfriend_limit', $params) <= 0) {
$errors['tellfriend_limit'] = ts('if Tell Friend is enable, Maximum recipients limit should be greater than zero.');
}
if (empty($params['supporter_profile_id'])) {
$errors['supporter_profile_id'] = ts('Supporter profile is a required field.');
} else {
if (CRM_PCP_BAO_PCP::checkEmailProfile($params['supporter_profile_id'])) {
$errors['supporter_profile_id'] = ts('Profile is not configured with Email address.');
}
}
if ($emails = CRM_Utils_Array::value('notify_email', $params)) {
$emailArray = explode(',', $emails);
foreach ($emailArray as $email) {
if ($email && !CRM_Utils_Rule::email(trim($email))) {
$errors['notify_email'] = ts('A valid Notify Email address must be specified');
}
}
}
}
return empty($errors) ? TRUE : $errors;
}