} if (isset($mostViewed) && $mostViewed != false && $mostViewed != NULL) { $weHaveAPick[1] = true; if ($mostViewed["type"] == _TABLE_TRACK) { $tp_name[1] = $mostViewed["name"]; $tp_album[1] = $mostViewed["album"]; $urlIdentifier = "/t/"; } else { $tp_name[1] = $mostViewed["album"]; $tp_album[1] = ""; $urlIdentifier = "/a/"; } $tp_artist[1] = $mostViewed["artist"]; $tp_image[1] = $mostViewed["image"]; $tp_link[1] = _SITE_URL . $urlIdentifier . DBUtils::toUid(intval($mostViewed["id"]), _BASE_MULTIPLIER); } if (isset($lastShared) && $lastShared != false && $lastShared != NULL) { $weHaveAPick[2] = true; if ($lastShared["type"] == _TABLE_TRACK) { $urlIdentifier = "/t/"; $tp_name[2] = $lastShared["name"]; $tp_album[2] = $lastShared["album"]; } else { $urlIdentifier = "/a/"; $tp_name[2] = $lastShared["album"]; $tp_album[2] = ""; } $tp_artist[2] = $lastShared["artist"]; $tp_image[2] = $lastShared["image"]; $tp_link[2] = _SITE_URL . $urlIdentifier . DBUtils::toUid(intval($lastShared["id"]), _BASE_MULTIPLIER); }
public static function addAPick($id) { $db = DBConnection::db(); // Latest first $query = "SELECT id, name, album, artist, image FROM `items` WHERE id=:id AND type=" . _TABLE_TRACK . " LIMIT 1"; $statement = $db->prepare($query); $statement->bindParam(':id', $id, PDO::PARAM_INT); // Executes the query $exe = $statement->execute(); if (!$exe || $exe == false) { return false; } else { // Fetch the info $row = $statement->fetchAll(PDO::FETCH_ASSOC); $queryDate = "SELECT MAX(date) AS maxDate FROM `picks`"; $statementDate = $db->prepare($queryDate); // Executes the query $exeDate = $statementDate->execute(); if (!$exeDate || $exeDate == false) { return false; } else { $rowDate = $statementDate->fetch(PDO::FETCH_ASSOC); $maxDate = strftime("%Y-%m-%d", strtotime($rowDate['maxDate'] . " + 1 day")); } $queryPick = "INSERT INTO `picks` (name, artist, album, image, link, date) VALUES(:name, :artist, :album, :image, :link, :max_date)"; $statementPick = $db->prepare($queryPick); $statementPick->bindParam(':name', $row["name"], PDO::PARAM_STR); $statementPick->bindParam(':artist', $row["artist"], PDO::PARAM_STR); $statementPick->bindParam(':album', $row["album"], PDO::PARAM_STR); $statementPick->bindParam(':image', $row["image"], PDO::PARAM_STR); $statementPick->bindParam(':link', _SITE_URL . '/t/' . DBUtils::toUid($row["id"], _BASE_MULTIPLIER), PDO::PARAM_STR); $statementPick->bindParam(':max_date', $maxDate, PDO::PARAM_STR); // Executes the query $exePick = $statementPick->execute(); if (!$exePick || $exePick == false) { return false; } else { return true; } } }
<ol class="classement"> <?php while (list($key, $val) = each($mostViewedArtists)) { echo "<li><span class=\"classement_in\">" . html_entity_decode($key) . " : <span class=\"color\">" . intval($val) . "</span></span></li>"; } ?> </ol> </div> <div class="clear" style="height: 10px"></div> <h2 class="txtS">Tracks Statistics >> Most Viewed Tracks</h2> <div class="boxed"> <ol class="classement"> <?php while (list($key, $val) = each($mostViewedTracks)) { list($id, $artist, $title) = explode("|", $key); echo "<li><span class=\"classement_in\">" . html_entity_decode($artist) . " - <span class=\"link\"><a href=\"" . _SITE_URL . "/t/" . DBUtils::toUid($id, _BASE_MULTIPLIER) . "\">" . html_entity_decode($title) . "</a></span> : <span class=\"color\">" . intval($val) . "</span></span></li>"; } ?> </ol> </div> </div> </div> <?php // == == == == == == SEARCH TRENDS == == == == == == // ?> <div id="admin_searchTrends" class="bdTop bdBot"> <div class="margins"> <h2 class="txtS">Tracks Statistics >> Latest Searches</h2> <div class="boxed">
$order = 0; while (list($key, $val) = each($mostViewedTracks)) { list($id, $artist, $title) = explode('|', html_entity_decode($key)); $fontSize = 2.3 * (1 - $order / 5) + $order / 5 * 0.6; echo "<li><span class=\"count bdBot\">"; $i18n->views(intval($mostViewedTracks[$key])); echo "</span><span class=\"order bdTop bdBot\">" . ++$order . "</span><span class=\"title\"><a style=\"font-size: " . $fontSize . "em\" href=\"" . _SITE_URL . "/t/" . DBUtils::toUid($id, _BASE_MULTIPLIER) . "\">" . ellipsis($title, 30) . "</a></span><span class=\"artist bdTop\">" . $artist . "</span></li>"; } ?> </ul> </div> <div id="mostViewedAlbums"> <h2 class="color"><?php echo $i18n->most_viewed_albums($listDisplayLimit); ?> </h2> <ul> <?php $order = 0; while (list($key, $val) = each($mostViewedAlbums)) { list($id, $artist, $title) = explode('|', html_entity_decode($key)); $fontSize = 2.3 * (1 - $order / 5) + $order / 5 * 0.6; echo "<li><span class=\"count bdBot\">"; $i18n->views(intval($mostViewedAlbums[$key])); echo "</span><span class=\"order bdTop bdBot\">" . ++$order . "</span><span class=\"title\"><a style=\"font-size: " . $fontSize . "em\" href=\"" . _SITE_URL . "/a/" . DBUtils::toUid($id, _BASE_MULTIPLIER) . "\">" . ellipsis($title, 30) . "</a></span><span class=\"artist bdTop\">" . $artist . "</span></li>"; } ?> </ul> </div> </div>
<thead> <tr class="headerTable name"> <th colspan="2" width="20px" class="name">Item</th> <th class="name">Artist</th> <th class="name">Album</th> <th class="name" width="52px"></th> </tr> </thead> <tbody> <?php while (list($id, $item) = each($items)) { echo "<tr><td width=\"35px\" class=\"image\"><img src=\"" . $item['image'] . "\" width=\"30px\" /></td><td class=\"name\">"; if ($type == _TABLE_TRACK) { echo "<a href=\"" . _SITE_URL . '/t/' . DBUtils::toUid($id, _BASE_MULTIPLIER) . "\" target=\"_blank\">" . html_entity_decode($item['name']) . "</a></td>"; } else { echo "<a href=\"" . _SITE_URL . '/a/' . DBUtils::toUid($id, _BASE_MULTIPLIER) . "\" target=\"_blank\">" . html_entity_decode($item['album']) . "</a></td>"; } echo "<td class=\"name\">" . html_entity_decode($item['artist']) . "</td>"; if ($type == _TABLE_TRACK) { echo "<td class=\"name\">" . ellipsis(html_entity_decode($item['album']), 40) . "</td>"; } else { echo "<td class=\"name\"></td>"; } echo "<td class=\"name addAPick\" rel=\"" . $id . "\">pick it</td></tr>"; } ?> </tbody> </table> </div> </div>