Esempio n. 1
0
 /**
  * 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) . "&nbsp;";
     } else {
         $playButtons .= $img_play_dis . $img_random_play_dis . "&nbsp;";
     }
     // 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();
 }