/** * Shows the chart system * * @author Ross Carlson * @version 01/26/05 * @since 01/26/05 * @param $node The node we are viewing so we can filter * @param $types The charts to display. Comma seperated list of: * topplayalbum, topplayartist, topdownalbum, newalbums, newartists, newtracks * recentplayalbum, recentplayartist, recentplaytrack, * topratedalbum, topratedartist, topviewartist, topplaytrack * @param $numItems The number of items we want to return (defaults to 5) * @param $format Should we format this or return raw data (defaults to true) * @param $opts an array of extra options (transitioning to new parameter scheme) * */ function showCharts($node, $types = false, $numItems = false, $format = true, $vertAlign = false, $opts = false) { global $album_name_truncate, $img_tiny_play, $img_tiny_play_dis, $jzUSER, $img_rss, $root_dir, $advanced_tooltips, $rss_in_charts, $num_items_in_charts, $chart_timeout_days, $chart_types; $be = new jzBackend(); if ($be->hasFeature('charts') === false) { return; } // Let's setup our objects $blocks = new jzBlocks(); $display = new jzDisplay(); $nobr = true; if ($opts !== false) { if (isset($opts['allow_breaks'])) { $nobr = false; } else { $nobr = true; } } // Now let's do a loop creating all our blocks if ($types === false || $types == "") { if (isset($chart_types) && !isNothing($chart_types)) { $b = $chart_types; } else { $b = "topplayalbum,topplayartist,topviewartist,newalbums"; } } else { $b = $types; } $bArray = explode(",", $b); for ($e = 0; $e < count($bArray); $e++) { // Now let's create our blocks $showPlays = false; switch ($bArray[$e]) { case "topplayalbum": $func = "getMostPlayed"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "played-albums"; $title = word("Top Played Albums"); $distance = "album"; $showPlays = true; $showDownload = false; $rss = "most-played"; break; case "topplayartist": $func = "getMostPlayed"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "played-artists"; $title = word("Top Played Artists"); $distance = "artist"; $showPlays = true; $showDownload = false; $rss = "most-played-artist"; break; case "topdownalbum": $func = "getMostDownloaded"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "downloaded-albums"; $title = word("Top Downloaded Albums"); $distance = "album"; $showDownload = true; $rss = "most-downloaded"; break; case "newalbums": $func = "getRecentlyAdded"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "new-albums"; $title = word("New Albums"); $distance = "album"; $showDownload = false; $rss = "last-added"; break; case "newartists": $func = "getRecentlyAdded"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "new-artists"; $title = word("New Artists"); $distance = "artist"; $showDownload = false; $rss = "last-added-artists"; break; case "newtracks": $func = "getRecentlyAdded"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "new-tracks"; $title = word("New Tracks"); $distance = "track"; $showDownload = false; $rss = "last-added-tracks"; break; case "recentplaytrack": $func = "getRecentlyPlayed"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "recentplayed-tracks"; $title = word("Recently Played Tracks"); $distance = "track"; $showDownload = false; $rss = "recentplayed-track"; break; case "topplaytrack": $func = "getMostPlayed"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "played-tracks"; $title = word("Top Played Tracks"); $distance = "track"; $showDownload = false; $rss = "most-played-tracks"; break; case "recentplayalbum": $func = "getRecentlyPlayed"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "recentplayed-albums"; $title = word("Recently Played Albums"); $distance = "album"; $showDownload = false; $rss = "recentplayed-album"; break; case "recentplayartist": $func = "getRecentlyPlayed"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "recentplayed-artists"; $title = word("Recently Played Artists"); $distance = "artist"; $showDownload = false; $rss = "recentplayed-artist"; break; case "topratedalbum": $func = "getTopRated"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "toprated-albums"; $title = word("Top Rated Albums"); $distance = "album"; $showDownload = false; $rss = "toprated-album"; break; case "topratedartist": $func = "getTopRated"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "toprated-artists"; $title = word("Top Rated Artists"); $distance = "artist"; $showDownload = false; $rss = "toprated-artist"; break; case "topviewartist": $func = "getMostViewed"; $arr['action'] = "popup"; $arr['ptype'] = "topstuff"; $arr['tptype'] = "topviewed-artists"; $title = word("Most Viewed Artists"); $distance = "artist"; $showDownload = false; $rss = "topviewed-artist"; break; default: continue; } // Now let's get the data if ($distance == "track") { $returnType = "tracks"; } else { $returnType = "nodes"; } if ($numItems) { $num_items_in_charts = $numItems; } if ($chart_timeout_days > 0) { $be = new jzBackend(); $data_id .= pathize('chart-' . $node->getPath("String")) . "-{$func}-{$distance}-{$num_items_in_charts}"; if (($recent = $be->loadData($data_id, true)) === false) { $recent = $node->{$func}($returnType, distanceTo($distance, $node), $num_items_in_charts); $be->storeData($data_id, $recent, $chart_timeout_days); } } else { $recent = $node->{$func}($returnType, distanceTo($distance, $node), $num_items_in_charts); } // Now let's see if we got data if (count($recent) == 0) { continue; } ?> <td width="25%" valign="top"> <?php if ($format) { echo '<div id="slickMainBlockBody">'; } ?> <table width="95%" cellpadding="0" cellspacing="0" border="0"> <tr> <td width="100%" valign="middle"> <?php if ($nobr) { echo '<nobr>'; } ?> <?php if ($format) { // Now let's display the link to the FULL top played list echo '<a onclick="openPopup(this, 300, 450); return false;" title="' . $title . '" href="' . urlize($arr) . '"><strong>' . $title . '</strong></a>'; // Let's link to the RSS feed if ($rss_in_charts == "true") { echo ' - <a href="' . $root_dir . '/rss.php?type=' . $rss; if ($node->getLevel() != 0) { echo '&root=' . $node->getPath("String"); } echo '">' . $img_rss . '</a>'; } echo '<br>'; } // Now let's loop through the results for ($i = 0; $i < count($recent); $i++) { // Now let's create our node and get the properties $item = $artnode = $recent[$i]; $album = $item->getName(); $parent = $item->getAncestor("artist"); if ($parent !== false) { $artist = $parent->getName(); } $albumDLCount = $item->getDownloadCount(); $year = $item->getYear(); $dispYear = ""; if ($year != "-") { $dispYear = " (" . $year . ")"; } // Now let's create our links if ($distance == "track") { $artnode = $item->getAncestor("album"); if (is_object($artnode)) { $albumArr['jz_path'] = $artnode->getPath("String"); $gp = $item->getAncestor("artist"); if (is_object($gp)) { $artistArr['jz_path'] = $gp->getPath("String"); } else { $artistArr['jz_path'] = ''; } } else { $albumArr['jz_path'] = ''; $artistArr['jz_path'] = ''; } } else { $albumArr['jz_path'] = $item->getPath("String"); if ($parent !== false) { $artistArr['jz_path'] = $parent->getPath("String"); } } // Now let's create our short names $artistTitle = returnItemShortName($artist, $album_name_truncate); $albumTitle = returnItemShortName($album, $album_name_truncate); // Now let's display it if ($nobr) { echo "<nobr>"; } if (!$jzUSER->getSetting('stream')) { echo $img_tiny_play_dis; } else { $display->playLink($item, $img_tiny_play, $album); } // Ok, did they want advanced tooltips? if ($advanced_tooltips == "true") { // Now let's set the hover code $innerOver = ""; $showTip = false; if (($art = $artnode->getMainArt("75x75")) != false) { $innerOver .= $display->returnImage($art, $artnode->getName(), 75, 75, "limit", false, false, "left", "3", "3"); $showTip = true; $bTitle = $artist . " - " . $album . $dispYear; } else { // Ok, no art so let's make this look better $innerOver .= "<strong>" . $artist . "<br>" . $album . $dispYear . "</strong><br>"; $bTitle = $album . $dispYear; } $desc_truncate = 200; $desc = $item->getDescription(); if (!isNothing($desc)) { $innerOver .= $display->returnShortName($desc, $desc_truncate); $showTip = true; } // Now let's fix up $innerOver = str_replace("'", "", str_replace('"', "", $innerOver)); $bTitle = str_replace("'", "", str_replace('"', "", $bTitle)); if ($showTip) { $title = $display->returnToolTip($innerOver, $bTitle); } else { $title = ' title="' . $artist . ' - ' . $album . $dispYear . '"'; } } else { // Standard tooltips $title = ' title="' . $artist . ' - ' . $album . $dispYear . '"'; } echo ' <a ' . $title . ' href="' . urlize($albumArr) . '">' . $albumTitle; if ($showPlays) { if ($bArray[$e] == "topplayalbum") { $albumPlayCount = $item->getSubNodeCount('tracks', -1); if ($albumPlayCount > 0) { $albumPlayCount = ceil($item->getPlayCount() / $albumPlayCount); } } else { $albumPlayCount = $item->getPlayCount(); } echo ' (' . $albumPlayCount . ')'; } if ($showDownload) { echo ' (' . $albumDLCount . ')'; } echo "</a><br>"; if ($nobr) { echo "</nobr>"; } } if ($nobr) { echo '</nobr>'; } ?> </td> </tr> </table> <?php if ($format) { echo '</div>'; } ?> </td> <?php if ($vertAlign) { echo '</tr><tr>'; } ?> <?php } }
function pageTop($node) { global $this_page, $include_path, $jinzora_url; // Let's setup our objects $display = new jzDisplay(); // Let's include the settings file include_once $include_path . 'frontend/frontends/simple/settings.php'; echo '<a href="' . $this_page . '">Home</a> - '; $display->loginLink(); echo "<br>"; // Now let's see if we need the breadcrumbs if ($_GET['jz_path'] != "") { if (isset($_POST['jz_path'])) { $bcArray = explode("/", $_POST['jz_path']); } else { $bcArray = explode("/", $_GET['jz_path']); } $path = ""; $br = false; foreach ($bcArray as $item) { if ($item != "") { $path .= "/" . $item; $arr['jz_path'] = $path; $data = new jzMediaNode($path); echo ' - ('; $display->playLink($data, "P", word("Play"), false, false, false); echo "-"; $display->playLink($data, "R", word("Play Random"), false, false, true); echo ') <a href="' . urlize($arr) . '">' . $item . '</a>'; } unset($arr); $br = true; } } if ($br) { echo "<br>"; } }
/** * Draws the Featured Artist/Album Block * * @author Ross Carlson * @version 01/19/05 * @since 01/19/05 * @param object $node The node that we are looking at so we can filter */ function showFeatured($featured, $truncate = 150, $slimDisplay = false) { global $album_name_truncate, $img_tiny_play, $artist_truncate, $album_name_truncate, $cms_mode; // Let's set the featured width $featWidth = 250; // Should we just return? if (!is_array($featured)) { return; } // Let's make sure there are featured items // Now let's grab the featured artists shuffle($featured); $item = $featured[0]; if ($item == "") { return; } // Let's setup our objects $display = new jzDisplay(); $smarty = smartySetup(); $title = word("Editors Pick") . ": "; $title2 = "<strong>" . $display->playLink($item, $img_tiny_play, $item->getName(), false, true) . $display->link($item, $display->returnShortName($item->getName(), $artist_truncate), word("Browse") . ": " . $item->getName(), false, true) . "</strong>"; $smarty->assign('art', ""); if (($art = $item->getMainArt("75x75")) != false) { $smarty->assign('art', $display->link($item, $display->returnImage($art, $item->getName(), 75, 75, "limit", false, false, "left", "3", "3"), false, false, true)); } $smarty->assign('title', $title); $smarty->assign('title2', $title2); // Should we display the artist? if ($item->getPType() == "album") { $parent = $item->getParent(); $smarty->assign('artist_play_button', $display->playLink($parent, $img_tiny_play, $parent->getName(), false, true)); $smarty->assign('artist', $display->link($parent, $parent->getName(), $parent->getName(), false, true)); } $desc_truncate = $truncate; $desc = $item->getDescription(); $smarty->assign('description', $display->returnShortName($desc, $desc_truncate)); $smarty->assign('read_more', ""); if (strlen($desc) > $desc_truncate) { $url_array = array(); $url_array['jz_path'] = $item->getPath("String"); $url_array['action'] = "popup"; $url_array['ptype'] = "readmore"; $smarty->assign('read_more', '<a href="' . urlize($url_array) . '" onclick="openPopup(this, 450, 450); return false;"> - ' . word("read more") . '</a>'); } $smarty->display(SMARTY_ROOT . 'templates/slick/block-editors-pick.tpl'); }
// Now let's loop through the results for ($i = 0; $i < count($recent); $i++) { // Now let's create our node and get the properties $item = $recent[$i]; $album = $item->getName(); $parent = $item->getParent(); $artist = $parent->getName(); // Now let's create our links $albumArr['jz_path'] = $item->getPath("String"); $artistArr['jz_path'] = $parent->getPath("String"); // Now let's create our short names $artistTitle = returnItemShortName($artist, $album_name_truncate); $albumTitle = returnItemShortName($album, $album_name_truncate); // Now let's display it echo "<nobr>"; $display->playLink($item, $img_tiny_play, $album); // Now let's set the hover code $innerOver = ""; if (($art = $item->getMainArt()) != false) { $innerOver .= $display->returnImage($art, $item->getName(), 75, 75, "limit", false, false, "left", "3", "3"); } $desc_truncate = 200; $desc = $item->getDescription(); $innerOver .= $display->returnShortName($desc, $desc_truncate); if (strlen($desc) > $desc_truncate) { $innerOver .= "..."; } $innerOver = str_replace('"', "", $innerOver); $innerOver = str_replace("'", "", $innerOver); // Now let's return our tooltip $capTitle = $artist . " - " . $album;