Ejemplo n.º 1
0
        ?>
                                </a>
								<?php 
    }
    ?>
                                </div>
						</form>
					<?php 
}
?>
				</td>
				<td width="90%" valign="top">					
					<?php 
if ($jz_jbstatus == 'playing') {
    $curTrackLength = $jb->getCurrentTrackLength();
    $curTrackLoc = $jb->getCurrentTrackLocation();
    ?>
							<script> 
								<!--// 
								var seconds = '<?php 
    echo $curTrackLoc;
    ?>
';
								var time = '';
								t = document.getElementById("timer");	
								
								function converTime(sec){
									ctr=0;
									while (sec >= 60){
										sec = sec - 60;
										ctr++;
Ejemplo n.º 2
0
    /**
     * Draws the play controller for the Jukezora interface
     * 
     * @author Ross Carlson
     * @version 01/21/05
     * @since 01/21/05
     */
    function jukeboxBlock()
    {
        global $this_page, $media_dirs, $jbArr, $root_dir, $include_path;
        $display = new jzDisplay();
        include_once $include_path . "jukebox/class.php";
        if (!isset($_SESSION['jb_playwhere'])) {
            $_SESSION['jb_playwhere'] = "stream";
        }
        $jb_playwhere = $_SESSION['jb_playwhere'];
        ?>
			<table width="100%" cellpadding="2" cellspacing="0" border="0" class="jz_block_td" height="100%">
				<tr>
					<td width="50%" valign="top" height="100%">
						<nobr>
						<?php 
        // Now let's create our Jukebox class and connect to it to make sure it works
        $jb = new jzJukebox();
        if (!$jb->connect()) {
            echo "We had a problem connecting to the player, sorry this is a fatal error!<br><br>";
            echo "Player Settings:<br>";
            for ($i = 0; $i < count($jbArr); $i++) {
                if ($jbArr[$i]['description'] == $_SESSION['jb_playwhere']) {
                    foreach ($jbArr[$i] as $setting => $value) {
                        echo $setting . " - " . $value . "<br>";
                    }
                }
            }
            echo "<br>Please check these with your player's settings";
            echo "<br>";
            ?>
								Playback to:<br>
								<?php 
            $arr = array();
            $arr['action'] = "jukebox";
            $arr['subaction'] = "jukebox-command";
            $arr['command'] = "playwhere";
            ?>
								<form action="<?php 
            echo urlize($arr);
            ?>
" method="post">
									<select name="jbplaywhere" class="jz_select" style="width:142;" onChange="submit()">
										<option <?php 
            if ($jb_playwhere == "stream") {
                echo " selected ";
            }
            ?>
value="stream">Stream</option>
										<?php 
            // Now let's get a list of all the jukeboxes that are installed
            for ($i = 0; $i < count($jbArr); $i++) {
                echo '<option ';
                if ($jb_playwhere == $jbArr[$i]['description']) {
                    echo " selected ";
                }
                echo 'value="' . $jbArr[$i]['description'] . '">' . $jbArr[$i]['description'] . '</option>';
            }
            ?>
									</select>
								</form>
								<?php 
            return;
        }
        // Let's figure out where they are playing
        if (isset($_SESSION['jb_playwhere'])) {
            $jb_playwhere = $_SESSION['jb_playwhere'];
        } else {
            $jb_playwhere = "";
        }
        $remain = $jb->getCurrentTrackRemaining() + 1;
        $jz_jbstatus = $jb->getPlayerStatus();
        if ($jz_jbstatus != "playing") {
            $remain = 0;
        }
        if ($remain == 1) {
            $remain = 0;
        }
        if ($jb_playwhere != "stream") {
            // Ok, now we need to make sure we can do things
            $func = $jb->jbAbilities();
            if ($func['playbutton']) {
                $display->displayJukeboxButton("play");
            }
            if ($func['pausebutton']) {
                $display->displayJukeboxButton("pause");
            }
            if ($func['stopbutton']) {
                $display->displayJukeboxButton("stop");
            }
            if ($func['shufflebutton']) {
                $display->displayJukeboxButton("random_play");
            }
            echo "<br>";
            if ($func['nextbutton']) {
                $display->displayJukeboxButton("previous");
            }
            if ($func['prevbutton']) {
                $display->displayJukeboxButton("next");
            }
            if ($func['clearbutton']) {
                $display->displayJukeboxButton("clear");
            }
            ?>
							<br>
							<?php 
            if ($func['status']) {
                ?>
								Status: 
								<?php 
                echo ucwords($jz_jbstatus);
                ?>
								<br>
							<?php 
            }
            ?>
							<?php 
            if ($func['stats']) {
                $jb->returnJBStats();
                echo '<br>';
            }
            ?>
						
							
							<?php 
            if ($func['progress']) {
                ?>
								Progress:
								<span id="timer"></span>
								<script> 
								<!--// 
								var loadedcolor='green' ;            // PROGRESS BAR COLOR
								var unloadedcolor='lightgrey';      // BGCOLOR OF UNLOADED AREA
								var barheight=10;                   // HEIGHT OF PROGRESS BAR IN PIXELS
								var barwidth=120;                   // WIDTH OF THE BAR IN PIXELS
								var bordercolor='black';            // COLOR OF THE BORDER
								var waitTime=<?php 
                echo $remain;
                ?>
;                   // NUMBER OF SECONDS FOR PROGRESSBAR
								--> 
								</script>
								<script language="javascript" src="<?php 
                echo $root_dir;
                ?>
/jukebox/pbar.js"></script>
								<?php 
                if ($jz_jbstatus == 'playing') {
                    ?>
								<script> 
								<!--// 
								var seconds = <?php 
                    echo $jb->getCurrentTrackLocation();
                    ?>
;
								var time = '';
								t = document.getElementById("timer");					
								function converTime(sec){
									ctr=0;
									while (sec >= 60){
										sec = sec - 60;
										ctr++;
									}
									if (ctr<0){ctr=0}
									if (sec<0){sec=0}
									if (sec < 10){
										sec = "0" + sec;
									}
								
									return ctr + ":" + sec;
								}
								
								function display(){ 
									seconds++
									
									t.innerHTML = converTime(seconds) + "/" + "<?php 
                    echo convertSecMins($jb->getCurrentTrackLength());
                    ?>
";
									ctr=0;
									setTimeout("display()",1000) 
								} 
								display() 
								--> 
								</script> 
								<?php 
                }
                ?>
							<?php 
            }
            ?>
							<?php 
            if ($func['volume']) {
                ?>
								<?php 
                $arr = array();
                $arr['action'] = "jukebox";
                $arr['subaction'] = "jukebox-command";
                $arr['command'] = "volume";
                $arr['frame'] = $_GET['frame'];
                ?>
								<form action="<?php 
                echo urlize($arr);
                ?>
" method="post">
									<input type="hidden" name="action" value="jukebox">
									<input type="hidden" name="subaction" value="jukebox-command">
									<input type="hidden" name="command" value="volume">
									<input type="hidden" name="frame" value="top">
									<select name="jbvol" class="jz_select" style="width:120px;" onChange="submit()">
										<?php 
                $vol = "";
                if (isset($_SESSION['jz_jbvol-' . $_SESSION['jb_id']])) {
                    $vol = $_SESSION['jz_jbvol-' . $_SESSION['jb_id']];
                }
                $c = 100;
                while ($c > 0) {
                    echo '<option ';
                    if ($c == $vol) {
                        echo ' selected ';
                    }
                    echo 'value="' . $c . '">Volume ' . $c . '%</option>';
                    $c = $c - 10;
                }
                ?>
										<option value="0">Mute</option>
									</select>
								</form>
								<br>
							<?php 
            }
            ?>
						<?php 
            // This closes our if to see if we are streaming or not
        }
        ?>
						Playback to:<br>
						<?php 
        $arr = array();
        $arr['action'] = "jukebox";
        $arr['subaction'] = "jukebox-command";
        $arr['command'] = "playwhere";
        $arr['frame'] = $_GET['frame'];
        ?>
						<form action="<?php 
        echo urlize($arr);
        ?>
" method="post">
							<input type="hidden" name="action" value="jukebox">
							<input type="hidden" name="subaction" value="jukebox-command">
							<input type="hidden" name="command" value="playwhere">
							<input type="hidden" name="frame" value="top">
							<select name="jbplaywhere" class="jz_select" style="width:120px;" onChange="submit()">
								<option <?php 
        if ($jb_playwhere == "stream") {
            echo " selected ";
        }
        ?>
value="stream">Stream</option>
								<?php 
        // Now let's get a list of all the jukeboxes that are installed
        for ($i = 0; $i < count($jbArr); $i++) {
            echo '<option ';
            if ($jb_playwhere == $jbArr[$i]['description']) {
                echo " selected ";
            }
            echo 'value="' . $jbArr[$i]['description'] . '">' . $jbArr[$i]['description'] . '</option>';
        }
        ?>
							</select>
						</form>
						<?php 
        if ($jb_playwhere != "stream" and $func['addtype']) {
            ?>
						<br>
						Add type:<br>
						<?php 
            // Now let's set the add type IF it hasn't been set
            if (!isset($_SESSION['jb-addtype'])) {
                $_SESSION['jb-addtype'] = "current";
            }
            ?>
						<?php 
            $arr = array();
            $arr['action'] = "jukebox";
            $arr['subaction'] = "jukebox-command";
            $arr['command'] = "addwhere";
            $arr['frame'] = $_GET['frame'];
            ?>
						<form action="<?php 
            echo urlize($arr);
            ?>
" method="post">
						<input type="hidden" name="action" value="jukebox">
						<input type="hidden" name="subaction" value="jukebox-command">
						<input type="hidden" name="command" value="addwhere">
						<select name="addplat" class="jz_select" style="width:142;" onChange="submit()">
							<option <?php 
            if ($_SESSION['jb-addtype'] == "current") {
                echo " selected ";
            }
            ?>
 value="current">At Current</option>
							<option <?php 
            if ($_SESSION['jb-addtype'] == "end") {
                echo " selected ";
            }
            ?>
value="end">At End</option>
							<option <?php 
            if ($_SESSION['jb-addtype'] == "begin") {
                echo " selected ";
            }
            ?>
value="begin">At Beginning</option>
                                                        <option <?php 
            if ($_SESSION['jb-addtype'] == "replace") {
                echo " selected ";
            }
            ?>
value="replace">Replace</option>
						</select>
					        </form>
						</nobr>
						<?php 
        }
        ?>
					</td>
					<td width="50%" valign="top">
						<?php 
        // Let's make sure they aren't streaming
        if ($jb_playwhere == "stream") {
            return;
        }
        ?>
						<?php 
        if ($func['nowplaying']) {
            ?>
							<nobr><?php 
            echo word("Now Playing:");
            ?>
<br> 
							<?php 
            $curTrack = $jb->getCurrentTrackName();
            if (strlen($curTrack) > 20) {
                $curTrack = substr($curTrack, 0, 20) . "...";
            }
            echo '&nbsp;' . $curTrack . "</nobr>";
            ?>
							<br>
						<?php 
        }
        ?>
						<?php 
        if ($func['nexttrack']) {
            ?>
							<nobr><?php 
            echo word("Next Track:");
            ?>
 <br>
							<?php 
            // Now let's figure out the next track and clean it up
            $fullList = $jb->getCurrentPlaylist();
            if (getCurPlayingTrack() + 1 < sizeof($fullList)) {
                $nextTrack = $fullList[getCurPlayingTrack() + 1];
            } else {
                $nextTrack = '-';
            }
            if (stristr($nextTrack, "/")) {
                $nArr = explode("/", $nextTrack);
                $nextTrack = $nArr[count($nArr) - 1];
            }
            $nextTrack = str_replace(".mp3", "", $nextTrack);
            if (strlen($nextTrack) > 20) {
                $nextTrack = substr($nextTrack, 0, 20) . "...";
            }
            echo '&nbsp;' . $nextTrack . "</nobr>";
            ?>
							<br><br>
						<?php 
        }
        ?>
						
						<?php 
        if ($func['fullplaylist']) {
            ?>
							Complete Playlist
							<br>
							<?php 
            // Now let's get the full playlist back
            $curTrackNum = $jb->getCurrentPlayingTrack();
            ?>
							<?php 
            $arr = array();
            $arr['action'] = "jukebox";
            $arr['subaction'] = "jukebox-command";
            $arr['command'] = "jumpto";
            ?>
							<form action="<?php 
            echo urlize($arr);
            ?>
" method="post">
								<input type="hidden" name="action" value="jukebox">
								<input type="hidden" name="subaction" value="jukebox-command">
								<input type="hidden" name="command" value="jumpto">
								<input type="hidden" name="frame" value="top">
								<select name="jbjumpto" class="jz_select" size="5" style="width:165px;"<?php 
            if ($func['jump']) {
                echo 'onChange="submit()"';
            }
            ?>
>
									<?php 
            for ($i = 0; $i < count($fullList); $i++) {
                echo '<option value="' . $i . '"';
                if ($curTrackNum == $i) {
                    echo " selected ";
                }
                echo '>' . $fullList[$i] . '</option>';
            }
            ?>
								</select>
							</form>
						<?php 
        }
        ?>
					</td>
				</tr>
			</table>
			<?php 
    }