Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
232624b1 | 3 | | CiviCRM version 4.4 | |
6a488035 TO |
4 | +--------------------------------------------------------------------+ |
5 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 | {* Default template custom searches. This template is used automatically if templateFile() function not defined in | |
27 | custom search .php file. If you want a different layout, clone and customize this file and point to new file using | |
28 | templateFile() function.*} | |
29 | <div class="crm-block crm-form-block crm-contact-custom-search-form-block"> | |
30 | <div class="crm-accordion-wrapper crm-custom_search_form-accordion {if $rows}collapsed{/if}"> | |
31 | <div class="crm-accordion-header crm-master-accordion-header"> | |
32 | {ts}Edit Search Criteria{/ts} | |
33 | </div><!-- /.crm-accordion-header --> | |
34 | <div class="crm-accordion-body"> | |
35 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
36 | <table class="form-layout-compressed"> | |
37 | {* Loop through all defined search criteria fields (defined in the buildForm() function). *} | |
38 | {foreach from=$elements item=element} | |
39 | <tr class="crm-contact-custom-search-form-row-{$element}"> | |
40 | <td class="label">{$form.$element.label}</td> | |
41 | {if $element eq 'start_date'} | |
42 | <td>{include file="CRM/common/jcalendar.tpl" elementName=start_date}</td> | |
43 | {elseif $element eq 'end_date'} | |
44 | <td>{include file="CRM/common/jcalendar.tpl" elementName=end_date}</td> | |
45 | {else} | |
46 | <td>{$form.$element.html}</td> | |
47 | {/if} | |
48 | </tr> | |
49 | {/foreach} | |
50 | </table> | |
51 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | |
52 | </div><!-- /.crm-accordion-body --> | |
53 | </div><!-- /.crm-accordion-wrapper --> | |
54 | </div><!-- /.crm-form-block --> | |
55 | ||
56 | {if $rowsEmpty || $rows} | |
57 | <div class="crm-content-block"> | |
58 | {if $rowsEmpty} | |
59 | {include file="CRM/Contact/Form/Search/Custom/EmptyResults.tpl"} | |
60 | {/if} | |
61 | ||
62 | {if $summary} | |
63 | {$summary.summary}: {$summary.total} | |
64 | {/if} | |
65 | ||
66 | {if $rows} | |
67 | <div class="crm-results-block"> | |
68 | {* Search request has returned 1 or more matching rows. Display results and collapse the search criteria fieldset. *} | |
69 | {* This section handles form elements for action task select and submit *} | |
70 | <div class="crm-search-tasks"> | |
71 | {include file="CRM/Contact/Form/Search/ResultTasks.tpl"} | |
72 | </div> | |
73 | {* This section displays the rows along and includes the paging controls *} | |
74 | <div class="crm-search-results"> | |
75 | ||
76 | {include file="CRM/common/pager.tpl" location="top"} | |
77 | ||
78 | {* Include alpha pager if defined. *} | |
79 | {if $atoZ} | |
80 | {include file="CRM/common/pagerAToZ.tpl"} | |
81 | {/if} | |
82 | ||
83 | {strip} | |
84 | <table class="selector" summary="{ts}Search results listings.{/ts}"> | |
85 | <thead class="sticky"> | |
86 | <tr> | |
87 | <th scope="col" title="Select All Rows">{$form.toggleSelect.html}</th> | |
88 | {foreach from=$columnHeaders item=header} | |
89 | <th scope="col"> | |
90 | {if $header.sort} | |
91 | {assign var='key' value=$header.sort} | |
92 | {$sort->_response.$key.link} | |
93 | {else} | |
94 | {$header.name} | |
95 | {/if} | |
96 | </th> | |
97 | {/foreach} | |
98 | <th> </th> | |
99 | </tr> | |
100 | </thead> | |
101 | ||
102 | {counter start=0 skip=1 print=false} | |
103 | {foreach from=$rows item=row} | |
104 | <tr id='rowid{$row.contact_id}' class="{cycle values="odd-row,even-row"}"> | |
105 | {assign var=cbName value=$row.checkbox} | |
106 | <td>{$form.$cbName.html}</td> | |
107 | {foreach from=$columnHeaders item=header} | |
108 | {assign var=fName value=$header.sort} | |
109 | {if $fName eq 'sort_name'} | |
110 | <td><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.contact_id`"}">{$row.sort_name}</a></td> | |
111 | {else} | |
112 | <td>{$row.$fName}</td> | |
113 | {/if} | |
114 | {/foreach} | |
115 | <td>{$row.action}</td> | |
116 | </tr> | |
117 | {/foreach} | |
118 | </table> | |
119 | {/strip} | |
120 | ||
6a488035 TO |
121 | {include file="CRM/common/pager.tpl" location="bottom"} |
122 | ||
123 | </p> | |
124 | {* END Actions/Results section *} | |
125 | </div> | |
126 | </div> | |
127 | {/if} | |
128 | ||
129 | ||
130 | ||
131 | </div> | |
132 | {/if} | |
133 | {literal} | |
134 | <script type="text/javascript"> | |
135 | cj(function() { | |
136 | cj().crmAccordions(); | |
137 | }); | |
138 | ||
139 | function toggleContactSelection( name, qfKey, selection ){ | |
140 | var Url = "{/literal}{crmURL p='civicrm/ajax/markSelection' h=0}{literal}"; | |
141 | ||
142 | if ( selection == 'multiple' ) { | |
143 | var rowArr = new Array( ); | |
144 | {/literal}{foreach from=$rows item=row key=keyVal} | |
145 | {literal}rowArr[{/literal}{$keyVal}{literal}] = '{/literal}{$row.checkbox}{literal}'; | |
146 | {/literal}{/foreach}{literal} | |
147 | var elements = rowArr.join('-'); | |
148 | ||
149 | if ( cj('#' + name).is(':checked') ){ | |
150 | cj.post( Url, { name: elements , qfKey: qfKey , variableType: 'multiple' } ); | |
151 | } | |
152 | else { | |
153 | cj.post( Url, { name: elements , qfKey: qfKey , variableType: 'multiple' , action: 'unselect' } ); | |
154 | } | |
155 | } | |
156 | else if ( selection == 'single' ) { | |
157 | if ( cj('#' + name).is(':checked') ){ | |
158 | cj.post( Url, { name: name , qfKey: qfKey } ); | |
159 | } | |
160 | else { | |
161 | cj.post( Url, { name: name , qfKey: qfKey , state: 'unchecked' } ); | |
162 | } | |
163 | } | |
164 | else if ( name == 'resetSel' && selection == 'reset' ) { | |
165 | cj.post( Url, { qfKey: qfKey , variableType: 'multiple' , action: 'unselect' } ); | |
166 | {/literal} | |
167 | {foreach from=$rows item=row}{literal} | |
8539f25d | 168 | cj("#{/literal}{$row.checkbox}{literal}").prop('checked', false);{/literal} |
6a488035 TO |
169 | {/foreach} |
170 | {literal} | |
8539f25d | 171 | cj("#toggleSelect").prop('checked', false); |
6a488035 | 172 | } |
d8249fcb | 173 | return false; |
6a488035 TO |
174 | } |
175 | </script> | |
176 | ||
177 | {/literal} |