本文整理汇总了PHP中CRM_Event_Form_ManageEvent::buildQuickForm方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_Form_ManageEvent::buildQuickForm方法的具体用法?PHP CRM_Event_Form_ManageEvent::buildQuickForm怎么用?PHP CRM_Event_Form_ManageEvent::buildQuickForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Event_Form_ManageEvent
的用法示例。
在下文中一共展示了CRM_Event_Form_ManageEvent::buildQuickForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
*
* @return void
*/
public function buildQuickForm()
{
$slots = CRM_Core_OptionGroup::values('conference_slot');
$this->add('select', 'slot_label_id', ts('Conference Slot'), array('' => ts('- select -')) + $slots, FALSE);
$this->addEntityRef('parent_event_id', ts('Parent Event'), array('entity' => 'event', 'placeholder' => ts('- any -'), 'select' => array('minimumInputLength' => 0)));
parent::buildQuickForm();
}
示例2: buildQuickForm
/**
* Function to build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
$slots = CRM_Core_OptionGroup::values('conference_slot');
$this->add('select', 'slot_label_id', ts('Conference Slot'), array('' => ts('- select -')) + $slots, FALSE);
$this->addElement('text', 'parent_event_name', ts('Parent Event'));
$this->addElement('hidden', 'parent_event_id');
parent::buildQuickForm();
}
示例3: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
// TODO:: Is this required?
$this->applyFilter('__ALL__', 'trim');
// Checkbox to ask whether or not to enable web tracking
$this->addElement('checkbox', 'enable_tracking', ts('Enable web tracking'));
// Text field to input the tracking id
$this->add('text', 'tracking_id', ts('Tracking ID'));
// Checkbox to ask whether or not to enable event tracking
$this->addElement('checkbox', 'ga_event_tracking', ts('Enable event tracking'));
// Checkbox to ask whether or not to track when the user visits the info page
$this->addElement('checkbox', 'track_info', ts('Track visit to info page'));
// Checkbox to ask whether or not to track when the user visits the registration page
$this->addElement('checkbox', 'track_register', ts('Track visit to registration page'));
// Checkbox to ask whether or not to track when the user visits the confirmation page
$this->addElement('checkbox', 'track_confirm_register', ts('Track visit to confirmation page'));
// Checkbox to ask whether or not to track when the user visits the thank you page
$this->addElement('checkbox', 'track_thank_you', ts('Track visit to thank you page'));
// Checkbox to ask whether or not to track when the user changes default price option
$this->addElement('checkbox', 'track_price_change', ts('Track price change'));
// Checkbox to ask whether or not to enable ecommerce tracking
$this->addElement('checkbox', 'track_ecommerce', ts('Enable source tracking'));
// Checkbox to ask whether the page is the primary page of the experiment
$this->addElement('checkbox', 'is_experiment', ts('Primary page of experiment'));
// Text field to input the experiment key
$this->add('text', 'experiment_id', ts('Experiment key'));
$this->addFormRule(array('CRM_WebTracking_Form_Event', 'formRule'));
parent::buildQuickForm();
}
示例4: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
if ($this->_addProfileBottom) {
return self::buildMultipleProfileBottom($this, $this->_profileBottomNum);
}
if ($this->_addProfileBottomAdd) {
return self::buildMultipleProfileBottom($this, $this->_profileBottomNumAdd, 'additional_', ts('Profile for Additional Participants'));
}
$this->applyFilter('__ALL__', 'trim');
$attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
$this->addElement('checkbox', 'is_online_registration', ts('Allow Online Registration'), NULL, array('onclick' => "return showHideByValue('is_online_registration'," . "''," . "'registration_blocks'," . "'block'," . "'radio'," . "false );"));
$this->add('text', 'registration_link_text', ts('Registration Link Text'));
if (!$this->_isTemplate) {
$this->addDateTime('registration_start_date', ts('Registration Start Date'), FALSE, array('formatType' => 'activityDateTime'));
$this->addDateTime('registration_end_date', ts('Registration End Date'), FALSE, array('formatType' => 'activityDateTime'));
}
$params = array('used' => 'Supervised', 'contact_type' => 'Individual');
$dedupeRuleFields = CRM_Dedupe_BAO_Rule::dedupeRuleFields($params);
foreach ($dedupeRuleFields as $key => $fields) {
$ruleFields[$key] = ucwords(str_replace('_', ' ', $fields));
}
$this->addElement('checkbox', 'is_multiple_registrations', ts('Register multiple participants?'));
$this->addElement('checkbox', 'allow_same_participant_emails', ts('Same email address?'));
$this->assign('ruleFields', json_encode($ruleFields));
$dedupeRules = array('' => '- Unsupervised rule -');
$dedupeRules += CRM_Dedupe_BAO_RuleGroup::getByType('Individual');
$this->add('select', 'dedupe_rule_group_id', ts('Duplicate matching rule'), $dedupeRules);
$participantStatuses = CRM_Event_PseudoConstant::participantStatus();
if (in_array('Awaiting approval', $participantStatuses) and in_array('Pending from approval', $participantStatuses) and in_array('Rejected', $participantStatuses)) {
$this->addElement('checkbox', 'requires_approval', ts('Require participant approval?'), NULL, array('onclick' => "return showHideByValue('requires_approval', '', 'id-approval-text', 'table-row', 'radio', false);"));
$this->add('textarea', 'approval_req_text', ts('Approval message'), $attributes['approval_req_text']);
}
$this->add('text', 'expiration_time', ts('Pending participant expiration (hours)'));
$this->addRule('expiration_time', ts('Please enter the number of hours (as an integer).'), 'integer');
self::buildRegistrationBlock($this);
self::buildConfirmationBlock($this);
self::buildMailBlock($this);
self::buildThankYouBlock($this);
parent::buildQuickForm();
}
示例5: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
if ($this->_cdType) {
return CRM_Custom_Form_CustomData::buildQuickForm($this);
}
//need to assign custom data type and subtype to the template
$this->assign('customDataType', 'Event');
if ($this->_eventType) {
$this->assign('customDataSubType', $this->_eventType);
}
$this->assign('entityId', $this->_id);
$this->_first = true;
$this->applyFilter('__ALL__', 'trim');
$attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
if ($this->_isTemplate) {
$this->add('text', 'template_title', ts('Template Title'), $attributes['template_title'], true);
}
if ($this->_action & CRM_Core_Action::ADD) {
require_once 'CRM/Event/PseudoConstant.php';
$eventTemplates =& CRM_Event_PseudoConstant::eventTemplates();
if (CRM_Utils_System::isNull($eventTemplates)) {
$this->assign('noEventTemplates', true);
} else {
$this->add('select', 'template_id', ts('From Template'), array('' => ts('- select -')) + $eventTemplates, false, array('onchange' => "reloadWindow( this.value );"));
}
}
// add event title, make required if this is not a template
$this->add('text', 'title', ts('Event Title'), $attributes['event_title'], !$this->_isTemplate);
require_once 'CRM/Core/OptionGroup.php';
$event = CRM_Core_OptionGroup::values('event_type');
$this->add('select', 'event_type_id', ts('Event Type'), array('' => ts('- select -')) + $event, true, array('onChange' => "buildCustomData( 'Event', this.value );"));
$participantRole = CRM_Core_OptionGroup::values('participant_role');
$this->add('select', 'default_role_id', ts('Participant Role'), $participantRole, true);
$participantListing = CRM_Core_OptionGroup::values('participant_listing');
$this->add('select', 'participant_listing_id', ts('Participant Listing'), array('' => ts('Disabled')) + $participantListing, false);
$this->add('textarea', 'summary', ts('Event Summary'), $attributes['summary']);
$this->addWysiwyg('description', ts('Complete Description'), $attributes['event_description']);
$this->addElement('checkbox', 'is_public', ts('Public Event?'));
$this->addElement('checkbox', 'is_map', ts('Include Map to Event Location?'));
$this->addDateTime('start_date', ts('Start Date'), false, array('formatType' => 'activityDateTime'));
$this->addDateTime('end_date', ts('End Date / Time'), false, array('formatType' => 'activityDateTime'));
$this->add('text', 'max_participants', ts('Max Number of Participants'), array('onchange' => "if (this.value != '') {show('id-waitlist','table-row'); showHideByValue('has_waitlist','0','id-waitlist-text','table-row','radio',false); showHideByValue('has_waitlist','0','id-event_full','table-row','radio',true); return;} else {hide('id-event_full','table-row'); hide('id-waitlist','table-row'); hide('id-waitlist-text','table-row'); return;}"));
$this->addRule('max_participants', ts('Max participants should be a positive number'), 'positiveInteger');
require_once 'CRM/Event/PseudoConstant.php';
$participantStatuses =& CRM_Event_PseudoConstant::participantStatus();
if (in_array('On waitlist', $participantStatuses) and in_array('Pending from waitlist', $participantStatuses)) {
$this->addElement('checkbox', 'has_waitlist', ts('Offer a Waitlist?'), null, array('onclick' => "showHideByValue('has_waitlist','0','id-event_full','table-row','radio',true); showHideByValue('has_waitlist','0','id-waitlist-text','table-row','radio',false);"));
$this->add('textarea', 'waitlist_text', ts('Waitlist Message'), $attributes['waitlist_text']);
}
$this->add('textarea', 'event_full_text', ts('Message if Event Is Full'), $attributes['event_full_text']);
$this->addElement('checkbox', 'is_active', ts('Is this Event Active?'));
$this->addFormRule(array('CRM_Event_Form_ManageEvent_EventInfo', 'formRule'));
parent::buildQuickForm();
}
示例6: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$vid = NULL;
parent::buildQuickForm();
$this->add('checkbox', 'is_active', ts('Enable Volunteer Management?', array('domain' => 'org.civicrm.volunteer')));
$this->addEntityRef('target_contact_id', ts('Select Beneficiary', array('domain' => 'org.civicrm.volunteer')), array('create' => TRUE, 'select' => array('allowClear' => FALSE)));
$params = array('entity_id' => $this->_id, 'entity_table' => CRM_Event_DAO_Event::$_tableName);
$projects = CRM_Volunteer_BAO_Project::retrieve($params);
if (count($projects) === 1) {
$p = current($projects);
$vid = $p->id;
}
$this->assign('vid', $vid);
}
示例7: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
CRM_Friend_BAO_Friend::buildFriendForm($this);
parent::buildQuickForm();
}
示例8: buildQuickForm
/**
* Build the form object
*
* @return None
* @access public
*/
public function buildQuickForm()
{
parent::buildQuickForm();
$this->add('checkbox', 'is_active', ts('Enable Volunteer Management?', array('domain' => 'org.civicrm.volunteer')));
$this->addEntityRef('target_contact_id', ts('Select Beneficiary', array('domain' => 'org.civicrm.volunteer')), array('create' => TRUE, 'select' => array('allowClear' => FALSE)), TRUE);
$this->assign('vid', $this->getProject() !== FALSE ? $this->getProject()->id : NULL);
$this->assign('profileSignUpMultiple', array_keys($this->getProfileIDs()));
$this->assign('profileSignUpCounter', count($this->getProfileIDs()));
$this->assign('isModulePermissionSupported', CRM_Core_Config::singleton()->userPermissionClass->isModulePermissionSupported());
}
示例9: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
$this->addYesNo('is_monetary', ts('Paid Event'), NULL, NULL, array('onclick' => "return showHideByValue('is_monetary','0','event-fees','block','radio',false);"));
//add currency element.
$this->addCurrency('currency', ts('Currency'), FALSE);
$paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor();
$this->assign('paymentProcessor', $paymentProcessor);
$this->addEntityRef('payment_processor', ts('Payment Processor'), array('entity' => 'PaymentProcessor', 'multiple' => TRUE, 'select' => array('minimumInputLength' => 0)));
// financial type
if (!CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() || CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Core_Permission::check('administer CiviCRM Financial Types')) {
$this->addSelect('financial_type_id');
} else {
CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, CRM_Core_Action::ADD);
$this->addSelect('financial_type_id', array('context' => 'search', 'options' => $financialTypes));
}
// add pay later options
$this->addElement('checkbox', 'is_pay_later', ts('Enable Pay Later option?'), NULL, array('onclick' => "return showHideByValue('is_pay_later','','payLaterOptions','block','radio',false);"));
$this->addElement('textarea', 'pay_later_text', ts('Pay Later Label'), CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event', 'pay_later_text'), FALSE);
$this->add('wysiwyg', 'pay_later_receipt', ts('Pay Later Instructions'), CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event', 'pay_later_receipt'));
$this->addElement('checkbox', 'is_billing_required', ts('Billing address required'));
$this->add('text', 'fee_label', ts('Fee Label'));
$price = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviEvent');
if (CRM_Utils_System::isNull($price)) {
$this->assign('price', FALSE);
} else {
$this->assign('price', TRUE);
}
$this->add('select', 'price_set_id', ts('Price Set'), array('' => ts('- none -')) + $price, NULL, array('onchange' => "return showHideByValue('price_set_id', '', 'map-field', 'block', 'select', false);"));
$default = array($this->createElement('radio', NULL, NULL, NULL, 0));
$this->add('hidden', 'price_field_id', '', array('id' => 'price_field_id'));
for ($i = 1; $i <= self::NUM_OPTION; $i++) {
// label
$this->add('text', "label[{$i}]", ts('Label'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'label'));
$this->add('hidden', "price_field_value[{$i}]", '', array('id' => "price_field_value[{$i}]"));
// value
$this->add('text', "value[{$i}]", ts('Value'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value'));
$this->addRule("value[{$i}]", ts('Please enter a valid money value for this field (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
// default
$default[] = $this->createElement('radio', NULL, NULL, NULL, $i);
}
$this->addGroup($default, 'default');
$this->addElement('checkbox', 'is_discount', ts('Discounts by Signup Date?'), NULL, array('onclick' => "warnDiscountDel(); return showHideByValue('is_discount','','discount','block','radio',false);"));
$discountSection = $this->get('discountSection');
$this->assign('discountSection', $discountSection);
// form fields of Discount sets
$defaultOption = array();
$_showHide = new CRM_Core_ShowHideBlocks('', '');
for ($i = 1; $i <= self::NUM_DISCOUNT; $i++) {
//the show hide blocks
$showBlocks = 'discount_' . $i;
if ($i > 2) {
$_showHide->addHide($showBlocks);
} else {
$_showHide->addShow($showBlocks);
}
//Increment by 1 of start date of previous end date.
if (is_array($this->_submitValues) && !empty($this->_submitValues['discount_name'][$i]) && !empty($this->_submitValues['discount_name'][$i + 1]) && isset($this->_submitValues['discount_end_date']) && isset($this->_submitValues['discount_end_date'][$i]) && $i < self::NUM_DISCOUNT - 1) {
$end_date = CRM_Utils_Date::processDate($this->_submitValues['discount_end_date'][$i]);
if (!empty($this->_submitValues['discount_end_date'][$i + 1]) && empty($this->_submitValues['discount_start_date'][$i + 1])) {
list($this->_submitValues['discount_start_date'][$i + 1]) = CRM_Utils_Date::setDateDefaults(date('Y-m-d', strtotime("+1 days {$end_date}")));
}
}
//Decrement by 1 of end date from next start date.
if ($i > 1 && is_array($this->_submitValues) && !empty($this->_submitValues['discount_name'][$i]) && !empty($this->_submitValues['discount_name'][$i - 1]) && isset($this->_submitValues['discount_start_date']) && isset($this->_submitValues['discount_start_date'][$i])) {
$start_date = CRM_Utils_Date::processDate($this->_submitValues['discount_start_date'][$i]);
if (!empty($this->_submitValues['discount_start_date'][$i]) && empty($this->_submitValues['discount_end_date'][$i - 1])) {
list($this->_submitValues['discount_end_date'][$i - 1]) = CRM_Utils_Date::setDateDefaults(date('Y-m-d', strtotime("-1 days {$start_date}")));
}
}
//discount name
$this->add('text', 'discount_name[' . $i . ']', ts('Discount Name'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_PriceSet', 'title'));
$this->add('hidden', "discount_price_set[{$i}]", '', array('id' => "discount_price_set[{$i}]"));
//discount start date
$this->addDate('discount_start_date[' . $i . ']', ts('Discount Start Date'), FALSE, array('formatType' => 'activityDate'));
//discount end date
$this->addDate('discount_end_date[' . $i . ']', ts('Discount End Date'), FALSE, array('formatType' => 'activityDate'));
}
$_showHide->addToTemplate();
$this->addElement('submit', $this->getButtonName('submit'), ts('Add Discount Set to Fee Table'), array('class' => 'crm-form-submit cancel'));
$this->buildAmountLabel();
parent::buildQuickForm();
}
示例10: buildQuickForm
/**
* function to build location block
*
* @return None
* @access public
*/
public function buildQuickForm()
{
//load form for child blocks
if ($this->_addBlockName) {
require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_Form_Edit_" . $this->_addBlockName) . ".php";
return eval('CRM_Contact_Form_Edit_' . $this->_addBlockName . '::buildQuickForm( $this );');
}
$this->applyFilter('__ALL__', 'trim');
//build location blocks.
CRM_Contact_Form_Location::buildQuickForm($this);
//fix for CRM-1971
$this->assign('action', $this->_action);
if ($this->_id) {
$this->_oldLocBlockId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'loc_block_id');
}
// get the list of location blocks being used by other events
$locationEvents = CRM_Event_BAO_Event::getLocationEvents();
// remove duplicates and make sure that the duplicate entry with key as
// loc_block_id of this event (this->_id) is preserved
if (CRM_Utils_Array::value($this->_oldLocBlockId, $locationEvents)) {
$possibleDuplicate = $locationEvents[$this->_oldLocBlockId];
$locationEvents = array_flip(array_unique($locationEvents));
if (CRM_Utils_Array::value($possibleDuplicate, $locationEvents)) {
$locationEvents[$possibleDuplicate] = $this->_oldLocBlockId;
}
$locationEvents = array_flip($locationEvents);
} else {
$locationEvents = array_unique($locationEvents);
}
$events = array();
if (!empty($locationEvents)) {
$this->assign('locEvents', true);
$optionTypes = array('1' => ts('Create new location'), '2' => ts('Use existing location'));
$this->addRadio('location_option', ts("Choose Location"), $optionTypes, array('onclick' => "showLocFields();"), '<br/>', false);
if (!isset($locationEvents[$this->_oldLocBlockId]) || !$this->_oldLocBlockId) {
$locationEvents = array('' => ts('- select -')) + $locationEvents;
}
$this->add('select', 'loc_event_id', ts('Use Location'), $locationEvents);
}
$this->addElement('advcheckbox', 'is_show_location', ts('Show Location?'));
parent::buildQuickForm();
}
示例11: buildQuickForm
/**
* function to build location block.
*
* @return void
*/
public function buildQuickForm()
{
//load form for child blocks
if ($this->_addBlockName) {
$className = "CRM_Contact_Form_Edit_{$this->_addBlockName}";
return $className::buildQuickForm($this);
}
$this->applyFilter('__ALL__', 'trim');
//build location blocks.
CRM_Contact_Form_Location::buildQuickForm($this);
//fix for CRM-1971
$this->assign('action', $this->_action);
if ($this->_id) {
$this->_oldLocBlockId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'loc_block_id');
}
// get the list of location blocks being used by other events
$locationEvents = CRM_Event_BAO_Event::getLocationEvents();
// remove duplicates and make sure that the duplicate entry with key as
// loc_block_id of this event (this->_id) is preserved
if (!empty($locationEvents[$this->_oldLocBlockId])) {
$possibleDuplicate = $locationEvents[$this->_oldLocBlockId];
$locationEvents = array_flip(array_unique($locationEvents));
if (!empty($locationEvents[$possibleDuplicate])) {
$locationEvents[$possibleDuplicate] = $this->_oldLocBlockId;
}
$locationEvents = array_flip($locationEvents);
} else {
$locationEvents = array_unique($locationEvents);
}
$events = array();
if (!empty($locationEvents)) {
$this->assign('locEvents', TRUE);
$optionTypes = array('1' => ts('Create new location'), '2' => ts('Use existing location'));
$this->addRadio('location_option', ts("Choose Location"), $optionTypes);
if (!isset($locationEvents[$this->_oldLocBlockId]) || !$this->_oldLocBlockId) {
$locationEvents = array('' => ts('- select -')) + $locationEvents;
}
$this->add('select', 'loc_event_id', ts('Use Location'), $locationEvents);
}
$this->addElement('advcheckbox', 'is_show_location', ts('Show Location?'));
parent::buildQuickForm();
}
示例12: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
require_once 'CRM/Utils/Money.php';
$this->addYesNo('is_monetary', ts('Paid Event'), null, null, array('onclick' => "return showHideByValue('is_monetary','0','event-fees','block','radio',false);"));
require_once 'CRM/Contribute/PseudoConstant.php';
$paymentProcessor =& CRM_Core_PseudoConstant::paymentProcessor();
$this->assign('paymentProcessor', $paymentProcessor);
$this->add('select', 'payment_processor_id', ts('Payment Processor'), array('' => ts('- select -')) + $paymentProcessor);
$this->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
// add pay later options
$this->addElement('checkbox', 'is_pay_later', ts('Enable Pay Later option?'), null, array('onclick' => "return showHideByValue('is_pay_later','','payLaterOptions','block','radio',false);"));
$this->addElement('textarea', 'pay_later_text', ts('Pay Later Label'), CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event', 'pay_later_text'), false);
$this->addElement('textarea', 'pay_later_receipt', ts('Pay Later Instructions'), CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event', 'pay_later_receipt'), false);
$this->add('text', 'fee_label', ts('Fee Label'));
require_once 'CRM/Price/BAO/Set.php';
$this->add('select', 'price_set_id', ts('Price Set'), array('' => ts('- none -')) + CRM_Price_BAO_Set::getAssoc(false, 'Event'), null, array('onchange' => "return showHideByValue('price_set_id', '', 'map-field', 'block', 'select', false);"));
$default = array();
for ($i = 1; $i <= self::NUM_OPTION; $i++) {
// label
$this->add('text', "label[{$i}]", ts('Label'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'label'));
// value
$this->add('text', "value[{$i}]", ts('Value'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value'));
$this->addRule("value[{$i}]", ts('Please enter a valid money value for this field (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
// default
$default[] = $this->createElement('radio', null, null, null, $i);
}
$this->addGroup($default, 'default');
$this->addElement('checkbox', 'is_discount', ts('Discounts by Signup Date?'), null, array('onclick' => "warnDiscountDel(); return showHideByValue('is_discount','','discount','block','radio',false);"));
$discountSection = $this->get('discountSection');
$this->assign('discountSection', $discountSection);
require_once 'CRM/Core/ShowHideBlocks.php';
// form fields of Discount sets
$defaultOption = array();
$_showHide =& new CRM_Core_ShowHideBlocks('', '');
for ($i = 1; $i <= self::NUM_DISCOUNT; $i++) {
//the show hide blocks
$showBlocks = 'discount_' . $i;
if ($i > 2) {
$_showHide->addHide($showBlocks);
} else {
$_showHide->addShow($showBlocks);
}
//Increment by 1 of start date of previous end date.
if (is_array($this->_submitValues) && !empty($this->_submitValues['discount_name'][$i]) && !empty($this->_submitValues['discount_name'][$i + 1]) && isset($this->_submitValues['discount_end_date']) && isset($this->_submitValues['discount_end_date'][$i]) && array_values($this->_submitValues['discount_end_date'][$i]) && $i < self::NUM_DISCOUNT - 1) {
$end_date = CRM_Utils_Date::format($this->_submitValues['discount_end_date'][$i], '-');
if (!empty($this->_submitValues['discount_end_date'][$i + 1]['M']) && empty($this->_submitValues['discount_start_date'][$i + 1]['M'])) {
$this->_submitValues['discount_start_date'][$i + 1] = CRM_Utils_Date::unformat(date('Y-m-d', strtotime("+1 days {$end_date}")));
}
}
//Decrement by 1 of end date from next start date.
if ($i > 1 && is_array($this->_submitValues) && !empty($this->_submitValues['discount_name'][$i]) && !empty($this->_submitValues['discount_name'][$i - 1]) && isset($this->_submitValues['discount_start_date']) && isset($this->_submitValues['discount_start_date'][$i]) && array_values($this->_submitValues['discount_start_date'][$i])) {
$start_date = CRM_Utils_Date::format($this->_submitValues['discount_start_date'][$i], '-');
if (!empty($this->_submitValues['discount_start_date'][$i]['M']) && empty($this->_submitValues['discount_end_date'][$i - 1]['M'])) {
$this->_submitValues['discount_end_date'][$i - 1] = CRM_Utils_Date::unformat(date('Y-m-d', strtotime("-1 days {$start_date}")));
}
}
//discount name
$this->add('text', 'discount_name[' . $i . ']', ts('Discount Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'label'));
//discount start date
$this->add('date', 'discount_start_date[' . $i . ']', ts('Discount Start Date'), CRM_Core_SelectValues::date('activityDate'));
//discount end date
$this->add('date', 'discount_end_date[' . $i . ']', ts('Discount End Date'), CRM_Core_SelectValues::date('activityDate'));
}
$_showHide->addToTemplate();
$this->addElement('submit', $this->getButtonName('submit'), ts('Add Discount Set to Fee Table'), array('class' => 'form-submit'));
$this->buildAmountLabel();
parent::buildQuickForm();
}
示例13: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
if (isset($this->_id)) {
$defaults['entity_table'] = 'civicrm_event';
$defaults['entity_id'] = $this->_id;
CRM_Friend_BAO_Friend::getValues($defaults);
$this->_friendId = CRM_Utils_Array::value('id', $defaults);
}
CRM_Friend_BAO_Friend::buildFriendForm($this);
parent::buildQuickForm();
}
示例14: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$this->applyFilter('__ALL__', 'trim');
$attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event');
$this->addElement('checkbox', 'is_online_registration', ts('Allow Online Registration?'), null, array('onclick' => "return showHideByValue('is_online_registration', \n '', \n 'registration_blocks', \n 'block', \n 'radio', \n false );"));
$this->add('text', 'registration_link_text', ts('Registration Link Text'));
if (!$this->_isTemplate) {
$this->addDateTime('registration_start_date', ts('Registration Start Date'));
$this->addDateTime('registration_end_date', ts('Registration End Date'));
}
$this->addElement('checkbox', 'is_multiple_registrations', ts('Register multiple participants?'), null, array('onclick' => "return showHideByValue('is_multiple_registrations', '', 'additional_profile_pre|additional_profile_post', 'table-row', 'radio', false);"));
$this->addElement('checkbox', 'allow_same_participant_emails', ts('Allow multiple registrations from the same email address?'));
require_once 'CRM/Event/PseudoConstant.php';
$participantStatuses =& CRM_Event_PseudoConstant::participantStatus();
if (in_array('Awaiting approval', $participantStatuses) and in_array('Pending from approval', $participantStatuses) and in_array('Rejected', $participantStatuses)) {
$this->addElement('checkbox', 'requires_approval', ts('Require participant approval?'), null, array('onclick' => "return showHideByValue('requires_approval', '', 'id-approval-text', 'table-row', 'radio', false);"));
$this->add('textarea', 'approval_req_text', ts('Approval message'), $attributes['approval_req_text']);
}
$this->add('text', 'expiration_time', ts('Pending participant expiration (hours)'));
$this->addRule('expiration_time', ts('Please enter the number of hours (as an integer).'), 'integer');
self::buildRegistrationBlock($this);
self::buildConfirmationBlock($this);
self::buildMailBlock($this);
self::buildThankYouBlock($this);
parent::buildQuickForm();
}
示例15: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$this->addYesNo('is_monetary', ts('Paid Event'), NULL, NULL, array('onclick' => "return showHideByValue('is_monetary','0','event-fees','block','radio',false);"));
//add currency element.
$this->addCurrency('currency', ts('Currency'), FALSE);
$paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor();
$this->assign('paymentProcessor', $paymentProcessor);
$this->addCheckBox('payment_processor', ts('Payment Processor'), array_flip($paymentProcessor), NULL, NULL, NULL, NULL, array(' ', ' ', ' ', '<br/>'));
$this->add('select', 'contribution_type_id', ts('Contribution Type'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionType());
// add pay later options
$this->addElement('checkbox', 'is_pay_later', ts('Enable Pay Later option?'), NULL, array('onclick' => "return showHideByValue('is_pay_later','','payLaterOptions','block','radio',false);"));
$this->addElement('textarea', 'pay_later_text', ts('Pay Later Label'), CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event', 'pay_later_text'), FALSE);
$this->addElement('textarea', 'pay_later_receipt', ts('Pay Later Instructions'), CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event', 'pay_later_receipt'), FALSE);
$this->add('text', 'fee_label', ts('Fee Label'));
$price = CRM_Price_BAO_Set::getAssoc(FALSE, 'CiviEvent');
if (CRM_Utils_System::isNull($price)) {
$this->assign('price', FALSE);
} else {
$this->assign('price', TRUE);
}
$this->add('select', 'price_set_id', ts('Price Set'), array('' => ts('- none -')) + $price, NULL, array('onchange' => "return showHideByValue('price_set_id', '', 'map-field', 'block', 'select', false);"));
$default = array();
$this->add('hidden', "price_field_id", '', array('id' => "price_field_id"));
for ($i = 1; $i <= self::NUM_OPTION; $i++) {
// label
$this->add('text', "label[{$i}]", ts('Label'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'label'));
$this->add('hidden', "price_field_value[{$i}]", '', array('id' => "price_field_value[{$i}]"));
// value
$this->add('text', "value[{$i}]", ts('Value'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value'));
$this->addRule("value[{$i}]", ts('Please enter a valid money value for this field (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
// default
$default[] = $this->createElement('radio', NULL, NULL, NULL, $i);
}
$this->addGroup($default, 'default');
$this->addElement('checkbox', 'is_discount', ts('Discounts by Signup Date?'), NULL, array('onclick' => "warnDiscountDel(); return showHideByValue('is_discount','','discount','block','radio',false);"));
$discountSection = $this->get('discountSection');
$this->assign('discountSection', $discountSection);
// form fields of Discount sets
$defaultOption = array();
$_showHide = new CRM_Core_ShowHideBlocks('', '');
for ($i = 1; $i <= self::NUM_DISCOUNT; $i++) {
//the show hide blocks
$showBlocks = 'discount_' . $i;
if ($i > 2) {
$_showHide->addHide($showBlocks);
} else {
$_showHide->addShow($showBlocks);
}
//Increment by 1 of start date of previous end date.
if (is_array($this->_submitValues) && !empty($this->_submitValues['discount_name'][$i]) && !empty($this->_submitValues['discount_name'][$i + 1]) && isset($this->_submitValues['discount_end_date']) && isset($this->_submitValues['discount_end_date'][$i]) && $i < self::NUM_DISCOUNT - 1) {
$end_date = CRM_Utils_Date::processDate($this->_submitValues['discount_end_date'][$i]);
if (!empty($this->_submitValues['discount_end_date'][$i + 1]) && empty($this->_submitValues['discount_start_date'][$i + 1])) {
list($this->_submitValues['discount_start_date'][$i + 1]) = CRM_Utils_Date::setDateDefaults(date('Y-m-d', strtotime("+1 days {$end_date}")));
}
}
//Decrement by 1 of end date from next start date.
if ($i > 1 && is_array($this->_submitValues) && !empty($this->_submitValues['discount_name'][$i]) && !empty($this->_submitValues['discount_name'][$i - 1]) && isset($this->_submitValues['discount_start_date']) && isset($this->_submitValues['discount_start_date'][$i])) {
$start_date = CRM_Utils_Date::processDate($this->_submitValues['discount_start_date'][$i]);
if (!empty($this->_submitValues['discount_start_date'][$i]) && empty($this->_submitValues['discount_end_date'][$i - 1])) {
list($this->_submitValues['discount_end_date'][$i - 1]) = CRM_Utils_Date::setDateDefaults(date('Y-m-d', strtotime("-1 days {$start_date}")));
}
}
//discount name
$this->add('text', 'discount_name[' . $i . ']', ts('Discount Name'), CRM_Core_DAO::getAttribute('CRM_Price_DAO_Set', 'title'));
$this->add('hidden', "discount_price_set[{$i}]", '', array('id' => "discount_price_set[{$i}]"));
// add a rule to ensure that discount name is not more than 24 characters to prevent overflow
// in option group name, CRM-7915
// 24 characters will make the option group name less than 64 characters
$this->addRule("discount_name[{$i}]", ts('Discount Name cannot be more than 24 characters'), 'maxlength', 24);
//discount start date
$this->addDate('discount_start_date[' . $i . ']', ts('Discount Start Date'), FALSE, array('formatType' => 'activityDate'));
//discount end date
$this->addDate('discount_end_date[' . $i . ']', ts('Discount End Date'), FALSE, array('formatType' => 'activityDate'));
}
$_showHide->addToTemplate();
$this->addElement('submit', $this->getButtonName('submit'), ts('Add Discount Set to Fee Table'), array('class' => 'form-submit'));
$this->buildAmountLabel();
parent::buildQuickForm();
}