protected function playlistNotFound($p_type) { $this->view->error = "{$p_type} not found"; Logging::info("{$p_type} not found"); Application_Model_Library::changePlaylist(null, $p_type); $this->createFullResponse(null); }
public function closePlaylistAction() { $type = $this->_getParam('type'); $obj = null; Application_Model_Library::changePlaylist($obj, $type); $this->createFullResponse($obj); }
public function saveAction() { $request = $this->getRequest(); $id = $request->getParam("id"); $parameters = array(); foreach (array('id', 'length', 'name', 'description', 'url') as $p) { $parameters[$p] = trim($request->getParam($p)); } if (!$this->isAuthorized($id)) { header("Status: 401 Not Authorized"); return; } list($analysis, $mime, $mediaUrl, $di) = Application_Model_Webstream::analyzeFormData($parameters); try { if (Application_Model_Webstream::isValid($analysis)) { $streamId = Application_Model_Webstream::save($parameters, $mime, $mediaUrl, $di); Application_Model_Library::changePlaylist($streamId, "stream"); $this->view->statusMessage = "<div class='success'>" . _("Webstream saved.") . "</div>"; $this->view->streamId = $streamId; $this->view->length = $di->format("%Hh %Im"); } else { throw new Exception("isValid returned false"); } } catch (Exception $e) { Logging::debug($e->getMessage()); $this->view->statusMessage = "<div class='errors'>" . _("Invalid form values.") . "</div>"; $this->view->streamId = -1; $this->view->analysis = $analysis; } }
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); } }