|
1 | 1 | <?php |
2 | 2 | /** |
3 | 3 | * Displays popular photos and albums,and fun facts such as the amount of time a site has been online |
4 | | - *@author Will Entriken <cameralife@phor.net> |
5 | | - *@copyright Copyright (c) 2001-2009 Will Entriken |
6 | | - *@access public |
| 4 | + * @author Will Entriken <cameralife@phor.net> |
| 5 | + * @copyright Copyright (c) 2001-2009 Will Entriken |
| 6 | + * @access public |
7 | 7 | */ |
8 | 8 |
|
9 | | - # $cameralife and $album are set by ShowPage() |
10 | | - $cameralife->GetFeature('photostore'); |
| 9 | +# $cameralife and $album are set by ShowPage() |
| 10 | +$cameralife->GetFeature('photostore'); |
11 | 11 |
|
12 | | - $stats = new Stats; |
13 | | - $counts = $stats->GetCounts(); |
14 | | - $popular_photos = $stats->GetPopularPhotos(); |
15 | | - $popular_albums = $stats->GetPopularAlbums(); |
16 | | - $funfacts = $stats->GetFunFacts(); |
| 12 | +$stats = new Stats; |
| 13 | +$counts = $stats->GetCounts(); |
| 14 | +$popular_photos = $stats->GetPopularPhotos(); |
| 15 | +$popular_albums = $stats->GetPopularAlbums(); |
| 16 | +$funfacts = $stats->GetFunFacts(); |
17 | 17 |
|
18 | | - $cameralife->Theme->Header($cameralife->GetPref('sitename').' - Stats', 'stats'); |
| 18 | +$cameralife->Theme->Header($cameralife->GetPref('sitename').' - Stats'); |
19 | 19 | ?> |
20 | | - |
21 | | -<h1>Uploading Photos</h1> |
22 | | -<ul> |
23 | | - <li>You can upload a photo in JPEG format or a ZIP of JPEG photos |
24 | | - <li>The maximum file size is 20MB. |
| 20 | + <h1>Site stats</h1> |
| 21 | + <ul class="thumbnails"> |
| 22 | + <li class="span4"> |
| 23 | + <div class="thumbnail"> |
| 24 | + <h2>Most popular photos</h2> |
| 25 | + <table class="table table-condensed"> |
25 | 26 | <?php |
26 | | - if ($cameralife->Security->Authorize('admin_file') && !isset($_REQUEST['path'])) |
27 | | - echo ' <li>To upload somewhere else, go to that folder and click "upload here"'; |
| 27 | +foreach ($popular_photos as $photo) { |
| 28 | + $percent = $photo->Get('hits') * 100 / $popular_photos[0]->Get('hits'); |
| 29 | + echo "<tr><td>"; |
| 30 | + echo "<div style=\"width:50px; clear:left\" class=\"progress progress-info\"><div class=\"bar\" style=\"width: $percent%\"></div></div>"; |
| 31 | + echo "<td>".number_format($photo->Get('hits')); |
| 32 | + echo "<td><a href=\"photo.php?id=".$photo->Get('id').'">'.$photo->Get('description')."</a>\n"; |
| 33 | +} |
28 | 34 | ?> |
29 | | -</ul> |
30 | | - |
31 | | -<div class="row"> |
32 | | - <div class="span4"> |
33 | | - <h1>Most popular nnphotos</h1> |
| 35 | + </table> |
| 36 | + </div> |
| 37 | + </li> |
| 38 | + <li class="span4"> |
| 39 | + <div class="thumbnail"> |
| 40 | + <h2>Most popular albums</h2> |
| 41 | + <table class="table table-condensed"> |
34 | 42 | <?php |
35 | | - foreach ($popular_photos as $result) |
36 | | - { |
37 | | - if ($i++==3) break; |
38 | | - $icon = $result->GetIcon(); |
39 | | - echo '<div class="item"><a href="'.$icon['href'].'"><img src="'.$icon['image'].'" alt="'.$icon['name'].'" /></a>'; |
40 | | - echo '<a style="clear: left" href="'.$icon['href'].'">'.$result->Get('hits').' hits</a><span class="description">'.$icon['name'].'</span></div>'; |
41 | | - } |
| 43 | +foreach ($popular_albums as $photo) { |
| 44 | + $percent = $photo->Get('hits') * 100 / $popular_photos[0]->Get('hits'); |
| 45 | + echo "<tr><td>"; |
| 46 | + echo "<div style=\"width:50px; clear:left\" class=\"progress progress-success\"><div class=\"bar\" style=\"width: $percent%\"></div></div>"; |
| 47 | + echo "<td>".number_format($photo->Get('hits')); |
| 48 | + echo "<td><a href=\"album.php?id=".$photo->Get('id').'">'.$photo->Get('name')."</a>\n"; |
| 49 | +} |
42 | 50 | ?> |
43 | | - </div> |
44 | | -</div> |
45 | | - |
46 | | -<?php exit(0); ?> |
47 | | - |
48 | | -<div id="text"> |
49 | | - |
50 | | - <h1>Most popular photos</h1> |
51 | | - <ol> |
52 | | - <?php |
53 | | - foreach ($popular_photos as $photo) |
54 | | - { |
55 | | - $percent = $photo->Get('hits') * 100 / $popular_photos[0]->Get('hits'); |
56 | | - echo "<li><div class='bar' style='width: ${percent}px; margin-right:".(20+100-$percent)."px'></div>"; |
57 | | - echo "<a href=\"photo.php?id=".$photo->Get('id').'">"'.$photo->Get('description').""</a>\n"; |
58 | | - echo "<font size=\"-2\">(".$photo->Get('hits').")</font>\n"; |
59 | | - } |
60 | | - ?> |
61 | | - </ol> |
62 | | - <ul> |
63 | | - <li>There are <?= number_format($counts['photos']) ?> photos with <?= number_format($counts['photohits']) ?> hits |
64 | | - <li>They contain <?= number_format($counts['pixels']) ?> total pixels |
65 | | - </ul> |
66 | | - |
67 | | - <h1>Most popular albums</h1> |
68 | | - <ol> |
69 | | - <?php |
70 | | - foreach ($popular_albums as $album) |
71 | | - { |
72 | | - $percent = $album->Get('hits') * 100 / $popular_albums[0]->Get('hits'); |
73 | | - echo "<li><div class='bar' style='width: ${percent}px; margin-right:".(20+100-$percent)."px'></div>"; |
74 | | - echo "<a href=\"album.php?id=".$album->Get('id').'">"'.$album->Get('name').""</a>\n"; |
75 | | - echo "<font size=\"-2\">(".$album->Get('hits').")</font>\n"; |
76 | | - } |
77 | | - ?> |
78 | | - </ol> |
79 | | - <ul> |
80 | | - <li>There are <?= number_format($counts['albums']) ?> albums with <?= number_format($counts['albumhits']) ?> hits |
81 | | - <li>They are in <?= $counts['topics'] ?> topics |
82 | | - </ul> |
83 | | - |
84 | | - <h1>Fun facts</h1> |
85 | | - <ul> |
86 | | - <li><?= $cameralife->GetPref('sitename') ?> has been online since <?= $cameralife->GetPref('sitedate') ?> (<b><?= $counts['daysonline'] ?> days</b>). |
| 51 | + </table> |
| 52 | + </div> |
| 53 | + </li> |
| 54 | + <li class="span4"> |
| 55 | + <div class="thumbnail"> |
| 56 | + <h2>Fun facts</h2> |
| 57 | + <ul> |
| 58 | + <li><?= $cameralife->GetPref('sitename') ?> has been online since <?= $cameralife->GetPref('sitedate') ?> (<b><?= $counts['daysonline'] ?> days</b>). |
87 | 59 | <?php |
88 | 60 | shuffle($funfacts); |
89 | 61 | for ($i = 0; $i < 3; $i++) |
90 | 62 | echo '<li>'.$funfacts[$i]."</li>\n"; |
91 | 63 | ?> |
92 | | - <li><a href="?">Click here to reload more random facts.</a></li> |
93 | | - </ul> |
| 64 | + <li><a href="?">Click here to reload more random facts.</a></li> |
| 65 | + </ul> |
| 66 | + </div> |
| 67 | + </li> |
| 68 | + </ul> |
94 | 69 |
|
95 | 70 | <?php |
96 | 71 | $cameralife->Theme->Footer(); |
|
0 commit comments