Merge branch 'CC-3174' into devel
Conflicts: airtime_mvc/application/Bootstrap.php airtime_mvc/application/controllers/LibraryController.php airtime_mvc/application/controllers/PlaylistController.php airtime_mvc/application/controllers/ScheduleController.php airtime_mvc/application/models/Playlist.php airtime_mvc/application/models/StoredFile.php airtime_mvc/public/js/airtime/library/spl.js
This commit is contained in:
commit
42452b8ea9
115 changed files with 26899 additions and 14699 deletions
|
@ -23,28 +23,40 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->search_sess = new Zend_Session_Namespace("search");
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
public function indexAction() {
|
||||
|
||||
$this->_helper->layout->setLayout('library');
|
||||
|
||||
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_playlistbuilder.js'),'text/javascript');
|
||||
|
||||
$this->_helper->actionStack('library', 'library');
|
||||
$this->_helper->actionStack('index', 'playlist');
|
||||
}
|
||||
|
||||
public function libraryAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js?'.filemtime($baseDir.'/js/contextmenu/jjmenu.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.filemtime($baseDir.'/js/contextmenu/jquery.contextMenu.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.filemtime($baseDir.'/js/datatables/js/jquery.dataTables.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.pluginAPI.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.ColVis.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.ColReorder.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorderResize.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.ColReorderResize.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.FixedColumns.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.TableTools.js'),'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.filemtime($baseDir.'/js/airtime/library/library.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/advancedsearch.js?'.filemtime($baseDir.'/js/airtime/library/advancedsearch.js'),'text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.filemtime($baseDir.'/css/media_library.css'));
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css?'.filemtime($baseDir.'/css/contextmenu.css'));
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.filemtime($baseDir.'/css/jquery.contextMenu.css'));
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.filemtime($baseDir.'/css/datatables/css/ColVis.css'));
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.filemtime($baseDir.'/css/datatables/css/ColReorder.css'));
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/TableTools.css?'.filemtime($baseDir.'/css/TableTools.css'));
|
||||
|
||||
$this->_helper->layout->setLayout('library');
|
||||
$this->_helper->viewRenderer->setResponseSegment('library');
|
||||
|
||||
$form = new Application_Form_AdvancedSearch();
|
||||
|
@ -54,8 +66,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->search_sess->next_row[1] = 2;
|
||||
$this->view->form = $form;
|
||||
$this->view->md = $this->search_sess->md;
|
||||
|
||||
$this->_helper->actionStack('index', 'playlist');
|
||||
}
|
||||
|
||||
public function contextMenuAction()
|
||||
|
@ -64,186 +74,137 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
$id = $this->_getParam('id');
|
||||
$type = $this->_getParam('type');
|
||||
//playlist||timeline
|
||||
$screen = $this->_getParam('screen');
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$params = '/format/json/id/#id#/type/#type#';
|
||||
|
||||
$paramsPop = str_replace('#id#', $id, $params);
|
||||
$paramsPop = str_replace('#type#', $type, $paramsPop);
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
$pl_sess = $this->pl_sess;
|
||||
if ($type === "audioclip") {
|
||||
|
||||
if($type === "au") {
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
|
||||
if(isset($pl_sess->id)) {
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/add-item'.$params, 'callback' => 'window["setSPLContent"]'),
|
||||
'title' => 'Add to Playlist');
|
||||
$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");
|
||||
|
||||
if ($user->isAdmin()) {
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
|
||||
}
|
||||
|
||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => '/Library/edit-file-md/id/#id#'),
|
||||
'title' => 'Edit Metadata');
|
||||
|
||||
// added for downlaod
|
||||
$id = $this->_getParam('id');
|
||||
|
||||
$file_id = $this->_getParam('id', null);
|
||||
$file = Application_Model_StoredFile::Recall($file_id);
|
||||
|
||||
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
|
||||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
||||
'title' => 'Download');
|
||||
$menu["download"] = array("name" => "Download", "url" => $url);
|
||||
|
||||
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
$text = "Upload to SoundCloud";
|
||||
if(!is_null($file->getSoundCloudId())){
|
||||
$text = "Re-upload to SoundCloud";
|
||||
}
|
||||
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Library/upload-file-soundcloud/id/#id#',
|
||||
'callback'=>"window['addProgressIcon']('$file_id')"),'title' => $text);
|
||||
|
||||
//create a menu separator
|
||||
$menu["sep1"] = "-----------";
|
||||
|
||||
//create a sub menu for Soundcloud actions.
|
||||
$menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array());
|
||||
|
||||
$scid = $file->getSoundCloudId();
|
||||
|
||||
if($scid > 0){
|
||||
$link_to_file = $file->getSoundCloudLinkToFile();
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['openFileOnSoundCloud']('$link_to_file')"),
|
||||
'title' => 'View on SoundCloud');
|
||||
if (!is_null($scid)){
|
||||
$text = "Re-upload to SoundCloud";
|
||||
}
|
||||
else {
|
||||
$text = "Upload to SoundCloud";
|
||||
}
|
||||
|
||||
$menu["soundcloud"]["items"]["upload"] = array("name" => $text, "url" => "/library/upload-file-soundcloud/id/{$id}");
|
||||
|
||||
if ($scid > 0){
|
||||
$url = $file->getSoundCloudLinkToFile();
|
||||
$menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "url" => $url);
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->isAdmin()) {
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['confirmDeleteAudioClip']('$paramsPop')"),
|
||||
'title' => 'Delete');
|
||||
}
|
||||
}
|
||||
else if($type === "pl") {
|
||||
else if ($type === "playlist") {
|
||||
|
||||
if(!isset($pl_sess->id) || $pl_sess->id !== $id) {
|
||||
$menu[] = array('action' =>
|
||||
array('type' => 'ajax',
|
||||
'url' => '/Playlist/edit'.$params,
|
||||
'callback' => 'window["openDiffSPL"]'),
|
||||
'title' => 'Edit');
|
||||
}
|
||||
else if(isset($pl_sess->id) && $pl_sess->id === $id) {
|
||||
$menu[] = array('action' =>
|
||||
array('type' => 'ajax',
|
||||
'url' => '/Playlist/close'.$params,
|
||||
'callback' => 'window["noOpenPL"]'),
|
||||
'title' => 'Close');
|
||||
if ($this->pl_sess->id !== $id && $screen == "playlist") {
|
||||
$menu["edit"] = array("name"=> "Edit", "icon" => "edit");
|
||||
}
|
||||
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['confirmDeletePlaylist']('$paramsPop')"),
|
||||
'title' => 'Delete');
|
||||
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
|
||||
}
|
||||
|
||||
//returns format jjmenu is looking for.
|
||||
die(json_encode($menu));
|
||||
$this->view->items = $menu;
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
//array containing id and type of media to delete.
|
||||
$mediaItems = $this->_getParam('media', null);
|
||||
|
||||
if ($user->isAdmin()) {
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
|
||||
if (!is_null($id)) {
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
$files = array();
|
||||
$playlists = array();
|
||||
|
||||
if (PEAR::isError($file)) {
|
||||
$this->view->message = $file->getMessage();
|
||||
return;
|
||||
}
|
||||
else if(is_null($file)) {
|
||||
$this->view->message = "file doesn't exist";
|
||||
return;
|
||||
}
|
||||
$message = null;
|
||||
|
||||
$res = $file->delete(true);
|
||||
foreach ($mediaItems as $media) {
|
||||
|
||||
if (PEAR::isError($res)) {
|
||||
$this->view->message = $res->getMessage();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$res = settype($res, "integer");
|
||||
$data = array("filepath" => $file->getFilePath(), "delete" => $res);
|
||||
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
|
||||
}
|
||||
if ($media["type"] === "audioclip") {
|
||||
$files[] = intval($media["id"]);
|
||||
}
|
||||
else if ($media["type"] === "playlist") {
|
||||
$playlists[] = intval($media["id"]);
|
||||
}
|
||||
|
||||
$this->view->id = $id;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteGroupAction()
|
||||
{
|
||||
$ids = $this->_getParam('ids');
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
if ($user->isAdmin()) {
|
||||
if (count($playlists)) {
|
||||
Application_Model_Playlist::DeletePlaylists($playlists);
|
||||
}
|
||||
|
||||
if (!is_null($ids)) {
|
||||
foreach ($ids as $key => $id) {
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
if (!$user->isAdmin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (PEAR::isError($file)) {
|
||||
$this->view->message = $file->getMessage();
|
||||
return;
|
||||
}
|
||||
else if(is_null($file)) {
|
||||
$this->view->message = "file doesn't exist";
|
||||
return;
|
||||
}
|
||||
foreach ($files as $id) {
|
||||
Logging::log("deleting file {$id}");
|
||||
|
||||
$res = $file->delete();
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
|
||||
if (PEAR::isError($res)) {
|
||||
$this->view->message = $res->getMessage();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$res = settype($res, "integer");
|
||||
$data = array("filepath" => $file->getFilePath(), "delete" => $res);
|
||||
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
|
||||
}
|
||||
if (isset($file)) {
|
||||
try {
|
||||
$res = $file->delete(true);
|
||||
}
|
||||
//could throw a scheduled in future exception.
|
||||
catch (Exception $e) {
|
||||
$message = "Could not delete some scheduled files.";
|
||||
}
|
||||
|
||||
$this->view->ids = $ids;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($message)) {
|
||||
$this->view->message = $message;
|
||||
}
|
||||
}
|
||||
|
||||
public function contentsAction()
|
||||
{
|
||||
$post = $this->getRequest()->getPost();
|
||||
$datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($post);
|
||||
|
||||
//format clip lengh to 1 decimal
|
||||
foreach($datatables["aaData"] as &$data){
|
||||
if($data['ftype'] == 'audioclip'){
|
||||
$params = $this->getRequest()->getParams();
|
||||
$datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($params);
|
||||
|
||||
//TODO move this to the datatables row callback.
|
||||
foreach ($datatables["aaData"] as &$data) {
|
||||
|
||||
if ($data['ftype'] == 'audioclip'){
|
||||
$file = Application_Model_StoredFile::Recall($data['id']);
|
||||
$scid = $file->getSoundCloudId();
|
||||
if($scid == "-2"){
|
||||
$data['track_title'] .= '<span id="'.$data['id'].'" class="small-icon progress"></span>';
|
||||
}else if($scid == "-3"){
|
||||
$data['track_title'] .= '<span id="'.$data['id'].'" class="small-icon sc-error"></span>';
|
||||
}else if(!is_null($scid)){
|
||||
$data['track_title'] .= '<span id="'.$data['id'].'" class="small-icon soundcloud"></span>';
|
||||
|
||||
if ($scid == "-2"){
|
||||
$data['track_title'] .= '<span class="small-icon progress"/>';
|
||||
}
|
||||
else if ($scid == "-3"){
|
||||
$data['track_title'] .= '<span class="small-icon sc-error"/>';
|
||||
}
|
||||
else if (!is_null($scid)){
|
||||
$data['track_title'] .= '<span class="small-icon soundcloud"/>';
|
||||
}
|
||||
}
|
||||
$sec = Application_Model_Playlist::playlistTimeToSeconds($data['length']);
|
||||
$data['length'] = Application_Model_Playlist::secondsToPlaylistTime($sec);
|
||||
}
|
||||
|
||||
die(json_encode($datatables));
|
||||
|
@ -284,13 +245,13 @@ class LibraryController extends Zend_Controller_Action
|
|||
$id = $this->_getParam('id');
|
||||
$type = $this->_getParam('type');
|
||||
|
||||
if($type == "au") {
|
||||
if ($type == "audioclip") {
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
$this->view->type = $type;
|
||||
$this->view->md = $file->getMetadata();
|
||||
}
|
||||
else if($type == "pl") {
|
||||
$file = Application_Model_Playlist::Recall($id);
|
||||
else if ($type == "playlist") {
|
||||
$file = new Application_Model_Playlist($id);
|
||||
$this->view->type = $type;
|
||||
$this->view->md = $file->getAllPLMetaData();
|
||||
$this->view->contents = $file->getContents();
|
||||
|
@ -308,13 +269,15 @@ class LibraryController extends Zend_Controller_Action
|
|||
public function getUploadToSoundcloudStatusAction(){
|
||||
$id = $this->_getParam('id');
|
||||
$type = $this->_getParam('type');
|
||||
if($type == "show"){
|
||||
|
||||
if ($type == "show") {
|
||||
$show_instance = new Application_Model_ShowInstance($id);
|
||||
$this->view->sc_id = $show_instance->getSoundCloudFileId();
|
||||
$file = $show_instance->getRecordedFile();
|
||||
$this->view->error_code = $file->getSoundCloudErrorCode();
|
||||
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
||||
}else{
|
||||
}
|
||||
else if ($type == "file") {
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
$this->view->sc_id = $file->getSoundCloudId();
|
||||
$this->view->error_code = $file->getSoundCloudErrorCode();
|
||||
|
|
|
@ -7,19 +7,16 @@ class PlaylistController extends Zend_Controller_Action
|
|||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('add-item', 'json')
|
||||
->addActionContext('delete-item', 'json')
|
||||
->addActionContext('add-group', 'json')
|
||||
->addActionContext('delete-group', 'json')
|
||||
$ajaxContext->addActionContext('add-items', 'json')
|
||||
->addActionContext('move-items', 'json')
|
||||
->addActionContext('delete-items', 'json')
|
||||
->addActionContext('set-fade', 'json')
|
||||
->addActionContext('set-cue', 'json')
|
||||
->addActionContext('move-item', 'json')
|
||||
->addActionContext('close', 'json')
|
||||
->addActionContext('new', 'json')
|
||||
->addActionContext('edit', 'json')
|
||||
->addActionContext('delete-active', 'json')
|
||||
->addActionContext('delete', 'json')
|
||||
->addActionContext('set-playlist-fades', 'json')
|
||||
->addActionContext('get-playlist-fades', 'json')
|
||||
->addActionContext('set-playlist-name', 'json')
|
||||
->addActionContext('set-playlist-description', 'json')
|
||||
->initContext();
|
||||
|
@ -29,52 +26,41 @@ class PlaylistController extends Zend_Controller_Action
|
|||
|
||||
private function getPlaylist()
|
||||
{
|
||||
$pl_sess = $this->pl_sess;
|
||||
$pl = null;
|
||||
|
||||
if(isset($pl_sess->id)) {
|
||||
|
||||
$pl = Application_Model_Playlist::Recall($pl_sess->id);
|
||||
if($pl === FALSE) {
|
||||
unset($pl_sess->id);
|
||||
return false;
|
||||
}
|
||||
return $pl;
|
||||
}else{
|
||||
return false;
|
||||
if (isset($this->pl_sess->id)) {
|
||||
$pl = new Application_Model_Playlist($this->pl_sess->id);
|
||||
}
|
||||
return $pl;
|
||||
}
|
||||
|
||||
private function changePlaylist($pl_id)
|
||||
{
|
||||
$pl_sess = $this->pl_sess;
|
||||
|
||||
if(isset($pl_sess->id)) {
|
||||
|
||||
$pl = Application_Model_Playlist::Recall($pl_sess->id);
|
||||
if($pl !== FALSE) {
|
||||
$this->closePlaylist($pl);
|
||||
}
|
||||
}
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$pl = Application_Model_Playlist::Recall($pl_id);
|
||||
if($pl === FALSE) {
|
||||
return FALSE;
|
||||
}
|
||||
$pl->lock($userInfo->id);
|
||||
$pl_sess->id = $pl_id;
|
||||
$this->pl_sess->id = intval($pl_id);
|
||||
}
|
||||
|
||||
private function closePlaylist($pl)
|
||||
private function createUpdateResponse($pl)
|
||||
{
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$res = $pl->unlock($userInfo->id);
|
||||
$this->view->pl = $pl;
|
||||
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||
$this->view->name = $pl->getName();
|
||||
$this->view->length = $pl->getLength();
|
||||
$this->view->description = $pl->getDescription();
|
||||
|
||||
$pl_sess = $this->pl_sess;
|
||||
unset($pl_sess->id);
|
||||
unset($this->view->pl);
|
||||
}
|
||||
|
||||
return $res;
|
||||
private function createFullResponse($pl = null)
|
||||
{
|
||||
if (isset($pl)) {
|
||||
$this->view->pl = $pl;
|
||||
$this->view->id = $pl->getId();
|
||||
$this->view->html = $this->view->render('playlist/index.phtml');
|
||||
unset($this->view->pl);
|
||||
}
|
||||
else {
|
||||
$this->view->html = $this->view->render('playlist/index.phtml');
|
||||
}
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
|
@ -87,10 +73,21 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.filemtime($baseDir.'/css/playlist_builder.css'));
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('spl');
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl !== false){
|
||||
$this->view->pl = $pl;
|
||||
}
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
|
||||
if (isset($pl)) {
|
||||
$this->view->pl = $pl;
|
||||
}
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
public function newAction()
|
||||
|
@ -99,275 +96,223 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
$pl = new Application_Model_Playlist();
|
||||
$pl->create("Untitled Playlist");
|
||||
$pl->setPLMetaData('dc:creator', $userInfo->login);
|
||||
$pl->setName("Untitled Playlist");
|
||||
$pl->setPLMetaData('dc:creator', $userInfo->id);
|
||||
|
||||
$this->changePlaylist($pl->getId());
|
||||
|
||||
$this->view->pl = $pl;
|
||||
$this->view->pl_id = $pl->getId();
|
||||
$this->view->html = $this->view->render('playlist/index.phtml');
|
||||
unset($this->view->pl);
|
||||
$this->createFullResponse($pl);
|
||||
}
|
||||
|
||||
public function editAction()
|
||||
{
|
||||
$pl_id = $this->_getParam('id', null);
|
||||
|
||||
if(!is_null($pl_id)) {
|
||||
$this->changePlaylist($pl_id);
|
||||
}
|
||||
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->view->pl = $pl;
|
||||
$this->view->pl_id = $pl->getId();
|
||||
$this->view->html = $this->view->render('playlist/index.phtml');
|
||||
unset($this->view->pl);
|
||||
}
|
||||
|
||||
public function addItemAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$pos = $this->_getParam('pos', null);
|
||||
$id = $this->_getParam('id', null);
|
||||
Logging::log("editing playlist {$id}");
|
||||
|
||||
if (!is_null($id)) {
|
||||
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
$res = $pl->addAudioClip($id, $pos);
|
||||
|
||||
if (PEAR::isError($res)) {
|
||||
$this->view->message = $res->getMessage();
|
||||
}
|
||||
|
||||
$this->view->pl = $pl;
|
||||
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||
$this->view->name = $pl->getName();
|
||||
$this->view->length = $pl->getLength();
|
||||
$this->view->description = $pl->getDescription();
|
||||
|
||||
unset($this->view->pl);
|
||||
return;
|
||||
$this->changePlaylist($id);
|
||||
}
|
||||
$this->view->message = "a file is not chosen";
|
||||
}
|
||||
|
||||
public function moveItemAction()
|
||||
{
|
||||
$oldPos = $this->_getParam('oldPos');
|
||||
$newPos = $this->_getParam('newPos');
|
||||
|
||||
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
$pl->moveAudioClip($oldPos, $newPos);
|
||||
|
||||
$this->view->pl = $pl;
|
||||
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||
$this->view->name = $pl->getName();
|
||||
$this->view->length = $pl->getLength();
|
||||
$this->view->description = $pl->getDescription();
|
||||
|
||||
unset($this->view->pl);
|
||||
}
|
||||
|
||||
public function deleteItemAction()
|
||||
{
|
||||
$positions = $this->_getParam('pos', array());
|
||||
|
||||
if (!is_array($positions))
|
||||
$positions = array($positions);
|
||||
|
||||
//so the automatic updating of playlist positioning doesn't affect removal.
|
||||
sort($positions);
|
||||
$positions = array_reverse($positions);
|
||||
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($positions as $pos) {
|
||||
$pl->delAudioClip($pos);
|
||||
}
|
||||
|
||||
$this->view->pl = $pl;
|
||||
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||
$this->view->name = $pl->getName();
|
||||
$this->view->length = $pl->getLength();
|
||||
$this->view->description = $pl->getDescription();
|
||||
|
||||
unset($this->view->pl);
|
||||
}
|
||||
|
||||
public function addGroupAction()
|
||||
{
|
||||
$ids = $this->_getParam('ids');
|
||||
$pos = $this->_getParam('pos', null);
|
||||
|
||||
if (!is_null($ids)) {
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
if ($pl === false) {
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($ids as $key => $value) {
|
||||
$res = $pl->addAudioClip($value);
|
||||
if (PEAR::isError($res)) {
|
||||
$this->view->message = $res->getMessage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->pl = $pl;
|
||||
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||
$this->view->name = $pl->getName();
|
||||
$this->view->length = $pl->getLength();
|
||||
$this->view->description = $pl->getDescription();
|
||||
return;
|
||||
}
|
||||
$this->view->message = "a file is not chosen";
|
||||
}
|
||||
|
||||
public function deleteGroupAction()
|
||||
{
|
||||
$ids = $this->_getParam('ids', null);
|
||||
|
||||
foreach ($ids as $key => $id) {
|
||||
$pl = Application_Model_Playlist::Recall($id);
|
||||
|
||||
if ($pl !== FALSE) {
|
||||
Application_Model_Playlist::Delete($id);
|
||||
$pl_sess = $this->pl_sess;
|
||||
if($pl_sess->id === $id){
|
||||
unset($pl_sess->id);
|
||||
}
|
||||
} else {
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->ids = $ids;
|
||||
$this->view->html = $this->view->render('playlist/index.phtml');
|
||||
}
|
||||
|
||||
public function setCueAction()
|
||||
{
|
||||
$pos = $this->_getParam('pos');
|
||||
$pl = $this->getPlaylist();
|
||||
if ($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
$cueIn = $this->_getParam('cueIn', null);
|
||||
$cueOut = $this->_getParam('cueOut', null);
|
||||
|
||||
$response = $pl->changeClipLength($pos, $cueIn, $cueOut);
|
||||
|
||||
$this->view->response = $response;
|
||||
|
||||
if(!isset($response["error"])) {
|
||||
$this->view->pl = $pl;
|
||||
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||
$this->view->name = $pl->getName();
|
||||
$this->view->length = $pl->getLength();
|
||||
$this->view->description = $pl->getDescription();
|
||||
|
||||
unset($this->view->pl);
|
||||
}
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist {$id} not found");
|
||||
$this->changePlaylist(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
$this->changePlaylist(null);
|
||||
}
|
||||
|
||||
public function setFadeAction()
|
||||
{
|
||||
$pos = $this->_getParam('pos');
|
||||
$pl = $this->getPlaylist();
|
||||
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
$fadeIn = $this->_getParam('fadeIn', null);
|
||||
$fadeOut = $this->_getParam('fadeOut', null);
|
||||
|
||||
$response = $pl->changeFadeInfo($pos, $fadeIn, $fadeOut);
|
||||
$this->view->response = $response;
|
||||
|
||||
if(!isset($response["error"])) {
|
||||
$this->view->pl = $pl;
|
||||
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||
$this->view->name = $pl->getName();
|
||||
$this->view->length = $pl->getLength();
|
||||
$this->view->description = $pl->getDescription();
|
||||
|
||||
unset($this->view->pl);
|
||||
}
|
||||
$this->createFullResponse($pl);
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
$id = $this->_getParam('id', null);
|
||||
$pl = Application_Model_Playlist::Recall($id);
|
||||
$ids = $this->_getParam('ids');
|
||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
||||
$pl = null;
|
||||
|
||||
if ($pl !== FALSE) {
|
||||
try {
|
||||
|
||||
Application_Model_Playlist::Delete($id);
|
||||
Logging::log("Currently active playlist {$this->pl_sess->id}");
|
||||
if (in_array($this->pl_sess->id, $ids)) {
|
||||
Logging::log("Deleting currently active playlist");
|
||||
$this->changePlaylist(null);
|
||||
}
|
||||
else {
|
||||
$pl = $this->getPlaylist();
|
||||
Logging::log("Not deleting currently active playlist");
|
||||
}
|
||||
|
||||
$pl_sess = $this->pl_sess;
|
||||
|
||||
if($pl_sess->id === $id){
|
||||
unset($pl_sess->id);
|
||||
}
|
||||
}else{
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
Application_Model_Playlist::DeletePlaylists($ids);
|
||||
}
|
||||
catch(PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$pl = null;
|
||||
}
|
||||
catch(Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
}
|
||||
|
||||
$this->view->id = $id;
|
||||
$this->view->html = $this->view->render('playlist/index.phtml');
|
||||
$this->createFullResponse($pl);
|
||||
}
|
||||
|
||||
public function deleteActiveAction()
|
||||
public function addItemsAction()
|
||||
{
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
$ids = $this->_getParam('ids');
|
||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
||||
$afterItem = $this->_getParam('afterItem', null);
|
||||
$addType = $this->_getParam('type', 'after');
|
||||
|
||||
Logging::log("type is ".$addType);
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->addAudioClips($ids, $afterItem, $addType);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
}
|
||||
Application_Model_Playlist::Delete($pl->getId());
|
||||
|
||||
$pl_sess = $this->pl_sess;
|
||||
unset($pl_sess->id);
|
||||
|
||||
$this->view->html = $this->view->render('playlist/index.phtml');
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
|
||||
public function closeAction()
|
||||
public function moveItemsAction()
|
||||
{
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
}
|
||||
$this->closePlaylist($pl);
|
||||
$ids = $this->_getParam('ids');
|
||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
||||
$afterItem = $this->_getParam('afterItem', null);
|
||||
|
||||
$this->view->html = $this->view->render('playlist/index.phtml');
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->moveAudioClips($ids, $afterItem);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
}
|
||||
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
|
||||
public function deleteItemsAction()
|
||||
{
|
||||
$ids = $this->_getParam('ids');
|
||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->delAudioClips($ids);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
}
|
||||
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
|
||||
public function setCueAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$cueIn = $this->_getParam('cueIn', null);
|
||||
$cueOut = $this->_getParam('cueOut', null);
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$response = $pl->changeClipLength($id, $cueIn, $cueOut);
|
||||
|
||||
$this->view->response = $response;
|
||||
|
||||
if(!isset($response["error"])) {
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
public function setFadeAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$fadeIn = $this->_getParam('fadeIn', null);
|
||||
$fadeOut = $this->_getParam('fadeOut', null);
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$response = $pl->changeFadeInfo($id, $fadeIn, $fadeOut);
|
||||
|
||||
$this->view->response = $response;
|
||||
|
||||
if (!isset($response["error"])) {
|
||||
$this->createUpdateResponse($pl);
|
||||
}
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
public function getPlaylistFadesAction()
|
||||
{
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$fades = $pl->getFadeInfo(0);
|
||||
$this->view->fadeIn = $fades[0];
|
||||
|
||||
$fades = $pl->getFadeInfo($pl->getSize()-1);
|
||||
$this->view->fadeOut = $fades[1];
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -377,32 +322,23 @@ class PlaylistController extends Zend_Controller_Action
|
|||
**/
|
||||
public function setPlaylistFadesAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$pl = $this->getPlaylist();
|
||||
if($pl === false){
|
||||
$this->view->playlist_error = true;
|
||||
return false;
|
||||
$fadeIn = $this->_getParam('fadeIn', null);
|
||||
$fadeOut = $this->_getParam('fadeOut', null);
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
$pl->setPlaylistfades($fadeIn, $fadeOut);
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist not found");
|
||||
$this->changePlaylist(null);
|
||||
$this->createFullResponse(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
Logging::log("{$e->getFile()}");
|
||||
Logging::log("{$e->getLine()}");
|
||||
Logging::log("{$e->getMessage()}");
|
||||
}
|
||||
|
||||
if($request->isPost()) {
|
||||
$fadeIn = $this->_getParam('fadeIn', null);
|
||||
$fadeOut = $this->_getParam('fadeOut', null);
|
||||
|
||||
if($fadeIn)
|
||||
$response = $pl->changeFadeInfo(0, $fadeIn, $fadeOut);
|
||||
else if($fadeOut)
|
||||
$response = $pl->changeFadeInfo($pl->getSize(), $fadeIn, $fadeOut);
|
||||
|
||||
$this->view->response = $response;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$fades = $pl->getFadeInfo(0);
|
||||
$this->view->fadeIn = $fades[0];
|
||||
|
||||
$fades = $pl->getFadeInfo($pl->getSize());
|
||||
$this->view->fadeOut = $fades[1];
|
||||
}
|
||||
|
||||
public function setPlaylistNameAction()
|
||||
|
|
|
@ -45,7 +45,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.filemtime($baseDir.'/js/datatables/js/jquery.dataTables.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.filemtime($baseDir.'/js/datatables/plugin/dataTables.pluginAPI.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/fullcalendar/fullcalendar.js?'.filemtime($baseDir.'/js/fullcalendar/fullcalendar.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker-0.0.6.js?'.filemtime($baseDir.'/js/timepicker/jquery.ui.timepicker-0.0.6.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js?'.filemtime($baseDir.'/js/timepicker/jquery.ui.timepicker.js'),'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js?'.filemtime($baseDir.'/js/colorpicker/js/colorpicker.js'),'text/javascript');
|
||||
|
||||
//full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time
|
||||
|
@ -68,7 +68,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$user = new Application_Model_User($userInfo->id);
|
||||
$this->view->isAdmin = $user->isAdmin();
|
||||
$this->view->isProgramManager = $user->isUserType('P');
|
||||
|
||||
|
||||
$this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";");
|
||||
}
|
||||
|
||||
|
|
128
airtime_mvc/application/controllers/ShowbuilderController.php
Normal file
128
airtime_mvc/application/controllers/ShowbuilderController.php
Normal file
|
@ -0,0 +1,128 @@
|
|||
<?php
|
||||
|
||||
class ShowbuilderController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('schedule-move', 'json')
|
||||
->addActionContext('schedule-add', 'json')
|
||||
->addActionContext('schedule-remove', 'json')
|
||||
->addActionContext('builder-feed', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction() {
|
||||
|
||||
$this->_helper->layout->setLayout('builder');
|
||||
|
||||
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js'),'text/javascript');
|
||||
|
||||
$this->_helper->actionStack('library', 'library');
|
||||
$this->_helper->actionStack('builder', 'showbuilder');
|
||||
}
|
||||
|
||||
public function builderAction() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendScript("var serverTimezoneOffset = ".date("Z")."; //in seconds");
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/builder.js','text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/showbuilder.css');
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('builder');
|
||||
}
|
||||
|
||||
public function builderFeedAction() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
$current_time = time();
|
||||
|
||||
$starts_epoch = $request->getParam("start", $current_time);
|
||||
//default ends is 24 hours after starts.
|
||||
$ends_epoch = $request->getParam("end", $current_time + (60*60*24));
|
||||
|
||||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||
|
||||
Logging::log("showbuilder starts {$startsDT->format("Y-m-d H:i:s")}");
|
||||
Logging::log("showbuilder ends {$endsDT->format("Y-m-d H:i:s")}");
|
||||
|
||||
$showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT);
|
||||
|
||||
$this->view->schedule = $showBuilder->GetItems();
|
||||
}
|
||||
|
||||
public function scheduleAddAction() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$mediaItems = $request->getParam("mediaIds", null);
|
||||
$scheduledIds = $request->getParam("schedIds", null);
|
||||
|
||||
$json = array();
|
||||
|
||||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->scheduleAfter($scheduledIds, $mediaItems);
|
||||
|
||||
$json["message"]="success... maybe";
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$json["message"]=$e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
}
|
||||
|
||||
$this->view->data = $json;
|
||||
}
|
||||
|
||||
public function scheduleRemoveAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$ids = $request->getParam("ids", null);
|
||||
|
||||
$json = array();
|
||||
|
||||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->removeItems($ids);
|
||||
|
||||
$json["message"]="success... maybe";
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$json["message"]=$e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
}
|
||||
|
||||
$this->view->data = $json;
|
||||
}
|
||||
|
||||
public function scheduleMoveAction() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$selectedItem = $request->getParam("selectedItem");
|
||||
$afterItem = $request->getParam("afterItem");
|
||||
|
||||
$json = array();
|
||||
|
||||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
$scheduler->moveItem($selectedItem, $afterItem);
|
||||
|
||||
$json["message"]="success... maybe";
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$json["message"]=$e->getMessage();
|
||||
Logging::log($e->getMessage());
|
||||
}
|
||||
|
||||
$this->view->data = $json;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue