本文整理汇总了PHP中CRM_Core_Page::createElement方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Page::createElement方法的具体用法?PHP CRM_Core_Page::createElement怎么用?PHP CRM_Core_Page::createElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Page
的用法示例。
在下文中一共展示了CRM_Core_Page::createElement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildPcp
/**
* Add PCP form elements to a form.
*
* @param int $pcpId
* @param CRM_Core_Page $page
* @param null $elements
*/
public static function buildPcp($pcpId, &$page, &$elements = NULL)
{
$prms = array('id' => $pcpId);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $prms, $pcpInfo);
if ($pcpSupporter = CRM_PCP_BAO_PCP::displayName($pcpId)) {
if ($pcpInfo['page_type'] == 'event') {
$pcp_supporter_text = ts('This event registration is being made thanks to the efforts of <strong>%1</strong>, who supports our campaign. ', array(1 => $pcpSupporter));
$text = CRM_PCP_BAO_PCP::getPcpBlockStatus($pcpInfo['page_id'], 'event');
if (!empty($text)) {
$pcp_supporter_text .= "You can support it as well - once you complete the registration, you will be able to create your own Personal Campaign Page!";
}
} else {
$pcp_supporter_text = ts('This contribution is being made thanks to the efforts of <strong>%1</strong>, who supports our campaign. ', array(1 => $pcpSupporter));
$text = CRM_PCP_BAO_PCP::getPcpBlockStatus($pcpInfo['page_id'], 'contribute');
if (!empty($text)) {
$pcp_supporter_text .= "You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!";
}
}
$page->assign('pcpSupporterText', $pcp_supporter_text);
}
$page->assign('pcp', TRUE);
// build honor roll fields for registration form if supporter has honor roll enabled for their PCP
if ($pcpInfo['is_honor_roll']) {
$page->assign('is_honor_roll', TRUE);
$page->add('checkbox', 'pcp_display_in_roll', ts('Show my support in the public honor roll'), NULL, NULL, array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );"));
$extraOption = array('onclick' => "return pcpAnonymous( );");
$elements = array();
$elements[] =& $page->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
$elements[] =& $page->createElement('radio', NULL, '', ts('List my support anonymously'), 1, $extraOption);
$page->addGroup($elements, 'pcp_is_anonymous', NULL, ' ');
$page->_defaults['pcp_is_anonymous'] = 0;
$page->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30));
$page->add('textarea', "pcp_personal_note", ts('Personal Note'), array('style' => 'height: 3em; width: 40em;'));
} else {
$page->assign('is_honor_roll', FALSE);
}
}