本文整理汇总了PHP中CRM_Core_ShowHideBlocks::linksForArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_ShowHideBlocks::linksForArray方法的具体用法?PHP CRM_Core_ShowHideBlocks::linksForArray怎么用?PHP CRM_Core_ShowHideBlocks::linksForArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_ShowHideBlocks
的用法示例。
在下文中一共展示了CRM_Core_ShowHideBlocks::linksForArray方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildIMBlock
/**
* build the form elements for an IM object
*
* @param CRM_Core_Form $form reference to the form object
* @param array $location the location object to store all the form elements in
* @param int $locationId the locationId we are dealing with
* @param int $count the number of blocks to create
*
* @return void
* @access public
* @static
*/
function buildIMBlock(&$form, &$location, $locationId, $count)
{
for ($i = 1; $i <= $count; $i++) {
$label = $i == 1 ? ts('Instant Messenger (preferred)') : ts('Instant Messenger');
CRM_Core_ShowHideBlocks::linksForArray($form, $i, $count, "location[{$locationId}][im]", ts('another IM'), ts('hide this IM'));
$location[$locationId]['im'][$i]['service_id'] = $form->addElement('select', "location[{$locationId}][im][{$i}][provider_id]", $label, array('' => ts('- select service -')) + CRM_Core_PseudoConstant::IMProvider());
$location[$locationId]['im'][$i]['name'] = $form->addElement('text', "location[{$locationId}][im][{$i}][name]", null, CRM_Core_DAO::getAttribute('CRM_Core_DAO_IM', 'name'));
}
}
示例2: buildEmailBlock
/**
* build the form elements for an email object
*
* @param CRM_Core_Form $form reference to the form object
* @param array $location the location object to store all the form elements in
* @param int $locationId the locationId we are dealing with
* @param int $count the number of blocks to create
*
* @return void
* @access public
* @static
*/
function buildEmailBlock(&$form, &$location, $locationId, $count)
{
for ($i = 1; $i <= $count; $i++) {
$label = $i == 1 ? ts('Email (preferred)') : ts('Email');
CRM_Core_ShowHideBlocks::linksForArray($form, $i, $count, "location[{$locationId}][email]", ts('another email'), ts('hide this email'));
$location[$locationId]['email'][$i]['email'] = $form->addElement('text', "location[{$locationId}][email][{$i}][email]", $label, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', 'email'));
$form->addRule("location[{$locationId}][email][{$i}][email]", ts('Email is not valid.'), 'email');
}
}
示例3: buildPhoneBlock
/**
* build the form elements for a phone object
*
* @param CRM_Core_Form $form reference to the form object
* @param array $location the location object to store all the form elements in
* @param int $locationId the locationId we are dealing with
* @param int $count the number of blocks to create
*
* @return void
* @access public
* @static
*/
function buildPhoneBlock(&$form, &$location, $locationId, $count)
{
for ($i = 1; $i <= $count; $i++) {
$label = $i == 1 ? ts('Phone (preferred)') : ts('Phone');
CRM_Core_ShowHideBlocks::linksForArray($form, $i, $count, "location[{$locationId}][phone]", ts('another phone'), ts('hide this phone'));
$location[$locationId]['phone'][$i]['phone_type'] = $form->addElement('select', "location[{$locationId}][phone][{$i}][phone_type]", null, CRM_Core_SelectValues::phoneType());
$location[$locationId]['phone'][$i]['phone'] = $form->addElement('text', "location[{$locationId}][phone][{$i}][phone]", $label, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'));
// TODO: set this up as a group, we need a valid phone_type_id if we have a phone number
// $form->addRule( "location[$locationId][phone][$i][phone]", ts('Phone number is not valid.'), 'phone' );
}
}
示例4: array
/**
* function to build location block
*
* @param object $form the object of the form (QF Object)
* @param int $maxLocationBlocks no of location blocks
*
* @static
* @access public
*/
function &buildLocationBlock(&$form, $maxLocationBlocks)
{
$location = array();
for ($locationId = 1; $locationId <= $maxLocationBlocks; $locationId++) {
$location[$locationId]['location_type_id'] = $form->addElement('select', "location[{$locationId}][location_type_id]", null, CRM_Core_PseudoConstant::locationType());
$location[$locationId]['is_primary'] = $form->addElement('checkbox', "location[{$locationId}][is_primary]", ts('Primary location for this contact'), ts('Primary location for this contact'), array('onchange' => "location_is_primary_onclick('" . $form->getName() . "', {$locationId}, {$maxLocationBlocks});"));
$location[$locationId]['name'] = $form->addElement('text', "location[{$locationId}][name]", ts('Location Name'), CRM_Core_PseudoConstant::locationType());
CRM_Contact_Form_Address::buildAddressBlock($form, $location, $locationId);
CRM_Contact_Form_Phone::buildPhoneBlock($form, $location, $locationId, CRM_CONTACT_FORM_LOCATION_BLOCKS);
CRM_Contact_Form_Email::buildEmailBlock($form, $location, $locationId, CRM_CONTACT_FORM_LOCATION_BLOCKS);
CRM_Contact_Form_IM::buildIMBlock($form, $location, $locationId, CRM_CONTACT_FORM_LOCATION_BLOCKS);
CRM_Core_ShowHideBlocks::linksForArray($form, $locationId, $maxLocationBlocks, "location", '', '');
}
return $location;
}