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
|
@ -33,11 +33,11 @@ date_default_timezone_set(Application_Model_Preference::GetTimezone());
|
|||
Zend_Validate::setDefaultNamespaces("Zend");
|
||||
|
||||
$front = Zend_Controller_Front::getInstance();
|
||||
$front->registerPlugin(new RabbitMqPlugin());
|
||||
$front->registerPlugin(new RabbitMqPlugin());
|
||||
|
||||
Logging::debug($_SERVER['REQUEST_URI']);
|
||||
|
||||
/* The bootstrap class should only be used to initialize actions that return a view.
|
||||
/* The bootstrap class should only be used to initialize actions that return a view.
|
||||
Actions that return JSON will not use the bootstrap class! */
|
||||
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
{
|
||||
|
@ -56,23 +56,25 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
|
||||
$view->headLink()->appendStylesheet($baseUrl.'/css/redmond/jquery-ui-1.8.8.custom.css?'.filemtime($baseDir.'/css/redmond/jquery-ui-1.8.8.custom.css'));
|
||||
$view->headLink()->appendStylesheet($baseUrl.'/css/pro_dropdown_3.css?'.filemtime($baseDir.'/css/pro_dropdown_3.css'));
|
||||
$view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.min.css?'.filemtime($baseDir.'/css/qtip/jquery.qtip.min.css'));
|
||||
$view->headLink()->appendStylesheet($baseUrl.'/css/qtip/jquery.qtip.css?'.filemtime($baseDir.'/css/qtip/jquery.qtip.min.css'));
|
||||
$view->headLink()->appendStylesheet($baseUrl.'/css/styles.css?'.filemtime($baseDir.'/css/styles.css'));
|
||||
|
||||
}
|
||||
|
||||
protected function _initHeadScript()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
|
||||
$view = $this->getResource('view');
|
||||
$baseUrl = Zend_Controller_Front::getInstance()->getBaseUrl();
|
||||
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||
|
||||
$view->headScript()->appendFile($baseUrl.'/js/libs/jquery-1.5.2.min.js?'.filemtime($baseDir.'/js/libs/jquery-1.5.2.min.js'),'text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'/js/libs/jquery-ui-1.8.11.custom.min.js?'.filemtime($baseDir.'/js/libs/jquery-ui-1.8.11.custom.min.js'),'text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'/js/libs/jquery-1.7.1.min.js?'.filemtime($baseDir.'/js/libs/jquery-1.7.1.min.js'),'text/javascript');
|
||||
$view->headScript()->appendFile('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js');
|
||||
$view->headScript()->appendFile($baseUrl.'/js/libs/jquery.stickyPanel.js?'.filemtime($baseDir.'/js/libs/jquery.stickyPanel.js'),'text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip2.min.js?'.filemtime($baseDir.'/js/qtip/jquery.qtip2.min.js'),'text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'/js/qtip/jquery.qtip.min.js?'.filemtime($baseDir.'/js/qtip/jquery.qtip2.min.js'),'text/javascript');
|
||||
$view->headScript()->appendFile($baseUrl.'/js/jplayer/jquery.jplayer.min.js?'.filemtime($baseDir.'/js/jplayer/jquery.jplayer.min.js'));
|
||||
|
||||
$view->headScript()->appendScript("var baseUrl='$baseUrl/'");
|
||||
|
||||
//scripts for now playing bar
|
||||
|
@ -81,7 +83,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/versiontooltip.js?'.filemtime($baseDir.'/js/airtime/dashboard/versiontooltip.js'),'text/javascript');
|
||||
|
||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/common/common.js?'.filemtime($baseDir.'/js/airtime/common/common.js'),'text/javascript');
|
||||
|
||||
|
||||
if (Application_Model_Preference::GetPlanLevel() != "disabled"
|
||||
&& $_SERVER['REQUEST_URI'] != '/Dashboard/stream-player') {
|
||||
$client_id = Application_Model_Preference::GetClientId();
|
||||
|
@ -109,12 +111,12 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
{
|
||||
if (APPLICATION_ENV == "development"){
|
||||
global $CC_DBC;
|
||||
|
||||
|
||||
$autoloader = Zend_Loader_Autoloader::getInstance();
|
||||
$autoloader->registerNamespace('ZFDebug');
|
||||
|
||||
$options = array(
|
||||
'plugins' => array('Variables',
|
||||
'plugins' => array('Variables',
|
||||
'Exception',
|
||||
'Memory',
|
||||
'Time')
|
||||
|
@ -126,12 +128,12 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
|||
$frontController->registerPlugin($debug);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function _initRouter()
|
||||
{
|
||||
$front = Zend_Controller_Front::getInstance();
|
||||
$router = $front->getRouter();
|
||||
|
||||
|
||||
$router->addRoute(
|
||||
'password-change',
|
||||
new Zend_Controller_Router_Route('password-change/:user_id/:token', array(
|
||||
|
|
|
@ -24,6 +24,7 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
|
|||
->add(new Zend_Acl_Resource('dashboard'))
|
||||
->add(new Zend_Acl_Resource('preference'))
|
||||
->add(new Zend_Acl_Resource('recorder'))
|
||||
->add(new Zend_Acl_Resource('showbuilder'))
|
||||
->add(new Zend_Acl_Resource('auth'));
|
||||
|
||||
/** Creating permissions */
|
||||
|
@ -42,6 +43,7 @@ $ccAcl->allow('G', 'index')
|
|||
->allow('H', 'library')
|
||||
->allow('H', 'search')
|
||||
->allow('H', 'playlist')
|
||||
->allow('H', 'showbuilder')
|
||||
->allow('A', 'user')
|
||||
->allow('A', 'systemstatus')
|
||||
->allow('A', 'preference');
|
||||
|
|
|
@ -29,6 +29,13 @@ $pages = array(
|
|||
'action' => 'index',
|
||||
'resource' => 'library'
|
||||
),
|
||||
array(
|
||||
'label' => 'Airtimeline',
|
||||
'module' => 'default',
|
||||
'controller' => 'Showbuilder',
|
||||
'action' => 'index',
|
||||
'resource' => 'showbuilder'
|
||||
),
|
||||
array(
|
||||
'label' => 'Calendar',
|
||||
'module' => 'default',
|
||||
|
@ -67,7 +74,7 @@ $pages = array(
|
|||
'action' => 'stream-setting'
|
||||
),
|
||||
array(
|
||||
'label' =>
|
||||
'label' =>
|
||||
Application_Model_Preference::GetPlanLevel() == 'disabled'?'Support Settings':'Station Information Settings',
|
||||
'module' => 'default',
|
||||
'controller' => 'Preference',
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
28
airtime_mvc/application/layouts/scripts/builder.phtml
Normal file
28
airtime_mvc/application/layouts/scripts/builder.phtml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<?php echo $this->doctype() ?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<?php echo $this->headTitle() ?>
|
||||
<?php echo $this->headScript() ?>
|
||||
<?php echo $this->headLink() ?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="Panel">
|
||||
<div class="logo"></div>
|
||||
<?php echo $this->versionNotify() ?>
|
||||
<?php echo $this->partial('partialviews/header.phtml', array("user" => $this->loggedInAs(), "is_trial"=>$this->isTrial(), "trial_remain"=> $this->trialRemaining())) ?>
|
||||
|
||||
<?php $partial = array('menu.phtml', 'default');
|
||||
$this->navigation()->menu()->setPartial($partial); ?>
|
||||
|
||||
<?php echo $this->navigation()->menu() ?>
|
||||
</div>
|
||||
|
||||
<div class="wrapper">
|
||||
<!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist-->
|
||||
<div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div>
|
||||
<div id="show_builder" style="width:500px;" class="ui-widget ui-widget-content block-shadow omega-block padded"><?php echo $this->layout()->builder ?></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load diff
|
@ -155,7 +155,7 @@ class Application_Model_Schedule {
|
|||
"nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, 1),
|
||||
"timezone"=> date("T"),
|
||||
"timezoneOffset"=> date("Z"));
|
||||
|
||||
|
||||
return $range;
|
||||
}
|
||||
|
||||
|
@ -294,6 +294,48 @@ class Application_Model_Schedule {
|
|||
return $rows;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* @param DateTime $p_startDateTime
|
||||
*
|
||||
* @param DateTime $p_endDateTime
|
||||
*
|
||||
* @return array $scheduledItems
|
||||
*
|
||||
*/
|
||||
public static function GetScheduleDetailItems($p_startDateTime, $p_endDateTime)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$sql = "SELECT DISTINCT
|
||||
|
||||
showt.name AS show_name, showt.color AS show_color,
|
||||
showt.background_color AS show_background_colour, showt.id AS show_id,
|
||||
|
||||
si.starts AS si_starts, si.ends AS si_ends, si.time_filled AS si_time_filled,
|
||||
si.record AS si_record, si.rebroadcast AS si_rebroadcast, si.id AS si_id,
|
||||
|
||||
sched.starts AS sched_starts, sched.ends AS sched_ends, sched.id AS sched_id,
|
||||
|
||||
ft.track_title AS file_track_title, ft.artist_name AS file_artist_name,
|
||||
ft.album_title AS file_album_title, ft.length AS file_length
|
||||
|
||||
FROM
|
||||
((cc_schedule AS sched JOIN cc_files AS ft ON (sched.file_id = ft.id)
|
||||
RIGHT OUTER JOIN cc_show_instances AS si ON (si.id = sched.instance_id))
|
||||
JOIN cc_show AS showt ON (showt.id = si.show_id)
|
||||
)
|
||||
|
||||
WHERE si.starts >= '{$p_startDateTime}' AND si.starts <= '{$p_endDateTime}'
|
||||
|
||||
ORDER BY si.starts, sched.starts;";
|
||||
|
||||
Logging::log($sql);
|
||||
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public static function GetShowInstanceItems($instance_id)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
@ -533,7 +575,7 @@ class Application_Model_Schedule {
|
|||
|
||||
public static function createNewFormSections($p_view){
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
|
@ -560,16 +602,16 @@ class Application_Model_Schedule {
|
|||
'add_show_duration' => '1h'));
|
||||
|
||||
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
|
||||
|
||||
|
||||
if(!$isSaas){
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
|
||||
|
||||
$p_view->rr = $formRecord;
|
||||
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$p_view->rebroadcast = $formRebroadcast;
|
||||
|
|
352
airtime_mvc/application/models/Scheduler.php
Normal file
352
airtime_mvc/application/models/Scheduler.php
Normal file
|
@ -0,0 +1,352 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_Scheduler {
|
||||
|
||||
private $con;
|
||||
private $fileInfo = array(
|
||||
"id" => "",
|
||||
"cliplength" => "",
|
||||
"cuein" => "00:00:00",
|
||||
"cueout" => "00:00:00",
|
||||
"fadein" => "00:00:00",
|
||||
"fadeout" => "00:00:00",
|
||||
"sched_id" => null,
|
||||
);
|
||||
|
||||
public function __construct($id = null) {
|
||||
|
||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||
}
|
||||
|
||||
/*
|
||||
* @param $id
|
||||
* @param $type
|
||||
*
|
||||
* @return $files
|
||||
*/
|
||||
private function retrieveMediaFiles($id, $type) {
|
||||
|
||||
$files = array();
|
||||
|
||||
if ($type === "audioclip") {
|
||||
$file = CcFilesQuery::create()->findPK($id, $this->con);
|
||||
|
||||
$data = $this->fileInfo;
|
||||
$data["id"] = $id;
|
||||
$data["cliplength"] = $file->getDbLength();
|
||||
|
||||
$files[] = $data;
|
||||
}
|
||||
else if ($type === "playlist") {
|
||||
|
||||
$contents = CcPlaylistcontentsQuery::create()
|
||||
->orderByDbPosition()
|
||||
->filterByDbPlaylistId($id)
|
||||
->find($this->con);
|
||||
|
||||
foreach ($contents as $plItem) {
|
||||
|
||||
$data = $this->fileInfo;
|
||||
$data["id"] = $plItem->getDbFileId();
|
||||
$data["cliplength"] = $plItem->getDbCliplength();
|
||||
$data["cuein"] = $plItem->getDbCuein();
|
||||
$data["cueout"] = $plItem->getDbCueout();
|
||||
$data["fadein"] = $plItem->getDbFadein();
|
||||
$data["fadeout"] = $plItem->getDbFadeout();
|
||||
|
||||
$files[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/*
|
||||
* @param DateTime startDT
|
||||
* @param string duration
|
||||
* in format H:i:s.u (could be more that 24 hours)
|
||||
*/
|
||||
private function findEndTime($startDT, $duration) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* @param array $scheduledIds
|
||||
* @param array $fileIds
|
||||
* @param array $playlistIds
|
||||
*/
|
||||
private function insertAfter($scheduleItems, $schedFiles, $adjustSched = true) {
|
||||
|
||||
try {
|
||||
|
||||
//dont want to recalculate times for moved items.
|
||||
$excludeIds = array();
|
||||
foreach ($schedFiles as $file) {
|
||||
if (isset($file["sched_id"])) {
|
||||
$excludeIds[] = intval($file["sched_id"]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($scheduleItems as $schedule) {
|
||||
$id = intval($schedule["id"]);
|
||||
|
||||
Logging::log("scheduling after scheduled item: ".$id);
|
||||
Logging::log("in show: ".intval($schedule["instance"]));
|
||||
|
||||
if ($id !== 0) {
|
||||
$schedItem = CcScheduleQuery::create()->findPK($id, $this->con);
|
||||
$instance = $schedItem->getDbInstanceId();
|
||||
|
||||
//user has an old copy of the time line opened.
|
||||
if ($instance !== intval($schedule["instance"])) {
|
||||
Logging::log("items have been since updated");
|
||||
return;
|
||||
}
|
||||
|
||||
$nextStartDT = $schedItem->getDbEnds(null);
|
||||
}
|
||||
//selected empty row to add after
|
||||
else {
|
||||
$showInstance = CcShowInstancesQuery::create()->findPK($schedule["instance"], $this->con);
|
||||
$nextStartDT = $showInstance->getDbStarts(null);
|
||||
$instance = intval($schedule["instance"]);
|
||||
}
|
||||
|
||||
Logging::log("finding items >= {$nextStartDT->format("Y-m-d H:i:s.u")}");
|
||||
if ($adjustSched === true) {
|
||||
$followingSchedItems = CcScheduleQuery::create()
|
||||
->filterByDBStarts($nextStartDT->format("Y-m-d H:i:s.u"), Criteria::GREATER_EQUAL)
|
||||
->filterByDbInstanceId($instance)
|
||||
->filterByDbId($excludeIds, Criteria::NOT_IN)
|
||||
->orderByDbStarts()
|
||||
->find($this->con);
|
||||
|
||||
foreach ($excludeIds as $id) {
|
||||
Logging::log("Excluding id {$id}");
|
||||
}
|
||||
}
|
||||
|
||||
foreach($schedFiles as $file) {
|
||||
|
||||
Logging::log("adding file with id: ".$file["id"]);
|
||||
|
||||
$durationDT = new DateTime("1970-01-01 {$file['cliplength']}", new DateTimeZone("UTC"));
|
||||
$endTimeEpoch = $nextStartDT->format("U") + $durationDT->format("U");
|
||||
$endTimeDT = DateTime::createFromFormat("U", $endTimeEpoch, new DateTimeZone("UTC"));
|
||||
|
||||
//item existed previously and is being moved.
|
||||
//need to keep same id for resources if we want REST.
|
||||
if (isset($file['sched_id'])) {
|
||||
$sched = CcScheduleQuery::create()->findPK($file['sched_id'], $this->con);
|
||||
}
|
||||
else {
|
||||
$sched = new CcSchedule();
|
||||
}
|
||||
Logging::log("id {$sched->getDbId()}");
|
||||
Logging::log("start time {$nextStartDT->format("Y-m-d H:i:s.u")}");
|
||||
Logging::log("end time {$endTimeDT->format("Y-m-d H:i:s.u")}");
|
||||
|
||||
$sched->setDbStarts($nextStartDT);
|
||||
$sched->setDbEnds($endTimeDT);
|
||||
$sched->setDbFileId($file['id']);
|
||||
$sched->setDbCueIn($file['cuein']);
|
||||
$sched->setDbCueOut($file['cueout']);
|
||||
$sched->setDbFadeIn($file['fadein']);
|
||||
$sched->setDbFadeOut($file['fadeout']);
|
||||
$sched->setDbClipLength($durationDT->format("H:i:s.u"));
|
||||
$sched->setDbInstanceId($instance);
|
||||
$sched->save($this->con);
|
||||
|
||||
$nextStartDT = $endTimeDT;
|
||||
}
|
||||
|
||||
if ($adjustSched === true) {
|
||||
|
||||
//recalculate the start/end times after the inserted items.
|
||||
foreach($followingSchedItems as $item) {
|
||||
|
||||
Logging::log("adjusting iterm {$item->getDbId()}");
|
||||
|
||||
$durationDT = new DateTime("1970-01-01 {$item->getDbClipLength()}", new DateTimeZone("UTC"));
|
||||
$endTimeEpoch = $nextStartDT->format("U") + $durationDT->format("U");
|
||||
$endTimeDT = DateTime::createFromFormat("U", $endTimeEpoch, new DateTimeZone("UTC"));
|
||||
|
||||
$item->setDbStarts($nextStartDT);
|
||||
$item->setDbEnds($endTimeDT);
|
||||
$item->save($this->con);
|
||||
|
||||
$nextStartDT = $endTimeDT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @param array $scheduledIds
|
||||
* @param array $fileIds
|
||||
* @param array $playlistIds
|
||||
*/
|
||||
public function scheduleAfter($scheduleItems, $mediaItems, $adjustSched = true) {
|
||||
|
||||
$this->con->beginTransaction();
|
||||
|
||||
$schedFiles = array();
|
||||
|
||||
try {
|
||||
|
||||
foreach($mediaItems as $media) {
|
||||
Logging::log("Media Id ".$media["id"]);
|
||||
Logging::log("Type ".$media["type"]);
|
||||
|
||||
$schedFiles = array_merge($schedFiles, $this->retrieveMediaFiles($media["id"], $media["type"]));
|
||||
}
|
||||
$this->insertAfter($scheduleItems, $schedFiles, $adjustSched);
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @param array $selectedItem
|
||||
* @param array $afterItem
|
||||
*/
|
||||
public function moveItem($selectedItem, $afterItem, $adjustSched = true) {
|
||||
|
||||
$this->con->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
$origSelIns = intval($selectedItem[0]["instance"]);
|
||||
$origAfterIns = intval($afterItem[0]["instance"]);
|
||||
|
||||
Logging::log("Moving item {$selectedItem[0]["id"]}");
|
||||
Logging::log("After {$afterItem[0]["id"]}");
|
||||
|
||||
$selected = CcScheduleQuery::create()->findPk($selectedItem[0]["id"]);
|
||||
$after = CcScheduleQuery::create()->findPk($afterItem[0]["id"]);
|
||||
|
||||
/*
|
||||
if (isset($after) && $origSelIns !== $selected->getDBInstanceId()
|
||||
|| $origAfterIns !== $after->getDBInstanceId()) {
|
||||
|
||||
Logging::log("items have been since updated");
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
$this->removeGaps($origSelIns, $selected->getDbId());
|
||||
|
||||
//moved to another show, remove gaps from original show.
|
||||
if ($adjustSched === true && $origSelIns !== $origAfterIns) {
|
||||
|
||||
}
|
||||
|
||||
$data = $this->fileInfo;
|
||||
$data["id"] = $selected->getDbFileId();
|
||||
$data["cliplength"] = $selected->getDbClipLength();
|
||||
$data["cuein"] = $selected->getDbCueIn();
|
||||
$data["cueout"] = $selected->getDbCueOut();
|
||||
$data["fadein"] = $selected->getDbFadeIn();
|
||||
$data["fadeout"] = $selected->getDbFadeOut();
|
||||
$data["sched_id"] = $selected->getDbId();
|
||||
|
||||
$this->insertAfter($afterItem, array($data), $adjustSched);
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeItems($scheduledIds, $adjustSched = true) {
|
||||
|
||||
$showInstances = array();
|
||||
$this->con->beginTransaction();
|
||||
|
||||
try {
|
||||
|
||||
$removedItems = CcScheduleQuery::create()->findPks($scheduledIds);
|
||||
$removedItems->delete($this->con);
|
||||
|
||||
if ($adjustSched === true) {
|
||||
//get the show instances of the shows we must adjust times for.
|
||||
foreach ($removedItems as $item) {
|
||||
|
||||
$instance = $item->getDBInstanceId();
|
||||
if (!in_array($instance, $showInstances)) {
|
||||
$showInstances[] = $instance;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($showInstances as $instance) {
|
||||
$this->removeGaps($instance);
|
||||
}
|
||||
}
|
||||
|
||||
$this->con->commit();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->con->rollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @param int $showInstance
|
||||
* @param array $exclude
|
||||
* ids of sched items to remove from the calulation.
|
||||
*/
|
||||
public function removeGaps($showInstance, $exclude=null) {
|
||||
|
||||
Logging::log("removing gaps from show instance #".$showInstance);
|
||||
|
||||
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con);
|
||||
$itemStartDT = $instance->getDbStarts(null);
|
||||
|
||||
$schedule = CcScheduleQuery::create()
|
||||
->filterByDbInstanceId($showInstance)
|
||||
->filterByDbId($exclude, Criteria::NOT_IN)
|
||||
->orderByDbStarts()
|
||||
->find($this->con);
|
||||
|
||||
|
||||
foreach ($schedule as $item) {
|
||||
|
||||
Logging::log("adjusting item #".$item->getDbId());
|
||||
|
||||
if (!$item->isDeleted()) {
|
||||
Logging::log("item #".$item->getDbId()." is not deleted");
|
||||
|
||||
$durationDT = new DateTime("1970-01-01 {$item->getDbClipLength()}", new DateTimeZone("UTC"));
|
||||
$startEpoch = $itemStartDT->format("U");
|
||||
Logging::log("new start time");
|
||||
Logging::log($itemStartDT->format("Y-m-d H:i:s"));
|
||||
|
||||
Logging::log("duration");
|
||||
Logging::log($durationDT->format("U"). "seconds");
|
||||
|
||||
$endEpoch = $itemStartDT->format("U") + $durationDT->format("U");
|
||||
$itemEndDT = DateTime::createFromFormat("U", $endEpoch, new DateTimeZone("UTC"));
|
||||
Logging::log("new end time");
|
||||
Logging::log($itemEndDT->format("Y-m-d H:i:s"));
|
||||
|
||||
$item->setDbStarts($itemStartDT);
|
||||
$item->setDbEnds($itemEndDT);
|
||||
$item->save($this->con);
|
||||
|
||||
$itemStartDT = $itemEndDT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
156
airtime_mvc/application/models/ShowBuilder.php
Normal file
156
airtime_mvc/application/models/ShowBuilder.php
Normal file
|
@ -0,0 +1,156 @@
|
|||
<?php
|
||||
|
||||
class Application_Model_ShowBuilder {
|
||||
|
||||
private $timezone;
|
||||
private $startDT;
|
||||
private $endDT;
|
||||
private $user;
|
||||
|
||||
private $defaultRowArray = array(
|
||||
"header" => false,
|
||||
"footer" => false,
|
||||
"empty" => false,
|
||||
"checkbox" => false,
|
||||
"id" => 0,
|
||||
"instance" => "",
|
||||
"starts" => "",
|
||||
"startsUnix" => null,
|
||||
"ends" => "",
|
||||
"endsUnix" => null,
|
||||
"runtime" => "",
|
||||
"title" => "",
|
||||
"creator" => "",
|
||||
"album" => ""
|
||||
);
|
||||
|
||||
/*
|
||||
* @param DateTime $p_startsDT
|
||||
* @param DateTime $p_endsDT
|
||||
*/
|
||||
public function __construct($p_startDT, $p_endDT) {
|
||||
|
||||
$this->startDT = $p_startDT;
|
||||
$this->endDT = $p_endDT;
|
||||
$this->timezone = date_default_timezone_get();
|
||||
$this->user = Application_Model_User::GetCurrentUser();
|
||||
}
|
||||
|
||||
/*
|
||||
* @param DateInterval $p_interval
|
||||
*
|
||||
* @return string $runtime
|
||||
*/
|
||||
private function formatDuration($p_interval){
|
||||
|
||||
$hours = $p_interval->format("%h");
|
||||
$mins = $p_interval->format("%i");
|
||||
|
||||
if( $hours == 0) {
|
||||
$runtime = $p_interval->format("%i:%S");
|
||||
}
|
||||
else {
|
||||
$runtime = $p_interval->format("%h:%I:%S");
|
||||
}
|
||||
|
||||
return $runtime;
|
||||
}
|
||||
|
||||
private function makeFooterRow() {
|
||||
|
||||
$row = $this->defaultRowArray;
|
||||
$row["footer"] = true;
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
private function makeHeaderRow($p_item) {
|
||||
|
||||
$row = $this->defaultRowArray;
|
||||
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
$showStartDT->setTimezone(new DateTimeZone($this->timezone));
|
||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||
$showEndDT->setTimezone(new DateTimeZone($this->timezone));
|
||||
|
||||
//$diff =
|
||||
|
||||
$row["header"] = true;
|
||||
$row["starts"] = $showStartDT->format("Y-m-d H:i");
|
||||
$row["ends"] = $showEndDT->format("Y-m-d H:i");
|
||||
$row["duration"] = $showEndDT->format("U") - $showStartDT->format("U");
|
||||
$row["title"] = $p_item["show_name"];
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
private function makeScheduledItemRow($p_item) {
|
||||
$row = $this->defaultRowArray;
|
||||
|
||||
if (isset($p_item["sched_starts"])) {
|
||||
|
||||
$schedStartDT = new DateTime($p_item["sched_starts"], new DateTimeZone("UTC"));
|
||||
$schedStartDT->setTimezone(new DateTimeZone($this->timezone));
|
||||
$schedEndDT = new DateTime($p_item["sched_ends"], new DateTimeZone("UTC"));
|
||||
$schedEndDT->setTimezone(new DateTimeZone($this->timezone));
|
||||
|
||||
$runtime = $schedStartDT->diff($schedEndDT);
|
||||
|
||||
$row["id"] = intval($p_item["sched_id"]);
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
$row["starts"] = $schedStartDT->format("H:i:s");
|
||||
$row["ends"] = $schedEndDT->format("H:i:s");
|
||||
$row["runtime"] = $this->formatDuration($runtime);
|
||||
$row["title"] = $p_item["file_track_title"];
|
||||
$row["creator"] = $p_item["file_artist_name"];
|
||||
$row["album"] = $p_item["file_album_title"];
|
||||
|
||||
if ($this->user->canSchedule($item["show_id"]) === true) {
|
||||
$row["checkbox"] = true;
|
||||
}
|
||||
}
|
||||
//show is empty
|
||||
else {
|
||||
$row["empty"] = true;
|
||||
$row["id"] = 0 ;
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
public function GetItems() {
|
||||
|
||||
$current_id = -1;
|
||||
$display_items = array();
|
||||
|
||||
$scheduled_items = Application_Model_Schedule::GetScheduleDetailItems($this->startDT->format("Y-m-d H:i:s"), $this->endDT->format("Y-m-d H:i:s"));
|
||||
|
||||
foreach ($scheduled_items as $item) {
|
||||
|
||||
//make a header row.
|
||||
if ($current_id !== $item["si_id"]) {
|
||||
|
||||
//make a footer row.
|
||||
if ($current_id !== -1) {
|
||||
$display_items[] = $this->makeFooterRow();
|
||||
}
|
||||
|
||||
$display_items[] = $this->makeHeaderRow($item);
|
||||
|
||||
$current_id = $item["si_id"];
|
||||
}
|
||||
|
||||
//make a normal data row.
|
||||
$display_items[] = $this->makeScheduledItemRow($item);
|
||||
}
|
||||
|
||||
//make the last footer if there were any scheduled items.
|
||||
if (count($scheduled_items) > 0) {
|
||||
$display_items[] = $this->makeFooterRow();
|
||||
}
|
||||
|
||||
return $display_items;
|
||||
}
|
||||
}
|
|
@ -90,7 +90,7 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
$this->setDbColMetadata($dbMd);
|
||||
}
|
||||
|
||||
|
||||
$this->_file->setDbMtime(new DateTime("now"), new DateTimeZone("UTC"));
|
||||
$this->_file->save();
|
||||
}
|
||||
|
@ -227,30 +227,6 @@ class Application_Model_StoredFile {
|
|||
return $md;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete and insert media file
|
||||
*
|
||||
* @param string $p_localFilePath
|
||||
* local path
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
public function replaceFile($p_localFilePath, $p_copyMedia=TRUE)
|
||||
{
|
||||
// Dont do anything if the source and destination files are
|
||||
// the same.
|
||||
if ($this->name == $p_localFilePath) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ($this->exists) {
|
||||
$r = $this->deleteFile();
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
return $this->addFile($p_localFilePath, $p_copyMedia);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set state of virtual file
|
||||
*
|
||||
|
@ -301,98 +277,30 @@ class Application_Model_StoredFile {
|
|||
*
|
||||
* @param boolean $p_deleteFile
|
||||
*
|
||||
* @return void|PEAR_Error
|
||||
*/
|
||||
public function delete($deleteFromPlaylist=false)
|
||||
{
|
||||
if ($this->exists()) {
|
||||
if ($this->getFormat() == 'audioclip') {
|
||||
$res = $this->deleteFile();
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($deleteFromPlaylist){
|
||||
Application_Model_Playlist::DeleteFileFromAllPlaylists($this->getId());
|
||||
}
|
||||
|
||||
// set file_exists falg to false
|
||||
$this->_file->setDbFileExists(false);
|
||||
$this->_file->save();
|
||||
//$this->_file->delete();
|
||||
|
||||
if (isset($res)) {
|
||||
return $res;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete media file from filesystem.
|
||||
* You cant delete a file if it is being accessed.
|
||||
* You cant delete a file if it is scheduled to be played in the future.
|
||||
* The file will be removed from all playlists it is a part of.
|
||||
*
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public function deleteFile()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
if ($this->isAccessed()) {
|
||||
return PEAR::raiseError('Cannot delete a file that is currently accessed.');
|
||||
}
|
||||
|
||||
// Check if the file is scheduled to be played in the future
|
||||
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->getId())) {
|
||||
return PEAR::raiseError('Cannot delete a file that is scheduled in the future.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if media file exists
|
||||
* @return boolean
|
||||
*/
|
||||
public function exists()
|
||||
{
|
||||
if ($this->_file->isDeleted()) {
|
||||
return false;
|
||||
}
|
||||
if ($this->getFormat() == 'audioclip') {
|
||||
return $this->existsFile();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if raw media file exists
|
||||
* @return boolean
|
||||
*/
|
||||
public function existsFile() {
|
||||
|
||||
$filepath = $this->getFilePath();
|
||||
|
||||
if (!isset($filepath) || !file_exists($filepath) || !is_readable($filepath)) {
|
||||
return false;
|
||||
// Check if the file is scheduled to be played in the future
|
||||
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->getId())) {
|
||||
throw new DeleteScheduledFileException();
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if virtual file is currently in use.<br>
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAccessed()
|
||||
{
|
||||
return ($this->_file->getDbCurrentlyaccessing() > 0);
|
||||
if (file_exists($filepath)) {
|
||||
|
||||
$data = array("filepath" => $filepath, "delete" => 1);
|
||||
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
|
||||
}
|
||||
|
||||
if ($deleteFromPlaylist){
|
||||
Application_Model_Playlist::DeleteFileFromAllPlaylists($this->getId());
|
||||
}
|
||||
|
||||
// set file_exists falg to false
|
||||
$this->_file->setDbFileExists(false);
|
||||
$this->_file->save();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -419,10 +327,10 @@ class Application_Model_StoredFile {
|
|||
* @return string
|
||||
*/
|
||||
public function getFilePath()
|
||||
{
|
||||
{
|
||||
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
|
||||
$directory = $music_dir->getDirectory();
|
||||
|
||||
|
||||
$filepath = $this->_file->getDbFilepath();
|
||||
|
||||
return $directory.$filepath;
|
||||
|
@ -436,7 +344,7 @@ class Application_Model_StoredFile {
|
|||
public function setFilePath($p_filepath)
|
||||
{
|
||||
$path_info = Application_Model_MusicDir::splitFilePath($p_filepath);
|
||||
|
||||
|
||||
if (is_null($path_info)) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -506,7 +414,7 @@ class Application_Model_StoredFile {
|
|||
$storedFile->_file = $file;
|
||||
|
||||
if(isset($md['MDATA_KEY_FILEPATH'])) {
|
||||
// removed "//" in the path. Always use '/' for path separator
|
||||
// removed "//" in the path. Always use '/' for path separator
|
||||
$filepath = str_replace("//", "/", $md['MDATA_KEY_FILEPATH']);
|
||||
$res = $storedFile->setFilePath($filepath);
|
||||
if ($res === -1) {
|
||||
|
@ -643,6 +551,34 @@ class Application_Model_StoredFile {
|
|||
return $res;
|
||||
}
|
||||
|
||||
/*
|
||||
* @param DateInterval $p_interval
|
||||
*
|
||||
* @return string $runtime
|
||||
*/
|
||||
private static function formatDuration($dt){
|
||||
|
||||
$hours = $dt->format("H");
|
||||
$min = $dt->format("i");
|
||||
$sec = $dt->format("s");
|
||||
|
||||
$time = "PT{$hours}H{$min}M{$sec}S";
|
||||
|
||||
$p_interval = new DateInterval($time);
|
||||
|
||||
$hours = $p_interval->format("%h");
|
||||
$mins = $p_interval->format("%i");
|
||||
|
||||
if( $hours == 0) {
|
||||
$runtime = $p_interval->format("%i:%S");
|
||||
}
|
||||
else {
|
||||
$runtime = $p_interval->format("%h:%I:%S");
|
||||
}
|
||||
|
||||
return $runtime;
|
||||
}
|
||||
|
||||
public static function searchFilesForPlaylistBuilder($datatables)
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
@ -660,11 +596,11 @@ class Application_Model_StoredFile {
|
|||
$plSelect .= "'playlist' AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else if ($key === "artist_name") {
|
||||
$plSelect .= "creator AS ".$key.", ";
|
||||
$plSelect .= "login AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
} else if ($key === "length") {
|
||||
$plSelect .= $key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
$fileSelect .= $key."::interval, ";
|
||||
} else if ($key === "year") {
|
||||
$plSelect .= "CAST(utime AS varchar) AS ".$key.", ";
|
||||
$fileSelect .= $key.", ";
|
||||
|
@ -681,13 +617,19 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
|
||||
$fromTable = " ((".$plSelect."PL.id
|
||||
FROM ".$CC_CONFIG["playListTable"]." AS PL
|
||||
LEFT JOIN ".$CC_CONFIG['playListTimeView']." AS PLT USING(id))
|
||||
FROM cc_playlist AS PL LEFT JOIN cc_subjs AS sub ON (sub.id = PL.creator_id))
|
||||
UNION
|
||||
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES WHERE file_exists = 'TRUE')) AS RESULTS";
|
||||
|
||||
|
||||
$results = Application_Model_StoredFile::searchFiles($fromTable, $datatables);
|
||||
|
||||
foreach($results['aaData'] as &$row){
|
||||
|
||||
$row['id'] = intval($row['id']);
|
||||
|
||||
$length = new DateTime($row['length']);
|
||||
$row['length'] = self::formatDuration($length);
|
||||
|
||||
// add checkbox row
|
||||
$row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>";
|
||||
|
||||
|
@ -695,7 +637,22 @@ class Application_Model_StoredFile {
|
|||
// split it and grab only the year info
|
||||
$yearSplit = explode('-', $row['year']);
|
||||
$row['year'] = $yearSplit[0];
|
||||
|
||||
$type = substr($row['ftype'], 0, 2);
|
||||
|
||||
$row['tr_id'] = "{$type}_{$row['id']}";
|
||||
|
||||
//TODO url like this to work on both playlist/showbuilder screens.
|
||||
//datatable stuff really needs to be pulled out and generalized within the project
|
||||
//access to zend view methods to access url helpers is needed.
|
||||
if($type == "au") {
|
||||
$row['image'] = '<img src="/css/images/icon_audioclip.png">';
|
||||
}
|
||||
else {
|
||||
$row['image'] = '<img src="/css/images/icon_playlist.png">';
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
@ -723,7 +680,8 @@ class Application_Model_StoredFile {
|
|||
unset($columnsDisplayed[$key]);
|
||||
}
|
||||
}
|
||||
$selectorRows = "SELECT " . join(',', $columnsDisplayed );
|
||||
//$selectorRows = "SELECT " . join(',', $columnsDisplayed );
|
||||
$selectorRows = "SELECT * ";
|
||||
|
||||
$sql = $selectorCount." FROM ".$fromTable;
|
||||
$totalRows = $CC_DBC->getOne($sql);
|
||||
|
@ -774,9 +732,11 @@ class Application_Model_StoredFile {
|
|||
else {
|
||||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
|
||||
}
|
||||
|
||||
|
||||
//Logging::log($sql);
|
||||
|
||||
$results = $CC_DBC->getAll($sql);
|
||||
|
||||
|
||||
if(!isset($totalDisplayRows)) {
|
||||
$totalDisplayRows = $totalRows;
|
||||
}
|
||||
|
@ -905,6 +865,7 @@ class Application_Model_StoredFile {
|
|||
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||
|
||||
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
||||
|
||||
$r = @rename($audio_file, $audio_stor);
|
||||
|
@ -927,14 +888,14 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Enter description here ...
|
||||
* @param $dir_id - if this is not provided, it returns all files with full path constructed.
|
||||
* @param $propelObj - if this is true, it returns array of proepl obj
|
||||
*/
|
||||
public static function listAllFiles($dir_id=null, $propelObj=false){
|
||||
global $CC_DBC;
|
||||
|
||||
|
||||
if($propelObj){
|
||||
$sql = "SELECT m.directory || f.filepath as fp"
|
||||
." FROM CC_MUSIC_DIRS m"
|
||||
|
@ -996,12 +957,12 @@ class Application_Model_StoredFile {
|
|||
public function getSoundCloudErrorMsg(){
|
||||
return $this->_file->getDbSoundCloudErrorMsg();
|
||||
}
|
||||
|
||||
|
||||
public function setFileExistsFlag($flag){
|
||||
$this->_file->setDbFileExists($flag)
|
||||
->save();
|
||||
}
|
||||
|
||||
|
||||
public function getFileExistsFlag(){
|
||||
return $this->_file->getDbFileExists();
|
||||
}
|
||||
|
@ -1048,3 +1009,4 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
}
|
||||
|
||||
class DeleteScheduledFileException extends Exception {}
|
||||
|
|
|
@ -11,11 +11,16 @@ class Application_Model_User {
|
|||
|
||||
public function __construct($userId)
|
||||
{
|
||||
if (strlen($userId)==0){
|
||||
if (empty($userId)){
|
||||
$this->_userInstance = $this->createUser();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$this->_userInstance = CcSubjsQuery::create()->findPK($userId);
|
||||
}
|
||||
|
||||
if (is_null($this->_userInstance)){
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getId() {
|
||||
|
@ -29,7 +34,20 @@ class Application_Model_User {
|
|||
public function isAdmin() {
|
||||
return $this->isUserType(UTYPE_ADMIN);
|
||||
}
|
||||
|
||||
|
||||
public function canSchedule($p_showId) {
|
||||
$type = $this->getType();
|
||||
|
||||
if ( $type === UTYPE_ADMIN ||
|
||||
$type === UTYPE_PROGRAM_MANAGER ||
|
||||
CcShowHostsQuery::create()->filterByDbShow($p_showId)->filterByDbHost($this->getId())->count() > 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isUserType($type, $showId=''){
|
||||
if(is_array($type)){
|
||||
$result = false;
|
||||
|
@ -62,99 +80,99 @@ class Application_Model_User {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function setLogin($login){
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbLogin($login);
|
||||
$user->setDbLogin($login);
|
||||
}
|
||||
|
||||
|
||||
public function setPassword($password){
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbPass(md5($password));
|
||||
$user->setDbPass(md5($password));
|
||||
}
|
||||
|
||||
|
||||
public function setFirstName($firstName){
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbFirstName($firstName);
|
||||
$user->setDbFirstName($firstName);
|
||||
}
|
||||
|
||||
|
||||
public function setLastName($lastName){
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbLastName($lastName);
|
||||
$user->setDbLastName($lastName);
|
||||
}
|
||||
|
||||
|
||||
public function setType($type){
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbType($type);
|
||||
$user->setDbType($type);
|
||||
}
|
||||
|
||||
public function setEmail($email){
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbEmail($email);
|
||||
$user->setDbEmail($email);
|
||||
}
|
||||
|
||||
public function setSkype($skype){
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbSkypeContact($skype);
|
||||
$user->setDbSkypeContact($skype);
|
||||
}
|
||||
|
||||
public function setJabber($jabber){
|
||||
$user = $this->_userInstance;
|
||||
$user->setDbJabberContact($jabber);
|
||||
$user->setDbJabberContact($jabber);
|
||||
}
|
||||
|
||||
|
||||
public function getLogin(){
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbLogin();
|
||||
}
|
||||
|
||||
return $user->getDbLogin();
|
||||
}
|
||||
|
||||
public function getPassword(){
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbPass();
|
||||
return $user->getDbPass();
|
||||
}
|
||||
|
||||
|
||||
public function getFirstName(){
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbFirstName();
|
||||
return $user->getDbFirstName();
|
||||
}
|
||||
|
||||
|
||||
public function getLastName(){
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbLastName();
|
||||
return $user->getDbLastName();
|
||||
}
|
||||
|
||||
|
||||
public function getType(){
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbType();
|
||||
return $user->getDbType();
|
||||
}
|
||||
|
||||
public function getEmail(){
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbEmail();
|
||||
return $user->getDbEmail();
|
||||
}
|
||||
|
||||
public function getSkype(){
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbSkypeContact();
|
||||
return $user->getDbSkypeContact();
|
||||
}
|
||||
|
||||
public function getJabber(){
|
||||
$user = $this->_userInstance;
|
||||
return $user->getDbJabberContact();
|
||||
|
||||
return $user->getDbJabberContact();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function save(){
|
||||
$this->_userInstance->save();
|
||||
}
|
||||
|
||||
|
||||
public function delete(){
|
||||
if (!$this->_userInstance->isDeleted())
|
||||
$this->_userInstance->delete();
|
||||
}
|
||||
|
||||
private function createUser() {
|
||||
$user = new CcSubjs();
|
||||
$user = new CcSubjs();
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
@ -165,7 +183,7 @@ class Application_Model_User {
|
|||
|
||||
$sql_gen = "SELECT login AS value, login AS label, id as index FROM cc_subjs ";
|
||||
$sql = $sql_gen;
|
||||
|
||||
|
||||
if(is_array($type)) {
|
||||
for($i=0; $i<count($type); $i++) {
|
||||
$type[$i] = "type = '{$type[$i]}'";
|
||||
|
@ -175,9 +193,9 @@ class Application_Model_User {
|
|||
else {
|
||||
$sql_type = "type = {$type}";
|
||||
}
|
||||
|
||||
|
||||
$sql = $sql_gen ." WHERE (". $sql_type.") ";
|
||||
|
||||
|
||||
if(!is_null($search)) {
|
||||
$like = "login ILIKE '%{$search}%'";
|
||||
|
||||
|
@ -185,17 +203,17 @@ class Application_Model_User {
|
|||
}
|
||||
|
||||
$sql = $sql ." ORDER BY login";
|
||||
|
||||
return $CC_DBC->GetAll($sql);
|
||||
|
||||
return $CC_DBC->GetAll($sql);
|
||||
}
|
||||
|
||||
|
||||
public static function getUserCount($type=NULL){
|
||||
global $CC_DBC;
|
||||
|
||||
$sql;
|
||||
|
||||
$sql_gen = "SELECT count(*) AS cnt FROM cc_subjs ";
|
||||
|
||||
|
||||
if(!isset($type)){
|
||||
$sql = $sql_gen;
|
||||
}
|
||||
|
@ -209,21 +227,21 @@ class Application_Model_User {
|
|||
else {
|
||||
$sql_type = "type = {$type}";
|
||||
}
|
||||
|
||||
|
||||
$sql = $sql_gen ." WHERE (". $sql_type.") ";
|
||||
}
|
||||
|
||||
|
||||
return $CC_DBC->GetOne($sql);
|
||||
}
|
||||
|
||||
public static function getHosts($search=NULL) {
|
||||
return Application_Model_User::getUsers(array('H'), $search);
|
||||
}
|
||||
|
||||
|
||||
public static function getUsersDataTablesInfo($datatables_post) {
|
||||
|
||||
$fromTable = "cc_subjs";
|
||||
|
||||
|
||||
// get current user
|
||||
$username = "";
|
||||
$auth = Zend_Auth::getInstance();
|
||||
|
@ -231,9 +249,9 @@ class Application_Model_User {
|
|||
if ($auth->hasIdentity()) {
|
||||
$username = $auth->getIdentity()->login;
|
||||
}
|
||||
|
||||
|
||||
$res = Application_Model_StoredFile::searchFiles($fromTable, $datatables_post);
|
||||
|
||||
|
||||
// mark record which is for the current user
|
||||
foreach($res['aaData'] as &$record){
|
||||
if($record['login'] == $username){
|
||||
|
@ -242,20 +260,20 @@ class Application_Model_User {
|
|||
$record['delete'] = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
public static function getUserData($id){
|
||||
global $CC_DBC;
|
||||
|
||||
|
||||
$sql = "SELECT login, first_name, last_name, type, id, email, skype_contact, jabber_contact"
|
||||
." FROM cc_subjs"
|
||||
." WHERE id = $id";
|
||||
|
||||
|
||||
return $CC_DBC->GetRow($sql);
|
||||
}
|
||||
|
||||
|
||||
public static function GetUserID($login){
|
||||
$user = CcSubjsQuery::create()->findOneByDbLogin($login);
|
||||
if (is_null($user)){
|
||||
|
@ -265,4 +283,9 @@ class Application_Model_User {
|
|||
}
|
||||
}
|
||||
|
||||
public static function GetCurrentUser() {
|
||||
$userinfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
|
||||
return new self($userinfo->id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/**
|
||||
* Skeleton subclass for representing a row from the 'cc_playlist' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
|
@ -15,34 +15,66 @@
|
|||
*/
|
||||
class CcPlaylist extends BaseCcPlaylist {
|
||||
|
||||
|
||||
public function computeLastPosition()
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [utime] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
* If format is NULL, then the raw DateTime object will be returned.
|
||||
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
|
||||
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||
*/
|
||||
public function getDbUtime($format = 'Y-m-d H:i:s')
|
||||
{
|
||||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||
if ($this->utime === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$sql = 'SELECT MAX('.CcPlaylistcontentsPeer::POSITION.') AS pos'
|
||||
. ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME
|
||||
. ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1';
|
||||
try {
|
||||
$dt = new DateTime($this->utime, new DateTimeZone("UTC"));
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->utime, true), $x);
|
||||
}
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p1', $this->getDbId());
|
||||
$stmt->execute();
|
||||
return $stmt->fetchColumn();
|
||||
if ($format === null) {
|
||||
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
|
||||
return $dt;
|
||||
} elseif (strpos($format, '%') !== false) {
|
||||
return strftime($format, $dt->format('U'));
|
||||
} else {
|
||||
return $dt->format($format);
|
||||
}
|
||||
}
|
||||
|
||||
public function computeLength()
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [mtime] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
* If format is NULL, then the raw DateTime object will be returned.
|
||||
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
|
||||
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||
*/
|
||||
public function getDbMtime($format = 'Y-m-d H:i:s')
|
||||
{
|
||||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME);
|
||||
if ($this->mtime === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$sql = 'SELECT SUM('.CcPlaylistcontentsPeer::CLIPLENGTH.') AS length'
|
||||
. ' FROM ' .CcPlaylistcontentsPeer::TABLE_NAME
|
||||
. ' WHERE ' .CcPlaylistcontentsPeer::PLAYLIST_ID. ' = :p1';
|
||||
try {
|
||||
$dt = new DateTime($this->mtime, new DateTimeZone("UTC"));
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->mtime, true), $x);
|
||||
}
|
||||
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p1', $this->getDbId());
|
||||
$stmt->execute();
|
||||
return $stmt->fetchColumn();
|
||||
if ($format === null) {
|
||||
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
|
||||
return $dt;
|
||||
} elseif (strpos($format, '%') !== false) {
|
||||
return strftime($format, $dt->format('U'));
|
||||
} else {
|
||||
return $dt->format($format);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // CcPlaylist
|
||||
|
|
|
@ -5,7 +5,7 @@ require_once('Common.php');
|
|||
/**
|
||||
* Skeleton subclass for representing a row from the 'cc_playlistcontents' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
|
@ -15,67 +15,5 @@ require_once('Common.php');
|
|||
*/
|
||||
class CcPlaylistcontents extends BaseCcPlaylistcontents {
|
||||
|
||||
public function getDbFadein()
|
||||
{
|
||||
return $this->fadein;
|
||||
}
|
||||
|
||||
public function setDbFadein($time)
|
||||
{
|
||||
$this->fadein = $time;
|
||||
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEIN;
|
||||
Common::setTimeInSub($this, 'FADEIN', $time);
|
||||
}
|
||||
|
||||
public function getDbFadeout()
|
||||
{
|
||||
return $this->fadeout;
|
||||
}
|
||||
|
||||
public function setDbFadeout($time)
|
||||
{
|
||||
$this->fadeout = $time;
|
||||
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::FADEOUT;
|
||||
Common::setTimeInSub($this, 'FADEOUT', $time);
|
||||
}
|
||||
|
||||
public function getDbCuein()
|
||||
{
|
||||
return $this->cuein;
|
||||
}
|
||||
|
||||
public function setDbCuein($time)
|
||||
{
|
||||
$this->cuein = $time;
|
||||
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
|
||||
Common::setTimeInSub($this, 'CUEIN', $time);
|
||||
}
|
||||
|
||||
public function getDbCueout()
|
||||
{
|
||||
return $this->cueout;
|
||||
}
|
||||
|
||||
public function setDbCueout($time)
|
||||
{
|
||||
$this->cueout = $time;
|
||||
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
|
||||
Common::setTimeInSub($this, 'CUEOUT', $time);
|
||||
}
|
||||
|
||||
public function getDbCliplength()
|
||||
{
|
||||
return $this->cliplength;
|
||||
}
|
||||
|
||||
public function setDbCliplength($time)
|
||||
{
|
||||
$this->cliplength = $time;
|
||||
//$this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
|
||||
Common::setTimeInSub($this, 'CLIPLENGTH', $time);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // CcPlaylistcontents
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/**
|
||||
* Skeleton subclass for representing a row from the 'cc_schedule' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
|
@ -15,4 +15,88 @@
|
|||
*/
|
||||
class CcSchedule extends BaseCcSchedule {
|
||||
|
||||
public function getDbClipLength($format = 'H:i:s.u')
|
||||
{
|
||||
if ($this->clip_length === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$dt = new DateTime($this->clip_length);
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->clip_length, true), $x);
|
||||
}
|
||||
|
||||
if ($format === null) {
|
||||
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
|
||||
return $dt;
|
||||
} elseif (strpos($format, '%') !== false) {
|
||||
return strftime($format, $dt->format('U'));
|
||||
} else {
|
||||
return $dt->format($format);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [starts] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
* If format is NULL, then the raw DateTime object will be returned.
|
||||
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
|
||||
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||
*/
|
||||
public function getDbStarts($format = 'Y-m-d H:i:s')
|
||||
{
|
||||
if ($this->starts === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$dt = new DateTime($this->starts, new DateTimeZone("UTC"));
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->starts, true), $x);
|
||||
}
|
||||
|
||||
if ($format === null) {
|
||||
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
|
||||
return $dt;
|
||||
} elseif (strpos($format, '%') !== false) {
|
||||
return strftime($format, $dt->format('U'));
|
||||
} else {
|
||||
return $dt->format($format);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [ends] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
* If format is NULL, then the raw DateTime object will be returned.
|
||||
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
|
||||
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||
*/
|
||||
public function getDbEnds($format = 'Y-m-d H:i:s')
|
||||
{
|
||||
if ($this->ends === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$dt = new DateTime($this->ends, new DateTimeZone("UTC"));
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ends, true), $x);
|
||||
}
|
||||
|
||||
if ($format === null) {
|
||||
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
|
||||
return $dt;
|
||||
} elseif (strpos($format, '%') !== false) {
|
||||
return strftime($format, $dt->format('U'));
|
||||
} else {
|
||||
return $dt->format($format);
|
||||
}
|
||||
}
|
||||
|
||||
} // CcSchedule
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/**
|
||||
* Skeleton subclass for representing a row from the 'cc_show_instances' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* You should add additional methods to this class to meet the
|
||||
* application requirements. This class will only be generated as
|
||||
|
@ -15,4 +15,65 @@
|
|||
*/
|
||||
class CcShowInstances extends BaseCcShowInstances {
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [starts] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
* If format is NULL, then the raw DateTime object will be returned.
|
||||
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
|
||||
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||
*/
|
||||
public function getDbStarts($format = 'Y-m-d H:i:s')
|
||||
{
|
||||
if ($this->starts === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$dt = new DateTime($this->starts, new DateTimeZone("UTC"));
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->starts, true), $x);
|
||||
}
|
||||
|
||||
if ($format === null) {
|
||||
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
|
||||
return $dt;
|
||||
} elseif (strpos($format, '%') !== false) {
|
||||
return strftime($format, $dt->format('U'));
|
||||
} else {
|
||||
return $dt->format($format);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [ends] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
* If format is NULL, then the raw DateTime object will be returned.
|
||||
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
|
||||
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||
*/
|
||||
public function getDbEnds($format = 'Y-m-d H:i:s')
|
||||
{
|
||||
if ($this->ends === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
$dt = new DateTime($this->ends, new DateTimeZone("UTC"));
|
||||
} catch (Exception $x) {
|
||||
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ends, true), $x);
|
||||
}
|
||||
|
||||
if ($format === null) {
|
||||
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
|
||||
return $dt;
|
||||
} elseif (strpos($format, '%') !== false) {
|
||||
return strftime($format, $dt->format('U'));
|
||||
} else {
|
||||
return $dt->format($format);
|
||||
}
|
||||
}
|
||||
} // CcShowInstances
|
||||
|
|
|
@ -40,14 +40,12 @@ class CcPlaylistTableMap extends TableMap {
|
|||
// columns
|
||||
$this->addPrimaryKey('ID', 'DbId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('NAME', 'DbName', 'VARCHAR', true, 255, '');
|
||||
$this->addColumn('STATE', 'DbState', 'VARCHAR', true, 128, 'empty');
|
||||
$this->addColumn('CURRENTLYACCESSING', 'DbCurrentlyaccessing', 'INTEGER', true, null, 0);
|
||||
$this->addForeignKey('EDITEDBY', 'DbEditedby', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
|
||||
$this->addColumn('MTIME', 'DbMtime', 'TIMESTAMP', false, 6, null);
|
||||
$this->addColumn('UTIME', 'DbUtime', 'TIMESTAMP', false, 6, null);
|
||||
$this->addColumn('LPTIME', 'DbLPtime', 'TIMESTAMP', false, 6, null);
|
||||
$this->addColumn('CREATOR', 'DbCreator', 'VARCHAR', false, 32, null);
|
||||
$this->addForeignKey('CREATOR_ID', 'DbCreatorId', 'INTEGER', 'cc_subjs', 'ID', false, null, null);
|
||||
$this->addColumn('DESCRIPTION', 'DbDescription', 'VARCHAR', false, 512, null);
|
||||
$this->addColumn('LENGTH', 'DbLength', 'VARCHAR', false, null, '00:00:00');
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
|
@ -56,8 +54,21 @@ class CcPlaylistTableMap extends TableMap {
|
|||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('editedby' => 'id', ), null, null);
|
||||
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), null, null);
|
||||
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'playlist_id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'aggregate_column' => array('name' => 'length', 'expression' => 'SUM(cliplength)', 'foreign_table' => 'cc_playlistcontents', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
} // CcPlaylistTableMap
|
||||
|
|
|
@ -59,4 +59,17 @@ class CcPlaylistcontentsTableMap extends TableMap {
|
|||
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::MANY_TO_ONE, array('playlist_id' => 'id', ), 'CASCADE', null);
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'aggregate_column_relation' => array('foreign_table' => 'cc_playlist', 'update_method' => 'updateDbLength', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
} // CcPlaylistcontentsTableMap
|
||||
|
|
|
@ -62,7 +62,7 @@ class CcSubjsTableMap extends TableMap {
|
|||
$this->addRelation('CcFiles', 'CcFiles', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null);
|
||||
$this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null);
|
||||
$this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'subjs_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'editedby', ), null, null);
|
||||
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), null, null);
|
||||
$this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null);
|
||||
$this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null);
|
||||
$this->addRelation('CcSubjsToken', 'CcSubjsToken', RelationMap::ONE_TO_MANY, array('id' => 'user_id', ), 'CASCADE', null);
|
||||
|
|
|
@ -37,26 +37,6 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* The value for the state field.
|
||||
* Note: this column has a database default value of: 'empty'
|
||||
* @var string
|
||||
*/
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* The value for the currentlyaccessing field.
|
||||
* Note: this column has a database default value of: 0
|
||||
* @var int
|
||||
*/
|
||||
protected $currentlyaccessing;
|
||||
|
||||
/**
|
||||
* The value for the editedby field.
|
||||
* @var int
|
||||
*/
|
||||
protected $editedby;
|
||||
|
||||
/**
|
||||
* The value for the mtime field.
|
||||
* @var string
|
||||
|
@ -76,10 +56,10 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
protected $lptime;
|
||||
|
||||
/**
|
||||
* The value for the creator field.
|
||||
* @var string
|
||||
* The value for the creator_id field.
|
||||
* @var int
|
||||
*/
|
||||
protected $creator;
|
||||
protected $creator_id;
|
||||
|
||||
/**
|
||||
* The value for the description field.
|
||||
|
@ -87,6 +67,13 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* The value for the length field.
|
||||
* Note: this column has a database default value of: '00:00:00'
|
||||
* @var string
|
||||
*/
|
||||
protected $length;
|
||||
|
||||
/**
|
||||
* @var CcSubjs
|
||||
*/
|
||||
|
@ -120,8 +107,7 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
public function applyDefaultValues()
|
||||
{
|
||||
$this->name = '';
|
||||
$this->state = 'empty';
|
||||
$this->currentlyaccessing = 0;
|
||||
$this->length = '00:00:00';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,36 +140,6 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [state] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDbState()
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [currentlyaccessing] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbCurrentlyaccessing()
|
||||
{
|
||||
return $this->currentlyaccessing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [editedby] column value.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDbEditedby()
|
||||
{
|
||||
return $this->editedby;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [mtime] column value.
|
||||
*
|
||||
|
@ -284,13 +240,13 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the [creator] column value.
|
||||
* Get the [creator_id] column value.
|
||||
*
|
||||
* @return string
|
||||
* @return int
|
||||
*/
|
||||
public function getDbCreator()
|
||||
public function getDbCreatorId()
|
||||
{
|
||||
return $this->creator;
|
||||
return $this->creator_id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -303,6 +259,16 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [length] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDbLength()
|
||||
{
|
||||
return $this->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
|
@ -343,70 +309,6 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
return $this;
|
||||
} // setDbName()
|
||||
|
||||
/**
|
||||
* Set the value of [state] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return CcPlaylist The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbState($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->state !== $v || $this->isNew()) {
|
||||
$this->state = $v;
|
||||
$this->modifiedColumns[] = CcPlaylistPeer::STATE;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbState()
|
||||
|
||||
/**
|
||||
* Set the value of [currentlyaccessing] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcPlaylist The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbCurrentlyaccessing($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->currentlyaccessing !== $v || $this->isNew()) {
|
||||
$this->currentlyaccessing = $v;
|
||||
$this->modifiedColumns[] = CcPlaylistPeer::CURRENTLYACCESSING;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbCurrentlyaccessing()
|
||||
|
||||
/**
|
||||
* Set the value of [editedby] column.
|
||||
*
|
||||
* @param int $v new value
|
||||
* @return CcPlaylist The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbEditedby($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->editedby !== $v) {
|
||||
$this->editedby = $v;
|
||||
$this->modifiedColumns[] = CcPlaylistPeer::EDITEDBY;
|
||||
}
|
||||
|
||||
if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) {
|
||||
$this->aCcSubjs = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbEditedby()
|
||||
|
||||
/**
|
||||
* Sets the value of [mtime] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
|
@ -555,24 +457,28 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
} // setDbLPtime()
|
||||
|
||||
/**
|
||||
* Set the value of [creator] column.
|
||||
* Set the value of [creator_id] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @param int $v new value
|
||||
* @return CcPlaylist The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbCreator($v)
|
||||
public function setDbCreatorId($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
$v = (int) $v;
|
||||
}
|
||||
|
||||
if ($this->creator !== $v) {
|
||||
$this->creator = $v;
|
||||
$this->modifiedColumns[] = CcPlaylistPeer::CREATOR;
|
||||
if ($this->creator_id !== $v) {
|
||||
$this->creator_id = $v;
|
||||
$this->modifiedColumns[] = CcPlaylistPeer::CREATOR_ID;
|
||||
}
|
||||
|
||||
if ($this->aCcSubjs !== null && $this->aCcSubjs->getDbId() !== $v) {
|
||||
$this->aCcSubjs = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbCreator()
|
||||
} // setDbCreatorId()
|
||||
|
||||
/**
|
||||
* Set the value of [description] column.
|
||||
|
@ -594,6 +500,26 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
return $this;
|
||||
} // setDbDescription()
|
||||
|
||||
/**
|
||||
* Set the value of [length] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return CcPlaylist The current object (for fluent API support)
|
||||
*/
|
||||
public function setDbLength($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->length !== $v || $this->isNew()) {
|
||||
$this->length = $v;
|
||||
$this->modifiedColumns[] = CcPlaylistPeer::LENGTH;
|
||||
}
|
||||
|
||||
return $this;
|
||||
} // setDbLength()
|
||||
|
||||
/**
|
||||
* Indicates whether the columns in this object are only set to default values.
|
||||
*
|
||||
|
@ -608,11 +534,7 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->state !== 'empty') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->currentlyaccessing !== 0) {
|
||||
if ($this->length !== '00:00:00') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -640,14 +562,12 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
|
||||
$this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
|
||||
$this->name = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
|
||||
$this->state = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
|
||||
$this->currentlyaccessing = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
|
||||
$this->editedby = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
|
||||
$this->mtime = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
|
||||
$this->utime = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
|
||||
$this->lptime = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
|
||||
$this->creator = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
|
||||
$this->description = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
|
||||
$this->mtime = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
|
||||
$this->utime = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
|
||||
$this->lptime = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
|
||||
$this->creator_id = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
|
||||
$this->description = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
|
||||
$this->length = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
@ -656,7 +576,7 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 10; // 10 = CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 8; // 8 = CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating CcPlaylist object", $e);
|
||||
|
@ -679,7 +599,7 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
public function ensureConsistency()
|
||||
{
|
||||
|
||||
if ($this->aCcSubjs !== null && $this->editedby !== $this->aCcSubjs->getDbId()) {
|
||||
if ($this->aCcSubjs !== null && $this->creator_id !== $this->aCcSubjs->getDbId()) {
|
||||
$this->aCcSubjs = null;
|
||||
}
|
||||
} // ensureConsistency
|
||||
|
@ -1008,29 +928,23 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
return $this->getDbName();
|
||||
break;
|
||||
case 2:
|
||||
return $this->getDbState();
|
||||
break;
|
||||
case 3:
|
||||
return $this->getDbCurrentlyaccessing();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getDbEditedby();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getDbMtime();
|
||||
break;
|
||||
case 6:
|
||||
case 3:
|
||||
return $this->getDbUtime();
|
||||
break;
|
||||
case 7:
|
||||
case 4:
|
||||
return $this->getDbLPtime();
|
||||
break;
|
||||
case 8:
|
||||
return $this->getDbCreator();
|
||||
case 5:
|
||||
return $this->getDbCreatorId();
|
||||
break;
|
||||
case 9:
|
||||
case 6:
|
||||
return $this->getDbDescription();
|
||||
break;
|
||||
case 7:
|
||||
return $this->getDbLength();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
|
@ -1057,14 +971,12 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
$result = array(
|
||||
$keys[0] => $this->getDbId(),
|
||||
$keys[1] => $this->getDbName(),
|
||||
$keys[2] => $this->getDbState(),
|
||||
$keys[3] => $this->getDbCurrentlyaccessing(),
|
||||
$keys[4] => $this->getDbEditedby(),
|
||||
$keys[5] => $this->getDbMtime(),
|
||||
$keys[6] => $this->getDbUtime(),
|
||||
$keys[7] => $this->getDbLPtime(),
|
||||
$keys[8] => $this->getDbCreator(),
|
||||
$keys[9] => $this->getDbDescription(),
|
||||
$keys[2] => $this->getDbMtime(),
|
||||
$keys[3] => $this->getDbUtime(),
|
||||
$keys[4] => $this->getDbLPtime(),
|
||||
$keys[5] => $this->getDbCreatorId(),
|
||||
$keys[6] => $this->getDbDescription(),
|
||||
$keys[7] => $this->getDbLength(),
|
||||
);
|
||||
if ($includeForeignObjects) {
|
||||
if (null !== $this->aCcSubjs) {
|
||||
|
@ -1108,29 +1020,23 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
$this->setDbName($value);
|
||||
break;
|
||||
case 2:
|
||||
$this->setDbState($value);
|
||||
break;
|
||||
case 3:
|
||||
$this->setDbCurrentlyaccessing($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setDbEditedby($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setDbMtime($value);
|
||||
break;
|
||||
case 6:
|
||||
case 3:
|
||||
$this->setDbUtime($value);
|
||||
break;
|
||||
case 7:
|
||||
case 4:
|
||||
$this->setDbLPtime($value);
|
||||
break;
|
||||
case 8:
|
||||
$this->setDbCreator($value);
|
||||
case 5:
|
||||
$this->setDbCreatorId($value);
|
||||
break;
|
||||
case 9:
|
||||
case 6:
|
||||
$this->setDbDescription($value);
|
||||
break;
|
||||
case 7:
|
||||
$this->setDbLength($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
|
@ -1157,14 +1063,12 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
|
||||
if (array_key_exists($keys[0], $arr)) $this->setDbId($arr[$keys[0]]);
|
||||
if (array_key_exists($keys[1], $arr)) $this->setDbName($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setDbState($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setDbCurrentlyaccessing($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setDbEditedby($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setDbMtime($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setDbUtime($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setDbLPtime($arr[$keys[7]]);
|
||||
if (array_key_exists($keys[8], $arr)) $this->setDbCreator($arr[$keys[8]]);
|
||||
if (array_key_exists($keys[9], $arr)) $this->setDbDescription($arr[$keys[9]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setDbMtime($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setDbUtime($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setDbLPtime($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setDbCreatorId($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setDbDescription($arr[$keys[6]]);
|
||||
if (array_key_exists($keys[7], $arr)) $this->setDbLength($arr[$keys[7]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1178,14 +1082,12 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
|
||||
if ($this->isColumnModified(CcPlaylistPeer::ID)) $criteria->add(CcPlaylistPeer::ID, $this->id);
|
||||
if ($this->isColumnModified(CcPlaylistPeer::NAME)) $criteria->add(CcPlaylistPeer::NAME, $this->name);
|
||||
if ($this->isColumnModified(CcPlaylistPeer::STATE)) $criteria->add(CcPlaylistPeer::STATE, $this->state);
|
||||
if ($this->isColumnModified(CcPlaylistPeer::CURRENTLYACCESSING)) $criteria->add(CcPlaylistPeer::CURRENTLYACCESSING, $this->currentlyaccessing);
|
||||
if ($this->isColumnModified(CcPlaylistPeer::EDITEDBY)) $criteria->add(CcPlaylistPeer::EDITEDBY, $this->editedby);
|
||||
if ($this->isColumnModified(CcPlaylistPeer::MTIME)) $criteria->add(CcPlaylistPeer::MTIME, $this->mtime);
|
||||
if ($this->isColumnModified(CcPlaylistPeer::UTIME)) $criteria->add(CcPlaylistPeer::UTIME, $this->utime);
|
||||
if ($this->isColumnModified(CcPlaylistPeer::LPTIME)) $criteria->add(CcPlaylistPeer::LPTIME, $this->lptime);
|
||||
if ($this->isColumnModified(CcPlaylistPeer::CREATOR)) $criteria->add(CcPlaylistPeer::CREATOR, $this->creator);
|
||||
if ($this->isColumnModified(CcPlaylistPeer::CREATOR_ID)) $criteria->add(CcPlaylistPeer::CREATOR_ID, $this->creator_id);
|
||||
if ($this->isColumnModified(CcPlaylistPeer::DESCRIPTION)) $criteria->add(CcPlaylistPeer::DESCRIPTION, $this->description);
|
||||
if ($this->isColumnModified(CcPlaylistPeer::LENGTH)) $criteria->add(CcPlaylistPeer::LENGTH, $this->length);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
|
@ -1248,14 +1150,12 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
public function copyInto($copyObj, $deepCopy = false)
|
||||
{
|
||||
$copyObj->setDbName($this->name);
|
||||
$copyObj->setDbState($this->state);
|
||||
$copyObj->setDbCurrentlyaccessing($this->currentlyaccessing);
|
||||
$copyObj->setDbEditedby($this->editedby);
|
||||
$copyObj->setDbMtime($this->mtime);
|
||||
$copyObj->setDbUtime($this->utime);
|
||||
$copyObj->setDbLPtime($this->lptime);
|
||||
$copyObj->setDbCreator($this->creator);
|
||||
$copyObj->setDbCreatorId($this->creator_id);
|
||||
$copyObj->setDbDescription($this->description);
|
||||
$copyObj->setDbLength($this->length);
|
||||
|
||||
if ($deepCopy) {
|
||||
// important: temporarily setNew(false) because this affects the behavior of
|
||||
|
@ -1323,9 +1223,9 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
public function setCcSubjs(CcSubjs $v = null)
|
||||
{
|
||||
if ($v === null) {
|
||||
$this->setDbEditedby(NULL);
|
||||
$this->setDbCreatorId(NULL);
|
||||
} else {
|
||||
$this->setDbEditedby($v->getDbId());
|
||||
$this->setDbCreatorId($v->getDbId());
|
||||
}
|
||||
|
||||
$this->aCcSubjs = $v;
|
||||
|
@ -1349,8 +1249,8 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
*/
|
||||
public function getCcSubjs(PropelPDO $con = null)
|
||||
{
|
||||
if ($this->aCcSubjs === null && ($this->editedby !== null)) {
|
||||
$this->aCcSubjs = CcSubjsQuery::create()->findPk($this->editedby, $con);
|
||||
if ($this->aCcSubjs === null && ($this->creator_id !== null)) {
|
||||
$this->aCcSubjs = CcSubjsQuery::create()->findPk($this->creator_id, $con);
|
||||
/* The following can be used additionally to
|
||||
guarantee the related object contains a reference
|
||||
to this object. This level of coupling may, however, be
|
||||
|
@ -1503,14 +1403,12 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
{
|
||||
$this->id = null;
|
||||
$this->name = null;
|
||||
$this->state = null;
|
||||
$this->currentlyaccessing = null;
|
||||
$this->editedby = null;
|
||||
$this->mtime = null;
|
||||
$this->utime = null;
|
||||
$this->lptime = null;
|
||||
$this->creator = null;
|
||||
$this->creator_id = null;
|
||||
$this->description = null;
|
||||
$this->length = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->alreadyInValidation = false;
|
||||
$this->clearAllReferences();
|
||||
|
@ -1543,6 +1441,34 @@ abstract class BaseCcPlaylist extends BaseObject implements Persistent
|
|||
$this->aCcSubjs = null;
|
||||
}
|
||||
|
||||
// aggregate_column behavior
|
||||
|
||||
/**
|
||||
* Computes the value of the aggregate column length
|
||||
*
|
||||
* @param PropelPDO $con A connection object
|
||||
*
|
||||
* @return mixed The scalar result from the aggregate query
|
||||
*/
|
||||
public function computeDbLength(PropelPDO $con)
|
||||
{
|
||||
$stmt = $con->prepare('SELECT SUM(cliplength) FROM "cc_playlistcontents" WHERE cc_playlistcontents.PLAYLIST_ID = :p1');
|
||||
$stmt->bindValue(':p1', $this->getDbId());
|
||||
$stmt->execute();
|
||||
return $stmt->fetchColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the aggregate column length
|
||||
*
|
||||
* @param PropelPDO $con A connection object
|
||||
*/
|
||||
public function updateDbLength(PropelPDO $con)
|
||||
{
|
||||
$this->setDbLength($this->computeDbLength($con));
|
||||
$this->save($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Catches calls to virtual methods
|
||||
*/
|
||||
|
|
|
@ -26,7 +26,7 @@ abstract class BaseCcPlaylistPeer {
|
|||
const TM_CLASS = 'CcPlaylistTableMap';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 10;
|
||||
const NUM_COLUMNS = 8;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
|
@ -37,15 +37,6 @@ abstract class BaseCcPlaylistPeer {
|
|||
/** the column name for the NAME field */
|
||||
const NAME = 'cc_playlist.NAME';
|
||||
|
||||
/** the column name for the STATE field */
|
||||
const STATE = 'cc_playlist.STATE';
|
||||
|
||||
/** the column name for the CURRENTLYACCESSING field */
|
||||
const CURRENTLYACCESSING = 'cc_playlist.CURRENTLYACCESSING';
|
||||
|
||||
/** the column name for the EDITEDBY field */
|
||||
const EDITEDBY = 'cc_playlist.EDITEDBY';
|
||||
|
||||
/** the column name for the MTIME field */
|
||||
const MTIME = 'cc_playlist.MTIME';
|
||||
|
||||
|
@ -55,12 +46,15 @@ abstract class BaseCcPlaylistPeer {
|
|||
/** the column name for the LPTIME field */
|
||||
const LPTIME = 'cc_playlist.LPTIME';
|
||||
|
||||
/** the column name for the CREATOR field */
|
||||
const CREATOR = 'cc_playlist.CREATOR';
|
||||
/** the column name for the CREATOR_ID field */
|
||||
const CREATOR_ID = 'cc_playlist.CREATOR_ID';
|
||||
|
||||
/** the column name for the DESCRIPTION field */
|
||||
const DESCRIPTION = 'cc_playlist.DESCRIPTION';
|
||||
|
||||
/** the column name for the LENGTH field */
|
||||
const LENGTH = 'cc_playlist.LENGTH';
|
||||
|
||||
/**
|
||||
* An identiy map to hold any loaded instances of CcPlaylist objects.
|
||||
* This must be public so that other peer classes can access this when hydrating from JOIN
|
||||
|
@ -77,12 +71,12 @@ abstract class BaseCcPlaylistPeer {
|
|||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbState', 'DbCurrentlyaccessing', 'DbEditedby', 'DbMtime', 'DbUtime', 'DbLPtime', 'DbCreator', 'DbDescription', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbState', 'dbCurrentlyaccessing', 'dbEditedby', 'dbMtime', 'dbUtime', 'dbLPtime', 'dbCreator', 'dbDescription', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::STATE, self::CURRENTLYACCESSING, self::EDITEDBY, self::MTIME, self::UTIME, self::LPTIME, self::CREATOR, self::DESCRIPTION, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'STATE', 'CURRENTLYACCESSING', 'EDITEDBY', 'MTIME', 'UTIME', 'LPTIME', 'CREATOR', 'DESCRIPTION', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'state', 'currentlyaccessing', 'editedby', 'mtime', 'utime', 'lptime', 'creator', 'description', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbMtime', 'DbUtime', 'DbLPtime', 'DbCreatorId', 'DbDescription', 'DbLength', ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbMtime', 'dbUtime', 'dbLPtime', 'dbCreatorId', 'dbDescription', 'dbLength', ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::MTIME, self::UTIME, self::LPTIME, self::CREATOR_ID, self::DESCRIPTION, self::LENGTH, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'MTIME', 'UTIME', 'LPTIME', 'CREATOR_ID', 'DESCRIPTION', 'LENGTH', ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'mtime', 'utime', 'lptime', 'creator_id', 'description', 'length', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -92,12 +86,12 @@ abstract class BaseCcPlaylistPeer {
|
|||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbState' => 2, 'DbCurrentlyaccessing' => 3, 'DbEditedby' => 4, 'DbMtime' => 5, 'DbUtime' => 6, 'DbLPtime' => 7, 'DbCreator' => 8, 'DbDescription' => 9, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbState' => 2, 'dbCurrentlyaccessing' => 3, 'dbEditedby' => 4, 'dbMtime' => 5, 'dbUtime' => 6, 'dbLPtime' => 7, 'dbCreator' => 8, 'dbDescription' => 9, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::STATE => 2, self::CURRENTLYACCESSING => 3, self::EDITEDBY => 4, self::MTIME => 5, self::UTIME => 6, self::LPTIME => 7, self::CREATOR => 8, self::DESCRIPTION => 9, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'STATE' => 2, 'CURRENTLYACCESSING' => 3, 'EDITEDBY' => 4, 'MTIME' => 5, 'UTIME' => 6, 'LPTIME' => 7, 'CREATOR' => 8, 'DESCRIPTION' => 9, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'state' => 2, 'currentlyaccessing' => 3, 'editedby' => 4, 'mtime' => 5, 'utime' => 6, 'lptime' => 7, 'creator' => 8, 'description' => 9, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbMtime' => 2, 'DbUtime' => 3, 'DbLPtime' => 4, 'DbCreatorId' => 5, 'DbDescription' => 6, 'DbLength' => 7, ),
|
||||
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbMtime' => 2, 'dbUtime' => 3, 'dbLPtime' => 4, 'dbCreatorId' => 5, 'dbDescription' => 6, 'dbLength' => 7, ),
|
||||
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::MTIME => 2, self::UTIME => 3, self::LPTIME => 4, self::CREATOR_ID => 5, self::DESCRIPTION => 6, self::LENGTH => 7, ),
|
||||
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'MTIME' => 2, 'UTIME' => 3, 'LPTIME' => 4, 'CREATOR_ID' => 5, 'DESCRIPTION' => 6, 'LENGTH' => 7, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'mtime' => 2, 'utime' => 3, 'lptime' => 4, 'creator_id' => 5, 'description' => 6, 'length' => 7, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, )
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -171,25 +165,21 @@ abstract class BaseCcPlaylistPeer {
|
|||
if (null === $alias) {
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::ID);
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::NAME);
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::STATE);
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::CURRENTLYACCESSING);
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::EDITEDBY);
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::MTIME);
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::UTIME);
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::LPTIME);
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::CREATOR);
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::CREATOR_ID);
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::DESCRIPTION);
|
||||
$criteria->addSelectColumn(CcPlaylistPeer::LENGTH);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.NAME');
|
||||
$criteria->addSelectColumn($alias . '.STATE');
|
||||
$criteria->addSelectColumn($alias . '.CURRENTLYACCESSING');
|
||||
$criteria->addSelectColumn($alias . '.EDITEDBY');
|
||||
$criteria->addSelectColumn($alias . '.MTIME');
|
||||
$criteria->addSelectColumn($alias . '.UTIME');
|
||||
$criteria->addSelectColumn($alias . '.LPTIME');
|
||||
$criteria->addSelectColumn($alias . '.CREATOR');
|
||||
$criteria->addSelectColumn($alias . '.CREATOR_ID');
|
||||
$criteria->addSelectColumn($alias . '.DESCRIPTION');
|
||||
$criteria->addSelectColumn($alias . '.LENGTH');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -514,7 +504,7 @@ abstract class BaseCcPlaylistPeer {
|
|||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
|
||||
$criteria->addJoin(CcPlaylistPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doCount($criteria, $con);
|
||||
|
||||
|
@ -550,7 +540,7 @@ abstract class BaseCcPlaylistPeer {
|
|||
$startcol = (CcPlaylistPeer::NUM_COLUMNS - CcPlaylistPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||
CcSubjsPeer::addSelectColumns($criteria);
|
||||
|
||||
$criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
|
||||
$criteria->addJoin(CcPlaylistPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
@ -630,7 +620,7 @@ abstract class BaseCcPlaylistPeer {
|
|||
$con = Propel::getConnection(CcPlaylistPeer::DATABASE_NAME, Propel::CONNECTION_READ);
|
||||
}
|
||||
|
||||
$criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
|
||||
$criteria->addJoin(CcPlaylistPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doCount($criteria, $con);
|
||||
|
||||
|
@ -668,7 +658,7 @@ abstract class BaseCcPlaylistPeer {
|
|||
CcSubjsPeer::addSelectColumns($criteria);
|
||||
$startcol3 = $startcol2 + (CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS);
|
||||
|
||||
$criteria->addJoin(CcPlaylistPeer::EDITEDBY, CcSubjsPeer::ID, $join_behavior);
|
||||
$criteria->addJoin(CcPlaylistPeer::CREATOR_ID, CcSubjsPeer::ID, $join_behavior);
|
||||
|
||||
$stmt = BasePeer::doSelect($criteria, $con);
|
||||
$results = array();
|
||||
|
|
|
@ -8,25 +8,21 @@
|
|||
*
|
||||
* @method CcPlaylistQuery orderByDbId($order = Criteria::ASC) Order by the id column
|
||||
* @method CcPlaylistQuery orderByDbName($order = Criteria::ASC) Order by the name column
|
||||
* @method CcPlaylistQuery orderByDbState($order = Criteria::ASC) Order by the state column
|
||||
* @method CcPlaylistQuery orderByDbCurrentlyaccessing($order = Criteria::ASC) Order by the currentlyaccessing column
|
||||
* @method CcPlaylistQuery orderByDbEditedby($order = Criteria::ASC) Order by the editedby column
|
||||
* @method CcPlaylistQuery orderByDbMtime($order = Criteria::ASC) Order by the mtime column
|
||||
* @method CcPlaylistQuery orderByDbUtime($order = Criteria::ASC) Order by the utime column
|
||||
* @method CcPlaylistQuery orderByDbLPtime($order = Criteria::ASC) Order by the lptime column
|
||||
* @method CcPlaylistQuery orderByDbCreator($order = Criteria::ASC) Order by the creator column
|
||||
* @method CcPlaylistQuery orderByDbCreatorId($order = Criteria::ASC) Order by the creator_id column
|
||||
* @method CcPlaylistQuery orderByDbDescription($order = Criteria::ASC) Order by the description column
|
||||
* @method CcPlaylistQuery orderByDbLength($order = Criteria::ASC) Order by the length column
|
||||
*
|
||||
* @method CcPlaylistQuery groupByDbId() Group by the id column
|
||||
* @method CcPlaylistQuery groupByDbName() Group by the name column
|
||||
* @method CcPlaylistQuery groupByDbState() Group by the state column
|
||||
* @method CcPlaylistQuery groupByDbCurrentlyaccessing() Group by the currentlyaccessing column
|
||||
* @method CcPlaylistQuery groupByDbEditedby() Group by the editedby column
|
||||
* @method CcPlaylistQuery groupByDbMtime() Group by the mtime column
|
||||
* @method CcPlaylistQuery groupByDbUtime() Group by the utime column
|
||||
* @method CcPlaylistQuery groupByDbLPtime() Group by the lptime column
|
||||
* @method CcPlaylistQuery groupByDbCreator() Group by the creator column
|
||||
* @method CcPlaylistQuery groupByDbCreatorId() Group by the creator_id column
|
||||
* @method CcPlaylistQuery groupByDbDescription() Group by the description column
|
||||
* @method CcPlaylistQuery groupByDbLength() Group by the length column
|
||||
*
|
||||
* @method CcPlaylistQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method CcPlaylistQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
|
@ -45,25 +41,21 @@
|
|||
*
|
||||
* @method CcPlaylist findOneByDbId(int $id) Return the first CcPlaylist filtered by the id column
|
||||
* @method CcPlaylist findOneByDbName(string $name) Return the first CcPlaylist filtered by the name column
|
||||
* @method CcPlaylist findOneByDbState(string $state) Return the first CcPlaylist filtered by the state column
|
||||
* @method CcPlaylist findOneByDbCurrentlyaccessing(int $currentlyaccessing) Return the first CcPlaylist filtered by the currentlyaccessing column
|
||||
* @method CcPlaylist findOneByDbEditedby(int $editedby) Return the first CcPlaylist filtered by the editedby column
|
||||
* @method CcPlaylist findOneByDbMtime(string $mtime) Return the first CcPlaylist filtered by the mtime column
|
||||
* @method CcPlaylist findOneByDbUtime(string $utime) Return the first CcPlaylist filtered by the utime column
|
||||
* @method CcPlaylist findOneByDbLPtime(string $lptime) Return the first CcPlaylist filtered by the lptime column
|
||||
* @method CcPlaylist findOneByDbCreator(string $creator) Return the first CcPlaylist filtered by the creator column
|
||||
* @method CcPlaylist findOneByDbCreatorId(int $creator_id) Return the first CcPlaylist filtered by the creator_id column
|
||||
* @method CcPlaylist findOneByDbDescription(string $description) Return the first CcPlaylist filtered by the description column
|
||||
* @method CcPlaylist findOneByDbLength(string $length) Return the first CcPlaylist filtered by the length column
|
||||
*
|
||||
* @method array findByDbId(int $id) Return CcPlaylist objects filtered by the id column
|
||||
* @method array findByDbName(string $name) Return CcPlaylist objects filtered by the name column
|
||||
* @method array findByDbState(string $state) Return CcPlaylist objects filtered by the state column
|
||||
* @method array findByDbCurrentlyaccessing(int $currentlyaccessing) Return CcPlaylist objects filtered by the currentlyaccessing column
|
||||
* @method array findByDbEditedby(int $editedby) Return CcPlaylist objects filtered by the editedby column
|
||||
* @method array findByDbMtime(string $mtime) Return CcPlaylist objects filtered by the mtime column
|
||||
* @method array findByDbUtime(string $utime) Return CcPlaylist objects filtered by the utime column
|
||||
* @method array findByDbLPtime(string $lptime) Return CcPlaylist objects filtered by the lptime column
|
||||
* @method array findByDbCreator(string $creator) Return CcPlaylist objects filtered by the creator column
|
||||
* @method array findByDbCreatorId(int $creator_id) Return CcPlaylist objects filtered by the creator_id column
|
||||
* @method array findByDbDescription(string $description) Return CcPlaylist objects filtered by the description column
|
||||
* @method array findByDbLength(string $length) Return CcPlaylist objects filtered by the length column
|
||||
*
|
||||
* @package propel.generator.airtime.om
|
||||
*/
|
||||
|
@ -212,90 +204,6 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
|
|||
return $this->addUsingAlias(CcPlaylistPeer::NAME, $dbName, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the state column
|
||||
*
|
||||
* @param string $dbState The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcPlaylistQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbState($dbState = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($dbState)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $dbState)) {
|
||||
$dbState = str_replace('*', '%', $dbState);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcPlaylistPeer::STATE, $dbState, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the currentlyaccessing column
|
||||
*
|
||||
* @param int|array $dbCurrentlyaccessing The value to use as filter.
|
||||
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcPlaylistQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbCurrentlyaccessing($dbCurrentlyaccessing = null, $comparison = null)
|
||||
{
|
||||
if (is_array($dbCurrentlyaccessing)) {
|
||||
$useMinMax = false;
|
||||
if (isset($dbCurrentlyaccessing['min'])) {
|
||||
$this->addUsingAlias(CcPlaylistPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbCurrentlyaccessing['max'])) {
|
||||
$this->addUsingAlias(CcPlaylistPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcPlaylistPeer::CURRENTLYACCESSING, $dbCurrentlyaccessing, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the editedby column
|
||||
*
|
||||
* @param int|array $dbEditedby The value to use as filter.
|
||||
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcPlaylistQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbEditedby($dbEditedby = null, $comparison = null)
|
||||
{
|
||||
if (is_array($dbEditedby)) {
|
||||
$useMinMax = false;
|
||||
if (isset($dbEditedby['min'])) {
|
||||
$this->addUsingAlias(CcPlaylistPeer::EDITEDBY, $dbEditedby['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbEditedby['max'])) {
|
||||
$this->addUsingAlias(CcPlaylistPeer::EDITEDBY, $dbEditedby['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcPlaylistPeer::EDITEDBY, $dbEditedby, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the mtime column
|
||||
*
|
||||
|
@ -390,25 +298,34 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
|
|||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the creator column
|
||||
* Filter the query on the creator_id column
|
||||
*
|
||||
* @param string $dbCreator The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param int|array $dbCreatorId The value to use as filter.
|
||||
* Accepts an associative array('min' => $minValue, 'max' => $maxValue)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcPlaylistQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbCreator($dbCreator = null, $comparison = null)
|
||||
public function filterByDbCreatorId($dbCreatorId = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($dbCreator)) {
|
||||
if (is_array($dbCreatorId)) {
|
||||
$useMinMax = false;
|
||||
if (isset($dbCreatorId['min'])) {
|
||||
$this->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $dbCreatorId['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($dbCreatorId['max'])) {
|
||||
$this->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $dbCreatorId['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $dbCreator)) {
|
||||
$dbCreator = str_replace('*', '%', $dbCreator);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcPlaylistPeer::CREATOR, $dbCreator, $comparison);
|
||||
return $this->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $dbCreatorId, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -433,6 +350,28 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
|
|||
return $this->addUsingAlias(CcPlaylistPeer::DESCRIPTION, $dbDescription, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the length column
|
||||
*
|
||||
* @param string $dbLength The value to use as filter.
|
||||
* Accepts wildcards (* and % trigger a LIKE)
|
||||
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
|
||||
*
|
||||
* @return CcPlaylistQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByDbLength($dbLength = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($dbLength)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $dbLength)) {
|
||||
$dbLength = str_replace('*', '%', $dbLength);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
return $this->addUsingAlias(CcPlaylistPeer::LENGTH, $dbLength, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query by a related CcSubjs object
|
||||
*
|
||||
|
@ -444,7 +383,7 @@ abstract class BaseCcPlaylistQuery extends ModelCriteria
|
|||
public function filterByCcSubjs($ccSubjs, $comparison = null)
|
||||
{
|
||||
return $this
|
||||
->addUsingAlias(CcPlaylistPeer::EDITEDBY, $ccSubjs->getDbId(), $comparison);
|
||||
->addUsingAlias(CcPlaylistPeer::CREATOR_ID, $ccSubjs->getDbId(), $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -107,6 +107,9 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
*/
|
||||
protected $alreadyInValidation = false;
|
||||
|
||||
// aggregate_column_relation behavior
|
||||
protected $oldCcPlaylist;
|
||||
|
||||
/**
|
||||
* Applies default values to this object.
|
||||
* This method should be called from the object's constructor (or
|
||||
|
@ -895,6 +898,8 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
$this->postUpdate($con);
|
||||
}
|
||||
$this->postSave($con);
|
||||
// aggregate_column_relation behavior
|
||||
$this->updateRelatedCcPlaylist($con);
|
||||
CcPlaylistcontentsPeer::addInstanceToPool($this);
|
||||
} else {
|
||||
$affectedRows = 0;
|
||||
|
@ -1437,6 +1442,10 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
*/
|
||||
public function setCcPlaylist(CcPlaylist $v = null)
|
||||
{
|
||||
// aggregate_column_relation behavior
|
||||
if (null !== $this->aCcPlaylist && $v !== $this->aCcPlaylist) {
|
||||
$this->oldCcPlaylist = $this->aCcPlaylist;
|
||||
}
|
||||
if ($v === null) {
|
||||
$this->setDbPlaylistId(NULL);
|
||||
} else {
|
||||
|
@ -1518,6 +1527,24 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
|
|||
$this->aCcPlaylist = null;
|
||||
}
|
||||
|
||||
// aggregate_column_relation behavior
|
||||
|
||||
/**
|
||||
* Update the aggregate column in the related CcPlaylist object
|
||||
*
|
||||
* @param PropelPDO $con A connection object
|
||||
*/
|
||||
protected function updateRelatedCcPlaylist(PropelPDO $con)
|
||||
{
|
||||
if ($ccPlaylist = $this->getCcPlaylist()) {
|
||||
$ccPlaylist->updateDbLength($con);
|
||||
}
|
||||
if ($this->oldCcPlaylist) {
|
||||
$this->oldCcPlaylist->updateDbLength($con);
|
||||
$this->oldCcPlaylist = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Catches calls to virtual methods
|
||||
*/
|
||||
|
|
|
@ -578,4 +578,90 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to execute before every DELETE statement
|
||||
*
|
||||
* @param PropelPDO $con The connection object used by the query
|
||||
*/
|
||||
protected function basePreDelete(PropelPDO $con)
|
||||
{
|
||||
// aggregate_column_relation behavior
|
||||
$this->findRelatedCcPlaylists($con);
|
||||
|
||||
return $this->preDelete($con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to execute after every DELETE statement
|
||||
*
|
||||
* @param int $affectedRows the number of deleted rows
|
||||
* @param PropelPDO $con The connection object used by the query
|
||||
*/
|
||||
protected function basePostDelete($affectedRows, PropelPDO $con)
|
||||
{
|
||||
// aggregate_column_relation behavior
|
||||
$this->updateRelatedCcPlaylists($con);
|
||||
|
||||
return $this->postDelete($affectedRows, $con);
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to execute before every UPDATE statement
|
||||
*
|
||||
* @param array $values The associatiove array of columns and values for the update
|
||||
* @param PropelPDO $con The connection object used by the query
|
||||
* @param boolean $forceIndividualSaves If false (default), the resulting call is a BasePeer::doUpdate(), ortherwise it is a series of save() calls on all the found objects
|
||||
*/
|
||||
protected function basePreUpdate(&$values, PropelPDO $con, $forceIndividualSaves = false)
|
||||
{
|
||||
// aggregate_column_relation behavior
|
||||
$this->findRelatedCcPlaylists($con);
|
||||
|
||||
return $this->preUpdate($values, $con, $forceIndividualSaves);
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to execute after every UPDATE statement
|
||||
*
|
||||
* @param int $affectedRows the number of udated rows
|
||||
* @param PropelPDO $con The connection object used by the query
|
||||
*/
|
||||
protected function basePostUpdate($affectedRows, PropelPDO $con)
|
||||
{
|
||||
// aggregate_column_relation behavior
|
||||
$this->updateRelatedCcPlaylists($con);
|
||||
|
||||
return $this->postUpdate($affectedRows, $con);
|
||||
}
|
||||
|
||||
// aggregate_column_relation behavior
|
||||
|
||||
/**
|
||||
* Finds the related CcPlaylist objects and keep them for later
|
||||
*
|
||||
* @param PropelPDO $con A connection object
|
||||
*/
|
||||
protected function findRelatedCcPlaylists($con)
|
||||
{
|
||||
$criteria = clone $this;
|
||||
if ($this->useAliasInSQL) {
|
||||
$alias = $this->getModelAlias();
|
||||
$criteria->removeAlias($alias);
|
||||
} else {
|
||||
$alias = '';
|
||||
}
|
||||
$this->ccPlaylists = CcPlaylistQuery::create()
|
||||
->joinCcPlaylistcontents($alias)
|
||||
->mergeWith($criteria)
|
||||
->find($con);
|
||||
}
|
||||
|
||||
protected function updateRelatedCcPlaylists($con)
|
||||
{
|
||||
foreach ($this->ccPlaylists as $ccPlaylist) {
|
||||
$ccPlaylist->updateDbLength($con);
|
||||
}
|
||||
$this->ccPlaylists = array();
|
||||
}
|
||||
|
||||
} // BaseCcPlaylistcontentsQuery
|
||||
|
|
|
@ -758,7 +758,7 @@ abstract class BaseCcSubjsQuery extends ModelCriteria
|
|||
public function filterByCcPlaylist($ccPlaylist, $comparison = null)
|
||||
{
|
||||
return $this
|
||||
->addUsingAlias(CcSubjsPeer::ID, $ccPlaylist->getDbEditedby(), $comparison);
|
||||
->addUsingAlias(CcSubjsPeer::ID, $ccPlaylist->getDbCreatorId(), $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php if($this->type == "au") : ?>
|
||||
<?php if($this->type == "audioclip") : ?>
|
||||
<div><span>Title:</span><span><?php echo ($this->md["MDATA_KEY_TITLE"]);?></span></div>
|
||||
<div><span>Artist:</span><span><?php echo ($this->md["MDATA_KEY_CREATOR"]);?></span></div>
|
||||
<div><span>Album:</span><span><?php echo ($this->md["MDATA_KEY_SOURCE"]);?></span></div>
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($this->type == "pl") : ?>
|
||||
<?php if($this->type == "playlist") : ?>
|
||||
<div><span>Name:</span><span><?php echo ($this->md["dc:title"]);?></span></div>
|
||||
<div><span>Creator:</span><span><?php echo ($this->md["dc:creator"]);?></span></div>
|
||||
<div><span>Length:</span><span><?php echo ($this->md["dcterms:extent"]);?></span></div>
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<ul>
|
||||
<li><a href="#simpleSearch">Search</a></li>
|
||||
<!--<li><a href="#advancedSearch">Advanced Search</a></li>-->
|
||||
</ul>
|
||||
<div id="simpleSearch">
|
||||
<div id="import_status" style="visibility:hidden">File import in progress...</div>
|
||||
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable">
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<!--
|
||||
<div id="advancedSearch">
|
||||
<div id="search">
|
||||
<?php //echo $this->form; ?>
|
||||
</div>
|
||||
<div><?php //echo var_dump($this->md); ?></div>
|
||||
</div>
|
||||
-->
|
|
@ -0,0 +1,9 @@
|
|||
<ul>
|
||||
<li><a href="#simpleSearch">Search</a></li>
|
||||
</ul>
|
||||
<div id="simpleSearch">
|
||||
<div id="import_status" style="visibility:hidden">File import in progress...</div>
|
||||
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable">
|
||||
|
||||
</table>
|
||||
</div>
|
|
@ -1,12 +1,14 @@
|
|||
<button id="spl_new" class="ui-button" role="button" aria-disabled="false">New</button>
|
||||
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
|
||||
<?php if (isset($this->pl)) : ?>
|
||||
<button id="spl_delete" class="ui-button" role="button" aria-disabled="false">Delete</button>
|
||||
<button id="spl_delete" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">Delete</button>
|
||||
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button">
|
||||
<span class="ui-icon crossfade-main-icon"></span><span class="ui-button-text">Playlist crossfade</span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($this->pl)) : ?>
|
||||
<input id="pl_id" type="hidden" value="<?php echo $this->pl->getId(); ?>"></input>
|
||||
<input id="pl_lastMod" type="hidden" value="<?php echo $this->pl->getLastModified('U'); ?>"></input>
|
||||
<div class="playlist_title">
|
||||
<h3 id="spl_name">
|
||||
<a id="playlist_name_display"><?php echo $this->pl->getName(); ?></a>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<dl id="spl_cue_editor" class="inline-list">
|
||||
<dt>Cue In:</dt>
|
||||
<dd id="spl_cue_in_<?php echo $this->pos; ?>" class="spl_cue_in">
|
||||
<dd id="spl_cue_in_<?php echo $this->id; ?>" class="spl_cue_in">
|
||||
<span contenteditable="true" class="spl_text_input"><?php echo $this->cueIn; ?></span>
|
||||
</dd>
|
||||
<dd class="edit-error"></dd>
|
||||
<dt>Cue Out:</dt>
|
||||
<dd id="spl_cue_out_<?php echo $this->pos; ?>" class="spl_cue_out">
|
||||
<dd id="spl_cue_out_<?php echo $this->id; ?>" class="spl_cue_out">
|
||||
<span contenteditable="true" class="spl_text_input"><?php echo $this->cueOut; ?></span>
|
||||
</dd>
|
||||
<dd class="edit-error"></dd>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<dl id="spl_editor" class="inline-list">
|
||||
<dt>Fade out:</dt>
|
||||
<dd id="spl_fade_out_<?php echo $this->pos; ?>" class="spl_fade_out">
|
||||
<dd id="spl_fade_out_<?php echo $this->item1; ?>" class="spl_fade_out">
|
||||
<span contenteditable="true" class="spl_text_input"><?php echo $this->fadeOut; ?></span>
|
||||
</dd>
|
||||
<dd class="edit-error"></dd>
|
||||
<dt>Fade in:</dt>
|
||||
<dd id="spl_fade_in_<?php echo $this->pos + 1; ?>" class="spl_fade_in">
|
||||
<dd id="spl_fade_in_<?php echo $this->item2; ?>" class="spl_fade_in">
|
||||
<span contenteditable="true" class="spl_text_input"><?php echo $this->fadeIn; ?></span>
|
||||
</dd>
|
||||
<dd class="edit-error"></dd>
|
||||
|
|
|
@ -4,7 +4,7 @@ if (count($items)) : ?>
|
|||
|
||||
<?php $i = 0; ?>
|
||||
<?php foreach($items as $item) : ?>
|
||||
<li class="ui-state-default" id="spl_<?php echo $i ?>" unqid="<?php echo $item["CcFiles"]["gunid"]."_".$i; ?>">
|
||||
<li class="ui-state-default" id="spl_<?php echo $item["id"] ?>" unqid="<?php echo $item["CcFiles"]["gunid"]."_".$i; ?>">
|
||||
<div class="list-item-container">
|
||||
<a href="javascript:void(0);" class="big_play"
|
||||
onclick="audioPreview('<?php echo $item["CcFiles"]["gunid"].".".pathinfo($item["CcFiles"]["filepath"], PATHINFO_EXTENSION);?>',
|
||||
|
@ -25,12 +25,12 @@ if (count($items)) : ?>
|
|||
?>
|
||||
<div id="fade_<?php echo $i ?>" class="spl_fade_control ui-state-default"></div>
|
||||
<?php endif; ?>
|
||||
<span class="ui-icon ui-icon-closethick"></span>
|
||||
<span id="remove_<?php echo $item["id"] ?>" class="ui-icon ui-icon-closethick"></span>
|
||||
</div>
|
||||
|
||||
<div id="cues_<?php echo $i ?>" class="cue-edit clearfix" style="display: none">
|
||||
<?php echo $this->partial('playlist/set-cue.phtml', array(
|
||||
'pos' => $i,
|
||||
'id' => $item["id"],
|
||||
'cueIn' => $item['cuein'],
|
||||
'cueOut' => $item['cueout'],
|
||||
'origLength' => $item["CcFiles"]['length'])); ?>
|
||||
|
@ -43,7 +43,8 @@ if (count($items)) : ?>
|
|||
?>
|
||||
<div id="crossfade_<?php echo $i ?>-<?php echo $i+1 ?>" class="crossfade clearfix" style="display: none">
|
||||
<?php echo $this->partial('playlist/set-fade.phtml', array(
|
||||
'pos' => $i,
|
||||
'item1' => $items[$i]['id'],
|
||||
'item2' => $items[$i+1]['id'],
|
||||
'fadeOut' => $items[$i]['fadeout'],
|
||||
'fadeIn' => $items[$i+1]['fadein'])); ?>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<input type="text" id="show_builder_datepicker_start" class="input_text"></input>
|
||||
<input type="text" id="show_builder_timepicker_start" class="input_text"></input>
|
||||
<input type="text" id="show_builder_datepicker_end" class="input_text"></input>
|
||||
<input type="text" id="show_builder_timepicker_end" class="input_text"></input>
|
||||
<input type="button" id="show_builder_timerange_button" class="ui-button ui-state-default" value="GO"></input>
|
||||
<table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
|
Loading…
Add table
Add a link
Reference in a new issue