/
sopac-record-musicdownload.tpl.php
226 lines (209 loc) · 8.69 KB
/
sopac-record-musicdownload.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
<?php
/*
* Item record display template
*/
// Set the page title
drupal_set_title(title_case($item['title']));
global $user;
$verified = FALSE;
if($user->uid && $user->bcode_verified){
$verified = TRUE;
}
// Set up some variables.
$url_prefix = variable_get('sopac_url_prefix', 'cat/seek');
function sec2hms ($sec, $padHours = false) {
$hms = "";
$hours = intval(intval($sec) / 3600);
if($hours > 0) {
$hms .= ($padHours)
? str_pad($hours, 2, "0", STR_PAD_LEFT). ':'
: $hours. ':';
}
$minutes = intval(($sec / 60) % 60);
$hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ':';
$seconds = intval($sec % 60);
$hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT);
return $hms;
}
$license = isset($item['licensed_from']) ? $item['licensed_from'] : 'magnatune';
?>
<!-- begin item record -->
<div class="itemrecord">
<!-- begin left-hand column -->
<div class="item-left">
<!-- Cover Image -->
<?php
$cover_img = "http://media.aadl.org/music/$license/".$item['_id']."/data/cover.jpg";
$cover_img = '<img class="item-cover" width="200" src="' . $cover_img . '">';
print $cover_img;
?>
<!-- Ratings -->
<?php
if (variable_get('sopac_social_enable', 1)) {
print '<div class="item-rating">';
print theme_sopac_get_rating_stars($item['_id']);
print '</div>';
}
?>
<!-- Item Details -->
<ul>
<?php
if ($item['pub_info']) {
print '<li><b>Published:</b> ' . $item['pub_info'] . '</li>';
}
if ($item['release_date']) {
print '<li><b>Release Date:</b> ' . $item['release_date'] . '</li>';
}
if ($item['pub_year']) {
print '<li><b>Year Published:</b> ' . $item['pub_year'] . '</li>';
}
if($item['zipmd5']){
?>
<li><b>Format:</b> 320Kbps MP3</li>
<?php } ?>
</ul>
<?php if($verified && $item['zipmd5']) { ?>
<h3>All Formats</h3>
<ul>
<li><a href="<?php echo '/'.$url_prefix . '/record/'.$item['_id'].'/download?type=album'; ?>">Download MP3 Album</a></li>
<li><a href="<?php echo '/'.$url_prefix . '/record/'.$item['_id'].'/download?type=flac'; ?>">Download FLAC Album</a> ( <a href="/downloadhelp#flac">What is this?</a> )</li>
</ul>
<!-- Subject Headings -->
<?php
}
if ($item['genres']) {
print '<h3>Genres</h3><ul>';
if (is_array($item['genres'])) {
foreach ($item['genres'] as $genre) {
$subjurl = $url_prefix . '/search/subject/%22' . urlencode($genre) . '%22';
print '<li>' . l($genre, $subjurl) . '</li>';
}
}
print '</ul>';
}
?>
<?php if($item['license']) { ?>
<h3>License</h3>
<ul>
<li><a href="<?php echo $item['license']; ?>">Creative Commons</a></li>
<li>This download is available for personal use only.</li>
</ul>
<?php }
if($item['magnatune_url']) {
?>
<h3>Elsewhere</h3>
<ul>
<li><a href="<?php echo $item['magnatune_url']; ?>">Magnatune</a></li>
</ul>
<!-- Tags -->
<?php
}
if (variable_get('sopac_social_enable', 1)) {
print '<h3>Tags</h3>';
$block = module_invoke('sopac','block','view', 4);
print $block['content'];
}
?>
<h3>Share This</h3>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<ul>
<li><fb:like href="http://www.aadl.org/catalog/record/<?php echo $item['_id']; ?>" layout="button_count" show_faces="false" width="450" font=""></fb:like></li>
<li><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.aadl.org/catalog/record/<?php echo $item['_id']; ?>" data-text="Enjoying <?php echo title_case($item['title']); ?>" data-count="none" data-via="aadl">Tweet</a></li>
</ul>
<!-- end left-hand column -->
</div>
<!-- begin right-hand column -->
<div class="item-right">
<div class="item-main">
<!-- Item Format Icon -->
<ul class="item-format-icon">
<li><img src="<?php print base_path() . drupal_get_path('module', 'sopac') . '/images/z.png' ?>"></li>
<li style="margin-top: -2px;"><?php print wordwrap("Music Download", 13, '<br />'); ?></li>
</ul>
<!-- Actions -->
<ul class="item-actions">
<?php echo sopac_put_request_link($item['_id'],0,0,'Music Download'); ?>
<?php
include_once('sopac_user.php');
//print sopac_put_list_links($item['magnatune_id']);
?>
</ul>
<!-- Item Title -->
<h1>
<?php
print ucwords($item['title']);
?>
</h1>
<!-- Item Author -->
<?php
if ($item['artist']) {
$authorurl = $url_prefix . '/search/author/' . $item['artist'];
print '<h3>by ' . l($item['artist'], $authorurl) . '</h3>';
}
?>
<?php if(!$verified) { ?>
<p class="info">This download is only available to active library card holders.</p>
<?php } ?>
<p class="info"><img src="<?php print base_path() . drupal_get_path('module', 'sopac') . '/images/info.png' ?>" align="center" width="35px" /> <?php echo l('How do I download and use these files?','downloadhelp'); ?></p>
</div>
<?php if($item['tracks']) { $tracks = $item['tracks']; ksort($tracks); ?>
<div id="item-samples">
<h2>Tracks<?php if($verified) { ?> - Full Length Streaming<?php } ?></h2>
<?php if(!$user->uid) { ?>
<p><?php echo l(t('Log in to Stream or Download Tracks'), 'user/login', array('query' => drupal_get_destination())); ?></p>
<?php } else if(!$verified) { l(t('Verify card to Stream or Download Tracks'), 'user/' . $user->uid); } else if($verified) { ?>
<p>Play Album: <img src="<?php print base_path() . drupal_get_path('module', 'sopac') . '/images/prev.png' ?>" align="center" height="20px" id="prev_track" /> <img src="<?php print base_path() . drupal_get_path('module', 'sopac') . '/images/play.png' ?>" height="30px" align="center" id="play_pause" /> <img src="<?php print base_path() . drupal_get_path('module', 'sopac') . '/images/next.png' ?>" height="20px" align="center" id="next_track" /></p>
<?php } ?>
<ul class="samples">
<?php foreach($tracks as $track => $info) { ?>
<?php if($verified) { ?>
<li><a href="<?php echo '/'.$url_prefix . '/record/'.$item['_id'].'/download?type=play&tracknum='.$track; ?>" class="mp3player inline-playable"><?php echo $track; ?>. <?php echo $info['title']; ?> (<?php echo sec2hms($info['length']); ?>)</a><span class="right">(<?php echo round(($info['size'] / 1048576), 2); ?>MB) <a href="<?php echo '/'.$url_prefix . '/record/'.$item['_id'].'/download?type=track&tracknum='.$track; ?>">Download Track</a></span></li>
<?php } else { ?>
<li><?php echo $track; ?>. <?php echo $info['title']; ?></li>
<?php } } ?>
</ul>
</div>
<?php }
if (is_array($item['notes'])) {
print '<div id="item-notes">';
print '<h2>Additional Details</h2>';
foreach($item['notes'] as $note) {
print '<p>' . $note . '</p>';
}
print '</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>
<!-- end right-hand column -->
</div>
<!-- end item record -->
</div>