forked from vufind-org/vufind
-
Notifications
You must be signed in to change notification settings - Fork 1
/
list-entry.phtml
241 lines (226 loc) · 11.8 KB
/
list-entry.phtml
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?php
// Set up some convenience variables:
$id = $this->driver->getUniqueId();
$source = $this->driver->getSourceIdentifier();
if (isset($this->list) && is_object($this->list)) {
$list_id = $this->list->id;
$user_id = $this->list->user_id;
} else {
$list_id = null;
$user_id = $this->user ? $this->user->id : null;
}
// Thumbnail
$coverDetails = $this->record($this->driver)->getCoverDetails('list-entry', 'medium', $this->recordLinker()->getUrl($this->driver));
$cover = $coverDetails['html'];
$thumbnail = false;
$thumbnailAlignment = $this->record($this->driver)->getThumbnailAlignment('list');
$describedById = $this->record($this->driver)->getTitleDescribedById();
?>
<li class="result<?php if ($this->driver->supportsAjaxStatus()): ?> ajaxItem<?php endif ?>">
<?php if ($cover):
ob_start(); ?>
<div class="media-<?=$thumbnailAlignment ?> <?=$this->escapeHtmlAttr($coverDetails['size'])?>">
<?=$cover ?>
</div>
<?php $thumbnail = ob_get_contents(); ?>
<?php ob_end_clean(); ?>
<?php endif; ?>
<input type="hidden" value="<?=$this->escapeHtmlAttr($id) ?>" class="hiddenId">
<input type="hidden" value="<?=$this->escapeHtmlAttr($source) ?>" class="hiddenSource">
<?=$this->record($this->driver)->getCheckbox()?>
<div class="media">
<?php if ($thumbnail && $thumbnailAlignment == 'left'): ?>
<?=$thumbnail ?>
<?php endif; ?>
<div class="media-body">
<div class="result-body">
<div class="resultItemLine1">
<?php $missing = $this->driver instanceof \VuFind\RecordDriver\Missing; ?>
<?php if (!$missing): ?><a href="<?=$this->escapeHtmlAttr($this->recordLinker()->getUrl($this->driver))?>" class="getFull" data-view="<?=$this->params->getOptions()->getListViewOption() ?>"><?php endif; ?>
<span id="<?=$describedById?>" class="title"><?=$this->record($this->driver)->getTitleHtml()?></span>
<?php if (!$missing): ?></a><?php endif; ?>
<?php foreach ($this->driver->tryMethod('getTitlesAltScript', [], []) as $altTitle): ?>
<div class="title-alt">
<?=$this->escapeHtml($altTitle)?>
</div>
<?php endforeach; ?>
</div>
<div class="resultItemLine2">
<?php if ($this->driver->isCollection()): ?>
<?=implode('<br>', array_map([$this, 'escapeHtml'], $this->driver->getSummary())); ?>
<?php else: ?>
<?php $summAuthors = $this->driver->getPrimaryAuthors(); if (!empty($summAuthors)): ?>
<?=$this->transEsc('by')?>
<?php $authorCount = count($summAuthors); foreach ($summAuthors as $i => $summAuthor): ?>
<a href="<?=$this->record($this->driver)->getLink('author', $summAuthor)?>"><?=$this->escapeHtml($summAuthor)?></a><?=($i + 1 < $authorCount ? ';' : '') ?>
<?php endforeach; ?>
<?php endif; ?>
<?php $journalTitle = $this->driver->getContainerTitle(); $summDate = $this->driver->getPublicationDates(); ?>
<?php if (!empty($journalTitle)): ?>
<?=!empty($summAuthor) ? '<br>' : ''?>
<?=/* TODO: handle highlighting more elegantly here */ $this->transEsc('Published in') . ' <a href="' . $this->record($this->driver)->getLink('journaltitle', str_replace(['{{{{START_HILITE}}}}', '{{{{END_HILITE}}}}'], '', $journalTitle)) . '">' . $this->highlight($journalTitle) . '</a>';?>
<?=!empty($summDate) ? ' (' . $this->escapeHtml($summDate[0]) . ')' : ''?>
<?php elseif (!empty($summDate)): ?>
<?=!empty($summAuthor) ? '<br>' : ''?>
<?=$this->transEsc('Published') . ' ' . $this->escapeHtml($summDate[0])?>
<?php endif; ?>
<?php $summInCollection = $this->driver->getContainingCollections(); if (false && !empty($summInCollection)): ?>
<?php foreach ($summInCollection as $collId => $collText): ?>
<div>
<b><?=$this->transEsc("in_collection_label")?></b>
<a class="collectionLinkText" href="<?=$this->record($this->driver)->getLink('collection', $collid)?>">
<?=$this->escapeHtml($collText)?>
</a>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>
</div>
<div class="last">
<?php if (!$this->driver->isCollection()) {
if ($snippet = $this->driver->getHighlightedSnippet()) {
if (!empty($snippet['caption'])) {
echo '<strong>' . $this->transEsc($snippet['caption']) . ':</strong> ';
}
if (!empty($snippet['snippet'])) {
echo $this->translate(
'highlight_snippet_html',
['%%snippet%%' => $this->highlight($snippet['snippet'])]
) . '<br>';
}
}
} ?>
<?php
$listTags = ($this->usertags()->getMode() !== 'disabled') ? $this->driver->getTags(
null === $list_id ? true : $list_id, // get tags for all lists if no single list is selected
$user_id,
'tag'
) : [];
?>
<?php if (count($listTags) > 0): ?>
<strong><?=$this->transEsc('Your Tags')?>:</strong>
<?php foreach ($listTags as $tag): ?>
<a href="<?=$this->currentPath() . $results->getUrlQuery()->addFacet('tags', $tag->tag)?>"><?=$this->escapeHtml($tag->tag)?></a>
<?php endforeach; ?>
<br>
<?php endif; ?>
<?php $listNotes = $this->driver->getListNotes($list_id, $user_id); ?>
<?php if (count($listNotes) > 0): ?>
<strong><?=$this->transEsc('Notes')?>:</strong>
<?php if (count($listNotes) > 1): ?><br><?php endif; ?>
<?php foreach ($listNotes as $note): ?>
<?=$this->escapeHtml($note)?><br>
<?php endforeach; ?>
<?php endif; ?>
<?php if (count($this->lists ?? []) > 0): ?>
<strong><?=$this->transEsc('Saved in')?>:</strong>
<?php $i = 0;foreach ($this->lists as $current): ?>
<a href="<?=$this->url('userList', ['id' => $current->id])?>"><?=$this->escapeHtml($current->title)?></a><?php if ($i++ < count($this->lists) - 1): ?>,<?php endif; ?>
<?php endforeach; ?>
<br>
<?php endif; ?>
<div class="callnumAndLocation ajax-availability hidden">
<?php if ($this->driver->supportsAjaxStatus()): ?>
<strong class="hideIfDetailed"><?=$this->transEsc('Call Number')?>:</strong>
<span class="callnumber ajax-availability hidden">
<?=$this->transEsc('loading_ellipsis')?><br>
</span>
<strong><?=$this->transEsc('Located')?>:</strong>
<span class="location ajax-availability hidden">
<?=$this->transEsc('loading_ellipsis')?>
</span>
<div class="locationDetails"></div>
<?php else: ?>
<?php $summCallNo = $this->driver->getCallNumber(); if (!empty($summCallNo)): ?>
<strong><?=$this->transEsc('Call Number')?>:</strong> <?=$this->escapeHtml($summCallNo)?>
<?php endif; ?>
<?php endif; ?>
</div>
<?php /* We need to find out if we're supposed to display an OpenURL link ($openUrlActive),
but even if we don't plan to display the link, we still want to get the $openUrl
value for use in generating a COinS (Z3988) tag -- see bottom of file.
*/
$openUrl = $this->openUrl($this->driver, 'results');
$openUrlActive = $openUrl->isActive();
$doi = $this->doi($this->driver, 'results');
$doiActive = $doi->isActive();
// Account for replace_other_urls setting
$urls = $this->record($this->driver)->getLinkDetails($openUrlActive);
if ($openUrlActive || $doiActive || !empty($urls)):
?>
<?php if ($openUrlActive): ?>
<br>
<?=$openUrl->renderTemplate()?>
<?php endif;?>
<?php if ($doiActive): ?>
<br>
<?=$doi->renderTemplate()?>
<?php endif; ?>
<?php if (!is_array($urls)) { $urls = []; }
if (!$this->driver->isCollection()):
foreach ($urls as $current): ?>
<a href="<?=$this->escapeHtmlAttr($this->proxyUrl($current['url']))?>" class="fulltext icon-link" target="new">
<?=$this->icon('external-link', 'icon-link__icon') ?>
<span class="icon-link__label"><?=($current['url'] == $current['desc']) ? $this->transEsc('Get full text') : $this->escapeHtml($current['desc'])?></span>
</a>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>
<br>
<?=$this->record($this->driver)->getFormatList() ?>
<?php if (!$openUrlActive && empty($urls) && $this->driver->supportsAjaxStatus()): ?>
<span class="status ajax-availability hidden"><?=$this->transEsc('loading_ellipsis')?></span>
<br><br>
<?php endif; ?>
<?=$this->record($this->driver)->getPreviews()?>
</div>
</div>
<div class="result-links hidden-print">
<a href="<?=$this->url('myresearch-edit')?>?id=<?=urlencode($id)?>&source=<?=urlencode($source)?><?php if (null !== $list_id):?>&list_id=<?=urlencode($list_id)?><?php endif; ?>" class="edit tool icon-link">
<?=$this->icon('user-list-entry-edit', 'icon-link__icon') ?>
<span class="icon-link__label"><?=$this->transEsc('Edit')?></span>
</a><br>
<?php /* Use a different delete URL if we're removing from a specific list or the overall favorites: */
$deleteUrl = null === $list_id
? $this->url('myresearch-favorites')
: $this->url('userList', ['id' => $list_id]);
$deleteUrlGet = $deleteUrl . '?delete=' . urlencode($id) . '&source=' . urlencode($source);
$dLabel = 'delete-label-' . preg_replace('[\W]', '-', $id);
?>
<div class="dropdown">
<a class="dropdown-toggle icon-link" id="<?=$dLabel ?>" role="button" data-toggle="dropdown" href="<?=$deleteUrlGet ?>">
<?=$this->icon('user-list-remove', 'icon-link__icon') ?>
<span class="icon-link__label"><?=$this->transEsc('Delete') ?></span>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="<?=$dLabel ?>">
<li><a id="confirm_delete_item_<?=$this->escapeHtmlAttr($id);?>" title="<?=$this->transEscAttr('confirm_delete_brief')?>"><?=$this->transEsc('confirm_dialog_yes')?></a></li>
<li><a><?=$this->transEsc('confirm_dialog_no')?></a></li>
</ul>
</div>
<?=$this->driver->supportsCoinsOpenUrl() ? '<span class="Z3988" title="' . $this->escapeHtmlAttr($this->driver->getCoinsOpenUrl()) . '"></span>' : ''?>
</div>
</div>
<?php if ($thumbnail && $thumbnailAlignment == 'right'): ?>
<?=$thumbnail ?>
<?php endif; ?>
</div>
<?php
$escId = $this->escapeJs($id);
$escSource = $this->escapeJs($source);
$script = <<<JS
$('#confirm_delete_item_${escId}').click(function(e) {
e.preventDefault();
$.post('${deleteUrl}', {
'delete':'${escId}',
'source':'${escSource}',
'confirm':true
},
function() {
location.reload()
}
);
});
JS;
?>
<?=$this->inlineScript(\Laminas\View\Helper\HeadScript::SCRIPT, $script, 'SET');?>
</li>