本文整理汇总了PHP中CRM_Core_Form::addButtons方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Form::addButtons方法的具体用法?PHP CRM_Core_Form::addButtons怎么用?PHP CRM_Core_Form::addButtons使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Form
的用法示例。
在下文中一共展示了CRM_Core_Form::addButtons方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
* Build form.
*
* @param CRM_Core_Form $form
*/
public static function buildForm(&$form)
{
// We should not build form elements in dashlet mode.
if ($form->_section) {
return;
}
// Check role based permission.
$instanceID = $form->getVar('_id');
if ($instanceID && !CRM_Report_Utils_Report::isInstanceGroupRoleAllowed($instanceID)) {
$url = CRM_Utils_System::url('civicrm/report/list', 'reset=1');
CRM_Core_Error::statusBounce(ts('You do not have permission to access this report.'), $url);
}
$attributes = CRM_Core_DAO::getAttribute('CRM_Report_DAO_ReportInstance');
$form->add('text', 'title', ts('Report Title'), $attributes['title']);
$form->add('text', 'description', ts('Report Description'), $attributes['description']);
$form->add('text', 'email_subject', ts('Subject'), $attributes['email_subject']);
$form->add('text', 'email_to', ts('To'), $attributes['email_to']);
$form->add('text', 'email_cc', ts('CC'), $attributes['email_subject']);
$form->add('text', 'row_count', ts('Limit Dashboard Results'), array('maxlength' => 64, 'size' => 5));
$form->add('textarea', 'report_header', ts('Report Header'), $attributes['header']);
$form->add('textarea', 'report_footer', ts('Report Footer'), $attributes['footer']);
$form->addElement('checkbox', 'is_navigation', ts('Include Report in Navigation Menu?'), NULL, array('onclick' => "return showHideByValue('is_navigation','','navigation_menu','table-row','radio',false);"));
$form->addElement('select', 'view_mode', ts('Configure link to...'), array('view' => ts('View Results'), 'criteria' => ts('Show Criteria')));
$form->addElement('checkbox', 'addToDashboard', ts('Available for Dashboard?'), NULL, array('onclick' => "return showHideByValue('addToDashboard','','limit_result','table-row','radio',false);"));
$form->addElement('checkbox', 'is_reserved', ts('Reserved Report?'));
if (!CRM_Core_Permission::check('administer reserved reports')) {
$form->freeze('is_reserved');
}
$config = CRM_Core_Config::singleton();
if ($config->userFramework != 'Joomla' || $config->userFramework != 'WordPress') {
$form->addElement('select', 'permission', ts('Permission'), array('0' => ts('Everyone (includes anonymous)')) + CRM_Core_Permission::basicPermissions());
// prepare user_roles to save as names not as ids
if (function_exists('user_roles')) {
$user_roles_array = user_roles();
foreach ($user_roles_array as $key => $value) {
$user_roles[$value] = $value;
}
$grouprole =& $form->addElement('advmultiselect', 'grouprole', ts('ACL Group/Role'), $user_roles, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$grouprole->setButtonAttributes('add', array('value' => ts('Add >>')));
$grouprole->setButtonAttributes('remove', array('value' => ts('<< Remove')));
}
}
// navigation field
$parentMenu = CRM_Core_BAO_Navigation::getNavigationList();
$form->add('select', 'parent_id', ts('Parent Menu'), array('' => ts('- select -')) + $parentMenu);
// For now we only providing drilldown for one primary detail report only. In future this could be multiple reports
foreach ($form->_drilldownReport as $reportUrl => $drillLabel) {
$instanceList = CRM_Report_Utils_Report::getInstanceList($reportUrl);
if (count($instanceList) > 1) {
$form->add('select', 'drilldown_id', $drillLabel, array('' => ts('- select -')) + $instanceList);
}
break;
}
$form->addButtons(array(array('type' => 'submit', 'name' => ts('Save Report'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
$form->addFormRule(array('CRM_Report_Form_Instance', 'formRule'), $form);
}
示例2: buildQuickForm
/**
* Build form.
*
* @param CRM_Core_Form $form
*/
public static function buildQuickForm(&$form)
{
// FIXME: this is using the following as keys rather than the standard numeric keys returned by CRM_Utils_Date
$dayOfTheWeek = array();
$dayKeys = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
foreach (CRM_Utils_Date::getAbbrWeekdayNames() as $k => $label) {
$dayOfTheWeek[$dayKeys[$k]] = $label;
}
$form->add('select', 'repetition_frequency_unit', ts('Repeats every'), CRM_Core_SelectValues::getRecurringFrequencyUnits(), FALSE, array('class' => 'required'));
$numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 30);
$form->add('select', 'repetition_frequency_interval', NULL, $numericOptions, FALSE, array('class' => 'required'));
$form->addDateTime('repetition_start_date', ts('Repetition Start Date'), FALSE, array('formatType' => 'activityDateTime'));
foreach ($dayOfTheWeek as $key => $val) {
$startActionCondition[] = $form->createElement('checkbox', $key, NULL, $val);
}
$form->addGroup($startActionCondition, 'start_action_condition', ts('Repeats on'));
$roptionTypes = array('1' => ts('day of the month'), '2' => ts('day of the week'));
$form->addRadio('repeats_by', ts("Repeats by"), $roptionTypes, array('required' => TRUE), NULL);
$form->add('select', 'limit_to', '', CRM_Core_SelectValues::getNumericOptions(1, 31));
$dayOfTheWeekNo = array('first' => ts('First'), 'second' => ts('Second'), 'third' => ts('Third'), 'fourth' => ts('Fourth'), 'last' => ts('Last'));
$form->add('select', 'entity_status_1', '', $dayOfTheWeekNo);
$form->add('select', 'entity_status_2', '', $dayOfTheWeek);
$eoptionTypes = array('1' => ts('After'), '2' => ts('On'));
$form->addRadio('ends', ts("Ends"), $eoptionTypes, array('class' => 'required'), NULL);
// Offset options gets key=>val pairs like 1=>2 because the BAO wants to know the number of
// children while it makes more sense to the user to see the total number including the parent.
$offsetOptions = range(1, 30);
unset($offsetOptions[0]);
$form->add('select', 'start_action_offset', NULL, $offsetOptions, FALSE);
$form->addFormRule(array('CRM_Core_Form_RecurringEntity', 'formRule'));
$form->addDate('repeat_absolute_date', ts('On'), FALSE, array('formatType' => 'mailing'));
$form->add('text', 'exclude_date_list', ts('Exclude Dates'), array('class' => 'twenty'));
$form->addElement('hidden', 'allowRepeatConfigToSubmit', '', array('id' => 'allowRepeatConfigToSubmit'));
$form->addButtons(array(array('type' => 'submit', 'name' => ts('Save'), 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
// For client-side pluralization
$form->assign('recurringFrequencyOptions', array('single' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::getRecurringFrequencyUnits()), 'plural' => CRM_Utils_Array::makeNonAssociative(CRM_Core_SelectValues::getRecurringFrequencyUnits(2))));
}