本文整理汇总了PHP中CRM_Core_SelectValues::unitList方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_SelectValues::unitList方法的具体用法?PHP CRM_Core_SelectValues::unitList怎么用?PHP CRM_Core_SelectValues::unitList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_SelectValues
的用法示例。
在下文中一共展示了CRM_Core_SelectValues::unitList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
if ($this->_id) {
$name = $this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipStatus', 'name'));
$name->freeze();
$this->assign('id', $this->_id);
}
$this->add('text', 'label', ts('Label'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipStatus', 'label'), TRUE);
$this->addRule('label', ts('A membership status with this label already exists. Please select another label.'), 'objectExists', array('CRM_Member_DAO_MembershipStatus', $this->_id, 'name'));
$this->add('select', 'start_event', ts('Start Event'), CRM_Core_SelectValues::eventDate(), TRUE);
$this->add('select', 'start_event_adjust_unit', ts('Start Event Adjustment'), CRM_Core_SelectValues::unitList());
$this->add('text', 'start_event_adjust_interval', ts('Start Event Adjust Interval'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipStatus', 'start_event_adjust_interval'));
$this->add('select', 'end_event', ts('End Event'), CRM_Core_SelectValues::eventDate(), FALSE);
$this->add('select', 'end_event_adjust_unit', ts('End Event Adjustment'), CRM_Core_SelectValues::unitList());
$this->add('text', 'end_event_adjust_interval', ts('End Event Adjust Interval'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipStatus', 'end_event_adjust_interval'));
$this->add('checkbox', 'is_current_member', ts('Current Membership?'));
$this->add('checkbox', 'is_admin', ts('Administrator Only?'));
$this->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipStatus', 'weight'));
$this->add('checkbox', 'is_default', ts('Default?'));
$this->add('checkbox', 'is_active', ts('Enabled?'));
}
示例2: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'name'), true);
$this->addRule('name', ts('A membership type with this name already exists. Please select another name.'), 'objectExists', array('CRM_Member_DAO_MembershipType', $this->_id));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'description'));
$this->add('text', 'minimum_fee', ts('Minimum Fee'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'minimum_fee'));
$this->addRule('minimum_fee', ts('Please enter a monetary value for the Minimum Fee.'), 'money');
$this->addElement('select', 'duration_unit', ts('Duration') . ' ', CRM_Core_SelectValues::unitList('duration'), array('onchange' => 'showHidePeriodSettings()'));
//period type
$this->addElement('select', 'period_type', ts('Period Type'), CRM_Core_SelectValues::periodType(), array('onchange' => 'showHidePeriodSettings()'));
$this->add('text', 'duration_interval', ts('Duration Interval'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'duration_interval'));
$memberOrg =& $this->add('text', 'member_org', ts('Membership Organization'), 'size=30 maxlength=120');
//start day
$this->add('date', 'fixed_period_start_day', ts('Fixed Period Start Day'), CRM_Core_SelectValues::date('custom', 3, 1, "Md"), false);
//rollover day
$this->add('date', 'fixed_period_rollover_day', ts('Fixed Period Rollover Day'), CRM_Core_SelectValues::date('custom', 3, 1, "Md"), false);
$this->add('hidden', 'action', $this->_action);
//required in form rule
require_once 'CRM/Contribute/PseudoConstant.php';
$this->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
require_once 'CRM/Contact/BAO/Relationship.php';
$relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(null, null, null, null, true);
if (is_array($relTypeInd)) {
asort($relTypeInd);
}
$memberRel =& $this->add('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + $relTypeInd);
$this->add('select', 'visibility', ts('Visibility'), CRM_Core_SelectValues::memberVisibility());
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'weight'));
$this->add('checkbox', 'is_active', ts('Enabled?'));
require_once "CRM/Core/BAO/MessageTemplates.php";
$msgTemplates = CRM_Core_BAO_MessageTemplates::getMessageTemplates();
if (!empty($msgTemplates)) {
$reminderMsg = $this->add('select', 'renewal_msg_id', ts('Renewal Reminder Message'), array('' => ts('- select -')) + $msgTemplates);
} else {
$this->assign('noMsgTemplates', true);
}
$reminderDay =& $this->add('text', 'renewal_reminder_day', ts('Renewal Reminder Day'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'renewal_reminder_day'));
$searchRows = $this->get('searchRows');
$searchCount = $this->get('searchCount');
$searchDone = $this->get('searchDone');
if ($searchRows) {
$checkBoxes = array();
$chekFlag = 0;
foreach ($searchRows as $id => $row) {
$checked = '';
if (!$chekFlag) {
$checked = array('checked' => null);
$chekFlag++;
}
$checkBoxes[$id] = $this->createElement('radio', null, null, null, $id, $checked);
}
$this->addGroup($checkBoxes, 'contact_check');
$this->assign('searchRows', $searchRows);
}
$this->assign('searchCount', $searchCount);
$this->assign('searchDone', $searchDone);
if ($searchDone) {
$searchBtn = ts('Search Again');
} elseif ($this->_action & CRM_Core_Action::UPDATE) {
$searchBtn = ts('Change');
} else {
$searchBtn = ts('Search');
}
$membershipRecords = false;
if ($this->_action & CRM_Core_Action::UPDATE) {
require_once 'CRM/Member/BAO/Membership.php';
$membershipType = new CRM_Member_BAO_Membership();
$membershipType->membership_type_id = $this->_id;
if ($membershipType->find(true)) {
$membershipRecords = true;
$memberRel->freeze();
}
$memberOrg->freeze();
if ($searchDone) {
$memberOrg->unfreeze();
}
}
if ($this->_action & CRM_Core_Action::UPDATE && $reminderDay) {
$renewMessage = array();
$returnProperties = array('renewal_msg_id', 'renewal_reminder_day');
CRM_Core_DAO::commonRetrieveAll('CRM_Member_DAO_MembershipType', 'id', $this->_id, $renewMessage, $returnProperties);
if (CRM_Utils_Array::value('renewal_msg_id', $renewMessage[$this->_id]) && CRM_Utils_Array::value('renewal_reminder_day', $renewMessage[$this->_id]) && $membershipRecords) {
$reminderMsg = $this->add('select', 'renewal_msg_id', ts('Renewal Reminder Message'), array('' => ts('- select -')) + $msgTemplates);
$reminderDay->freeze();
$reminderMsg->freeze();
}
}
$this->addElement('submit', $this->getButtonName('refresh'), $searchBtn, array('class' => 'form-submit'));
$this->addFormRule(array('CRM_Member_Form_MembershipType', 'formRule'));
//.........这里部分代码省略.........
示例3: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'name'), TRUE);
$this->addRule('name', ts('A membership type with this name already exists. Please select another name.'), 'objectExists', array('CRM_Member_DAO_MembershipType', $this->_id));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'description'));
$this->add('text', 'minimum_fee', ts('Minimum Fee'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'minimum_fee'));
$this->addRule('minimum_fee', ts('Please enter a monetary value for the Minimum Fee.'), 'money');
$this->addElement('select', 'duration_unit', ts('Duration') . ' ', CRM_Core_SelectValues::unitList('duration'), array('onchange' => 'showHidePeriodSettings()'));
//period type
$this->addElement('select', 'period_type', ts('Period Type'), CRM_Core_SelectValues::periodType(), array('onchange' => 'showHidePeriodSettings()'));
$this->add('text', 'duration_interval', ts('Duration Interval'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'duration_interval'));
$memberOrg =& $this->add('text', 'member_org', ts('Membership Organization'), 'size=30 maxlength=120');
//start day
$this->add('date', 'fixed_period_start_day', ts('Fixed Period Start Day'), CRM_Core_SelectValues::date(NULL, 'M d'), FALSE);
$msgTemplates = CRM_Core_BAO_MessageTemplates::getMessageTemplates(FALSE);
$hasMsgTemplates = FALSE;
if (!empty($msgTemplates)) {
$hasMsgTemplates = TRUE;
}
//Auto-renew Option
$paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1');
$isAuthorize = FALSE;
$options = array();
$allowAutoRenewMsg = FALSE;
if (is_array($paymentProcessor) && !empty($paymentProcessor)) {
$isAuthorize = TRUE;
$options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required '));
if ($hasMsgTemplates) {
$allowAutoRenewMsg = TRUE;
$autoRenewReminderMsg = $this->add('select', 'autorenewal_msg_id', ts('Auto-renew Reminder Message'), array('' => ts('- select -')) + $msgTemplates);
}
}
$this->addRadio('auto_renew', ts('Auto-renew Option'), $options, array('onclick' => "setReminder(this.value);"));
$this->assign('authorize', $isAuthorize);
$this->assign('allowAutoRenewMsg', $allowAutoRenewMsg);
//rollover day
$this->add('date', 'fixed_period_rollover_day', ts('Fixed Period Rollover Day'), CRM_Core_SelectValues::date(NULL, 'M d'), FALSE);
// required in form rule
$this->add('hidden', 'action', $this->_action);
$this->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
$relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, NULL, TRUE);
if (is_array($relTypeInd)) {
asort($relTypeInd);
}
$memberRel =& $this->add('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + $relTypeInd);
$memberRel->setMultiple(TRUE);
$this->add('select', 'visibility', ts('Visibility'), CRM_Core_SelectValues::memberVisibility());
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'weight'));
$this->add('checkbox', 'is_active', ts('Enabled?'));
if ($hasMsgTemplates) {
$reminderMsg = $this->add('select', 'renewal_msg_id', ts('Renewal Reminder Message'), array('' => ts('- select -')) + $msgTemplates);
}
$this->assign('hasMsgTemplates', $hasMsgTemplates);
$reminderDay =& $this->add('text', 'renewal_reminder_day', ts('Renewal Reminder Day'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'renewal_reminder_day'));
$searchRows = $this->get('searchRows');
$searchCount = $this->get('searchCount');
$searchDone = $this->get('searchDone');
if ($searchRows) {
$checkBoxes = array();
$chekFlag = 0;
foreach ($searchRows as $id => $row) {
$checked = '';
if (!$chekFlag) {
$checked = array('checked' => NULL);
$chekFlag++;
}
$checkBoxes[$id] = $this->createElement('radio', NULL, NULL, NULL, $id, $checked);
}
$this->addGroup($checkBoxes, 'contact_check');
$this->assign('searchRows', $searchRows);
}
$this->assign('searchCount', $searchCount);
$this->assign('searchDone', $searchDone);
if ($searchDone) {
$searchBtn = ts('Search Again');
} elseif ($this->_action & CRM_Core_Action::UPDATE) {
$searchBtn = ts('Change');
} else {
$searchBtn = ts('Search');
}
$membershipRecords = FALSE;
if ($this->_action & CRM_Core_Action::UPDATE) {
$membershipType = new CRM_Member_BAO_Membership();
$membershipType->membership_type_id = $this->_id;
if ($membershipType->find(TRUE)) {
$membershipRecords = TRUE;
$memberRel->freeze();
}
$memberOrg->freeze();
//.........这里部分代码省略.........
示例4: buildQuickForm
/**
* Function to build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$this->applyFilter('__ALL__', 'trim');
$this->add('text', 'name', ts('Name'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'name'), TRUE);
$this->addRule('name', ts('A membership type with this name already exists. Please select another name.'), 'objectExists', array('CRM_Member_DAO_MembershipType', $this->_id));
$this->add('text', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'description'));
$this->add('text', 'minimum_fee', ts('Minimum Fee'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'minimum_fee'));
$this->addRule('minimum_fee', ts('Please enter a monetary value for the Minimum Fee.'), 'money');
$this->addElement('select', 'duration_unit', ts('Duration'), CRM_Core_SelectValues::unitList('duration'));
//period type
$this->addElement('select', 'period_type', ts('Period Type'), CRM_Core_SelectValues::periodType());
$this->add('text', 'duration_interval', ts('Duration Interval'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'duration_interval'));
$props = array('api' => array('params' => array('contact_type' => 'Organization')));
$this->addEntityRef('member_of_contact_id', ts('Membership Organization'), $props, TRUE);
//start day
$this->add('date', 'fixed_period_start_day', ts('Fixed Period Start Day'), CRM_Core_SelectValues::date(NULL, 'M d'), FALSE);
//Auto-renew Option
$paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1');
$isAuthorize = FALSE;
$options = array();
if (is_array($paymentProcessor) && !empty($paymentProcessor)) {
$isAuthorize = TRUE;
$options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required '));
}
$this->addRadio('auto_renew', ts('Auto-renew Option'), $options);
$this->assign('authorize', $isAuthorize);
//rollover day
$this->add('date', 'fixed_period_rollover_day', ts('Fixed Period Rollover Day'), CRM_Core_SelectValues::date(NULL, 'M d'), FALSE);
$this->add('date', 'month_fixed_period_rollover_day', ts('Fixed Period Rollover Day'), CRM_Core_SelectValues::date(NULL, 'd'), FALSE);
$this->add('select', 'financial_type_id', ts('Financial Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::financialType());
$relTypeInd = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, NULL, TRUE);
if (is_array($relTypeInd)) {
asort($relTypeInd);
}
$memberRel =& $this->add('select', 'relationship_type_id', ts('Relationship Type'), array('' => ts('- select -')) + $relTypeInd);
$memberRel->setMultiple(TRUE);
$this->add('select', 'visibility', ts('Visibility'), CRM_Core_SelectValues::memberVisibility());
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'weight'));
$this->add('checkbox', 'is_active', ts('Enabled?'));
$membershipRecords = FALSE;
if ($this->_action & CRM_Core_Action::UPDATE) {
$membershipType = new CRM_Member_BAO_Membership();
$membershipType->membership_type_id = $this->_id;
if ($membershipType->find(TRUE)) {
$membershipRecords = TRUE;
$memberRel->freeze();
}
}
$this->assign('membershipRecordsExists', $membershipRecords);
$this->add('text', 'max_related', ts('Max related'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipType', 'max_related'));
$this->addFormRule(array('CRM_Member_Form_MembershipType', 'formRule'));
$this->assign('membershipTypeId', $this->_id);
}