CC-84: Smart Playlists

- audio preview on playlist
- cleaning up some code
This commit is contained in:
James 2012-08-02 16:36:12 -04:00
parent 3b5a3e6713
commit 0d2d8218bf
14 changed files with 202 additions and 72 deletions

View file

@ -81,6 +81,53 @@ class AudiopreviewController extends Zend_Controller_Action
$this->_helper->viewRenderer->setRender('audio-preview');
}
public function blockPreviewAction()
{
global $CC_CONFIG;
$blockIndex = $this->_getParam('blockIndex');
$blockId = $this->_getParam('blockId');
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']);
$this->_helper->layout->setLayout('audioPlayer');
$logo = Application_Model_Preference::GetStationLogo();
if ($logo) {
$this->view->logo = "data:image/png;base64,$logo";
} else {
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
}
$this->view->blockIndex= $blockIndex;
$this->view->blockId = $blockId;
$this->_helper->viewRenderer->setRender('audio-preview');
}
public function getBlockAction()
{
// disable the view and the layout
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$blockId = $this->_getParam('blockId');
if (!isset($blockId)) {
return;
}
$bl = new Application_Model_Block($blockId);
$result = array();
foreach ($bl->getContents(true) as $ele) {
$result[] = $this->createElementMap($ele);
}
$this->_helper->json($result);
}
/**
*Function will load and return the contents of the requested playlist.
*/

View file

@ -76,6 +76,9 @@ class LibraryController extends Zend_Controller_Action
$obj = new Application_Model_Playlist($id);
} else {
$obj = new Application_Model_Block($id);
if (!$obj->isStatic()){
unset($menu["play"]);
}
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
if ($this->obj_sess->type === "playlist") {
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
@ -312,21 +315,22 @@ class LibraryController extends Zend_Controller_Action
$this->view->md = $md;
$this->view->contents = $file->getContents();
} else if ($type == "block") {
$file = new Application_Model_Block($id);
$block = new Application_Model_Block($id);
$this->view->type = $type;
$md = $file->getAllPLMetaData();
$md = $block->getAllPLMetaData();
$formatter = new LengthFormatter($md["dcterms:extent"]);
$md["dcterms:extent"] = $formatter->format();
$this->view->md = $md;
if ($file->isStatic()) {
if ($block->isStatic()) {
$this->view->blType = 'Static';
$this->view->contents = $file->getContents();
$this->view->contents = $block->getContents();
} else {
$this->view->blType = 'Dynamic';
$this->view->contents = $file->getCriteria();
$this->view->contents = $block->getCriteria();
}
$this->view->block = $block;
} else if ($type == "stream") {
$file = new Application_Model_Webstream($id);

View file

@ -71,7 +71,6 @@ class PlaylistController extends Zend_Controller_Action
$this->view->length = $formatter->format();
$this->view->obj = $obj;
Logging::log($obj->getContents());
$this->view->html = $this->view->render('playlist/update.phtml');
$this->view->name = $obj->getName();
$this->view->description = $obj->getDescription();