Esempio n. 1
0
function doTemplate($node)
{
    global $jzUSER;
    $display =& new jzDisplay();
    $smarty = mobileSmarty();
    $smarty->assign('Play', word('Play'));
    $smarty->assign('Shuffle', word('Shuffle'));
    if (!isset($_REQUEST['playlist']) && !isset($_SESSION['jz_playlist_queue'])) {
        jzTemplate($smart, 'playlist');
        return;
    }
    $elements = array();
    if (isset($_REQUEST['playlist'])) {
        $pl = $jzUSER->loadPlaylist($_REQUEST['playlist']);
    } else {
        $pl = $jzUSER->loadPlaylist($_SESSION['jz_playlist_queue']);
    }
    $smarty->assign('plName', $pl->getName());
    $smarty->assign('openPlayTag', $display->getOpenPlayTag($pl));
    $smarty->assign('openShuffleTag', $display->getOpenPlayTag($pl, true));
    $smarty->assign('isStatic', $pl->getPLType() == 'static');
    $list = $pl->getList();
    foreach ($list as $el) {
        $elements[] = array('name' => $el->getName(), 'openPlayTag' => $display->getOpenPlayTag($el));
    }
    $smarty->assign('elements', $elements);
    jzTemplate($smarty, 'playlist');
}
Esempio n. 2
0
function doTemplate($node)
{
    global $jzUSER, $display, $chart_size;
    $display =& new jzDisplay();
    $smarty = mobileSmarty();
    $smarty->assign('Play', word('Play'));
    $smarty->assign('Shuffle', word('Shuffle'));
    /** Playlists **/
    $smarty->assign('Playlists', word('Playlists'));
    $editPage = array('page' => 'playlist');
    $sm_lists = array();
    $l = $jzUSER->loadPlaylist("session");
    if ($l->length() > 0) {
        $sm_lists[] = array('name' => word("Quick List"), 'openPlayTag' => $display->getOpenPlayTag($l), 'editHREF' => urlize($editPage, array('playlist' => 'session')), 'isStatic' => true, 'openShuffleTag' => $display->getOpenPlayTag($l, true));
    }
    $lists = $jzUSER->listPlaylists("static") + $jzUSER->listPlaylists("dynamic");
    // use "all" to mix ordering
    foreach ($lists as $id => $plName) {
        $l = $jzUSER->loadPlaylist($id);
        $static = $l->getPLType() == 'static' ? true : false;
        $sm_lists[] = array('name' => $plName, 'openPlayTag' => $display->getOpenPlayTag($l), 'editHREF' => urlize($editPage, array('playlist' => $id)), 'isStatic' => $static, 'openShuffleTag' => $display->getOpenPlayTag($l, true));
    }
    $smarty->assign('playlists', $sm_lists);
    /** Charts **/
    /**
     * array of titles and lists */
    $root = new jzMediaNode();
    $charts = array();
    /* recently added albums */
    $chart = array();
    $chart['title'] = word('New Albums');
    $entries = array();
    $list = $root->getRecentlyAdded('nodes', distanceTo('album'), $chart_size);
    for ($i = 0; $i < sizeof($list); $i++) {
        $entries[] = array('name' => $list[$i]->getName(), 'link' => urlize(array('jz_path' => $list[$i]->getPath("String"))), 'openPlayTag' => $display->getOpenPlayTag($list[$i]));
    }
    $chart['entries'] = $entries;
    $charts[] = $chart;
    /* recently played albums */
    $chart = array();
    $chart['title'] = word('Recently Played Albums');
    $entries = array();
    $list = $root->getRecentlyPlayed('nodes', distanceTo('album'), $chart_size);
    for ($i = 0; $i < sizeof($list); $i++) {
        $entries[] = array('name' => $list[$i]->getName(), 'link' => urlize(array('jz_path' => $list[$i]->getPath("String"))), 'openPlayTag' => $display->getOpenPlayTag($list[$i]));
    }
    $chart['entries'] = $entries;
    $charts[] = $chart;
    $smarty->assign('charts', $charts);
    jzTemplate($smarty, 'lists');
}
Esempio n. 3
0
function doTemplate($node)
{
    global $jbArr, $jzUSER;
    $display =& new jzDisplay();
    $smarty = mobileSmarty();
    $smarty->assign('Playback', word('Playback'));
    $smarty->assign('SendToDevice', word('Send to Device:'));
    $smarty->assign('AddToPlaylist', word('Add to Playlist:'));
    $path = $node->getPath("String");
    $url = array('jz_path' => $path, 'page' => 'settings');
    $pbt = array();
    $playlists = array();
    $url['jz_player'] = 'stream';
    $url['jz_player_type'] = 'stream';
    $selected = !actionIsQueue() && checkPlayback() == 'stream';
    $pbt[] = array('label' => word('Stream media'), 'url' => urlize($url), 'selected' => $selected);
    $url['jz_player_type'] = 'jukebox';
    if (isset($jbArr) && is_array($jbArr)) {
        for ($i = 0; $i < sizeof($jbArr); $i++) {
            $url['jz_player'] = $i;
            $url['jz_player_type'] = 'jukebox';
            $selected = !actionIsQueue() && checkPlayback() == 'jukebox' && $_SESSION['jb_id'] == $i;
            $pbt[] = array('label' => word('Send to %s', $jbArr[$i]['description']), 'url' => urlize($url), 'selected' => $selected);
        }
    }
    $smarty->assign('devices', $pbt);
    /* playlists */
    $url['jz_player_type'] = 'playlist';
    $url['jz_player'] = 'session';
    $selected = actionIsQueue() && $_SESSION['jz_playlist_queue'] == 'session';
    $playlists[] = array('label' => word('Quick List'), 'url' => urlize($url), 'selected' => $selected);
    $lists = $jzUSER->listPlaylists("static");
    foreach ($lists as $id => $plName) {
        $url['jz_player'] = $id;
        $selected = actionIsQueue() && $_SESSION['jz_playlist_queue'] == $id;
        $playlists[] = array('label' => $plName, 'url' => urlize($url), 'selected' => $selected);
    }
    $smarty->assign('playlists', $playlists);
    $url['jz_player'] = 'new';
    $smarty->assign('newList', array('href' => '#', 'onclick' => "window.location='" . urlize($url) . "'.concat('&playlistname='.concat(document.getElementById('playlistname').value)); return true;", 'name' => word('My Playlist'), 'inputID' => word('playlistname'), 'label' => word('New list:'), 'selected' => false));
    jzTemplate($smarty, 'settings');
}
Esempio n. 4
0
function doTemplate($node)
{
    $display =& new jzDisplay();
    $smarty = mobileSmarty();
    $breadcrumbs = array();
    if (isset($_REQUEST['jz_path'])) {
        $me = $node;
        while ($me->getLevel() > 0) {
            $breadcrumbs[] = array("name" => $me->getName(), "link" => urlize(array('jz_path' => $me->getPath("String"))));
            $me = $me->getParent();
        }
    }
    $breadcrumbs[] = array("name" => word("Home"), "link" => urlize(array()));
    $smarty->assign('breadcrumbs', $breadcrumbs);
    if (actionIsQueue()) {
        $smarty->assign('Play', word('Add'));
    } else {
        $smarty->assign('Play', word('Play'));
    }
    $myNodes = $node->getSubNodes('nodes');
    sortElements($myNodes);
    $myTracks = $node->getSubNodes('tracks');
    $nodes = array();
    for ($i = 0; $i < sizeof($myNodes); $i++) {
        $e = $myNodes[$i];
        $nodes[] = smartyNode($myNodes[$i]);
    }
    $smarty->assign('nodes', $nodes);
    $tracks = array();
    for ($i = 0; $i < sizeof($myTracks); $i++) {
        $e = $myNodes[$i];
        $tracks[] = smartyTrack($myTracks[$i]);
    }
    $smarty->assign('tracks', $tracks);
    jzTemplate($smarty, 'browse');
}
Esempio n. 5
0
function doTemplate($node)
{
    global $jzUSER;
    $display =& new jzDisplay();
    $smarty = mobileSmarty();
    $jb = new jzJukebox();
    if (!$jb->connect()) {
        //jzTemplate($smarty,'jukeboxError');
        echo 'Error connecting to jukebox.';
        return;
    }
    $smarty->assign('Play', word('Play'));
    $smarty->assign('Pause', word('Pause'));
    $smarty->assign('Stop', word('Stop'));
    $smarty->assign('Previous', word('Previous'));
    $smarty->assign('Next', word('Next'));
    $smarty->assign('Shuffle', word('Shuffle'));
    $smarty->assign('Clear', word('Clear'));
    /* buttons */
    if (checkPermission($jzUSER, "jukebox_admin")) {
        $func = $jb->jbAbilities();
        if ($func['playbutton']) {
            $smarty->assign('openPlayTag', $display->getOpenJukeboxActionTag('play'));
        }
        if ($func['pausebutton']) {
            $smarty->assign('openPauseTag', $display->getOpenJukeboxActionTag('pause'));
        }
        if ($func['stopbutton']) {
            $smarty->assign('openStopTag', $display->getOpenJukeboxActionTag('stop'));
        }
        if ($func['prevbutton']) {
            $smarty->assign('openPrevTag', $display->getOpenJukeboxActionTag('previous'));
        }
        if ($func['nextbutton']) {
            $smarty->assign('openNextTag', $display->getOpenJukeboxActionTag('next'));
        }
        if ($func['shufflebutton']) {
            $smarty->assign('openShuffleTag', $display->getOpenJukeboxActionTag('random_play'));
        }
        if ($func['clearbutton']) {
            $smarty->assign('openClearTag', $display->getOpenJukeboxActionTag('clear'));
        }
        if ($func['volume']) {
            $smarty->assign('Volume', word('Volume:'));
            $smarty->assign('volumeSteps', range(0, 100, 5));
            $vol = $_SESSION['jz_jbvol-' . $_SESSION['jb_id']];
            if (!isset($vol) || !is_numeric($vol)) {
                $vol = 0;
            }
            $smarty->assign('currentVolume', $vol);
        }
        if ($func['addtype']) {
            /* how to add media */
            $smarty->assign('whereAdd', word('Add media:'));
            function jbHREF($type)
            {
                return "javascript:sendJukeboxRequest('addwhere','{$type}');";
            }
            $set = array();
            $set[] = array('href' => jbHREF('current'), 'label' => 'After current track', 'selected' => $_SESSION['jb-addtype'] == "current");
            $set[] = array('href' => jbHREF('begin'), 'label' => 'At beginning of playlist', 'selected' => $_SESSION['jb-addtype'] == "begin");
            $set[] = array('href' => jbHREF('end'), 'label' => 'At end of playlist', 'selected' => $_SESSION['jb-addtype'] == "end");
            $set[] = array('href' => jbHREF('replace'), 'label' => 'Replace current playlist', 'selected' => $_SESSION['jb-addtype'] == "replace");
            $smarty->assign('addTypes', $set);
        }
    }
    jzTemplate($smarty, 'jukebox');
}