forked from aadl/sopac
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sopac-record.tpl.php
284 lines (253 loc) · 10.8 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
<?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') . '.';
} else if ($item_status['avail'] == 0) {
$class = "first";
$reqtext = "There are no copies available.";
} else if($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;
} else if ($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()) {
print '<p>' . l(t('« 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')) {
print $cover_img;
} else {
$cover_img_url = ($item['cover_img'] && $locum_result['cover_img'] != 'CACHE') ? $item['cover_img'] : '/' . drupal_get_path('module', 'sopac') . '/images/nocover.png';
print '<img class="item-cover" width="200" src="' . $cover_img_url . '" />';
}
?>
<!-- Ratings -->
<?php
if (variable_get('sopac_social_enable', 1)) {
print '<div class="item-rating">';
print theme_sopac_get_rating_stars($item['bnum']);
print '</div>';
}
?>
<!-- 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> <a href="/' .
$url_prefix . '/search/series/' . urlencode($series) . '">' . $item['series'] . '</a></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><a href="' . $addl_author_link . '">' . $addl_author . '</a></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><a href="' . $subjurl . '">' . $subj . '</a></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 <a href="' . $authorurl . '">' . $new_author_str . '</a></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 '<fieldset class="collapsible collapsed"><legend>Show All Copies (' . count($item_status['items']) . ')</legend>';
drupal_add_js('misc/collapse.js');
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 '</fieldset>';
} else if ($item['download_link']) {
print '<div class="item-request">';
print '<p><a href="' . $item['download_link'] . '" target="_new">Download this Title</a></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) {
print '<li><a href="' . $rev_link . '" target="_new">' . $rev_title . '</a>';
}
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"><a href="/review/view/' . $rev_item['rev_id'] . '" class="fn url">' . $rev_item['rev_title'] . '</a></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"><a href="/review/user/' . $rev_item['uid'] . '">' . $rev_user->name . '</a> 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 ' [ <a title="Delete this review" href="/review/delete/' . $rev_item['rev_id'] . '?ref=' . urlencode($_SERVER['REQUEST_URI']) . '">delete</a> ] [ <a title="Edit this review" href="/review/edit/' . $rev_item['rev_id'] . '?ref=' . urlencode($_SERVER['REQUEST_URI']) . '">edit</a> ]';
}
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><a href="/user/login?destination=' . $_SERVER['REQUEST_URI'] . '">Login</a> 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>