5 * Admin form inline-help.
9 * Class wf_crm_admin_help
10 * Adding a static function to this class with the same name as a field will magically add pop-up help for that field to the admin form.
12 class wf_crm_admin_help {
14 static function intro() {
16 t('Create anything from a simple newsletter signup, to a complex multi-step registration system.') .
18 t('Getting Started:') .
20 '<li>' . t('Enable fields for one or more contacts.') . '</li>' .
21 '<li>' . t('Arrange and configure those fields on the "Webform" tab.') . '</li>' .
22 '<li>' . t('Click the blue help icons to learn more.') . '</li>' .
23 '<li><a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Webform+CiviCRM+Integration" target="_blank">' . t('Read the instructions.') . '</a></li>' .
27 static function contact_existing() {
29 t('Gives many options for how this contact can be autofilled or selected. From the Webform tab you can edit this field to configure:') .'</p><ul>' .
30 '<li>' . t('Widget: Determine whether to expose this field to the form as an autocomplete or select element, or hide it and pick the contact automatically.') . '</li>' .
31 '<li>' . t('Default Value: Select a contact based on the current user, relationships, or other options.') . '</li>' .
32 '<li>' . t('Filters: Limit the list of available choices from which this contact may be autofilled or selected.') . '</li>' .
33 '<li>' . t('Show/Hide Fields: Control which other fields the user is allowed to edit and which will be hidden.') . '</li>' .
37 static function contact_employer_id() {
39 t('Choose a webform contact of type "Organization" to be the employer for this individual.') .
41 t('Use the "Existing Contact" field for that organization to enable autocomplete or selection of employers.') .
43 t('You can also autofill the employer by configuring the organization\'s "Existing Contact" default value to be "Employer" relationship to Contact 1.') .
47 static function contact_image_URL() {
49 t('Allows an image to be associated with a contact. This image will appear in CiviCRM, but the file is stored in Drupal. If the webform submission or entire webform were to be deleted, the image would be lost.') .
53 static function contact_contact_id() {
55 t('This hidden field can be used to as a token to generate links, for example to include an email link back to this form to update their info.') .
59 static function contact_external_identifier() {
60 self::contact_contact_id();
63 static function contact_source() {
65 t('This field will override the "Source Label" in "Additional Options".') .
69 static function contact_cs() {
70 self::contact_contact_id();
73 static function matching_rule() {
75 t('This determines how an <em>unknown</em> contact will be handled when the webform is submitted.') .
77 '<li>' . t('Select the "Default Unsupervised" rule for the same duplicate matching used by CiviCRM event registration & contribution forms.') . '</li>' .
78 '<li>' . t('Select a specific rule to customize how matching is performed.') . '</li>' .
79 '<li>' . t('Or select "- None -" to always create a new contact.') . '</li>' .
81 t('Note: Matching rules are only used if the contact is not already selected via "Existing Contact" field.') .
85 static function address_master_id() {
87 t('When selected, will hide fields for this address and use those of the other contact.') .
89 t('Tip: In many use-cases it is desirable to show this field as a single checkbox. You can configure that by editing the field and removing all but one option (the one this contact is allowed to share) and re-labelling it something like "Same as my address".') .
94 static function contribution_contribution_page_id() {
96 t("It is recommended to <a !link>create a new contribution page</a> solely for webform use. When configuring the page, most options will be irrelevant (such as profiles, premiums, widgets, recurring, etc.). Only the following need to be configured:",
97 array('!link' => 'target="_blank" href="' . url('civicrm/admin/contribute/add', array('query' => array('reset' => 1, 'action' => 'add'))) . '"')) .
99 '<li>' . t('Title: Displayed on the webform.') . '</li>' .
100 '<li>' . t('Financial Type: Controls overall contribution type.') . '</li>' .
101 '<li>' . t('Currency: Sets currency for all payment fields on this form.') . '</li>' .
102 '<li>' . t('Payment Processors: Controls list of options here.') . '</li>' .
103 '<li>' . t('Contribution Amounts: Must be enabled with a label and Allow Other Amounts checked.') . '</li>' .
104 '<li>' . t('Email Receipt: Configure email receipts from this webform.') . '</li>' .
108 static function contribution_payment_processor_id() {
110 t('Supported payment processors enabled on the contribution page are available here. "Pay Later" option allows the user to purchase events/memberships without entering a credit card.') .
112 t("Note that only on-site credit card processors are currently supported on Webforms. Services that redirect to an external website, such as Paypal Standard, are not supported. Recurring payments are not supported.") .
116 static function contribution_total_amount() {
118 t('This amount will be in addition to any paid events and memberships.') .
123 static function participant_fee_amount() {
125 t('Price for this event. If multiple events or participants are registered with this field, the amount will be multiplied per-person, per-event.') .
127 t('Note that any event prices you have configured in CiviCRM are not imported into the Webform - you will need to reconfigure them here.') .
132 static function fee() {
134 t('Once added to the webform, this field can be configured in a number of ways by changing its settings.') .
136 t('Possible Widgets:') .
138 '<li>' . t('Number (default): Allow the user to enter an amount, optionally constrained by min, max, and increments.') . '</li>' .
139 '<li>' . t('Hidden: Set the amount without giving the user a choice.') . '</li>' .
140 '<li>' . t('Select/Radios: Allow the user to choose from one of several options.') . '</li>' .
141 '<li>' . t('MultiSelect/Checkboxes: Each choice the user selects will be added together.') . '</li>' .
142 '<li>' . t('Grid: Configure multiple items and quantities.') . '</li>' .
146 static function participant_reg_type() {
148 t('Registering as a group will set Contact 1 as the primary registrant. Registering participants separately gives finer control over which contacts register for what events.') .
150 t('With only one contact on the form, there is no difference between these two options.') .
154 static function participant_event_id() {
156 t('Events can be selected here without giving the user a choice, or this field can be added to the form ("User Select").') .
158 t('Click the + button to choose multiple events.') .
160 t('On the form, this field could be represented as either single or multiselect (checkboxes or radios). Note: enabling this field as a multiselect (checkboxes) should only be done if all selectable events will have the same price, role, custom data, etc.') .
162 t('"Live Options" can be enabled to keep the field up-to-date with all your organization\'s events, or you can hand-pick the events you wish to show.') .
166 static function participant_status_id() {
168 t('In "Automatic" mode, status will be set to "Registered" (or "Pending" if the user chooses to "Pay Later" for events with a fee). The user will be able to cancel registration by re-visiting the form and de-selecting any events they are registered for.') .
170 t('If a status is selected here, events will be autofilled only if the participant has that status.') .
172 t('If this field is exposed to the webform ("User Select"), events will be autofilled only if the particiant status among the enabled options.') .
176 static function reg_options_show_remaining() {
178 t('Display a message at the top of the form for each event with a registration limit or past end date.') .
182 static function reg_options_validate() {
184 t('Will not allow the form to be submitted if user registers for an event that is ended or full.') .
188 static function reg_options_block_form() {
190 t('Hide webform if all the events for the form are full or ended.') .
194 static function reg_options_disable_unregister() {
196 t('If this is selected, on "User Select mode", participants will not be unregistered from unchecked events.') .
200 static function reg_options_allow_url_load() {
202 t('Allow events in "User Select" mode to be auto-filled from URL.') .
203 '</p>'.'<br /><p>'.t('Example for "Register all":') .
204 '<br /><code>' . url("node", array('absolute' => TRUE)) . '/{node.nid}?event1={event1.event_id},{event2.event_id}</code></p><br />'.
205 t('Example for "Register separately":') .
206 '<br /><code>' . url("node", array('absolute' => TRUE)) .
207 '/{node.nid}?c1event1={event1.event_id},{event2.event_id}&c2event1={event3.event_id}</code></p>';
210 static function reg_options_show_past_events() {
212 t('To also display events that have ended, choose an option for how far in the past to search.') .
216 static function reg_options_show_future_events() {
218 t('To also display events in the future, choose an option for how far in the future to search.') .
222 static function reg_options_title_display() {
224 t('Controls how events are displayed. Date formats can be further configured in <a !link>CiviCRM Date Settings</a>',
225 array('!link' => 'target="_blank" href="' . url('civicrm/admin/setting/date', array('query' => array('reset' => 1))) . '"')
228 t('Note: End-date will automatically be omitted if it is the same as the start-date.') .
232 static function membership_membership_type_id() {
234 t('Fee will be calculated automatically based on selected membership type and number of terms chosen. A contribution page must be enabled to collect fees.') .
238 static function membership_status_id() {
240 t('If number of terms is enabled, status can be calculated automatically based on new/renewal status and payment.') .
244 static function membership_num_terms() {
246 t('Membership dates will be filled automatically by selecting terms. This can be overridden by entering dates manually.') .
248 t('Note: Number of terms is required to calculate membership fees for paid memberships.') .
250 t('If you choose to enter dates manually, enabling membership fee field will provide the price. Otherwise the membership will be free') .
254 static function membership_fee_amount() {
256 t('Price for this membership per term. If this field is enabled, the default minimum membership fee from CiviCRM membership type settings will not be loaded.') .
258 t('Note that if this field is enabled, the default minimum membership fee from CiviCRM membership type settings will not be loaded.') .
263 static function multiselect_options() {
265 t('Click the + button to select more than one option.') .
267 t('You may set options here and/or add this element to the webform ("User Select"). Options chosen here will be applied automatically and will not appear on the form.') .
271 static function webform_label() {
273 t('Labels help you keep track of the role of each contact on the form. For example, you might label Contact 1 "Parent", Contact 2 "Spouse" and Contact 3 "Child".') .
275 t("Labels do not have to be shown to the end-user. By default they will be the title of each contact's fieldset, but you may rename (or remove) fieldsets without affecting this label.") .
279 static function activity_target_contact_id() {
281 t('Which contacts should be tagged as part of this activity?') .
283 self::contact_reference();
286 static function activity_source_contact_id() {
288 t('Choose "automatic" to have this activity attributed to the current user (or contact 1 if the user is anonymous).') .
290 self::contact_reference();
293 static function activity_assignee_contact_id() {
294 civicrm_initialize();
296 if (CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'activity_assignee_notification')) {
297 print t('A copy of this activity will be emailed to the assignee.');
300 print t('Assignee notifications are currently disabled in CiviCRM; no email will be sent to the assignee.');
303 self::contact_reference();
306 static function activity_duration() {
308 t('Total time spent on this activity (in minutes).') .
312 static function existing_activity_status() {
314 t('If a matching activity of the chosen type already exists for Contact 1, it will be autofilled and updated.') .
316 t('Note: an activity can also be autofilled by passing "activity1", etc. in the url.') .
320 static function existing_case_status() {
322 t('If a matching case of the chosen type already exists for the client, it will be autofilled and updated.') .
324 t('Note: a case can also be autofilled by passing "case1", etc. in the url.') .
328 static function existing_grant_status() {
330 t('If a matching grant of the chosen type already exists for the applicant, it will be autofilled and updated.') .
332 t('Note: a grant can also be autofilled by passing "grant1", etc. in the url.') .
336 static function file_on_case() {
338 t('Add this activity to either a specific case from this webform, or an already existing case based on matching criteria.') .
340 t('These options will not open a new case; configure the "Cases" section to do so.') .
344 static function case_medium_id() {
346 t('Medium for activities added to cases from this webform.') .
350 static function contact_reference() {
352 t('This is a contact reference field. Webform gives you a great deal of flexibility about how this field is displayed:') .
354 '<li>' . t('First choose a contact on this webform as the target for this field (or add a new contact to the form for that purpose).') . '</li>' .
355 '<li>' . t('To enable a selection of contacts, enable the "Existing Contact" field for the selected contact.') . '</li>' .
356 '<li>' . t('This allows the contact to be selected on the form via autocomplete or dropdown select, or hidden and set to always be the same contact.') . '</li>' .
357 '<li>' . t('In rare cases you might want to expose the list of webform contacts ("User Select").') . '</li>' .
358 '<li>' . t('There are many more possibilities, see "Existing Contact" field help for more information.') . '</li>' .
362 static function fieldset_relationship() {
364 t('Relationships are created from higher-number contacts to lower-number contacts.') .
366 t("Example: to create a relationship between Contact 3 and Contact 4, go to Contact 4's tab and select Number of Relationships: 3. This will give you the option to create relationships between Contact 4 and Contacts 1, 2, and 3, respectively.") .
370 static function contact_creation() {
372 t('CiviCRM requires at minimum a name or email address to create a new contact.') .
374 t("Webform contacts that do not have these fields can be used for selection of existing contacts but not creating new ones.") .
378 static function contact_component_widget() {
380 <li>' . t('Autocomplete will suggest names of contacts as the user types. Good for large numbers of contacts.') . '</li>
381 <li>' . t('A select list will show all possible contacts in a dropdown menu. Good for small lists - use filters.') . '</li>
382 <li>' . t('A static element will select a contact automatically without giving the user a choice. Use in conjunction with a default value setting or a cid passed in the url.') . '</li>
386 static function contact_component_hide_fields() {
388 t('When an existing contact is selected or prepopulated, which fields should the user not be allowed to edit?') .
390 t("This is useful for preventing changes to existing data.") .
395 * Get help for a custom field
397 static function custom($param) {
398 list( , $id) = explode('_', $param);
399 if (!is_numeric($id)) {
402 civicrm_initialize();
403 module_load_include('inc', 'webform_civicrm', 'includes/utils');
404 $info = wf_civicrm_api('custom_field', 'getsingle', array('id' => $id));
405 if (!empty($info['help_pre'])) {
406 print '<p>' . $info['help_pre'] . '</p>';
408 if (!empty($info['help_post'])) {
409 print '<p>' . $info['help_post'] . '</p>';
414 * Get help for a fieldset
416 static function fieldset($param) {
417 list( , $set) = explode('_', $param);
418 civicrm_initialize();
419 module_load_include('inc', 'webform_civicrm', 'includes/utils');
420 $sets = wf_crm_get_fields('sets');
421 if (!empty($sets[$set]['help_text'])) {
422 print '<p>' . $sets[$set]['help_text'] . '</p>';
427 * Copied from Core CiviCRM's templates/notifications.tpl
430 static function helpTemplate() {
432 <div class="crm-container">
433 <div id="crm-notification-container" style="display:none">
434 <div id="crm-notification-alert" class="#{type}">
435 <div class="icon ui-notify-close" title="' . t('close') . '"> </div>
436 <a class="ui-notify-cross ui-notify-close" href="#" title="' . t('close') . '">x</a>
438 <div class="notify-content">#{text}</div>
445 * Add Civi help icon to a FAPI field
446 * @param array $field
447 * @param string $topic
448 * @param string|null $title
450 static function addHelp(&$field, $topic, $title = NULL) {
451 $title = $title ? $title : $field['#title'];
452 $field['#title'] .= ' ' . self::helpIcon($topic, $title);
455 static function helpIcon($topic, $title) {
456 return '<span class="crm-container"><a class="helpicon" href="#' . $topic . '" title="' . $title .'"> </a></span>';
462 * @param string $topic
464 function wf_crm_admin_help($topic) {
465 if (method_exists('wf_crm_admin_help', $topic)) {
466 wf_crm_admin_help::$topic();
468 elseif (strpos($topic, 'custom_') === 0) {
469 wf_crm_admin_help::custom($topic);
471 elseif (strpos($topic, 'fieldset_') === 0) {
472 wf_crm_admin_help::fieldset($topic);