Merge pull request #2762 from amitajgaonkar/WebtestIssues
[civicrm-core.git] / templates / CRM / Profile / Form / Search.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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 {if ! empty( $fields )}
27 {if $groupId }
28 <div class="crm-accordion-wrapper crm-group-{$groupId}-accordion {if $rows}collapsed{/if}">
29 <div class="crm-accordion-header crm-master-accordion-header">
30 {ts}Edit Search Criteria{/ts}
31 </div>
32 <div class="crm-accordion-body">
33 {else}
34 <div>
35 {/if}
36
37 <table class="form-layout-compressed" id="profile">
38 {foreach from=$fields item=field key=fieldName}
39 {if $field.skipDisplay}
40 {continue}
41 {/if}
42 {assign var=n value=$field.name}
43 {if $field.is_search_range}
44 {assign var=from value=$field.name|cat:'_from'}
45 {assign var=to value=$field.name|cat:'_to'}
46 {if $field.data_type neq 'Date'}
47 <tr>
48 <td class="label">{$form.$from.label}</td>
49 <td class="description">{$form.$from.html}&nbsp;&nbsp;{$form.$to.label}&nbsp;&nbsp;{$form.$to.html}</td>
50 </tr>
51 {else}
52 <tr>
53 <td class="label">{$form.$from.label}</td>
54 <td class="description">{include file="CRM/common/jcalendar.tpl" elementName=$from}
55 &nbsp;&nbsp;{$form.$to.label}&nbsp;&nbsp;{include file="CRM/common/jcalendar.tpl" elementName=$to}</td>
56 </tr>
57 {/if}
58 {elseif $field.options_per_line}
59 <tr>
60 <td class="option-label">{$form.$n.label}</td>
61 <td>
62 {assign var="count" value="1"}
63 {strip}
64 <table class="form-layout-compressed">
65 <tr>
66 {* sort by fails for option per line. Added a variable to iterate through the element array*}
67 {assign var="index" value="1"}
68 {foreach name=outer key=key item=item from=$form.$n}
69 {if $index < 10} {* Hack to skip QF field properties that are not checkbox elements. *}
70 {assign var="index" value=`$index+1`}
71 {else}
72 {if $field.html_type EQ 'CheckBox' AND $smarty.foreach.outer.last EQ 1} {* Put 'match ANY / match ALL' checkbox in separate row. *}
73 </tr>
74 <tr>
75 <td class="op-checkbox" colspan="{$field.options_per_line}" style="padding-top: 0px;">{$form.$n.$key.html}</td>
76 {else}
77 <td class="labels font-light">{$form.$n.$key.html}</td>
78 {if $count EQ $field.options_per_line}
79 </tr>
80 <tr>
81 {assign var="count" value="1"}
82 {else}
83 {assign var="count" value=`$count+1`}
84 {/if}
85 {/if}
86 {/if}
87 {/foreach}
88 </tr>
89 </table>
90 {/strip}
91 </td>
92 </tr>
93 {else}
94 <tr>
95 <td class="label">
96 {$form.$n.label}
97 </td>
98 {if $n eq 'addressee' or $n eq 'email_greeting' or $n eq 'postal_greeting'}
99 <td class="description">
100 {include file="CRM/Profile/Form/GreetingType.tpl"}
101 </td>
102 {elseif $n eq 'group'}
103 <td>
104 <table id="selector" class="selector" style="width:auto;">
105 <tr><td>{$form.$n.html}{* quickform add closing </td> </tr>*}
106 </table>
107 </td>
108 {else}
109 <td class="description">
110 {if ( $field.data_type eq 'Date' or
111 ( ( ( $n eq 'birth_date' ) or ( $n eq 'deceased_date' ) ) ) ) }
112 {include file="CRM/common/jcalendar.tpl" elementName=$n}
113 {elseif $n|substr:0:5 eq 'phone'}
114 {assign var="phone_ext_field" value=$n|replace:'phone':'phone_ext'}
115 {$form.$n.html}
116 {if $form.$phone_ext_field.html}
117 &nbsp;{$form.$phone_ext_field.html}
118 {/if}
119 {else}
120 {$form.$n.html}
121 {/if}
122 {if $field.html_type eq 'Autocomplete-Select'}
123 {if $field.data_type eq 'ContactReference'}
124 {include file="CRM/Custom/Form/ContactReference.tpl" element_name = $n}
125 {/if}
126 {/if}
127 </td>
128 {/if}
129 </tr>
130 {/if}
131 {/foreach}
132
133 {if $proximity_search}
134 <tr><td colspan="2">{include file="CRM/Contact/Form/Task/ProximityCommon.tpl"}</td></tr>
135 {/if}
136
137 <tr><td></td><td>{include file="CRM/common/formButtons.tpl"}</td></tr>
138 </table>
139
140 {if $groupId}
141 </div><!-- /.crm-accordion-body -->
142 </div><!-- /.crm-accordion-wrapper -->
143
144 {literal}
145 <script type="text/javascript">
146 cj(function() {
147 cj().crmAccordions();
148 });
149 </script>
150 {/literal}
151
152 {/if}
153
154 {elseif $statusMessage}
155 <div class="messages status no-popup">
156 <div class="icon inform-icon"></div>
157 {$statusMessage}
158 </div>
159 {else} {* empty fields *}
160 <div class="messages status no-popup">
161 <div class="icon inform-icon"></div>
162 {ts}No fields in this Profile have been configured as searchable. Ask the site administrator to check the Profile setup.{/ts}
163 </div>
164 {/if}
165 {literal}
166 <script type="text/javascript">
167 cj(function(){
168 cj('#selector tr:even').addClass('odd-row ');
169 cj('#selector tr:odd ').addClass('even-row');
170 });
171 </script>
172 {/literal}