| 1 | {* |
| 2 | +--------------------------------------------------------------------+ |
| 3 | | CiviCRM version 4.7 | |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC (c) 2004-2015 | |
| 6 | +--------------------------------------------------------------------+ |
| 7 | | This file is a part of CiviCRM. | |
| 8 | | | |
| 9 | | CiviCRM is free software; you can copy, modify, and distribute it | |
| 10 | | under the terms of the GNU Affero General Public License | |
| 11 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | |
| 12 | | | |
| 13 | | CiviCRM is distributed in the hope that it will be useful, but | |
| 14 | | WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 16 | | See the GNU Affero General Public License for more details. | |
| 17 | | | |
| 18 | | You should have received a copy of the GNU Affero General Public | |
| 19 | | License and the CiviCRM Licensing Exception along | |
| 20 | | with this program; if not, contact CiviCRM LLC | |
| 21 | | at info[AT]civicrm[DOT]org. If you have questions about the | |
| 22 | | GNU Affero General Public License or the licensing of CiviCRM, | |
| 23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | |
| 24 | +--------------------------------------------------------------------+ |
| 25 | *} |
| 26 | {* Edit or display Profile fields, when embedded in an online contribution or event registration form. *} |
| 27 | {if ! empty( $fields )} |
| 28 | {strip} |
| 29 | {if $help_pre && $action neq 4}<div class="messages help">{$help_pre}</div>{/if} |
| 30 | {assign var=zeroField value="Initial Non Existent Fieldset"} |
| 31 | {assign var=fieldset value=$zeroField} |
| 32 | {foreach from=$fields item=field key=fieldName} |
| 33 | {if $field.groupTitle != $fieldset} |
| 34 | {if $fieldset != $zeroField} |
| 35 | {if $groupHelpPost && $action neq 4} |
| 36 | <div class="messages help">{$groupHelpPost}</div> |
| 37 | {/if} |
| 38 | {if $mode ne 8} |
| 39 | </fieldset> |
| 40 | {/if} |
| 41 | {/if} |
| 42 | |
| 43 | |
| 44 | {assign var=fieldset value=`$field.groupTitle`} |
| 45 | {assign var=groupHelpPost value=`$field.groupHelpPost`} |
| 46 | {if $field.groupHelpPre && $action neq 4 && $action neq 1028} |
| 47 | <div class="messages help">{$field.groupHelpPre}</div> |
| 48 | {/if} |
| 49 | {/if} |
| 50 | |
| 51 | {assign var=n value=$field.name} |
| 52 | |
| 53 | {if $field.options_per_line != 0} |
| 54 | <div class="crm-section {$form.$n.id}-section"> |
| 55 | {* Show explanatory text for field if not in 'view' or 'preview' modes *} |
| 56 | {if $field.help_pre && $action neq 4 && $action neq 1028} |
| 57 | <span class="description">{$field.help_pre}</span> |
| 58 | {/if} |
| 59 | <div class="label option-label">{$form.$n.label}</div> |
| 60 | <div class="content 3"> |
| 61 | {assign var="count" value="1"} |
| 62 | {strip} |
| 63 | <table class="form-layout-compressed"> |
| 64 | <tr> |
| 65 | {* sort by fails for option per line. Added a variable to iterate through the element array*} |
| 66 | {assign var="index" value="1"} |
| 67 | {foreach name=outer key=key item=item from=$form.$n} |
| 68 | {if $index < 10} |
| 69 | {assign var="index" value=`$index+1`} |
| 70 | {else} |
| 71 | <td class="labels font-light">{$form.$n.$key.html}</td> |
| 72 | {if $count == $field.options_per_line} |
| 73 | </tr> |
| 74 | <tr> |
| 75 | {assign var="count" value="1"} |
| 76 | {else} |
| 77 | {assign var="count" value=`$count+1`} |
| 78 | {/if} |
| 79 | {/if} |
| 80 | {/foreach} |
| 81 | </tr> |
| 82 | </table> |
| 83 | {/strip} |
| 84 | {* Show explanatory text for field if not in 'view' or 'preview' modes *} |
| 85 | {if $field.help_post && $action neq 4 && $action neq 1028} |
| 86 | <span class="description">{$field.help_post}</span> |
| 87 | {/if} |
| 88 | </div> |
| 89 | <div class="clear"></div> |
| 90 | </div> |
| 91 | {else} |
| 92 | <div class="crm-section {$form.$n.id}-section"> |
| 93 | {* Show explanatory text for field if not in 'view' or 'preview' modes *} |
| 94 | {if $field.help_pre && $action neq 4 && $action neq 1028} |
| 95 | <span class="description">{$field.help_pre}</span> |
| 96 | {/if} |
| 97 | <div class="label">{$form.$n.label}</div> |
| 98 | <div class="content"> |
| 99 | {if $n|substr:0:3 eq 'im-'} |
| 100 | {assign var="provider" value=$n|cat:"-provider_id"} |
| 101 | {$form.$provider.html} |
| 102 | {/if} |
| 103 | {if $n eq 'email_greeting' or $n eq 'postal_greeting' or $n eq 'addressee'} |
| 104 | {include file="CRM/Profile/Form/GreetingType.tpl"} |
| 105 | {elseif $n eq 'group'} |
| 106 | <table id="selector" class="selector" style="width:auto;"> |
| 107 | <tr><td>{$form.$n.html}{* quickform add closing </td> </tr>*} |
| 108 | </table> |
| 109 | {elseif ( $field.data_type eq 'Date' or |
| 110 | ( ( ( $n eq 'birth_date' ) or ( $n eq 'deceased_date' ) ) ) ) } |
| 111 | {include file="CRM/common/jcalendar.tpl" elementName=$n} |
| 112 | {else} |
| 113 | {$form.$n.html} |
| 114 | {/if} |
| 115 | {*CRM-4564*} |
| 116 | {if $field.html_type eq 'Autocomplete-Select'} |
| 117 | {if $field.data_type eq 'ContactReference'} |
| 118 | {include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n} |
| 119 | {/if} |
| 120 | {/if} |
| 121 | {* Show explanatory text for field if not in 'view' or 'preview' modes *} |
| 122 | {if $field.help_post && $action neq 4 && $action neq 1028} |
| 123 | <br /><span class="description">{$field.help_post}</span> |
| 124 | {/if} |
| 125 | </div> |
| 126 | <div class="clear"></div> |
| 127 | </div> |
| 128 | {/if} |
| 129 | {/foreach} |
| 130 | |
| 131 | {if $field.groupHelpPost && $action neq 4 && $action neq 1028} |
| 132 | <div class="messages help">{$field.groupHelpPost}</div> |
| 133 | {/if} |
| 134 | |
| 135 | {if $mode eq 4} |
| 136 | <div class="crm-submit-buttons"> |
| 137 | {$form.buttons.html} |
| 138 | </div> |
| 139 | {/if} |
| 140 | |
| 141 | |
| 142 | {if $help_post && $action neq 4}<br /><div class="messages help">{$help_post}</div>{/if} |
| 143 | {/strip} |
| 144 | |
| 145 | {/if} {* fields array is not empty *} |
| 146 | |
| 147 | {literal} |
| 148 | <script type="text/javascript"> |
| 149 | |
| 150 | CRM.$(function($) { |
| 151 | $('#selector tr:even').addClass('odd-row '); |
| 152 | $('#selector tr:odd ').addClass('even-row'); |
| 153 | }); |
| 154 | |
| 155 | </script> |
| 156 | {/literal} |