コード例 #1
0
ファイル: blocks.php プロジェクト: jinzora/jinzora3
    /**
     * Displays the block for the album on the Album page
     *
     * @author Ben Dodson, Ross Carlson
     * @since 9/6/05
     * @version 9/6/05
     *
     **/
    function albumAlbumBlock($node = false)
    {
        global $album_name_truncate, $img_play, $cms_mode, $img_random_play, $img_play_dis, $img_random_play_dis, $jzUSER, $short_date, $enable_ratings, $show_album_clip_play, $img_clip;
        $display = new jzDisplay();
        // Does the cache file exist?
        if ($display->startCache("albumAlbumBlock", $node)) {
            return;
        }
        if (!defined('NO_AJAX_LINKS') && $node === false) {
            $node = new jzMediaNode($_SESSION['jz_path']);
        }
        $artSize = 100;
        $desc_truncate = 700;
        $desc = $node->getDescription();
        // Now let's purge the extra returns that might be at the beginning
        while (substr($desc, 0, 4) == "<br>" or substr($desc, 0, 6) == "<br />") {
            if (substr($desc, 0, 4) == "<br>") {
                $desc = substr($desc, 5);
            }
            if (substr($desc, 0, 6) == "<br />") {
                $desc = substr($desc, 7);
            }
        }
        if ($desc == "") {
            $artSize = 200;
        }
        $art = $node->getMainArt($artSize . "x" . $artSize);
        if ($art == false and $desc == "") {
            return;
        }
        // now let's set the title for this block
        $title = returnItemShortName($node->getName(), $album_name_truncate);
        // Now let's get the year
        $year = $node->getYear();
        $dispYear = "";
        if (!isnothing($year)) {
            $dispYear = " (" . $year . ")";
        }
        // Now let's setup our buttons for later
        $playButtons = "";
        $playButtons .= $display->playLink($node, $img_play, false, false, true) . $display->playLink($node, $img_random_play, false, false, true, true);
        // Now let's make sure they can stream
        if (!$jzUSER->getSetting('stream')) {
            $playButtons = $img_play_dis . $img_random_play_dis;
        }
        if ($show_album_clip_play == "true") {
            $playButtons .= $display->playLink($node, $img_clip, false, false, true, false, false, true);
        }
        if ($jzUSER->getSetting('download')) {
            $playButtons .= $display->downloadButton($node, false, true, true);
        } else {
            $playButtons .= $display->downloadButton($node, true, true, true);
        }
        $playButtons .= $display->podcastLink($node);
        if ($enable_ratings == "true") {
            $playButtons .= $display->rateButton($node, true);
        }
        $playButtons .= " &nbsp; ";
        // Let's open the block
        $this->blockHeader(word("Album") . ": " . $title . $dispYear . "&nbsp;", $playButtons);
        $this->blockBodyOpen();
        ?>
		<table width="100%" cellpadding="2" cellspacing="0" border="0">
			<tr>
				<td width="100%" <?php 
        if ($desc == "") {
            echo 'align="center"';
            $align = "";
        } else {
            $align = "left";
        }
        ?>
>
					<?php 
        // If there is no description let's make the art bigger
        $rating = $display->rating($node, true);
        if ($rating != "" and $desc == "") {
            echo $rating . "<br>";
        }
        if ($jzUSER->getSetting('stream')) {
            $display->playLink($node, $display->returnImage($art, $node->getName(), $artSize, $artSize, "fit", false, false, $align, "5", "5"));
        } else {
            $display->Image($art, $node->getName(), $artSize, $artSize, "fit", false, false, $align, "5", "5");
        }
        if ($cms_mode == "false") {
            echo '<span class="jz_artistDesc">';
        }
        if ($rating != "" and $desc != "") {
            echo $rating . "<br>";
        }
        $desc = str_replace("\n", '<p>', $desc);
        echo $display->returnShortName($desc, $desc_truncate);
        if (strlen($desc) > $desc_truncate) {
            $url_array = array();
            $url_array['jz_path'] = $node->getPath("String");
            $url_array['action'] = "popup";
            $url_array['ptype'] = "readmore";
            echo ' <a href="' . urlize($url_array) . '" onclick="openPopup(this, 450, 450); return false;">read more</a>';
        }
        if (!isNothing($node->getDateAdded()) && $node->getDateAdded() != "0") {
            echo "<br>" . word("Added") . ": " . date($short_date, $node->getDateAdded());
        }
        if ($cms_mode == "false") {
            echo '</span>';
        }
        ?>
				</td>
			</tr>
		</table>
		<?php 
        // let's close the block
        $this->blockBodyClose();
        $this->blockSpacer();
        // Now lets finish out the cache
        $display->endCache();
    }