/** * * @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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { CRM_Friend_BAO_Friend::buildFriendForm($this); parent::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()); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * Build the form object. */ public function buildQuickForm() { //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) { $eventTemplates = CRM_Event_PseudoConstant::eventTemplates(); if (CRM_Utils_System::isNull($eventTemplates) && !$this->_isTemplate) { $url = CRM_Utils_System::url('civicrm/admin/eventTemplate', array('reset' => 1)); CRM_Core_Session::setStatus(ts('If you find that you are creating multiple events with similar settings, you may want to use the <a href="%1">Event Templates</a> feature to streamline your workflow.', array(1 => $url)), ts('Tip'), 'info'); } if (!CRM_Utils_System::isNull($eventTemplates)) { $this->add('select', 'template_id', ts('From Template'), array('' => ts('- select -')) + $eventTemplates, FALSE, array('class' => 'crm-select2 huge')); } // Make sure this form redirects properly $this->preventAjaxSubmit(); } // add event title, make required if this is not a template $this->add('text', 'title', ts('Event Title'), $attributes['event_title'], !$this->_isTemplate); $this->addSelect('event_type_id', array('onChange' => "CRM.buildCustomData( 'Event', this.value );"), TRUE); //CRM-7362 --add campaigns. $campaignId = NULL; if ($this->_id) { $campaignId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_id, 'campaign_id'); } CRM_Campaign_BAO_Campaign::addCampaign($this, $campaignId); $this->addSelect('default_role_id', array(), TRUE); $this->addSelect('participant_listing_id', array('placeholder' => ts('Disabled'), 'option_url' => NULL)); $this->add('textarea', 'summary', ts('Event Summary'), $attributes['summary']); $this->add('wysiwyg', 'description', ts('Complete Description'), $attributes['event_description']); $this->addElement('checkbox', 'is_public', ts('Public Event')); $this->addElement('checkbox', 'is_share', ts('Allow sharing through social media?')); $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 != '') {cj('#id-waitlist').show(); showHideByValue('has_waitlist','0','id-waitlist-text','table-row','radio',false); showHideByValue('has_waitlist','0','id-event_full','table-row','radio',true); return;} else {cj('#id-event_full, #id-waitlist, #id-waitlist-text').hide(); return;}")); $this->addRule('max_participants', ts('Max participants should be a positive number'), 'positiveInteger'); $participantStatuses = CRM_Event_PseudoConstant::participantStatus(); $waitlist = 0; 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']); $waitlist = 1; } $this->assign('waitlist', $waitlist); $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(); }
/** * Build the form object. * * @return void */ public function buildQuickForm() { CRM_PCP_BAO_PCP::buildPCPForm($this); $this->addElement('checkbox', 'pcp_active', ts('Enable Personal Campaign Pages? (for this event)'), NULL, array('onclick' => "return showHideByValue('pcp_active',true,'pcpFields','table-row','radio',false);")); $this->add('select', 'target_entity_type', ts('Campaign Type'), array('' => ts('- select -'), 'event' => ts('Event'), 'contribute' => ts('Contribution')), NULL, array('onchange' => "return showHideByValue('target_entity_type','contribute','pcpDetailFields','block','select',false);")); $this->add('select', 'target_entity_id', ts('Online Contribution Page'), array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::contributionPage()); parent::buildQuickForm(); // If at least one PCP has been created, don't allow changing the target $pcpBlock = new CRM_PCP_DAO_PCPBlock(); $pcpBlock->entity_table = 'civicrm_event'; $pcpBlock->entity_id = $this->_id; $pcpBlock->find(TRUE); if (!empty($pcpBlock->id) && CRM_PCP_BAO_PCP::getPcpBlockInUse($pcpBlock->id)) { foreach (array('target_entity_type', 'target_entity_id') as $element_name) { $element = $this->getElement($element_name); $element->freeze(); } } $this->addFormRule(array('CRM_PCP_Form_Event', 'formRule'), $this); }
/** * 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'), false, array('formatType' => 'activityDateTime')); $this->addDateTime('registration_end_date', ts('Registration End Date'), false, array('formatType' => 'activityDateTime')); } $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);")); require_once 'CRM/Dedupe/BAO/Rule.php'; $params = array('level' => 'Fuzzy', 'contact_type' => 'Individual'); $dedupeRuleFields = CRM_Dedupe_BAO_Rule::dedupeRuleFields($params); foreach ($dedupeRuleFields as $key => $fields) { $ruleFields[$key] = ucwords(str_replace('_', ' ', $fields)); } $this->addElement('checkbox', 'allow_same_participant_emails', ts('Allow multiple registrations from the same email address?'), null, array('onclick' => "return showRuleFields( " . json_encode($ruleFields) . " );")); $this->assign('ruleFields', json_encode($ruleFields)); 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(); }
/** * Function to build the form * * @return void * @access public */ public function buildQuickForm() { $field = 'civicrm_event'; if ($this->_isTemplate) { $field = 'event_template'; } $this->_mappingID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', $field, 'id', 'entity_value'); if (!$this->_mappingID) { CRM_Core_Error::fatal('Could not find mapping for event scheduled reminders.'); } parent::buildQuickForm(); $this->add('text', 'title', ts('Reminder Name'), array('size' => 45, 'maxlength' => 128), TRUE); $selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection($this->_mappingID); extract($selectionOptions); $this->assign('recipientMapping', json_encode($recipientMapping)); // Fixme: hack to adjust the output of CRM_Core_BAO_ActionSchedule::getSelection so it looks nice with the jQuery.select2 plugin // TODO: fix this upstream $options = $sel3[$this->_mappingID][0]; $attributes = array('multiple' => 'multiple', 'class' => 'crm-select2 huge', 'placeholder' => $options[0]); unset($options[0]); $entity = $this->add('select', 'entity', ts('Recipient(s)'), $options, TRUE, $attributes); //get the frequency units. $this->_freqUnits = array('hour' => 'hour') + CRM_Core_OptionGroup::values('recur_frequency_units'); $numericOptions = CRM_Core_SelectValues::getNumericOptions(0, 30); //reminder_interval $this->add('select', 'start_action_offset', ts('When'), $numericOptions); foreach ($this->_freqUnits as $val => $label) { $freqUnitsDisplay[$val] = ts('%1(s)', array(1 => $label)); } $this->addDate('absolute_date', ts('Start Date'), FALSE, array('formatType' => 'mailing')); //reminder_frequency $this->add('select', 'start_action_unit', ts('Frequency'), $freqUnitsDisplay, TRUE); $condition = array('before' => ts('before'), 'after' => ts('after')); //reminder_action $this->add('select', 'start_action_condition', ts('Action Condition'), $condition); $this->add('select', 'start_action_date', ts('Date Field'), $sel4, TRUE); $this->addElement('checkbox', 'record_activity', ts('Record activity for automated email')); $this->addElement('checkbox', 'is_repeat', ts('Repeat'), NULL, array('onclick' => "return showHideByValue('is_repeat',true,'repeatFields','table-row','radio',false);")); $this->add('select', 'repetition_frequency_unit', ts('every'), $freqUnitsDisplay); $this->add('select', 'repetition_frequency_interval', ts('every'), $numericOptions); $this->add('select', 'end_frequency_unit', ts('until'), $freqUnitsDisplay); $this->add('select', 'end_frequency_interval', ts('until'), $numericOptions); $this->add('select', 'end_action', ts('Repetition Condition'), $condition, TRUE); $this->add('select', 'end_date', ts('Date Field'), $sel4, TRUE); $recipient = 'event_contacts'; $limitOptions = array(1 => ts('Limit to'), 0 => ts('Addition to')); $this->add('select', 'limit_to', ts('Limit Options'), $limitOptions); $this->add('select', 'recipient', ts('Recipients'), $sel5[$recipient], FALSE, array('onchange' => "showHideByValue('recipient','manual','recipientManual','table-row','select',false); showHideByValue('recipient','group','recipientGroup','table-row','select',false);")); $recipientListing = $this->add('select', 'recipient_listing', ts('Recipient Listing'), $sel3[$this->_mappingID][0], FALSE, array('class' => 'crm-select2 huge')); $recipientListing->setMultiple(TRUE); //auto-complete url $dataUrl = CRM_Utils_System::url('civicrm/ajax/rest', "className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=activity&reset=1", FALSE, NULL, FALSE); $this->assign('dataUrl', $dataUrl); //token input url $tokenUrl = CRM_Utils_System::url('civicrm/ajax/checkemail', 'noemail=1', FALSE, NULL, FALSE); $this->assign('tokenUrl', $tokenUrl); $this->add('text', 'recipient_manual_id', ts('Manual Recipients')); $this->add('select', 'group_id', ts('Group'), CRM_Core_PseudoConstant::staticGroup(), FALSE, array('class' => 'crm-select2 huge')); CRM_Mailing_BAO_Mailing::commonCompose($this); $this->add('text', 'subject', ts('Subject'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_ActionSchedule', 'subject')); $this->add('checkbox', 'is_active', ts('Send email')); $this->addFormRule(array('CRM_Event_Form_ManageEvent_ScheduleReminders', 'formRule')); }
/** * Build the form object * * @return None * @access public */ public function buildQuickForm() { if ($this->loadAngular) { $ang = new CRM_Volunteer_Page_Angular(null, null, CRM_Core_Resources::singleton()); $ang->registerResources('ajax-snippet', false); CRM_Core_Resources::singleton()->addScriptFile('org.civicrm.volunteer', 'js/CRM_Volunteer_Form_Volunteer.js', -1000, 'ajax-snippet'); CRM_Core_Resources::singleton()->addStyleFile('org.civicrm.volunteer', 'css/volunteer_events.css'); // Low weight, go before all the other Angular scripts. The trick is only needed in snippet mode. CRM_Core_Resources::singleton()->addScript("CRM.origJQuery = window.jQuery; window.jQuery = CRM.\$;", -1001, 'ajax-snippet'); //High weight, go after all the other Angular scripts. The trick is only needed in snippet mode. CRM_Core_Resources::singleton()->addScript("window.jQuery = CRM.origJQuery; delete CRM.origJQuery", 1000, 'ajax-snippet'); } else { parent::buildQuickForm(); } }