-
Notifications
You must be signed in to change notification settings - Fork 0
/
sopac-record.tpl.php
358 lines (319 loc) · 13.5 KB
/
sopac-record.tpl.php
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<?php
/*
* Item record display template
*/
// Set the page title
drupal_set_title(ucwords($item['title']));
// Set up some variables.
$url_prefix = variable_get('sopac_url_prefix', 'cat/seek');
$new_author_str = sopac_author_format($item['author'], $item['addl_author']);
$dl_mat_codes = in_array($item['mat_code'], $locum->csv_parser($locum_config['format_special']['download']));
$no_avail_mat_codes = in_array($item['mat_code'], $locum->csv_parser($locum_config['format_special']['skip_avail']));
$location_label = $item['loc_code'] || ($item['loc_code'] != 'none') ? $locum_config['locations'][$item['loc_code']] : '';
$note_arr = unserialize($item['notes']);
$series = trim($item['series']);
if ($split_pos = max(strpos($series, ";"), strpos($series, ":"), strpos($series, "."), 0)) {
$series = trim(substr($series, 0, $split_pos));
}
// Construct the availabilty summary.
if ($item_status['avail'] == 0 && $item_status['holds'] > 0) {
$class = "holds";
$reqtext = "There are no copies available. " . $item_status['holds'] . " request" .
($item_status['holds'] == 1 ? '' : 's') . " on " . $item_status['total'] . ($item_status['total'] == 1 ? ' copy' : ' copies') . '.';
}
elseif ($item_status['avail'] == 0) {
$class = "first";
$reqtext = "There are no copies available.";
}
elseif($item_status['holds'] > 0) {
$class = "holds";
$reqtext = "There " . ($item_status['avail'] == 1 ? 'is' : 'are') . " currently $item_status[avail] available and " . $item_status['holds'] . " request" . ($item_status['holds'] == 1 ? '' : 's') . " on " . $item_status['total'] . ' ' . ($item_status['total'] == 1 ? 'copy' : 'copies');
}
else {
$class = "avail";
$reqtext = "There " . ($item_status['avail'] == 1 ? 'is' : 'are') . " currently $item_status[avail] available.";
}
// Build the item availability array
if (count($item_status['items'])) {
foreach ($item_status['items'] as $copy_status) {
if ($copy_status['avail'] > 0) {
$copy_tag = ($copy_status['avail'] == 1) ? t('copy available') : t('copies available');
$status_msg = $copy_status['avail'] . ' ' . $copy_tag;
}
elseif ($copy_status['due']) {
$status_msg = t('Next copy due') . ' ' . date('n-j-Y', $copy_status['due']);
}
else {
$status_msg = $copy_status['statusmsg'];
}
if (variable_get('sopac_multi_branch_enable', 0)) {
$copy_status_array[] = array($copy_status['location'], $copy_status['callnum'], $locum_config['branches'][$copy_status['branch']], $status_msg);
}
else {
$copy_status_array[] = array($copy_status['location'], $copy_status['callnum'], $status_msg);
}
}
}
if (sopac_prev_search_url(TRUE)) {
print '<p>' . l("« Return to your search", sopac_prev_search_url(), array('html' => TRUE)) . '</p>';
}
?>
<!-- begin item record -->
<div class="itemrecord">
<!-- begin left-hand column -->
<div class="item-left">
<!-- Cover Image -->
<?php
if (!module_exists('covercache')) {
if (strpos($item['cover_img'], 'http://') !== FALSE) {
$cover_img = $item['cover_img'];
} else {
$cover_img = base_path() . drupal_get_path('module', 'sopac') . '/images/nocover.png';
}
$cover_img = '<img class="item-cover" width="200" src="' . $cover_img . '">';
}
print $cover_img;
preg_match('#\bhttps?://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))#', $cover_img, $match);
$full_cover_image_url = $match[0] ? $match[0] : 'http://' . $_SERVER['SERVER_NAME'] . '/' . drupal_get_path('module', 'sopac') . '/images/' . $item['mat_code'] . '.png';
?>
<!-- Ratings -->
<?php
if (variable_get('sopac_social_enable', 1)) {
print '<div class="item-rating">';
print theme_sopac_get_rating_stars($item['bnum']);
print '</div>';
}
?>
<!-- Social Media -->
<?php $thispage = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>
<?php drupal_set_html_head('<meta property="og:title" content="' . ucwords($item['title']) . '"/>'); ?>
<?php drupal_set_html_head('<meta property="og:type" content="book"/>'); ?>
<?php drupal_set_html_head('<meta property="og:image" content="' . $full_cover_image_url . '"/>'); ?>
<?php drupal_set_html_head('<meta property="og:url" content="' . $thispage . '"/>'); ?>
<?php drupal_set_html_head('<meta property="fb:app_id" content="239889349362973"/>'); ?>
<?php
$soc_med_page_desc = ucwords($item['title']);
if ($item['author']) {
$soc_med_page_desc .= ' by ' . $new_author_str;
drupal_set_html_head('<meta property="og:description" content="by ' . $new_author_str . '"/>');
}
?>
<ul><li>
<?php $tweettitle = $new_author_str ? ucwords($item['title']) . ' by ' . $new_author_str : ucwords($item['title']); ?>
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<div>
<a href="http://twitter.com/share" class="twitter-share-button"
data-url="<?php print $thispage; ?>"
data-via="darienlibrary"
data-text="<?php print $tweettitle; ?>"
data-related="darienlibrary:Darien Library">Tweet</a>
</div>
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=239889349362973&xfbml=1"></script><fb:like hr
ef="<?php print urlencode($thispage); ?>" send="true" layout="button_count" width="450" show_faces="true" font="verdana"></fb:like>
<div style="padding-top:3px;"><a href="http://pinterest.com/pin/create/button/?url=<?php print urlencode($thispage); ?>&media=<?php print urlencode($full_cover_image_url); ?>&description=<?php print urlencode($soc_med_page_desc); ?>" class="pin-it-button" count-layout="horizontal">Pin It</a>
<script type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script></div>
</li></ul>
<!-- Item Details -->
<ul>
<?php
if ($item['pub_info']) {
print '<li><b>Published:</b> ' . $item['pub_info'] . '</li>';
}
if ($item['pub_year']) {
print '<li><b>Year Published:</b> ' . $item['pub_year'] . '</li>';
}
if ($item['series']) {
print '<li><b>Series:</b> ' . l($item['series'], $url_prefix . '/search/series/' . urlencode($series)) . '</li>';
}
if ($item['edition']) {
print '<li><b>Edition:</b> ' . $item['edition'] . '</li>';
}
if ($item['descr']) {
print '<li><b>Description:</b> ' . nl2br($item['descr']) . '</li>';
}
if ($item['stdnum']) {
print '<li><b>ISBN/Standard #:</b>' . $item['stdnum'] . '</li>';
}
if ($item['lang']) {
print '<li><b>Language:</b> ' . $locum_config['languages'][$item['lang']] . '</li>';
}
if ($item['mat_code']) {
print '<li><b>Format:</b> ' . $locum_config['formats'][$item['mat_code']] . '</li>';
}
?>
</ul>
<!-- Additional Credits -->
<?php
if ($item['addl_author']) {
print '<h3>Additional Credits</h3><ul>';
$addl_author_arr = unserialize($item['addl_author']);
foreach ($addl_author_arr as $addl_author) {
$addl_author_link = $url_prefix . '/search/author/%22' . urlencode($addl_author) .'%22';
print '<li>' . l($addl_author, $addl_author_link) . '</li>';
}
print '</ul>';
}
?>
<!-- Subject Headings -->
<?php
if ($item['subjects']) {
print '<h3>Subjects</h3><ul>';
$subj_arr = unserialize($item['subjects']);
if (is_array($subj_arr)) {
foreach ($subj_arr as $subj) {
$subjurl = $url_prefix . '/search/subject/%22' . urlencode($subj) . '%22';
print '<li>' . l($subj, $subjurl) . '</li>';
}
}
print '</ul>';
}
?>
<!-- Tags -->
<?php
if (variable_get('sopac_social_enable', 1)) {
print '<h3>Tags</h3>';
$block = module_invoke('sopac','block','view', 4);
print $block['content'];
}
?>
<!-- end left-hand column -->
</div>
<!-- begin right-hand column -->
<div class="item-right">
<!-- Supressed record notification -->
<?php
if ($item['active'] == '0') {
print '<div class="suppressed">This Record is Suppressed</div>';
}
?>
<!-- Item Title -->
<h1>
<?php
print ucwords($item['title']);
if ($item['title_medium']) {
print " $item[title_medium]";
}
?>
</h1>
<!-- Item Format Icon -->
<ul class="item-format-icon">
<li><img src="<?php print '/' . drupal_get_path('module', 'sopac') . '/images/' . $item['mat_code'] . '.png' ?>"></li>
<li style="margin-top: -2px;"><?php print wordwrap($locum_config['formats'][$item['mat_code']], 8, '<br />'); ?></li>
</ul>
<!-- Item Author -->
<?php
if ($item['author']) {
$authorurl = $url_prefix . '/search/author/' . $new_author_str;
print '<h3>by ' . l($new_author_str, $authorurl) . '</h3>';
}
?>
<!-- Request Link -->
<?php
if (!in_array($item['loc_code'], $no_circ) && !$item['download_link']) {
print '<div class="item-request">';
print '<p>' . sopac_put_request_link($item['bnum'], 1, 0, $locum_config['formats'][$item['mat_code']]) . '</p>';
print '<h3>' . $reqtext . '</h3>';
print '</div>';
}
?>
<!-- Where to find it -->
<div class="item-avail-disp">
<h2>Where To Find It</h2>
<?php
if ($item_status['callnums']) {
print '<p>Call number: <strong>' . implode(", ", $item_status['callnums']) . '</strong></p>';
}
if (count($item_status['items']) && !$no_avail_mat_codes) {
print '<div><fieldset class="collapsible collapsed"><legend>Show All Copies (' . count($item_status['items']) . ')</legend><div>';
if (variable_get('sopac_multi_branch_enable', 0)) {
print theme('table', array("Location", "Call Number", "Branch", "Item Status"), $copy_status_array);
}
else {
print theme('table', array("Location", "Call Number", "Item Status"), $copy_status_array);
}
print '</div></fieldset></div>';
}
elseif ($item['download_link']) {
print '<div class="item-request">';
print '<p>' . l(t('Download this Title'), $item['download_link'], array('attributes' => array('target' => '_new'))) . '</p>';
print '</div>';
}
else {
if (!$no_avail_mat_codes) {
print '<p>No copies found.</p>';
}
}
if (count($item_status['orders'])) {
print '<p>' . implode("</p><p>", $item_status['orders']) . '</p>';
}
?>
</div>
<!-- Notes / Additional Details -->
<?php
if (is_array($note_arr)) {
print '<div id="item-notes">';
print '<h2>Additional Details</h2>';
foreach($note_arr as $note) {
print '<p>' . $note . '</p>';
}
print '</div>';
}
?>
<!-- Syndetics / Review Links -->
<?php
if ($item['review_links']) {
print '<div id="item-syndetics">';
print '<h2>Reviews & Summaries</h2>';
print '<ul>';
foreach ($item['review_links'] as $rev_title => $rev_link) {
$rev_link = explode('?', $rev_link);
print '<li>' . l($rev_title, $rev_link[0], array('query' => $rev_link[1], 'attributes' => array('target' => '_new'))) . '</li>';
//print '<li>' . l($rev_title, $rev_link, array('attributes' => array('target' => '_new'))) . '</li>';
}
print '</ul></div>';
}
?>
<!-- Community / SOPAC Reviews -->
<div id="item-reviews">
<h2>Community Reviews</h2>
<?php
if (count($rev_arr)) {
foreach ($rev_arr as $rev_item) {
print '<div class="hreview">';
print '<h3 class="summary">' . l($rev_item['rev_title'], 'review/view/' . $rev_item['rev_id'], array('attributes' => array('class' => 'fn url'))) . '</h3>';
if ($rev_item['uid']) {
$rev_user = user_load(array('uid' => $rev_item['uid']));
print '<p class="review-byline">submitted by <span class="review-author">' . l($rev_user->name, 'review/user/' . $rev_item['uid']) . ' on <abbr class="dtreviewed" title="' . date("c", $rev_item['timestamp']) . '">' . date("F j, Y, g:i a", $rev_item['timestamp']) . '</abbr></span>';
if ($user->uid == $rev_item['uid']) {
print ' [ ' .
l(t('delete'), 'review/delete/' . $rev_item['rev_id'], array('attributes' => array('title' => 'Delete this review'), 'query' => array('ref' => $_GET['q']))) .
' ] [ ' .
l(t('edit'), 'review/edit/' . $rev_item['rev_id'], array('attributes' => array('title' => 'Edit this review'), 'query' => array('ref' => $_GET['q']))) .
' ]';
}
print '</p>';
}
print '<div class="review-body description">' . nl2br($rev_item['rev_body']) . '</div></div>';
}
}
else {
print '<p>No reviews have been written yet. You could be the first!</p>';
}
print $rev_form ? $rev_form : '<p>' . l(t('Login'), 'user/login', array('query' => array('destination' => $_GET['q']))) . ' to write a review of your own.</p>';
?>
</div>
<!-- Google Books Preview -->
<div id="item-google-books">
<div class="item-google-prev">
<script type="text/javascript" src="http://books.google.com/books/previewlib.js"></script>
<script type="text/javascript">
var w=document.getElementById("item-google-books").offsetWidth;
var h=(w*1.3);
GBS_insertEmbeddedViewer('ISBN:<?php print $item['stdnum']; ?>',w,h);
</script>
</div>
</div>
<!-- end right-hand column -->
</div>
<!-- end item record -->
</div>