本文整理汇总了PHP中CRM_Core_BAO_UFGroup::getValidProfiles方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_UFGroup::getValidProfiles方法的具体用法?PHP CRM_Core_BAO_UFGroup::getValidProfiles怎么用?PHP CRM_Core_BAO_UFGroup::getValidProfiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_UFGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_UFGroup::getValidProfiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
$this->_first = TRUE;
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage');
// name
$this->add('text', 'title', ts('Title'), $attributes['title'], TRUE);
$this->add('select', 'contribution_type_id', ts('Contribution Type'), CRM_Contribute_PseudoConstant::contributionType(), TRUE);
//CRM-7362 --add campaigns.
CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values));
$this->addWysiwyg('intro_text', ts('Introductory Message'), $attributes['intro_text']);
$this->addWysiwyg('footer_text', ts('Footer Message'), $attributes['footer_text']);
// is on behalf of an organization ?
$this->addElement('checkbox', 'is_organization', ts('Allow individuals to contribute and / or signup for membership on behalf of an organization?'), NULL, array('onclick' => "showHideByValue('is_organization',true,'for_org_text','table-row','radio',false);showHideByValue('is_organization',true,'for_org_option','table-row','radio',false);"));
$required = array('Contact', 'Organization');
$optional = array('Contribution', 'Membership');
$profiles = CRM_Core_BAO_UFGroup::getValidProfiles($required, $optional);
//Check profiles for Organization subtypes
$contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization');
foreach ($contactSubType as $type) {
$required = array('Contact', $type);
$subTypeProfiles = CRM_Core_BAO_UFGroup::getValidProfiles($required, $optional);
foreach ($subTypeProfiles as $profileId => $profileName) {
$profiles[$profileId] = $profileName;
}
}
$requiredProfileFields = array('organization_name', 'email');
if (!empty($profiles)) {
foreach ($profiles as $id => $dontCare) {
$validProfile = CRM_Core_BAO_UFGroup::checkValidProfile($id, $requiredProfileFields);
if (!$validProfile) {
unset($profiles[$id]);
}
}
}
if (empty($profiles)) {
$invalidProfiles = TRUE;
$this->assign('invalidProfiles', $invalidProfiles);
}
$this->add('select', 'onbehalf_profile_id', ts('Organization Profile'), array('' => ts('- select -')) + $profiles);
$options = array();
$options[] = $this->createElement('radio', NULL, NULL, ts('Optional'), 1);
$options[] = $this->createElement('radio', NULL, NULL, ts('Required'), 2);
$this->addGroup($options, 'is_for_organization', ts(''));
$this->add('textarea', 'for_organization', ts('On behalf of Label'), $attributes['for_organization']);
// collect goal amount
$this->add('text', 'goal_amount', ts('Goal Amount'), array('size' => 8, 'maxlength' => 12));
$this->addRule('goal_amount', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
// is confirmation page enabled?
$this->addElement('checkbox', 'is_confirm_enabled', ts('Use a confirmation page?'));
// is this page shareable through social media ?
$this->addElement('checkbox', 'is_share', ts('Allow sharing through social media?'));
// is this page active ?
$this->addElement('checkbox', 'is_active', ts('Is this Online Contribution Page Active?'));
// should the honor be enabled
$this->addElement('checkbox', 'honor_block_is_active', ts('Honoree Section Enabled'), NULL, array('onclick' => "showHonor()"));
$this->add('text', 'honor_block_title', ts('Honoree Section Title'), $attributes['honor_block_title']);
$this->add('textarea', 'honor_block_text', ts('Honoree Introductory Message'), $attributes['honor_block_text']);
// add optional start and end dates
$this->addDateTime('start_date', ts('Start Date'));
$this->addDateTime('end_date', ts('End Date'));
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Settings', 'formRule'));
parent::buildQuickForm();
}