Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
2c4c49ca | 3 | | CiviCRM version 4.7 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
e7112fa7 | 5 | | Copyright CiviCRM LLC (c) 2004-2015 | |
6a488035 TO |
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.skipDisplay} | |
34 | {continue} | |
35 | {/if} | |
36 | {if $field.groupTitle != $fieldset} | |
37 | {if $fieldset != $zeroField} | |
38 | {if $groupHelpPost && $action neq 4} | |
39 | <div class="messages help">{$groupHelpPost}</div> | |
40 | {/if} | |
41 | {if $mode ne 8} | |
42 | </fieldset> | |
43 | {/if} | |
44 | {/if} | |
45 | ||
46 | {if $mode ne 8 && $action ne 1028 && $action ne 4} | |
4a1143a1 | 47 | <fieldset class="crm-profile crm-profile-id-{$field.group_id} crm-profile-name-{$field.groupName}"><legend>{$field.groupTitle}</legend> |
6a488035 TO |
48 | {/if} |
49 | ||
133e2c99 | 50 | {if ($form.formName eq 'Confirm' OR $form.formName eq 'ThankYou') AND $prefix neq 'honor'} |
6a488035 TO |
51 | <div class="header-dark">{$field.groupTitle} </div> |
52 | {/if} | |
53 | {assign var=fieldset value=`$field.groupTitle`} | |
54 | {assign var=groupHelpPost value=`$field.groupHelpPost`} | |
55 | {if $field.groupHelpPre && $action neq 4 && $action neq 1028} | |
56 | <div class="messages help">{$field.groupHelpPre}</div> | |
57 | {/if} | |
58 | {/if} | |
59 | ||
60 | {assign var=n value=$field.name} | |
61 | ||
62 | {if $field.field_type eq "Formatting"} | |
63 | {if $action neq 4 && $action neq 1028} | |
64 | {$field.help_pre} | |
65 | {/if} | |
4d833fab E |
66 | {elseif $n} |
67 | {* Show explanatory text for field if not in 'view' or 'preview' modes *} | |
68 | {if $field.help_pre && $action neq 4 && $action neq 1028} | |
8669266d | 69 | <div class="crm-section helprow-{$n}-section helprow-pre" id="helprow-{$n}"> |
4d833fab E |
70 | <div class="content description">{$field.help_pre}</div> |
71 | </div> | |
72 | {/if} | |
73 | {if $field.options_per_line != 0} | |
74 | <div class="crm-section editrow_{$n}-section form-item" id="editrow-{$n}"> | |
e8d56359 | 75 | <div class="label option-label">{if $prefix}{$form.$prefix.$n.label}{else}{$form.$n.label}{/if}</div> |
4d833fab E |
76 | <div class="content 3"> |
77 | {assign var="count" value="1"} | |
78 | {strip} | |
79 | <table class="form-layout-compressed"> | |
80 | <tr> | |
81 | {* sort by fails for option per line. Added a variable to iterate through the element array*} | |
82 | {assign var="index" value="1"} | |
e8d56359 | 83 | {if $prefix} |
84 | {assign var="formElement" value=$form.$prefix.$n} | |
85 | {else} | |
86 | {assign var="formElement" value=$form.$n} | |
87 | {/if} | |
88 | {foreach name=outer key=key item=item from=$formElement} | |
4d833fab E |
89 | {if $index < 10} |
90 | {assign var="index" value=`$index+1`} | |
91 | {else} | |
e8d56359 | 92 | <td class="labels font-light">{$formElement.$key.html}</td> |
4d833fab E |
93 | {if $count == $field.options_per_line} |
94 | </tr> | |
95 | <tr> | |
96 | {assign var="count" value="1"} | |
97 | {else} | |
98 | {assign var="count" value=`$count+1`} | |
99 | {/if} | |
100 | {/if} | |
101 | {/foreach} | |
102 | </tr> | |
103 | </table> | |
104 | {/strip} | |
105 | </div> | |
106 | <div class="clear"></div> | |
107 | </div> | |
108 | {else} | |
109 | <div class="crm-section editrow_{$n}-section form-item" id="editrow-{$n}"> | |
110 | <div class="label"> | |
133e2c99 | 111 | {if $prefix}{$form.$prefix.$n.label}{else}{$form.$n.label}{/if} |
4d833fab E |
112 | </div> |
113 | <div class="content"> | |
114 | {if $n|substr:0:3 eq 'im-'} | |
115 | {assign var="provider" value=$n|cat:"-provider_id"} | |
116 | {$form.$provider.html} | |
4d833fab | 117 | {/if} |
6a488035 | 118 | |
4d833fab E |
119 | {if $n eq 'email_greeting' or $n eq 'postal_greeting' or $n eq 'addressee'} |
120 | {include file="CRM/Profile/Form/GreetingType.tpl"} | |
121 | {elseif ($n eq 'group' && $form.group) || ($n eq 'tag' && $form.tag)} | |
122 | {include file="CRM/Contact/Form/Edit/TagsAndGroups.tpl" type=$n title=null context="profile"} | |
123 | {elseif ( ( $field.data_type eq 'Date' ) or | |
124 | ( $n|substr:-5:5 eq '_date' ) ) AND | |
125 | ( $form.formName neq 'Confirm' ) AND | |
126 | ( $form.formName neq 'ThankYou' ) } | |
127 | {include file="CRM/common/jcalendar.tpl" elementName=$n} | |
128 | {elseif $n|substr:0:5 eq 'phone'} | |
129 | {assign var="phone_ext_field" value=$n|replace:'phone':'phone_ext'} | |
133e2c99 | 130 | {if $prefix}{$form.$prefix.$n.html}{else}{$form.$n.html}{/if} |
4d833fab E |
131 | {if $form.$phone_ext_field.html} |
132 | {$form.$phone_ext_field.html} | |
133 | {/if} | |
134 | {else} | |
133e2c99 | 135 | {if $prefix}{$form.$prefix.$n.html}{else}{$form.$n.html}{/if} |
4d833fab | 136 | {/if} |
6a488035 | 137 | |
4d833fab | 138 | {*CRM-4564*} |
4a143c04 | 139 | {if $field.html_type eq 'Autocomplete-Select'} |
4d833fab E |
140 | {if $field.data_type eq 'ContactReference'} |
141 | {include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n} | |
4d833fab E |
142 | {/if} |
143 | {/if} | |
6a488035 TO |
144 | </div> |
145 | <div class="clear"></div> | |
146 | </div> | |
4d833fab E |
147 | {/if} |
148 | {* Show explanatory text for field if not in 'view' or 'preview' modes *} | |
d9773bfd | 149 | {if $field.help_post && $action neq 4 && $action neq 1028} |
8669266d | 150 | <div class="crm-section helprow-{$n}-section helprow-post" id="helprow-{$n}"> |
4d833fab E |
151 | <div class="content description">{$field.help_post}</div> |
152 | </div> | |
d9773bfd | 153 | {/if} |
6a488035 TO |
154 | {/if} |
155 | {/foreach} | |
156 | ||
157 | {if $field.groupHelpPost && $action neq 4 && $action neq 1028} | |
158 | <div class="messages help">{$field.groupHelpPost}</div> | |
159 | {/if} | |
160 | ||
161 | {if $mode eq 4} | |
162 | <div class="crm-submit-buttons"> | |
163 | {$form.buttons.html} | |
164 | </div> | |
165 | {/if} | |
166 | ||
167 | {if $mode ne 8 && $action neq 1028} | |
168 | </fieldset> | |
169 | {/if} | |
170 | ||
171 | {if $help_post && $action neq 4}<br /><div class="messages help">{$help_post}</div>{/if} | |
172 | {/strip} | |
173 | ||
174 | {/if} {* fields array is not empty *} | |
175 | ||
176 | {literal} | |
177 | <script type="text/javascript"> | |
3cc60a06 | 178 | CRM.$(function($) { |
ae8f569f CW |
179 | $('#selector tr:even').addClass('odd-row'); |
180 | $('#selector tr:odd ').addClass('even-row'); | |
6a488035 TO |
181 | }); |
182 | </script> | |
054fa3e2 | 183 | {/literal} |