-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.tpl
123 lines (109 loc) · 4.93 KB
/
search.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{**
* templates/frontend/pages/search.tpl
*
* Copyright (c) 2014-2020 Simon Fraser University
* Copyright (c) 2003-2020 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @brief Display the page to search and view search results.
*
* @uses $query Value of the primary search query
* @uses $authors Value of the authors search filter
* @uses $dateFrom Value of the date from search filter (published after).
* Value is a single string: YYYY-MM-DD HH:MM:SS
* @uses $dateTo Value of the date to search filter (published before).
* Value is a single string: YYYY-MM-DD HH:MM:SS
* @uses $yearStart Earliest year that can be used in from/to filters
* @uses $yearEnd Latest year that can be used in from/to filters
*}
{include file="frontend/components/header.tpl" pageTitle="common.search"}
{if !$heading}
{assign var="heading" value="h2"}
{/if}
<div class="page page_search">
{include file="frontend/components/breadcrumbs.tpl" currentTitleKey="common.search"}
<h1>
{translate key="common.search"}
</h1>
{capture name="searchFormUrl"}{url op="search" escape=false}{/capture}
{$smarty.capture.searchFormUrl|parse_url:$smarty.const.PHP_URL_QUERY|parse_str:$formUrlParameters}
<form class="cmp_form" method="get" action="{$smarty.capture.searchFormUrl|strtok:"?"|escape}">
{foreach from=$formUrlParameters key=paramKey item=paramValue}
<input type="hidden" name="{$paramKey|escape}" value="{$paramValue|escape}"/>
{/foreach}
{* Repeat the label text just so that screen readers have a clear
label/input relationship *}
<div class="search_input">
<label class="pkp_screen_reader" for="query">
{translate key="search.searchFor"}
</label>
{block name=searchQuery}
<input type="text" id="query" name="query" value="{$query|escape}" class="query" placeholder="{translate|escape key="common.search"}">
{/block}
</div>
<fieldset class="search_advanced">
<legend>
{translate key="search.advancedFilters"}
</legend>
<div class="date_range">
<div class="from">
<label class="label">
{translate key="search.dateFrom"}
</label>
{html_select_date prefix="dateFrom" time=$dateFrom start_year=$yearStart end_year=$yearEnd year_empty="" month_empty="" day_empty="" field_order="YMD"}
</div>
<div class="to">
<label class="label">
{translate key="search.dateTo"}
</label>
{html_select_date prefix="dateTo" time=$dateTo start_year=$yearStart end_year=$yearEnd year_empty="" month_empty="" day_empty="" field_order="YMD"}
</div>
</div>
<div class="author">
<label class="label" for="authors">
{translate key="search.author"}
</label>
{block name=searchAuthors}
<input type="text" for="authors" name="authors" value="{$authors|escape}">
{/block}
</div>
{call_hook name="Templates::Search::SearchResults::AdditionalFilters"}
</fieldset>
<div class="submit">
<button class="submit" type="submit">{translate key="common.search"}</button>
</div>
</form>
{call_hook name="Templates::Search::SearchResults::PreResults"}
{* Results pagination *}
{if !$results->wasEmpty()}
<div class="pkp_screen_reader">
{page_info iterator=$results}
{page_links anchor="results" iterator=$results name="search" query=$query searchJournal=$searchJournal authors=$authors title=$title abstract=$abstract galleyFullText=$galleyFullText discipline=$discipline subject=$subject type=$type coverage=$coverage indexTerms=$indexTerms dateFromMonth=$dateFromMonth dateFromDay=$dateFromDay dateFromYear=$dateFromYear dateToMonth=$dateToMonth dateToDay=$dateToDay dateToYear=$dateToYear orderBy=$orderBy orderDir=$orderDir}
</div>
{/if}
{* Search results, finally! *}
<div class="search_results">
{iterate from=results item=result}
{include file="frontend/objects/article_summary.tpl" article=$result.publishedSubmission journal=$result.journal showDatePublished=true hideGalleys=true}
{/iterate}
</div>
{* No results found *}
{if $results->wasEmpty()}
{if $query}
{if $error}
{include file="frontend/components/notification.tpl" type="error" message=$error|escape}
{else}
{include file="frontend/components/notification.tpl" type="notice" messageKey="search.noResults"}
{/if}
{/if}
{* Results pagination *}
{else}
<div class="cmp_pagination">
{page_info iterator=$results}
{page_links anchor="results" iterator=$results name="search" query=$query searchJournal=$searchJournal authors=$authors title=$title abstract=$abstract galleyFullText=$galleyFullText discipline=$discipline subject=$subject type=$type coverage=$coverage indexTerms=$indexTerms dateFromMonth=$dateFromMonth dateFromDay=$dateFromDay dateFromYear=$dateFromYear dateToMonth=$dateToMonth dateToDay=$dateToDay dateToYear=$dateToYear orderBy=$orderBy orderDir=$orderDir}
</div>
{/if}
{* Search Syntax Instructions *}
{block name=searchSyntaxInstructions}{/block}
</div><!-- .page -->
{include file="frontend/components/footer.tpl"}