Пример #1
0
 public function indexAction()
 {
     global $CC_CONFIG;
     $request = $this->getRequest();
     $baseUrl = $request->getBaseUrl();
     $this->view->headScript()->appendFile($baseUrl . '/js/blockui/jquery.blockUI.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/contextmenu/jquery.contextMenu.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/datatables/js/jquery.dataTables.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/datatables/plugin/dataTables.pluginAPI.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/datatables/plugin/dataTables.ColVis.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/datatables/plugin/dataTables.ColReorder.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/datatables/plugin/dataTables.FixedColumns.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/datatables/plugin/dataTables.columnFilter.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/airtime/buttons/buttons.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/airtime/utilities/utilities.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/airtime/library/library.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/airtime/library/events/library_playlistbuilder.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headLink()->appendStylesheet($baseUrl . '/css/media_library.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . '/css/jquery.contextMenu.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . '/css/datatables/css/ColVis.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . '/css/datatables/css/ColReorder.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headScript()->appendFile($baseUrl . '/js/airtime/library/spl.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . '/js/airtime/playlist/smart_blockbuilder.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headLink()->appendStylesheet($baseUrl . '/css/playlist_builder.css?' . $CC_CONFIG['airtime_version']);
     try {
         $obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
         if (isset($obj_sess->id)) {
             $objInfo = Application_Model_Library::getObjInfo($obj_sess->type);
             Logging::info($obj_sess->id);
             Logging::info($obj_sess->type);
             $objInfo = Application_Model_Library::getObjInfo($obj_sess->type);
             $obj = new $objInfo['className']($obj_sess->id);
             $userInfo = Zend_Auth::getInstance()->getStorage()->read();
             $user = new Application_Model_User($userInfo->id);
             $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
             if ($isAdminOrPM || $obj->getCreatorId() == $userInfo->id) {
                 $this->view->obj = $obj;
                 if ($obj_sess->type == "block") {
                     $form = new Application_Form_SmartBlockCriteria();
                     $form->startForm($obj_sess->id);
                     $this->view->form = $form;
                 }
             }
             $formatter = new LengthFormatter($obj->getLength());
             $this->view->length = $formatter->format();
             $this->view->type = $obj_sess->type;
         }
     } catch (PlaylistNotFoundException $e) {
         $this->playlistNotFound($obj_sess->type);
     } catch (Exception $e) {
         $this->playlistNotFound($obj_sess->type);
         Logging::info($e->getMessage());
         //$this->playlistUnknownError($e);
     }
 }
 public function deleteAction()
 {
     $ids = $this->_getParam('ids');
     $ids = !is_array($ids) ? array($ids) : $ids;
     $type = $this->_getParam('type');
     $obj = null;
     $objInfo = Application_Model_Library::getObjInfo($type);
     $userInfo = Zend_Auth::getInstance()->getStorage()->read();
     $obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
     try {
         Logging::info("Currently active {$type} {$obj_sess->id}");
         if (in_array($obj_sess->id, $ids)) {
             Logging::info("Deleting currently active {$type}");
             Application_Model_Library::changePlaylist(null, $type);
         } else {
             Logging::info("Not deleting currently active {$type}");
             $obj = new $objInfo['className']($obj_sess->id);
         }
         if (strcmp($objInfo['className'], 'Application_Model_Playlist') == 0) {
             Application_Model_Playlist::deletePlaylists($ids, $userInfo->id);
         } else {
             Application_Model_Block::deleteBlocks($ids, $userInfo->id);
         }
         $this->createFullResponse($obj);
     } catch (PlaylistNoPermissionException $e) {
         $this->playlistNoPermission($type);
     } catch (BlockNoPermissionException $e) {
         $this->playlistNoPermission($type);
     } catch (PlaylistNotFoundException $e) {
         $this->playlistNotFound($type);
     } catch (Exception $e) {
         $this->playlistUnknownError($e);
     }
 }
 public function indexAction()
 {
     $CC_CONFIG = Config::getConfig();
     $request = $this->getRequest();
     $baseUrl = Application_Common_OsPath::getBaseDir();
     $this->view->headScript()->appendFile($baseUrl . 'js/blockui/jquery.blockUI.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/contextmenu/jquery.contextMenu.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/js/jquery.dataTables.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/plugin/dataTables.pluginAPI.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/plugin/dataTables.ColVis.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/plugin/dataTables.ColReorder.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/plugin/dataTables.FixedColumns.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/datatables/plugin/dataTables.columnFilter.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/buttons/buttons.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/utilities/utilities.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/library/library.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/library/events/library_playlistbuilder.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/media_library.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/jquery.contextMenu.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/datatables/css/ColVis.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/datatables/css/ColReorder.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/waveform.css?' . $CC_CONFIG['airtime_version']);
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/library/spl.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/airtime/playlist/smart_blockbuilder.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/waveformplaylist/observer/observer.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/waveformplaylist/config.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/waveformplaylist/curves.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/waveformplaylist/fades.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/waveformplaylist/local_storage.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/waveformplaylist/controls.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/waveformplaylist/playout.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/waveformplaylist/track_render.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/waveformplaylist/track.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/waveformplaylist/time_scale.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     $this->view->headScript()->appendFile($baseUrl . 'js/waveformplaylist/playlist.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
     //arbitrary attributes need to be allowed to set an id for the templates.
     $this->view->headScript()->setAllowArbitraryAttributes(true);
     //$this->view->headScript()->appendScript(file_get_contents(APPLICATION_PATH.'/../public/js/waveformplaylist/templates/bottombar.tpl'),
     //		'text/template', array('id' => 'tpl_playlist_cues', 'noescape' => true));
     $this->view->headLink()->appendStylesheet($baseUrl . 'css/playlist_builder.css?' . $CC_CONFIG['airtime_version']);
     try {
         $obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
         if (isset($obj_sess->id)) {
             $objInfo = Application_Model_Library::getObjInfo($obj_sess->type);
             Logging::info($obj_sess->id);
             Logging::info($obj_sess->type);
             $objInfo = Application_Model_Library::getObjInfo($obj_sess->type);
             $obj = new $objInfo['className']($obj_sess->id);
             $userInfo = Zend_Auth::getInstance()->getStorage()->read();
             $user = new Application_Model_User($userInfo->id);
             $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
             if ($isAdminOrPM || $obj->getCreatorId() == $userInfo->id) {
                 $this->view->obj = $obj;
                 if ($obj_sess->type == "block") {
                     $form = new Application_Form_SmartBlockCriteria();
                     $form->startForm($obj_sess->id);
                     $this->view->form = $form;
                 }
             }
             $formatter = new LengthFormatter($obj->getLength());
             $this->view->length = $formatter->format();
             $this->view->type = $obj_sess->type;
         }
         //get user settings and determine if we need to hide
         // or show the playlist editor
         $showPlaylist = false;
         $data = Application_Model_Preference::getLibraryScreenSettings();
         if (!is_null($data)) {
             if ($data["playlist"] == "true") {
                 $showPlaylist = true;
             }
         }
         $this->view->showPlaylist = $showPlaylist;
     } catch (PlaylistNotFoundException $e) {
         $this->playlistNotFound($obj_sess->type);
     } catch (Exception $e) {
         $this->playlistNotFound($obj_sess->type);
         Logging::info($e->getMessage());
         //$this->playlistUnknownError($e);
     }
 }