summaryrefslogtreecommitdiffstats
path: root/templates/show_random_albums.inc.php
blob: 2dee7f85d7b3cba032c77f4b00259bee82c9206f (plain)
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
<?php
/*

 Copyright (c) Ampache.org
 All rights reserved.

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License v2
 as published by the Free Software Foundation.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/
$web_path = Config::get('web_path'); 
$button = Ajax::button('?page=index&action=random_albums','random',_('Refresh'),'random_refresh'); 
?>
<?php show_box_top(_('Albums of the Moment') . ' ' . $button); ?>

	<?php 
	if ($albums) {
		foreach ($albums as $album_id) { 
			$album = new Album($album_id); 
			$album->format(); 
			$name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
			
			// This should not be hard coded, but it will likely break all the themes. 
			//$image_size = Config::get('bandwidth') == BANDWIDTH_MEDIUM ? 75 : 128;
			$image_size = 75;
        ?>
        <div class="random_album">
                <a href="<?php echo $web_path; ?>/albums.php?action=show&amp;album=<?php echo $album_id; ?>">
                <?php if (Config::get('bandwidth') > BANDWIDTH_LOW) { ?>
                <img src="<?php echo $web_path; ?>/image.php?thumb=3&amp;id=<?php echo $album_id; ?>&amp;thumb=<?php echo 1; /* This should be dynamic, but until themes are fixed to be more fluid in regards to images, make it static. */ /* Config::get('bandwidth'); */ ?>" width="<?php echo $image_size; ?>" height="<?php echo $image_size; ?>" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
                <?php } else { ?>
                <?php echo '[' . $album->f_artist . '] ' . $album->f_name; ?>
                <?php } ?>
                </a>
                <?php
                if(Config::get('ratings')){
                        //echo "<div style=\"float:left; display:inline;\" id=\"rating_" . $album->id . "_album\">";
                        show_rating_static($album->id, 'album');
                        //echo "</div>";
                }
                ?>
              	<span class="play_album"><?php echo Ajax::button('?action=basket&type=album&id=' . $album->id,'add',_('Play Album'),'play_full_' . $album->id); ?></span>
        </div>
       
        	<?php } // end foreach ?>
	<?php } // end if albums ?>

<?php show_box_bottom(); ?>