/** * Displays the random playlist generator * * @author Ross Carlson, Ben Dodson * @version 2/20/05 * @since 2/20/05 */ function randomGenerateSelector($node, $header = false, $return = false) { global $this_page, $random_play_amounts, $quick_list_truncate, $default_random_type, $default_random_count, $jzUSER; $root = new jzMediaNode(); $display = new jzDisplay(); // Now, can they stream? if (!$jzUSER->getSetting('stream')) { return; } if ($return) { ob_start(); } if ($header) { echo $header; } else { echo '<font size="1">' . word("Randomize selected") . '</font><br>'; } ?> <form name="randomizer" action="<?php echo $this_page; ?> " method="post"> <input type="hidden" name="<?php echo jz_encode("action"); ?> " value="<?php echo jz_encode("generateRandom"); ?> "> <select name="<?php echo jz_encode("random_play_number"); ?> " class="jz_select"> <?php $random_play = explode("|", $random_play_amounts); $ctr = 0; while (count($random_play) > $ctr) { echo '<option value="' . jz_encode($random_play[$ctr]) . '"'; if ($random_play[$ctr] == $default_random_count) { echo " selected"; } echo '>' . $random_play[$ctr] . '</option>' . "\n"; $ctr = $ctr + 1; } echo '</select> '; echo '<select name="' . jz_encode("random_play_type") . '" class="jz_select" style="width:60px;">'; $random_play_types = "Songs|Albums|Artists"; $random_play = explode("|", $random_play_types); $ctr = 0; while (count($random_play) > $ctr) { // Let's make sure this isn't blank if ($random_play[$ctr] != "") { echo '<option value="' . jz_encode($random_play[$ctr]) . '"'; if ($random_play[$ctr] == $default_random_type) { echo " selected"; } echo '>' . $random_play[$ctr] . '</option>' . "\n"; } $ctr++; } echo '</select>'; // Now let's let them pick a genre if (distanceTo("genre") !== false) { $curgenre = getInformation($node, 'genre'); echo ' <select name="' . jz_encode("random_play_genre") . '" class="jz_select" style="width:75px;">'; if ($curgenre === false) { echo '<option value="' . jz_encode("") . '" selected>All Genres</option>' . "\n"; } else { echo '<option value="' . jz_encode("") . '">All Genres</option>' . "\n"; } if (!isset($genreArray)) { // todo: use the genre array from the other dropdown // so we don't query twice. $genreArray = $root->getSubNodes("nodes", distanceTo("genre")); } for ($ctr = 0; $ctr < count($genreArray); $ctr++) { if ($genreArray[$ctr] != "") { $title = returnItemShortName($genreArray[$ctr]->getName(), $quick_list_truncate); echo '<option '; // Now let's see if this is the genre we're looking at if (!isset($genre)) { $genre = ""; } if (strtolower($title) == strtolower($genre)) { echo 'selected'; } echo ' value="' . jz_encode(htmlentities($genreArray[$ctr]->getPath("String"))) . '"'; if ($curgenre == $genreArray[$ctr]->getName()) { echo ' selected'; } echo '>' . $title . '</option>' . "\n"; } } echo '</select>'; } echo ' <input class="jz_submit" type="submit" name="submit_random" value="' . word("Go") . '"'; if (!defined('NO_AJAX_JUKEBOX')) { echo ' onClick="return submitPlaybackForm(this,\'' . htmlentities($this_page) . '\')"'; } else { if (checkPlayback() == "embedded") { echo ' onClick="' . $display->embeddedFormHandler('randomizer') . '"'; } } echo '>'; echo '</form>'; echo '</nobr>'; if ($return) { $var = ob_get_contents(); ob_end_clean(); return $var; } }
/** * Displays the block for the album on the Artist page * * @author Ben Dodson, Ross Carlson * @since 9/13/05 * @version 9/13/05 * **/ function artistAlbumsBlock($node = false) { global $jzUSER, $album_name_truncate, $img_play, $img_random_play, $img_play_dis, $img_random_play_dis, $sort_by_year, $web_root, $root_dir, $this_page, $show_album_clip_play, $img_clip; $display = new jzDisplay(); // Are they sorting? if (isset($_GET['sort'])) { $_SESSION['jz_purge_file_cache'] = "true"; $jzUSER->setSetting("sort", $_GET['sort']); } $mysort = $jzUSER->getSetting("sort"); // Does the cache file exist? if ($display->startCache("artistAlbumsBlock", $node, $mysort)) { return; } if (!defined('NO_AJAX_LINKS') && $node === false) { $node = new jzMediaNode($_SESSION['jz_path']); } // Let's create our buttons for later // Now let's create the sort link if ($node->getSubNodeCount() > 1) { $url_array = array(); $url_array['jz_path'] = $node->getPath("String"); $url_array['sort'] = "alpha"; $url_name = urlize($url_array); $url_array['sort'] = "year"; $url_year = urlize($url_array); $form = '<form action="' . $this_page . '" method="GET">' . "\n"; $form .= '<input type="hidden" name="' . jz_encode("jz_path") . '" value="' . jz_encode($node->getPath("String")) . '">'; $form .= $display->hiddenPageVars(true); $form .= '<select style="width:52px; height:15px; font-size:9px;" name="' . jz_encode("sort") . '" class="jz_select" onChange="form.submit();">' . "\n"; $form .= '<option '; if ($mysort == "year") { $form .= " selected "; } $form .= ' value="' . jz_encode("year") . '">Year</option>'; $form .= '<option '; if ($mysort == "alpha") { $form .= " selected "; } $form .= 'value="' . jz_encode("alpha") . '">Name</option>'; $form .= '</select></form>'; $playButtons .= $form . " "; } if ($jzUSER->getSetting('stream')) { $playButtons .= $display->playLink($node, $img_play, false, false, true) . " " . $display->playLink($node, $img_random_play, false, false, true, true) . " "; } else { $playButtons .= $img_play_dis . $img_random_play_dis . " "; } // Let's startup Smarty $smarty = smartySetup(); // Now let's assign our variables to smarty $smarty->assign('title', word("Albums") . ": " . $node->getName() . " (" . $node->getSubNodeCount() . ")"); $smarty->assign('playButtons', $playButtons); $smarty->assign('formaction', urlize()); $smarty->assign('formhandler', $display->embeddedFormHandler()); $smarty->assign('action', jz_encode("action")); $smarty->assign('action_value', jz_encode("mediaAction")); $smarty->assign('jz_path', jz_encode("jz_path")); $smarty->assign('jz_path_value', htmlentities(jz_encode($node->getPath("String")))); $smarty->assign('jz_list_type', jz_encode("jz_list_type")); $smarty->assign('jz_list_type_value', jz_encode("nodes")); // Now let's display the template $smarty->display(SMARTY_ROOT . 'templates/slick/artist-albums-block.tpl'); // Now lets finish out the cache $display->endCache(); }