本文整理汇总了PHP中CRM_Core_Form::addDate方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Form::addDate方法的具体用法?PHP CRM_Core_Form::addDate怎么用?PHP CRM_Core_Form::addDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Form
的用法示例。
在下文中一共展示了CRM_Core_Form::addDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
/**
* You can define a custom title for the search form
*/
$this->setTitle('Find Totals for Events');
/**
* Define the search form fields here
*/
$form->addElement('checkbox', 'paid_online', ts('Only show Credit Card Payments'));
$form->addElement('checkbox', 'show_payees', ts('Show payees'));
$event_type = CRM_Core_OptionGroup::values('event_type', FALSE);
foreach ($event_type as $eventId => $eventName) {
$form->addElement('checkbox', "event_type_id[{$eventId}]", 'Event Type', $eventName);
}
$events = CRM_Event_BAO_Event::getEvents(1);
$form->add('select', 'event_id', ts('Event Name'), array('' => ts('- select -')) + $events);
$form->addDate('start_date', ts('Payments Date From'), FALSE, array('formatType' => 'custom'));
$form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
$form->assign('elements', array('paid_online', 'start_date', 'end_date', 'show_payees', 'event_type_id', 'event_id'));
}
示例2: buildForm
/**
* Prepare a set of search fields
*
* @param CRM_Core_Form $form modifiable
* @return void
*/
function buildForm(&$form)
{
CRM_Utils_System::setTitle(ts('Custom Search Group Contact'));
$aElements = array();
#get all groups
$aGroups = CRM_Core_PseudoConstant::group();
$form->addElement('advmultiselect', 'group_contact', ts('Group(s)') . ' ', $aGroups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
#assign to element
$aElements[] = 'group_contact';
#date range
$form->addDate('start_date', 'From :', FALSE, array('formatType' => 'searchDate'));
$form->addDate('end_date', 'To :', FALSE, array('formatType' => 'searchDate'));
$aElements[] = 'start_date';
$aElements[] = 'end_date';
#to get all status
/*$oGroupContact = new CRM_Contact_DAO_GroupContact;
$aGroupFields = $oGroupContact->fields();
$sStatus = $aGroupFields['status']['enumValues'];
$aStatus = explode(', ', $sStatus);*/
$aStatus = CRM_Core_SelectValues::groupContactStatus();
foreach ($aStatus as $status) {
//$form->addElement('checkbox', "status[{$status}]",$status, '', array('class' => 'group_status'));
$form->addElement('checkbox', $status, ts("{$status}"), '', array('class' => 'group_status'));
//$form->addElement('checkbox', "status[{$status}]" , $status, '', array('class' => 'group_status'));
$aElements[] = $status;
}
/**
* if you are using the standard template, this array tells the template what elements
* are part of the search criteria
*/
$this->_elements = $aElements;
$form->assign('elements', $aElements);
}
示例3: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
/**
* You can define a custom title for the search form
*/
$this->setTitle('Find Contributors by Aggregate Totals');
/**
* Define the search form fields here
*/
$form->add('text', 'min_amount', ts('Aggregate Total Between $'));
$form->addRule('min_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
$form->add('text', 'max_amount', ts('...and $'));
$form->addRule('max_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
$form->addDate('start_date', ts('Contribution Date From'), FALSE, array('formatType' => 'custom'));
$form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
$financial_types = CRM_Contribute_PseudoConstant::financialType();
foreach ($financial_types as $financial_type_id => $financial_type) {
$form->addElement('checkbox', "financial_type_id[{$financial_type_id}]", 'Financial Type', $financial_type);
}
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
$form->assign('elements', array('min_amount', 'max_amount', 'start_date', 'end_date', 'financial_type_id'));
}
示例4: buildQuickForm
/**
* build the form elements for Demographics object
*
* @param CRM_Core_Form $form reference to the form object
*
* @return void
* @access public
* @static
*/
static function buildQuickForm(&$form)
{
// radio button for gender
$genderOptions = array();
$gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id', array('localize' => TRUE));
foreach ($gender as $key => $var) {
$genderOptions[$key] = $form->createElement('radio', NULL, ts('Gender'), $var, $key, array('id' => "civicrm_gender_{$var}_{$key}"));
}
$form->addGroup($genderOptions, 'gender_id', ts('Gender'))->setAttribute('unselectable', TRUE);
$form->addDate('birth_date', ts('Date of Birth'), FALSE, array('formatType' => 'birth'));
$form->addElement('checkbox', 'is_deceased', NULL, ts('Contact is deceased'), array('onclick' => "showDeceasedDate()"));
$form->addDate('deceased_date', ts('Deceased date'), FALSE, array('formatType' => 'birth'));
}
示例5: buildQuickForm
/**
* build the form elements for Demographics object
*
* @param CRM_Core_Form $form reference to the form object
*
* @return void
* @access public
* @static
*/
static function buildQuickForm(&$form)
{
// radio button for gender
$genderOptions = array();
$gender = CRM_Core_PseudoConstant::gender();
foreach ($gender as $key => $var) {
$genderOptions[$key] = HTML_QuickForm::createElement('radio', null, ts('Gender'), $var, $key);
}
$form->addGroup($genderOptions, 'gender_id', ts('Gender'));
$form->addDate('birth_date', ts('Date of birth'), false, array('formatType' => 'birth'));
$form->addElement('checkbox', 'is_deceased', null, ts('Contact is deceased'), array('onclick' => "showDeceasedDate()"));
$form->addDate('deceased_date', ts('Deceased date'), false, array('formatType' => 'birth'));
}
示例6: buildForm
/**
* Prepare a set of search fields
*
* @param CRM_Core_Form $form modifiable
* @return void
*/
function buildForm(&$form)
{
$config = CRM_Earmarking_Config::singleton();
CRM_Utils_System::setTitle($config->translate('Search for Contacts with Recurring Contributions'));
$paymentTypeList = $this->getPaymentTypeList();
$earmarkingList = $this->getEarmarkingList();
$contibutionStatusList = $this->getContributionStatusList();
$form->add('select', 'earmarking_id', $config->translate('Earmarking'), $earmarkingList);
$form->add('select', 'payment_type_id', $config->translate('Payment Type'), $paymentTypeList);
$form->add('select', 'status_id', ts('Contribution Status'), $contibutionStatusList);
$form->addDate('start_date', ts('Start Date'), FALSE, array('formatType' => 'custom'));
$form->addDate('end_date', ts('End Date'), FALSE, array('formatType' => 'custom'));
$form->assign('elements', array('earmarking_id', 'payment_type_id', 'status_id', 'start_date', 'end_date'));
}
示例7: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
/**
* You can define a custom title for the search form
*/
$this->setTitle('Find Latest Activities');
/**
* Define the search form fields here
*/
// Allow user to choose which type of contact to limit search on
$form->add('select', 'contact_type', ts('Find...'), CRM_Core_SelectValues::contactType());
// Text box for Activity Subject
$form->add('text', 'activity_subject', ts('Activity Subject'));
// Select box for Activity Type
$activityType = array('' => ' - select activity - ') + CRM_Core_PseudoConstant::activityType();
$form->add('select', 'activity_type_id', ts('Activity Type'), $activityType, FALSE);
// textbox for Activity Status
$activityStatus = array('' => ' - select status - ') + CRM_Core_PseudoConstant::activityStatus();
$form->add('select', 'activity_status_id', ts('Activity Status'), $activityStatus, FALSE);
// Activity Date range
$form->addDate('start_date', ts('Activity Date From'), FALSE, array('formatType' => 'custom'));
$form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
// Contact Name field
$form->add('text', 'sort_name', ts('Contact Name'));
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
$form->assign('elements', array('contact_type', 'activity_subject', 'activity_type_id', 'activity_status_id', 'start_date', 'end_date', 'sort_name'));
}
示例8: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
/**
* You can define a custom title for the search form
*/
$this->setTitle('Find Contribution Amounts by Tag');
/**
* Define the search form fields here
*/
$form->addDate('start_date', ts('Contribution Date From'), FALSE, array('formatType' => 'custom'));
$form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
$tag = array('' => ts('- any tag -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
$form->addElement('select', 'tag', ts('Tagged'), $tag);
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
$form->assign('elements', array('start_date', 'end_date', 'tag'));
}
示例9: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
$form->addDate('start_date', ts('Start Date'), FALSE, array('formatType' => 'custom'));
$form->addDate('end_date', ts('End Date'), FALSE, array('formatType' => 'custom'));
$groups = CRM_Core_PseudoConstant::nestedGroup();
$select2style = array('multiple' => TRUE, 'style' => 'width: 100%; max-width: 60em;', 'class' => 'crm-select2', 'placeholder' => ts('- select -'));
$form->add('select', 'includeGroups', ts('Include Group(s)'), $groups, FALSE, $select2style);
$form->add('select', 'excludeGroups', ts('Exclude Group(s)'), $groups, FALSE, $select2style);
$this->setTitle('Search by date added to CiviCRM');
//redirect if group not available for search criteria
if (count($groups) == 0) {
CRM_Core_Error::statusBounce(ts("Atleast one Group must be present for search."), CRM_Utils_System::url('civicrm/contact/search/custom/list', 'reset=1'));
}
/**
* if you are using the standard template, this array tells the template what elements
* are part of the search criteria
*/
$form->assign('elements', array('start_date', 'end_date', 'includeGroups', 'excludeGroups'));
}
示例10: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
/**
* You can define a custom title for the search form
*/
$this->setTitle('Find Contributors by Aggregate Totals');
/**
* Define the search form fields here
*/
$form->add('text', 'min_amount', ts('Aggregate Total Between $'));
$form->addRule('min_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
$form->add('text', 'max_amount', ts('...and $'));
$form->addRule('max_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
$form->addDate('start_date', ts('Contribution Date From'), FALSE, array('formatType' => 'custom'));
$form->addDate('end_date', ts('...through'), FALSE, array('formatType' => 'custom'));
$form->addSelect('financial_type_id', array('entity' => 'contribution', 'multiple' => 'multiple', 'context' => 'search'));
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
$form->assign('elements', array('min_amount', 'max_amount', 'start_date', 'end_date'));
}
示例11: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
foreach ($this->_amounts as $name => $title) {
$form->add('text', $name, $title);
}
foreach ($this->_dates as $name => $title) {
$form->addDate($name, $title, FALSE, array('formatType' => 'custom'));
}
foreach ($this->_checkboxes as $name => $title) {
$form->add('checkbox', $name, $title);
}
$this->setTitle('Contributions made in Year X and not Year Y');
// @TODO: Decide on better names for "Exclusion"
// @TODO: Add rule to ensure that exclusion dates are not in the inclusion range
}
示例12: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
/**
* You can define a custom title for the search form
*/
$this->setTitle('Recurring Contribution Changes');
/**
* Define the search form fields here
*/
$form->addDate('start_date', ts('Changes Since'), FALSE, array('formatType' => 'custom'));
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
$form->assign('elements', array('start_date'));
}
示例13: buildPremium
/**
* Build the form object for Premium Information.
*
* Called from the CRM_Contribute_Form_Contribute function and seemingly nowhere else.
*
* Probably this should be on the form that uses it since it is not used on multiple forms.
*
* Putting it on this class doesn't seem to reduce complexity.
*
* @param CRM_Core_Form $form
*/
public static function buildPremium(&$form)
{
//premium section
$form->add('hidden', 'hidden_Premium', 1);
$sel1 = $sel2 = array();
$dao = new CRM_Contribute_DAO_Product();
$dao->is_active = 1;
$dao->find();
$min_amount = array();
$sel1[0] = ts('-select product-');
while ($dao->fetch()) {
$sel1[$dao->id] = $dao->name . " ( " . $dao->sku . " )";
$min_amount[$dao->id] = $dao->min_contribution;
$options = explode(',', $dao->options);
foreach ($options as $k => $v) {
$options[$k] = trim($v);
}
if ($options[0] != '') {
$sel2[$dao->id] = $options;
}
$form->assign('premiums', TRUE);
}
$form->_options = $sel2;
$form->assign('mincontribution', $min_amount);
$sel =& $form->addElement('hierselect', "product_name", ts('Premium'), 'onclick="showMinContrib();"');
$js = "<script type='text/javascript'>\n";
$formName = 'document.forms.' . $form->getName();
for ($k = 1; $k < 2; $k++) {
if (!isset($defaults['product_name'][$k]) || !$defaults['product_name'][$k]) {
$js .= "{$formName}['product_name[{$k}]'].style.display = 'none';\n";
}
}
$sel->setOptions(array($sel1, $sel2));
$js .= "</script>\n";
$form->assign('initHideBoxes', $js);
$form->addDate('fulfilled_date', ts('Fulfilled'), FALSE, array('formatType' => 'activityDate'));
$form->addElement('text', 'min_amount', ts('Minimum Contribution Amount'));
}
示例14: buildForm
/**
* @param CRM_Core_Form $form
*/
public function buildForm(&$form)
{
/**
* You can define a custom title for the search form
*/
$this->setTitle('Recurring Contribution Aggregate');
// Get default curreny
$config = CRM_Core_Config::singleton();
$currencySymbol = $config->defaultCurrencySymbol;
/**
* Define the search form fields here
*/
$form->addDate('start_date', ts('Start Date'), FALSE, array('formatType' => 'custom'));
$form->add('text', 'min_amount', ts('Aggregate Total Between ' . $currencySymbol));
$form->addRule('min_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
$form->add('text', 'max_amount', ts('...and ' . $currencySymbol));
$form->addRule('max_amount', ts('Please enter a valid amount (numbers and decimal point only).'), 'money');
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
$form->assign('elements', array('start_date', 'min_amount', 'max_amount'));
}
示例15: buildForm
/**
* Prepare a set of search fields
*
* @param CRM_Core_Form $form modifiable
* @return void
*/
function buildForm(&$form)
{
$this->setTitle('Potential spam entries and names for fixing');
/**
* Define the search form fields here
*/
$spam_options = array('1' => ts('First name equals last name'), '2' => ts('Names contain numbers'), '6' => ts('MiXEd cAsE LAsT namE'), '7' => ts('Non-Numeric Postcode (and address not known to be overseas)'), '8' => ts('Long or short Postcode'), '9' => ts('Long or short Phone Number'), '10' => ts('Unexpected Punctuation in Name'));
$form->addRadio('spam_options', ts('Search options'), $spam_options, array(), '<br />', TRUE);
// Text box for phone number length to test
$form->add('text', 'min_length', ts('Shortest length of postcodes (default: 4) or phone numbers (default: 10)'));
// Text box for phone number length to test
$form->add('text', 'max_length', ts('Longest length of postcodes (default: 4) or phone numbers (default: 14)'));
// Date for records added since
$form->addDate('start_date', ts('Contact records added since'), FALSE, array('formatType' => 'custom'));
// Filter on Minimum Contact ID
$form->add('text', 'min_contact_id', ts('Only show contact records with ID greater than:'));
// Filter out blank names
$form->add('checkbox', 'blank_names', ts("Check to not display contacts whose first and last name are both blank"));
/**
* If you are using the sample template, this array tells the template fields to render
* for the search form.
*/
$form->assign('elements', array('spam_options', 'min_contact_id', 'blank_names', 'min_length', 'max_length'));
}