| 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 | {* Template for "Sample" custom search component. *} |
| 27 | <div class="crm-form-block crm-search-form-block"> |
| 28 | <div class="crm-accordion-wrapper crm-activity_search-accordion {if $rows}collapsed{/if}"> |
| 29 | <div class="crm-accordion-header crm-master-accordion-header"> |
| 30 | {ts}Edit Search Criteria{/ts} |
| 31 | </div><!-- /.crm-accordion-header --> |
| 32 | <div class="crm-accordion-body"> |
| 33 | <div id="searchForm" class="crm-block crm-form-block crm-contact-custom-search-activity-search-form-block"> |
| 34 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> |
| 35 | <table class="form-layout-compressed"> |
| 36 | {* Loop through all defined search criteria fields (defined in the buildForm() function). *} |
| 37 | {foreach from=$elements item=element} |
| 38 | <tr class="crm-contact-custom-search-activity-search-form-block-{$element}"> |
| 39 | <td class="label">{$form.$element.label}</td> |
| 40 | <td> |
| 41 | {if $element eq 'start_date' OR $element eq 'end_date'} |
| 42 | {include file="CRM/common/jcalendar.tpl" elementName=$element} |
| 43 | {else} |
| 44 | {$form.$element.html} |
| 45 | {/if} |
| 46 | </td> |
| 47 | </tr> |
| 48 | {/foreach} |
| 49 | </table> |
| 50 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> |
| 51 | </div> |
| 52 | </div><!-- /.crm-accordion-body --> |
| 53 | </div><!-- /.crm-accordion-wrapper --> |
| 54 | </div><!-- /.crm-form-block --> |
| 55 | |
| 56 | {if $rowsEmpty || $rows} |
| 57 | |
| 58 | <div class="crm-content-block"> |
| 59 | {if $rowsEmpty} |
| 60 | <div class="crm-results-block crm-results-block-empty"> |
| 61 | {include file="CRM/Contact/Form/Search/Custom/EmptyResults.tpl"} |
| 62 | </div> |
| 63 | {/if} |
| 64 | |
| 65 | {if $rows} |
| 66 | <div class="crm-results-block"> |
| 67 | {* Search request has returned 1 or more matching rows. Display results and collapse the search criteria fieldset. *} |
| 68 | |
| 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 file="CRM/common/pagerAToZ.tpl"} |
| 79 | |
| 80 | {strip} |
| 81 | <table summary="{ts}Search results listings.{/ts}"> |
| 82 | <thead class="sticky"> |
| 83 | <th scope="col" title="Select All Rows">{$form.toggleSelect.html}</th> |
| 84 | {foreach from=$columnHeaders item=header} |
| 85 | {if ($header.sort eq 'activity_id') or ($header.sort eq 'activity_type_id') or ($header.sort eq 'case_id') } |
| 86 | {elseif ($header.sort eq 'sort_name') or ($header.sort eq 'activity_status') or ($header.sort eq 'activity_type') or ($header.sort eq 'activity_subject') or ($header.sort eq 'source_contact') or ($header.SORT eq 'activity_date') or ($header.name eq null) } |
| 87 | <th scope="col"> |
| 88 | {if $header.sort} |
| 89 | {assign var='key' value=$header.sort} |
| 90 | {$sort->_response.$key.link} |
| 91 | {else} |
| 92 | {$header.name} |
| 93 | {/if} |
| 94 | </th> |
| 95 | {/if} |
| 96 | </th> |
| 97 | {/foreach} |
| 98 | <th> </th> |
| 99 | </thead> |
| 100 | |
| 101 | {counter start=0 skip=1 print=false} |
| 102 | {foreach from=$rows item=row} |
| 103 | <tr id='rowid{counter}' class="{cycle values="odd-row,even-row"}"> |
| 104 | {assign var=cbName value=$row.checkbox} |
| 105 | <td>{$form.$cbName.html}</td> |
| 106 | {foreach from=$columnHeaders item=header} |
| 107 | {if ($header.sort eq 'sort_name') or ($header.sort eq 'activity_status') or ($header.sort eq 'activity_type') or ($header.sort eq 'activity_subject') or ($header.sort eq 'source_contact') or ($header.SORT eq 'activity_date') or ($header.name eq null) } |
| 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`&key=`$qfKey`"}">{$row.sort_name}</a></td> |
| 111 | {elseif $fName eq 'activity_subject'} |
| 112 | <td> |
| 113 | {if $row.case_id } |
| 114 | <a href="{crmURL p='civicrm/case/activity/view' q="reset=1&aid=`$row.activity_id`&cid=`$row.contact_id`&caseID=`$row.case_id`"}" title="{ts}View activity details{/ts}"> |
| 115 | {else} |
| 116 | <a href="{crmURL p='civicrm/contact/view/activity' q="atype=`$row.activity_type_id`&action=view&reset=1&id=`$row.activity_id`&cid=`$row.contact_id`"}" title="{ts}View activity details{/ts}"> |
| 117 | {/if} |
| 118 | {if isset($row.activity_subject) AND $row.activity_subject NEQ 'NULL'}{$row.activity_subject}{else}{ts}(no subject){/ts}{/if}</a> |
| 119 | </td> |
| 120 | {elseif ($fName eq 'activity_id') or ($fName eq 'activity_type_id') or ($fName eq 'case_id')} |
| 121 | {else} |
| 122 | <td>{$row.$fName}</td> |
| 123 | {/if} |
| 124 | {/if} |
| 125 | {/foreach} |
| 126 | <td>{$row.action}</td> |
| 127 | </tr> |
| 128 | {/foreach} |
| 129 | </table> |
| 130 | {/strip} |
| 131 | |
| 132 | {include file="CRM/common/pager.tpl" location="bottom"} |
| 133 | |
| 134 | |
| 135 | </div> |
| 136 | {* END Actions/Results section *} |
| 137 | </div> |
| 138 | {/if} |
| 139 | </div> |
| 140 | {/if} |