diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php
index 2ea6beb89..fbed8005d 100644
--- a/airtime_mvc/application/controllers/ApiController.php
+++ b/airtime_mvc/application/controllers/ApiController.php
@@ -27,6 +27,7 @@ class ApiController extends Zend_Controller_Action
->addActionContext('live-chat', 'json')
->addActionContext('update-file-system-mount', 'json')
->addActionContext('handle-watched-dir-missing', 'json')
+ ->addActionContext('rabbitmq-do-push', 'json')
->initContext();
}
@@ -276,17 +277,19 @@ class ApiController extends Zend_Controller_Action
$api_key = $this->_getParam('api_key');
+ /*
if(!in_array($api_key, $CC_CONFIG["apiKey"]))
{
header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource. ';
exit;
}
+ * */
PEAR::setErrorHandling(PEAR_ERROR_RETURN);
- $result = Application_Model_Schedule::GetScheduledPlaylists();
- echo json_encode($result);
+ $data = Application_Model_Schedule::GetScheduledPlaylists();
+ echo json_encode($data, JSON_FORCE_OBJECT);
}
public function notifyMediaItemStartPlayAction()
@@ -316,6 +319,7 @@ class ApiController extends Zend_Controller_Action
}
}
+/*
public function notifyScheduleGroupPlayAction()
{
global $CC_CONFIG;
@@ -355,6 +359,7 @@ class ApiController extends Zend_Controller_Action
exit;
}
}
+ */
public function recordedShowsAction()
{
@@ -901,5 +906,26 @@ class ApiController extends Zend_Controller_Action
$dir = base64_decode($request->getParam('dir'));
Application_Model_MusicDir::removeWatchedDir($dir, false);
}
+
+
+ /* This action is for use by our dev scripts, that make
+ * a change to the database and we want rabbitmq to send
+ * out a message to pypo that a potential change has been made. */
+ public function rabbitmqDoPushAction(){
+ global $CC_CONFIG;
+
+ $request = $this->getRequest();
+ $api_key = $request->getParam('api_key');
+ if (!in_array($api_key, $CC_CONFIG["apiKey"]))
+ {
+ header('HTTP/1.0 401 Unauthorized');
+ print 'You are not allowed to access this resource.';
+ exit;
+ }
+
+ Logging::log("Notifying RabbitMQ to send message to pypo");
+
+ Application_Model_RabbitMq::PushSchedule();
+ }
}
diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php
index dd16c377c..64d411086 100644
--- a/airtime_mvc/application/controllers/LibraryController.php
+++ b/airtime_mvc/application/controllers/LibraryController.php
@@ -55,7 +55,9 @@ class LibraryController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/main_library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php
index b40de9d35..efa4fb8b4 100644
--- a/airtime_mvc/application/controllers/PlaylistController.php
+++ b/airtime_mvc/application/controllers/PlaylistController.php
@@ -197,7 +197,7 @@ class PlaylistController extends Zend_Controller_Action
public function addItemsAction()
{
- $ids = $this->_getParam('ids');
+ $ids = $this->_getParam('ids', array());
$ids = (!is_array($ids)) ? array($ids) : $ids;
$afterItem = $this->_getParam('afterItem', null);
$addType = $this->_getParam('type', 'after');
diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php
index 86678e8ba..a97471759 100644
--- a/airtime_mvc/application/controllers/ScheduleController.php
+++ b/airtime_mvc/application/controllers/ScheduleController.php
@@ -59,6 +59,29 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css?'.$CC_CONFIG['airtime_version']);
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
+ //Start Show builder JS/CSS requirements
+ $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version']),'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+ $this->view->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
+
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
+ $this->view->headLink()->appendStylesheet($baseUrl.'/css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
+ //End Show builder JS/CSS requirements
+
Application_Model_Schedule::createNewFormSections($this->view);
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
@@ -78,10 +101,12 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
- if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)))
+ if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$editable = true;
- else
+ }
+ else {
$editable = false;
+ }
$this->view->events = Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
}
@@ -95,19 +120,19 @@ class ScheduleController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
- if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
- try{
+ if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
+ try {
$showInstance = new Application_Model_ShowInstance($showInstanceId);
- }catch(Exception $e){
+ } catch (Exception $e){
$this->view->show_error = true;
return false;
}
$error = $showInstance->moveShow($deltaDay, $deltaMin);
}
- if(isset($error))
+ if (isset($error)) {
$this->view->error = $error;
-
+ }
}
public function resizeShowAction()
@@ -200,7 +225,7 @@ class ScheduleController extends Zend_Controller_Action
&& !$instance->isRebroadcast()) {
$menu["schedule"] = array("name"=> "Add / Remove Content",
- "url" => "/showbuilder/index/");
+ "url" => "/showbuilder/builder-dialog/");
$menu["clear"] = array("name"=> "Remove All Content", "icon" => "delete",
"url" => "/schedule/clear-show");
diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php
index ef8177f7c..1a9082988 100644
--- a/airtime_mvc/application/controllers/ShowbuilderController.php
+++ b/airtime_mvc/application/controllers/ShowbuilderController.php
@@ -9,6 +9,7 @@ class ShowbuilderController extends Zend_Controller_Action
$ajaxContext->addActionContext('schedule-move', 'json')
->addActionContext('schedule-add', 'json')
->addActionContext('schedule-remove', 'json')
+ ->addActionContext('builder-dialog', 'json')
->addActionContext('builder-feed', 'json')
->initContext();
}
@@ -53,11 +54,40 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->headScript()->appendScript("var serverTimezoneOffset = {$offset}; //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->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/main_builder.js','text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/showbuilder.css');
}
+ public function builderDialogAction() {
+
+ $request = $this->getRequest();
+ $id = $request->getParam("id");
+
+ $instance = CcShowInstancesQuery::create()->findPK($id);
+
+ if (is_null($instance)) {
+ $this->view->error = "show does not exist";
+ return;
+ }
+
+ $start = $instance->getDbStarts(null);
+ $start->setTimezone(new DateTimeZone(date_default_timezone_get()));
+ $end = $instance->getDbEnds(null);
+ $end->setTimezone(new DateTimeZone(date_default_timezone_get()));
+
+ $show_name = $instance->getCcShow()->getDbName();
+ $start_time = $start->format("Y-m-d H:i:s");
+ $end_time = $end->format("Y-m-d H:i:s");
+
+ $this->view->title = "{$show_name}: {$start_time} - {$end_time}";
+ $this->view->start = $instance->getDbStarts("U");
+ $this->view->end = $instance->getDbEnds("U");
+
+ $this->view->dialog = $this->view->render('showbuilder/builderDialog.phtml');
+ }
+
public function builderFeedAction() {
$request = $this->getRequest();
diff --git a/airtime_mvc/application/forms/customfilters/ImageSize.php b/airtime_mvc/application/forms/customfilters/ImageSize.php
index 69db3cb82..17c40228e 100644
--- a/airtime_mvc/application/forms/customfilters/ImageSize.php
+++ b/airtime_mvc/application/forms/customfilters/ImageSize.php
@@ -6,7 +6,7 @@ class Zend_Filter_ImageSize implements Zend_Filter_Interface {
throw new Zend_Filter_Exception('Image does not exist: ' . $value);
}
- $image = imageCreateFromString(file_get_contents($value));
+ $image = imagecreatefromstring(file_get_contents($value));
if (false === $image) {
throw new Zend_Filter_Exception('Can\'t load image: ' . $value);
}
diff --git a/airtime_mvc/application/models/RabbitMq.php b/airtime_mvc/application/models/RabbitMq.php
index 4d0e501a5..a01d5c9a9 100644
--- a/airtime_mvc/application/models/RabbitMq.php
+++ b/airtime_mvc/application/models/RabbitMq.php
@@ -29,7 +29,7 @@ class Application_Model_RabbitMq
$EXCHANGE = 'airtime-pypo';
$channel->exchange_declare($EXCHANGE, 'direct', false, true);
- $data = json_encode($md);
+ $data = json_encode($md, JSON_FORCE_OBJECT);
$msg = new AMQPMessage($data, array('content_type' => 'text/plain'));
$channel->basic_publish($msg, $EXCHANGE);
diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php
index 367278bc7..21306d43d 100644
--- a/airtime_mvc/application/models/Schedule.php
+++ b/airtime_mvc/application/models/Schedule.php
@@ -46,87 +46,6 @@ class Application_Model_Schedule {
}
- /**
- * Returns array indexed by:
- * "playlistId"/"playlist_id" (aliases to the same thing)
- * "start"/"starts" (aliases to the same thing) as YYYY-MM-DD HH:MM:SS.nnnnnn
- * "end"/"ends" (aliases to the same thing) as YYYY-MM-DD HH:MM:SS.nnnnnn
- * "group_id"/"id" (aliases to the same thing)
- * "clip_length" (for audio clips this is the length of the audio clip,
- * for playlists this is the length of the entire playlist)
- * "name" (playlist only)
- * "creator" (playlist only)
- * "file_id" (audioclip only)
- * "count" (number of items in the playlist, always 1 for audioclips.
- * Note that playlists with one item will also have count = 1.
- *
- * @param string $p_fromDateTime
- * In the format YYYY-MM-DD HH:MM:SS.nnnnnn
- * @param string $p_toDateTime
- * In the format YYYY-MM-DD HH:MM:SS.nnnnnn
- * @param boolean $p_playlistsOnly
- * Retrieve playlists as a single item.
- * @return array
- * Returns empty array if nothing found
- */
-
- public static function GetItems($p_currentDateTime, $p_toDateTime, $p_playlistsOnly = true)
- {
- global $CC_CONFIG, $CC_DBC;
- $rows = array();
- if (!$p_playlistsOnly) {
- $sql = "SELECT * FROM ".$CC_CONFIG["scheduleTable"]
- ." WHERE (starts >= TIMESTAMP '$p_currentDateTime') "
- ." AND (ends <= TIMESTAMP '$p_toDateTime')";
- $rows = $CC_DBC->GetAll($sql);
- foreach ($rows as &$row) {
- $row["count"] = "1";
- $row["playlistId"] = $row["playlist_id"];
- $row["start"] = $row["starts"];
- $row["end"] = $row["ends"];
- $row["id"] = $row["group_id"];
- }
- } else {
- $sql = "SELECT MIN(pt.creator) AS creator,"
- ." st.group_id,"
- ." SUM(st.clip_length) AS clip_length,"
- ." MIN(st.file_id) AS file_id,"
- ." COUNT(*) as count,"
- ." MIN(st.playlist_id) AS playlist_id,"
- ." MIN(st.starts) AS starts,"
- ." MAX(st.ends) AS ends,"
- ." MIN(sh.name) AS show_name,"
- ." MIN(si.starts) AS show_start,"
- ." MAX(si.ends) AS show_end"
- ." FROM $CC_CONFIG[scheduleTable] as st"
- ." LEFT JOIN $CC_CONFIG[playListTable] as pt"
- ." ON st.playlist_id = pt.id"
- ." LEFT JOIN $CC_CONFIG[showInstances] as si"
- ." ON st.instance_id = si.id"
- ." LEFT JOIN $CC_CONFIG[showTable] as sh"
- ." ON si.show_id = sh.id"
- //The next line ensures we only get songs that haven't ended yet
- ." WHERE (st.ends >= TIMESTAMP '$p_currentDateTime')"
- ." AND (st.ends <= TIMESTAMP '$p_toDateTime')"
- //next line makes sure that we aren't returning items that
- //are past the show's scheduled timeslot.
- ." AND (st.starts < si.ends)"
- ." GROUP BY st.group_id"
- ." ORDER BY starts";
-
- $rows = $CC_DBC->GetAll($sql);
- if (!PEAR::isError($rows)) {
- foreach ($rows as &$row) {
- $row["playlistId"] = $row["playlist_id"];
- $row["start"] = $row["starts"];
- $row["end"] = $row["ends"];
- $row["id"] = $row["group_id"];
- }
- }
- }
- return $rows;
- }
-
/**
* Returns data related to the scheduled items.
*
@@ -318,6 +237,7 @@ class Application_Model_Schedule {
sched.starts AS sched_starts, sched.ends AS sched_ends, sched.id AS sched_id,
sched.cue_in AS cue_in, sched.cue_out AS cue_out,
sched.fade_in AS fade_in, sched.fade_out AS fade_out,
+ sched.status AS sched_status,
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
@@ -476,6 +396,120 @@ class Application_Model_Schedule {
return $diff;
}
+ /**
+ * Returns array indexed by:
+ * "playlistId"/"playlist_id" (aliases to the same thing)
+ * "start"/"starts" (aliases to the same thing) as YYYY-MM-DD HH:MM:SS.nnnnnn
+ * "end"/"ends" (aliases to the same thing) as YYYY-MM-DD HH:MM:SS.nnnnnn
+ * "group_id"/"id" (aliases to the same thing)
+ * "clip_length" (for audio clips this is the length of the audio clip,
+ * for playlists this is the length of the entire playlist)
+ * "name" (playlist only)
+ * "creator" (playlist only)
+ * "file_id" (audioclip only)
+ * "count" (number of items in the playlist, always 1 for audioclips.
+ * Note that playlists with one item will also have count = 1.
+ *
+ * @param string $p_fromDateTime
+ * In the format YYYY-MM-DD HH:MM:SS.nnnnnn
+ * @param string $p_toDateTime
+ * In the format YYYY-MM-DD HH:MM:SS.nnnnnn
+ * @param boolean $p_playlistsOnly
+ * Retrieve playlists as a single item.
+ * @return array
+ * Returns null if nothing found
+ */
+ public static function GetItems($p_currentDateTime, $p_toDateTime) {
+ global $CC_CONFIG, $CC_DBC;
+ $rows = array();
+
+ $sql = "SELECT st.file_id AS file_id,"
+ ." st.id as id,"
+ ." st.starts AS start,"
+ ." st.ends AS end,"
+ ." st.cue_in AS cue_in,"
+ ." st.cue_out AS cue_out,"
+ ." st.fade_in AS fade_in,"
+ ." st.fade_out AS fade_out,"
+ ." si.starts as show_start,"
+ ." si.ends as show_end"
+ ." FROM $CC_CONFIG[scheduleTable] as st"
+ ." LEFT JOIN $CC_CONFIG[showInstances] as si"
+ ." ON st.instance_id = si.id"
+ ." ORDER BY start";
+
+ Logging::log($sql);
+
+ $rows = $CC_DBC->GetAll($sql);
+ if (PEAR::isError($rows)) {
+ return null;
+ }
+
+ return $rows;
+ }
+
+ public static function GetScheduledPlaylists($p_fromDateTime = null, $p_toDateTime = null){
+
+ global $CC_CONFIG, $CC_DBC;
+
+ /* if $p_fromDateTime and $p_toDateTime function parameters are null, then set range
+ * from "now" to "now + 24 hours". */
+ if (is_null($p_fromDateTime)) {
+ $t1 = new DateTime("@".time());
+ $range_start = $t1->format("Y-m-d H:i:s");
+ } else {
+ $range_start = Application_Model_Schedule::PypoTimeToAirtimeTime($p_fromDateTime);
+ }
+ if (is_null($p_fromDateTime)) {
+ $t2 = new DateTime("@".time());
+ $t2->add(new DateInterval("PT24H"));
+ $range_end = $t2->format("Y-m-d H:i:s");
+ } else {
+ $range_end = Application_Model_Schedule::PypoTimeToAirtimeTime($p_toDateTime);
+ }
+
+ // Scheduler wants everything in a playlist
+ $items = Application_Model_Schedule::GetItems($range_start, $range_end);
+
+ $data = array();
+ $utcTimeZone = new DateTimeZone("UTC");
+
+ $data["status"] = array();
+ $data["media"] = array();
+
+ foreach ($items as $item){
+
+ $storedFile = Application_Model_StoredFile::Recall($item["file_id"]);
+ $uri = $storedFile->getFileUrlUsingConfigAddress();
+
+ $showEndDateTime = new DateTime($item["show_end"], $utcTimeZone);
+ $trackEndDateTime = new DateTime($item["end"], $utcTimeZone);
+
+ /* Note: cue_out and end are always the same. */
+ /* TODO: Not all tracks will have "show_end" */
+
+ if ($trackEndDateTime->getTimestamp() > $showEndDateTime->getTimestamp()){
+ $diff = $trackEndDateTime->getTimestamp() - $showEndDateTime->getTimestamp();
+ //assuming ends takes cue_out into assumption
+ $item["cue_out"] = $item["cue_out"] - $diff;
+ }
+
+ $start = Application_Model_Schedule::AirtimeTimeToPypoTime($item["start"]);
+ $data["media"][$start] = array(
+ 'id' => $storedFile->getGunid(),
+ 'row_id' => $item["id"],
+ 'uri' => $uri,
+ 'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]),
+ 'fade_out' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_out"]),
+ 'cue_in' => Application_Model_DateHelper::CalculateLengthInSeconds($item["cue_in"]),
+ 'cue_out' => Application_Model_DateHelper::CalculateLengthInSeconds($item["cue_out"]),
+ 'start' => $start,
+ 'end' => Application_Model_Schedule::AirtimeTimeToPypoTime($item["end"])
+ );
+ }
+
+ return $data;
+ }
/**
* Export the schedule in json formatted for pypo (the liquidsoap scheduler)
@@ -485,7 +519,7 @@ class Application_Model_Schedule {
* @param string $p_toDateTime
* In the format "YYYY-MM-DD-HH-mm-SS"
*/
- public static function GetScheduledPlaylists($p_fromDateTime = null, $p_toDateTime = null)
+ public static function GetScheduledPlaylistsOld($p_fromDateTime = null, $p_toDateTime = null)
{
global $CC_CONFIG, $CC_DBC;
@@ -546,7 +580,6 @@ class Application_Model_Schedule {
$starts = Application_Model_Schedule::AirtimeTimeToPypoTime($item["starts"]);
$medias[$starts] = array(
- 'row_id' => $item["id"],
'id' => $storedFile->getGunid(),
'uri' => $uri,
'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]),
@@ -554,7 +587,6 @@ class Application_Model_Schedule {
'fade_cross' => 0,
'cue_in' => Application_Model_DateHelper::CalculateLengthInSeconds($item["cue_in"]),
'cue_out' => Application_Model_DateHelper::CalculateLengthInSeconds($item["cue_out"]),
- 'export_source' => 'scheduler',
'start' => $starts,
'end' => Application_Model_Schedule::AirtimeTimeToPypoTime($item["ends"])
);
diff --git a/airtime_mvc/application/models/Scheduler.php b/airtime_mvc/application/models/Scheduler.php
index 3df43b5ce..1c77774c9 100644
--- a/airtime_mvc/application/models/Scheduler.php
+++ b/airtime_mvc/application/models/Scheduler.php
@@ -229,6 +229,15 @@ class Application_Model_Scheduler {
}
}
+ //update the status flag in cc_schedule.
+ $instances = CcShowInstancesQuery::create()
+ ->filterByPrimaryKeys($affectedShowInstances)
+ ->find($this->con);
+
+ foreach ($instances as $instance) {
+ $instance->updateScheduleStatus($this->con);
+ }
+
//update the last scheduled timestamp.
CcShowInstancesQuery::create()
->filterByPrimaryKeys($affectedShowInstances)
@@ -383,11 +392,20 @@ class Application_Model_Scheduler {
}
}
- foreach($showInstances as $instance) {
+ foreach ($showInstances as $instance) {
$this->removeGaps($instance);
}
}
+ //update the status flag in cc_schedule.
+ $instances = CcShowInstancesQuery::create()
+ ->filterByPrimaryKeys($showInstances)
+ ->find($this->con);
+
+ foreach ($instances as $instance) {
+ $instance->updateScheduleStatus($this->con);
+ }
+
//update the last scheduled timestamp.
CcShowInstancesQuery::create()
->filterByPrimaryKeys($showInstances)
diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php
index ec4cdbcfe..6fa4fd132 100644
--- a/airtime_mvc/application/models/Show.php
+++ b/airtime_mvc/application/models/Show.php
@@ -125,10 +125,12 @@ class Application_Model_Show {
}
$hours = $deltaMin/60;
- if($hours > 0)
+ if ($hours > 0) {
$hours = floor($hours);
- else
+ }
+ else {
$hours = ceil($hours);
+ }
$mins = abs($deltaMin%60);
@@ -149,6 +151,28 @@ class Application_Model_Show {
//do both the queries at once.
$CC_DBC->query($sql);
+ $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
+ $con->beginTransaction();
+
+ try {
+ //update the status flag in cc_schedule.
+ $instances = CcShowInstancesQuery::create()
+ ->filterByDbStarts($current_timestamp, Criteria::GREATER_EQUAL)
+ ->filterByDbShowId($this->_showId)
+ ->find($con);
+
+ foreach ($instances as $instance) {
+ $instance->updateScheduleStatus();
+ }
+
+ $con->commit();
+ }
+ catch (Exception $e) {
+ $con->rollback();
+ Logging::log("Couldn't update schedule status.");
+ Logging::log($e->getMessage());
+ }
+
Application_Model_RabbitMq::PushSchedule();
}
@@ -1043,6 +1067,33 @@ class Application_Model_Show {
}
}
+ if ($data['add_show_id'] != -1) {
+ $con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
+ $con->beginTransaction();
+
+ //current timesamp in UTC.
+ $current_timestamp = gmdate("Y-m-d H:i:s");
+
+ try {
+ //update the status flag in cc_schedule.
+ $instances = CcShowInstancesQuery::create()
+ ->filterByDbStarts($current_timestamp, Criteria::GREATER_EQUAL)
+ ->filterByDbShowId($data['add_show_id'])
+ ->find($con);
+
+ foreach ($instances as $instance) {
+ $instance->updateScheduleStatus();
+ }
+
+ $con->commit();
+ }
+ catch (Exception $e) {
+ $con->rollback();
+ Logging::log("Couldn't update schedule status.");
+ Logging::log($e->getMessage());
+ }
+ }
+
Application_Model_Show::populateShowUntil($showId);
Application_Model_RabbitMq::PushSchedule();
return $showId;
@@ -1491,7 +1542,7 @@ class Application_Model_Show {
$events = array();
$interval = $start->diff($end);
- $days = $interval->format('%a');
+ $days = $interval->format('%a');
$shows = Application_Model_Show::getShows($start, $end);
@@ -1508,10 +1559,9 @@ class Application_Model_Show {
if ($editable && (strtotime($today_timestamp) < strtotime($show["starts"]))) {
$options["editable"] = true;
- $events[] = Application_Model_Show::makeFullCalendarEvent($show, $options);
- } else {
- $events[] = Application_Model_Show::makeFullCalendarEvent($show, $options);
}
+
+ $events[] = Application_Model_Show::makeFullCalendarEvent($show, $options);
}
return $events;
@@ -1521,10 +1571,6 @@ class Application_Model_Show {
{
$event = array();
- if($show["rebroadcast"]) {
- $event["disableResizing"] = true;
- }
-
$startDateTime = new DateTime($show["starts"], new DateTimeZone("UTC"));
$startDateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
@@ -1538,29 +1584,27 @@ class Application_Model_Show {
$event["end"] = $endDateTime->format("Y-m-d H:i:s");
$event["endUnix"] = $endDateTime->format("U");
$event["allDay"] = false;
- //$event["description"] = $show["description"];
$event["showId"] = intval($show["show_id"]);
$event["record"] = intval($show["record"]);
$event["rebroadcast"] = intval($show["rebroadcast"]);
// get soundcloud_id
- if(!is_null($show["file_id"])){
+ if (!is_null($show["file_id"])){
$file = Application_Model_StoredFile::Recall($show["file_id"]);
$soundcloud_id = $file->getSoundCloudId();
- }else{
- $soundcloud_id = null;
}
- $event["soundcloud_id"] = (is_null($soundcloud_id) ? -1 : $soundcloud_id);
+
+ $event["soundcloud_id"] = isset($soundcloud_id) ? $soundcloud_id : -1;
//event colouring
- if($show["color"] != "") {
+ if ($show["color"] != "") {
$event["textColor"] = "#".$show["color"];
}
- if($show["background_color"] != "") {
+ if ($show["background_color"] != "") {
$event["color"] = "#".$show["background_color"];
}
- foreach($options as $key=>$value) {
+ foreach ($options as $key => $value) {
$event[$key] = $value;
}
diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php
index e3804e17f..8762a1638 100644
--- a/airtime_mvc/application/models/ShowBuilder.php
+++ b/airtime_mvc/application/models/ShowBuilder.php
@@ -1,6 +1,7 @@
"",
"cueout" => "",
"fadein" => "",
- "fadeout" => ""
+ "fadeout" => "",
+ "current" => false,
);
/*
@@ -47,37 +49,14 @@ class Application_Model_ShowBuilder {
$this->epoch_now = time();
}
- private function formatTimeFilled($p_sec) {
-
- $formatted = "";
- $sign = ($p_sec < 0) ? "-" : "+";
-
- $time = Application_Model_Playlist::secondsToPlaylistTime(abs($p_sec));
- Logging::log("time is: ".$time);
- $info = explode(":", $time);
-
- $formatted .= $sign;
-
- if (intval($info[0]) > 0) {
- $info[0] = ltrim($info[0], "0");
- $formatted .= " {$info[0]}h";
- }
-
- if (intval($info[1]) > 0) {
- $info[1] = ltrim($info[1], "0");
- $formatted .= " {$info[1]}m";
- }
-
- if (intval($info[2]) > 0) {
- $sec = round($info[2], 0);
- $formatted .= " {$sec}s";
- }
-
- return $formatted;
- }
-
+ //check to see if this row should be editable.
private function isAllowed($p_item, &$row) {
+ //cannot schedule in a recorded show.
+ if (intval($p_item["si_record"]) === 1) {
+ return;
+ }
+
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
//can only schedule the show if it hasn't started and you are allowed.
@@ -86,27 +65,10 @@ class Application_Model_ShowBuilder {
}
}
+ //information about whether a track is inside|boundary|outside a show.
private function getItemStatus($p_item, &$row) {
- $showEndDT = new DateTime($p_item["si_ends"]);
- $schedStartDT = new DateTime($p_item["sched_starts"]);
- $schedEndDT = new DateTime($p_item["sched_ends"]);
-
- $showEndEpoch = intval($showEndDT->format("U"));
- $schedStartEpoch = intval($schedStartDT->format("U"));
- $schedEndEpoch = intval($schedEndDT->format("U"));
-
- if ($schedEndEpoch < $showEndEpoch) {
- $status = 0; //item will playout in full
- }
- else if ($schedStartEpoch < $showEndEpoch && $schedEndEpoch > $showEndEpoch) {
- $status = 1; //item is on boundry
- }
- else {
- $status = 2; //item is overscheduled won't play.
- }
-
- $row["status"] = $status;
+ $row["status"] = intval($p_item["sched_status"]);
}
private function getRowTimestamp($p_item, &$row) {
@@ -121,6 +83,16 @@ class Application_Model_ShowBuilder {
$row["timestamp"] = $ts;
}
+ private function isCurrent($p_epochItemStart, $p_epochItemEnd) {
+ $current = false;
+
+ if ($this->epoch_now >= $p_epochItemStart && $this->epoch_now < $p_epochItemEnd) {
+ $current = true;
+ }
+
+ return $current;
+ }
+
private function makeHeaderRow($p_item) {
$row = $this->defaultRowArray;
@@ -148,8 +120,8 @@ class Application_Model_ShowBuilder {
private function makeScheduledItemRow($p_item) {
$row = $this->defaultRowArray;
- $this->isAllowed($p_item, $row);
$this->getRowTimestamp($p_item, $row);
+ $this->isAllowed($p_item, $row);
if (isset($p_item["sched_starts"])) {
@@ -157,9 +129,19 @@ class Application_Model_ShowBuilder {
$schedStartDT->setTimezone(new DateTimeZone($this->timezone));
$schedEndDT = new DateTime($p_item["sched_ends"], new DateTimeZone("UTC"));
$schedEndDT->setTimezone(new DateTimeZone($this->timezone));
+ $showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
$this->getItemStatus($p_item, $row);
+ $startsEpoch = intval($schedStartDT->format("U"));
+ $endsEpoch = intval($schedEndDT->format("U"));
+ $showEndEpoch = intval($showEndDT->format("U"));
+
+ //don't want an overbooked item to stay marked as current.
+ if ($this->isCurrent($startsEpoch, min($endsEpoch, $showEndEpoch))) {
+ $row["current"] = true;
+ }
+
$row["id"] = intval($p_item["sched_id"]);
$row["instance"] = intval($p_item["si_id"]);
$row["starts"] = $schedStartDT->format("H:i:s");
@@ -179,7 +161,10 @@ class Application_Model_ShowBuilder {
$this->contentDT = $schedEndDT;
}
- //show is empty
+ //show is empty or is a special kind of show (recording etc)
+ else if (intval($p_item["si_record"]) === 1) {
+ $row["record"] = true;
+ }
else {
$row["empty"] = true;
@@ -193,7 +178,6 @@ class Application_Model_ShowBuilder {
private function makeFooterRow($p_item) {
$row = $this->defaultRowArray;
- $this->isAllowed($p_item, $row);
$row["footer"] = true;
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
@@ -201,7 +185,9 @@ class Application_Model_ShowBuilder {
$runtime = bcsub($contentDT->format("U.u"), $showEndDT->format("U.u"), 6);
$row["runtime"] = $runtime;
- $row["fRuntime"] = $this->formatTimeFilled($runtime);
+
+ $timeFilled = new TimeFilledFormatter($runtime);
+ $row["fRuntime"] = $timeFilled->format();
return $row;
}
diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php
index 8088b3a04..176bf9135 100644
--- a/airtime_mvc/application/models/ShowInstance.php
+++ b/airtime_mvc/application/models/ShowInstance.php
@@ -617,14 +617,14 @@ class Application_Model_ShowInstance {
public function getTimeScheduledSecs()
{
$time_filled = $this->getTimeScheduled();
- return Application_Model_Schedule::WallTimeToMillisecs($time_filled) / 1000;
+ return Application_Model_Playlist::playlistTimeToSeconds($time_filled);
}
public function getDurationSecs()
{
$ends = $this->getShowInstanceEnd(null);
$starts = $this->getShowInstanceStart(null);
- return $ends->format('U') - $starts->format('U');
+ return intval($ends->format('U')) - intval($starts->format('U'));
}
public function getPercentScheduled()
diff --git a/airtime_mvc/application/models/airtime/CcPlaylistcontents.php b/airtime_mvc/application/models/airtime/CcPlaylistcontents.php
index e533d9ada..441207585 100644
--- a/airtime_mvc/application/models/airtime/CcPlaylistcontents.php
+++ b/airtime_mvc/application/models/airtime/CcPlaylistcontents.php
@@ -35,39 +35,6 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
return parent::getDbFadeout($format);
}
- /**
- * Just changing the default format to return subseconds
- *
- * @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 getDbCuein($format = 'H:i:s.u')
- {
- return parent::getDbCuein($format);
- }
-
- /**
- * Just changing the default format to return subseconds
- *
- * @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 getDbCueout($format = 'H:i:s.u')
- {
- return parent::getDbCueout($format);
- }
-
- /**
- * Just changing the default format to return subseconds
- *
- * @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 getDbCliplength($format = 'H:i:s.u')
- {
- return parent::getDbCliplength($format);
- }
-
/**
*
* @param String in format SS.uuuuuu, Datetime, or DateTime accepted string.
@@ -124,88 +91,4 @@ class CcPlaylistcontents extends BaseCcPlaylistcontents {
return $this;
} // setDbFadeout()
- /**
- * Sets the value of [cuein] column to a normalized version of the date/time value specified.
- *
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbCuein($v)
- {
- if ($v instanceof DateTime) {
- $dt = $v;
- }
- else {
- try {
- $dt = new DateTime($v);
- }
- catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
- }
-
- $this->cuein = $dt->format('H:i:s.u');
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
-
- return $this;
- } // setDbCuein()
-
- /**
- * Sets the value of [cueout] column to a normalized version of the date/time value specified.
- *
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbCueout($v)
- {
- if ($v instanceof DateTime) {
- $dt = $v;
- }
- else {
- try {
- $dt = new DateTime($v);
- }
- catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
- }
-
- $this->cueout = $dt->format('H:i:s.u');
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
-
- return $this;
- } // setDbCueout()
-
- /**
- * Sets the value of [cliplength] column to a normalized version of the date/time value specified.
- *
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbCliplength($v)
- {
- if ($v instanceof DateTime) {
- $dt = $v;
- }
- else {
-
- try {
-
- $dt = new DateTime($v);
-
- } catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
- }
-
- $this->cliplength = $dt->format('H:i:s.u');
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
-
- return $this;
- } // setDbCliplength()
-
-
} // CcPlaylistcontents
diff --git a/airtime_mvc/application/models/airtime/CcSchedule.php b/airtime_mvc/application/models/airtime/CcSchedule.php
index ff222d7a3..0a15b7a3c 100644
--- a/airtime_mvc/application/models/airtime/CcSchedule.php
+++ b/airtime_mvc/application/models/airtime/CcSchedule.php
@@ -15,11 +15,6 @@
*/
class CcSchedule extends BaseCcSchedule {
- public function getDbClipLength($format = 'H:i:s.u')
- {
- return parent::getDbClipLength($format);
- }
-
/**
* Get the [optionally formatted] temporal [starts] column value.
*
@@ -104,28 +99,6 @@ class CcSchedule extends BaseCcSchedule {
return parent::getDbFadeout($format);
}
- /**
- * Just changing the default format to return subseconds
- *
- * @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 getDbCueIn($format = 'H:i:s.u')
- {
- return parent::getDbCuein($format);
- }
-
- /**
- * Just changing the default format to return subseconds
- *
- * @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 getDbCueOut($format = 'H:i:s.u')
- {
- return parent::getDbCueout($format);
- }
-
/**
*
* @param String in format SS.uuuuuu, Datetime, or DateTime accepted string.
@@ -182,89 +155,6 @@ class CcSchedule extends BaseCcSchedule {
return $this;
} // setDbFadeout()
- /**
- * Sets the value of [cuein] column to a normalized version of the date/time value specified.
- *
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbCueIn($v)
- {
- if ($v instanceof DateTime) {
- $dt = $v;
- }
- else {
- try {
- $dt = new DateTime($v);
- }
- catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
- }
-
- $this->cue_in = $dt->format('H:i:s.u');
- $this->modifiedColumns[] = CcSchedulePeer::CUE_IN;
-
- return $this;
- } // setDbCuein()
-
- /**
- * Sets the value of [cueout] column to a normalized version of the date/time value specified.
- *
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbCueout($v)
- {
- if ($v instanceof DateTime) {
- $dt = $v;
- }
- else {
- try {
- $dt = new DateTime($v);
- }
- catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
- }
-
- $this->cue_out = $dt->format('H:i:s.u');
- $this->modifiedColumns[] = CcSchedulePeer::CUE_OUT;
-
- return $this;
- } // setDbCueout()
-
- /**
- * Sets the value of [cliplength] column to a normalized version of the date/time value specified.
- *
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
- * @return CcPlaylistcontents The current object (for fluent API support)
- */
- public function setDbClipLength($v)
- {
- if ($v instanceof DateTime) {
- $dt = $v;
- }
- else {
-
- try {
-
- $dt = new DateTime($v);
-
- } catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
- }
-
- $this->clip_length = $dt->format('H:i:s.u');
- $this->modifiedColumns[] = CcSchedulePeer::CLIP_LENGTH;
-
- return $this;
- } // setDbCliplength()
-
/**
* Sets the value of [starts] column to a normalized version of the date/time value specified.
*
diff --git a/airtime_mvc/application/models/airtime/CcShowInstances.php b/airtime_mvc/application/models/airtime/CcShowInstances.php
index d1c97f437..ecd34e10e 100644
--- a/airtime_mvc/application/models/airtime/CcShowInstances.php
+++ b/airtime_mvc/application/models/airtime/CcShowInstances.php
@@ -107,4 +107,33 @@ class CcShowInstances extends BaseCcShowInstances {
return $dt->format($format);
}
}
+
+ //post save hook to update the cc_schedule status column for the tracks in the show.
+ public function updateScheduleStatus(PropelPDO $con) {
+
+ Logging::log("in post save for showinstances");
+
+ //scheduled track is in the show
+ CcScheduleQuery::create()
+ ->filterByDbInstanceId($this->id)
+ ->filterByDbEnds($this->ends, Criteria::LESS_EQUAL)
+ ->update(array('DbStatus' => 1), $con);
+
+ Logging::log("updating status for in show items.");
+
+ //scheduled track is a boundary track
+ CcScheduleQuery::create()
+ ->filterByDbInstanceId($this->id)
+ ->filterByDbStarts($this->ends, Criteria::LESS_THAN)
+ ->filterByDbEnds($this->ends, Criteria::GREATER_THAN)
+ ->update(array('DbStatus' => 2), $con);
+
+ //scheduled track is overbooked.
+ CcScheduleQuery::create()
+ ->filterByDbInstanceId($this->id)
+ ->filterByDbStarts($this->ends, Criteria::GREATER_THAN)
+ ->update(array('DbStatus' => 0), $con);
+
+ }
+
} // CcShowInstances
diff --git a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php
index d654fb799..c8a01608a 100644
--- a/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcPlaylistcontentsTableMap.php
@@ -42,9 +42,9 @@ class CcPlaylistcontentsTableMap extends TableMap {
$this->addForeignKey('PLAYLIST_ID', 'DbPlaylistId', 'INTEGER', 'cc_playlist', 'ID', false, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
$this->addColumn('POSITION', 'DbPosition', 'INTEGER', false, null, null);
- $this->addColumn('CLIPLENGTH', 'DbCliplength', 'TIME', false, null, '00:00:00');
- $this->addColumn('CUEIN', 'DbCuein', 'TIME', false, null, '00:00:00');
- $this->addColumn('CUEOUT', 'DbCueout', 'TIME', false, null, '00:00:00');
+ $this->addColumn('CLIPLENGTH', 'DbCliplength', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('CUEIN', 'DbCuein', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('CUEOUT', 'DbCueout', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('FADEIN', 'DbFadein', 'TIME', false, null, '00:00:00');
$this->addColumn('FADEOUT', 'DbFadeout', 'TIME', false, null, '00:00:00');
// validators
diff --git a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php
index ebbe397c8..e2a988421 100644
--- a/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php
+++ b/airtime_mvc/application/models/airtime/map/CcScheduleTableMap.php
@@ -42,13 +42,14 @@ class CcScheduleTableMap extends TableMap {
$this->addColumn('STARTS', 'DbStarts', 'TIMESTAMP', true, null, null);
$this->addColumn('ENDS', 'DbEnds', 'TIMESTAMP', true, null, null);
$this->addForeignKey('FILE_ID', 'DbFileId', 'INTEGER', 'cc_files', 'ID', false, null, null);
- $this->addColumn('CLIP_LENGTH', 'DbClipLength', 'TIME', false, null, '00:00:00');
+ $this->addColumn('CLIP_LENGTH', 'DbClipLength', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('FADE_IN', 'DbFadeIn', 'TIME', false, null, '00:00:00');
$this->addColumn('FADE_OUT', 'DbFadeOut', 'TIME', false, null, '00:00:00');
- $this->addColumn('CUE_IN', 'DbCueIn', 'TIME', false, null, '00:00:00');
- $this->addColumn('CUE_OUT', 'DbCueOut', 'TIME', false, null, '00:00:00');
+ $this->addColumn('CUE_IN', 'DbCueIn', 'VARCHAR', false, null, '00:00:00');
+ $this->addColumn('CUE_OUT', 'DbCueOut', 'VARCHAR', false, null, '00:00:00');
$this->addColumn('MEDIA_ITEM_PLAYED', 'DbMediaItemPlayed', 'BOOLEAN', false, null, false);
$this->addForeignKey('INSTANCE_ID', 'DbInstanceId', 'INTEGER', 'cc_show_instances', 'ID', true, null, null);
+ $this->addColumn('STATUS', 'DbStatus', 'SMALLINT', true, null, 1);
// validators
} // initialize()
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php
index 457a9b958..8f823a25e 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontents.php
@@ -176,102 +176,33 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
}
/**
- * Get the [optionally formatted] temporal [cliplength] column value.
+ * Get the [cliplength] 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.
+ * @return string
*/
- public function getDbCliplength($format = '%X')
+ public function getDbCliplength()
{
- if ($this->cliplength === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->cliplength);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cliplength, 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);
- }
+ return $this->cliplength;
}
/**
- * Get the [optionally formatted] temporal [cuein] column value.
+ * Get the [cuein] 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.
+ * @return string
*/
- public function getDbCuein($format = '%X')
+ public function getDbCuein()
{
- if ($this->cuein === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->cuein);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cuein, 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);
- }
+ return $this->cuein;
}
/**
- * Get the [optionally formatted] temporal [cueout] column value.
+ * Get the [cueout] 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.
+ * @return string
*/
- public function getDbCueout($format = '%X')
+ public function getDbCueout()
{
- if ($this->cueout === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->cueout);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cueout, 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);
- }
+ return $this->cueout;
}
/**
@@ -429,151 +360,61 @@ abstract class BaseCcPlaylistcontents extends BaseObject implements Persistent
} // setDbPosition()
/**
- * Sets the value of [cliplength] column to a normalized version of the date/time value specified.
+ * Set the value of [cliplength] column.
*
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
+ * @param string $v new value
* @return CcPlaylistcontents The current object (for fluent API support)
*/
public function setDbCliplength($v)
{
- // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
- // -- which is unexpected, to say the least.
- if ($v === null || $v === '') {
- $dt = null;
- } elseif ($v instanceof DateTime) {
- $dt = $v;
- } else {
- // some string/numeric value passed; we normalize that so that we can
- // validate it.
- try {
- if (is_numeric($v)) { // if it's a unix timestamp
- $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
- // We have to explicitly specify and then change the time zone because of a
- // DateTime bug: http://bugs.php.net/bug.php?id=43003
- $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
- } else {
- $dt = new DateTime($v);
- }
- } catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
+ if ($v !== null) {
+ $v = (string) $v;
}
- if ( $this->cliplength !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->cliplength !== null && $tmpDt = new DateTime($this->cliplength)) ? $tmpDt->format('H:i:s') : null;
- $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
-
- if ( ($currNorm !== $newNorm) // normalized values don't match
- || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
- )
- {
- $this->cliplength = ($dt ? $dt->format('H:i:s') : null);
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
- }
- } // if either are not null
+ if ($this->cliplength !== $v || $this->isNew()) {
+ $this->cliplength = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::CLIPLENGTH;
+ }
return $this;
} // setDbCliplength()
/**
- * Sets the value of [cuein] column to a normalized version of the date/time value specified.
+ * Set the value of [cuein] column.
*
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
+ * @param string $v new value
* @return CcPlaylistcontents The current object (for fluent API support)
*/
public function setDbCuein($v)
{
- // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
- // -- which is unexpected, to say the least.
- if ($v === null || $v === '') {
- $dt = null;
- } elseif ($v instanceof DateTime) {
- $dt = $v;
- } else {
- // some string/numeric value passed; we normalize that so that we can
- // validate it.
- try {
- if (is_numeric($v)) { // if it's a unix timestamp
- $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
- // We have to explicitly specify and then change the time zone because of a
- // DateTime bug: http://bugs.php.net/bug.php?id=43003
- $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
- } else {
- $dt = new DateTime($v);
- }
- } catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
+ if ($v !== null) {
+ $v = (string) $v;
}
- if ( $this->cuein !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->cuein !== null && $tmpDt = new DateTime($this->cuein)) ? $tmpDt->format('H:i:s') : null;
- $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
-
- if ( ($currNorm !== $newNorm) // normalized values don't match
- || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
- )
- {
- $this->cuein = ($dt ? $dt->format('H:i:s') : null);
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
- }
- } // if either are not null
+ if ($this->cuein !== $v || $this->isNew()) {
+ $this->cuein = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEIN;
+ }
return $this;
} // setDbCuein()
/**
- * Sets the value of [cueout] column to a normalized version of the date/time value specified.
+ * Set the value of [cueout] column.
*
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
+ * @param string $v new value
* @return CcPlaylistcontents The current object (for fluent API support)
*/
public function setDbCueout($v)
{
- // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
- // -- which is unexpected, to say the least.
- if ($v === null || $v === '') {
- $dt = null;
- } elseif ($v instanceof DateTime) {
- $dt = $v;
- } else {
- // some string/numeric value passed; we normalize that so that we can
- // validate it.
- try {
- if (is_numeric($v)) { // if it's a unix timestamp
- $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
- // We have to explicitly specify and then change the time zone because of a
- // DateTime bug: http://bugs.php.net/bug.php?id=43003
- $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
- } else {
- $dt = new DateTime($v);
- }
- } catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
+ if ($v !== null) {
+ $v = (string) $v;
}
- if ( $this->cueout !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->cueout !== null && $tmpDt = new DateTime($this->cueout)) ? $tmpDt->format('H:i:s') : null;
- $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
-
- if ( ($currNorm !== $newNorm) // normalized values don't match
- || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
- )
- {
- $this->cueout = ($dt ? $dt->format('H:i:s') : null);
- $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
- }
- } // if either are not null
+ if ($this->cueout !== $v || $this->isNew()) {
+ $this->cueout = $v;
+ $this->modifiedColumns[] = CcPlaylistcontentsPeer::CUEOUT;
+ }
return $this;
} // setDbCueout()
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php
index 85262c7bd..8769dfe60 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcPlaylistcontentsQuery.php
@@ -282,29 +282,20 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
/**
* Filter the query on the cliplength column
*
- * @param string|array $dbCliplength The value to use as filter.
- * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
+ * @param string $dbCliplength 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 CcPlaylistcontentsQuery The current query, for fluid interface
*/
public function filterByDbCliplength($dbCliplength = null, $comparison = null)
{
- if (is_array($dbCliplength)) {
- $useMinMax = false;
- if (isset($dbCliplength['min'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbCliplength['max'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
+ if (null === $comparison) {
+ if (is_array($dbCliplength)) {
$comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCliplength)) {
+ $dbCliplength = str_replace('*', '%', $dbCliplength);
+ $comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::CLIPLENGTH, $dbCliplength, $comparison);
@@ -313,29 +304,20 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
/**
* Filter the query on the cuein column
*
- * @param string|array $dbCuein The value to use as filter.
- * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
+ * @param string $dbCuein 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 CcPlaylistcontentsQuery The current query, for fluid interface
*/
public function filterByDbCuein($dbCuein = null, $comparison = null)
{
- if (is_array($dbCuein)) {
- $useMinMax = false;
- if (isset($dbCuein['min'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbCuein['max'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
+ if (null === $comparison) {
+ if (is_array($dbCuein)) {
$comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCuein)) {
+ $dbCuein = str_replace('*', '%', $dbCuein);
+ $comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEIN, $dbCuein, $comparison);
@@ -344,29 +326,20 @@ abstract class BaseCcPlaylistcontentsQuery extends ModelCriteria
/**
* Filter the query on the cueout column
*
- * @param string|array $dbCueout The value to use as filter.
- * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
+ * @param string $dbCueout 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 CcPlaylistcontentsQuery The current query, for fluid interface
*/
public function filterByDbCueout($dbCueout = null, $comparison = null)
{
- if (is_array($dbCueout)) {
- $useMinMax = false;
- if (isset($dbCueout['min'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbCueout['max'])) {
- $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
+ if (null === $comparison) {
+ if (is_array($dbCueout)) {
$comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCueout)) {
+ $dbCueout = str_replace('*', '%', $dbCueout);
+ $comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcPlaylistcontentsPeer::CUEOUT, $dbCueout, $comparison);
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php
index 751babc2d..977298da2 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedule.php
@@ -96,6 +96,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
*/
protected $instance_id;
+ /**
+ * The value for the status field.
+ * Note: this column has a database default value of: 1
+ * @var int
+ */
+ protected $status;
+
/**
* @var CcShowInstances
*/
@@ -137,6 +144,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->cue_in = '00:00:00';
$this->cue_out = '00:00:00';
$this->media_item_played = false;
+ $this->status = 1;
}
/**
@@ -236,36 +244,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
}
/**
- * Get the [optionally formatted] temporal [clip_length] column value.
+ * Get the [clip_length] 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.
+ * @return string
*/
- public function getDbClipLength($format = '%X')
+ public function getDbClipLength()
{
- 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);
- }
+ return $this->clip_length;
}
/**
@@ -335,69 +320,23 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
}
/**
- * Get the [optionally formatted] temporal [cue_in] column value.
+ * Get the [cue_in] 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.
+ * @return string
*/
- public function getDbCueIn($format = '%X')
+ public function getDbCueIn()
{
- if ($this->cue_in === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->cue_in);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cue_in, 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);
- }
+ return $this->cue_in;
}
/**
- * Get the [optionally formatted] temporal [cue_out] column value.
+ * Get the [cue_out] 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.
+ * @return string
*/
- public function getDbCueOut($format = '%X')
+ public function getDbCueOut()
{
- if ($this->cue_out === null) {
- return null;
- }
-
-
-
- try {
- $dt = new DateTime($this->cue_out);
- } catch (Exception $x) {
- throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->cue_out, 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);
- }
+ return $this->cue_out;
}
/**
@@ -420,6 +359,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this->instance_id;
}
+ /**
+ * Get the [status] column value.
+ *
+ * @return int
+ */
+ public function getDbStatus()
+ {
+ return $this->status;
+ }
+
/**
* Set the value of [id] column.
*
@@ -563,51 +512,21 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
} // setDbFileId()
/**
- * Sets the value of [clip_length] column to a normalized version of the date/time value specified.
+ * Set the value of [clip_length] column.
*
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
+ * @param string $v new value
* @return CcSchedule The current object (for fluent API support)
*/
public function setDbClipLength($v)
{
- // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
- // -- which is unexpected, to say the least.
- if ($v === null || $v === '') {
- $dt = null;
- } elseif ($v instanceof DateTime) {
- $dt = $v;
- } else {
- // some string/numeric value passed; we normalize that so that we can
- // validate it.
- try {
- if (is_numeric($v)) { // if it's a unix timestamp
- $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
- // We have to explicitly specify and then change the time zone because of a
- // DateTime bug: http://bugs.php.net/bug.php?id=43003
- $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
- } else {
- $dt = new DateTime($v);
- }
- } catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
+ if ($v !== null) {
+ $v = (string) $v;
}
- if ( $this->clip_length !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->clip_length !== null && $tmpDt = new DateTime($this->clip_length)) ? $tmpDt->format('H:i:s') : null;
- $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
-
- if ( ($currNorm !== $newNorm) // normalized values don't match
- || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
- )
- {
- $this->clip_length = ($dt ? $dt->format('H:i:s') : null);
- $this->modifiedColumns[] = CcSchedulePeer::CLIP_LENGTH;
- }
- } // if either are not null
+ if ($this->clip_length !== $v || $this->isNew()) {
+ $this->clip_length = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::CLIP_LENGTH;
+ }
return $this;
} // setDbClipLength()
@@ -713,101 +632,41 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
} // setDbFadeOut()
/**
- * Sets the value of [cue_in] column to a normalized version of the date/time value specified.
+ * Set the value of [cue_in] column.
*
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
+ * @param string $v new value
* @return CcSchedule The current object (for fluent API support)
*/
public function setDbCueIn($v)
{
- // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
- // -- which is unexpected, to say the least.
- if ($v === null || $v === '') {
- $dt = null;
- } elseif ($v instanceof DateTime) {
- $dt = $v;
- } else {
- // some string/numeric value passed; we normalize that so that we can
- // validate it.
- try {
- if (is_numeric($v)) { // if it's a unix timestamp
- $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
- // We have to explicitly specify and then change the time zone because of a
- // DateTime bug: http://bugs.php.net/bug.php?id=43003
- $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
- } else {
- $dt = new DateTime($v);
- }
- } catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
+ if ($v !== null) {
+ $v = (string) $v;
}
- if ( $this->cue_in !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->cue_in !== null && $tmpDt = new DateTime($this->cue_in)) ? $tmpDt->format('H:i:s') : null;
- $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
-
- if ( ($currNorm !== $newNorm) // normalized values don't match
- || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
- )
- {
- $this->cue_in = ($dt ? $dt->format('H:i:s') : null);
- $this->modifiedColumns[] = CcSchedulePeer::CUE_IN;
- }
- } // if either are not null
+ if ($this->cue_in !== $v || $this->isNew()) {
+ $this->cue_in = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::CUE_IN;
+ }
return $this;
} // setDbCueIn()
/**
- * Sets the value of [cue_out] column to a normalized version of the date/time value specified.
+ * Set the value of [cue_out] column.
*
- * @param mixed $v string, integer (timestamp), or DateTime value. Empty string will
- * be treated as NULL for temporal objects.
+ * @param string $v new value
* @return CcSchedule The current object (for fluent API support)
*/
public function setDbCueOut($v)
{
- // we treat '' as NULL for temporal objects because DateTime('') == DateTime('now')
- // -- which is unexpected, to say the least.
- if ($v === null || $v === '') {
- $dt = null;
- } elseif ($v instanceof DateTime) {
- $dt = $v;
- } else {
- // some string/numeric value passed; we normalize that so that we can
- // validate it.
- try {
- if (is_numeric($v)) { // if it's a unix timestamp
- $dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
- // We have to explicitly specify and then change the time zone because of a
- // DateTime bug: http://bugs.php.net/bug.php?id=43003
- $dt->setTimeZone(new DateTimeZone(date_default_timezone_get()));
- } else {
- $dt = new DateTime($v);
- }
- } catch (Exception $x) {
- throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
- }
+ if ($v !== null) {
+ $v = (string) $v;
}
- if ( $this->cue_out !== null || $dt !== null ) {
- // (nested ifs are a little easier to read in this case)
-
- $currNorm = ($this->cue_out !== null && $tmpDt = new DateTime($this->cue_out)) ? $tmpDt->format('H:i:s') : null;
- $newNorm = ($dt !== null) ? $dt->format('H:i:s') : null;
-
- if ( ($currNorm !== $newNorm) // normalized values don't match
- || ($dt->format('H:i:s') === '00:00:00') // or the entered value matches the default
- )
- {
- $this->cue_out = ($dt ? $dt->format('H:i:s') : null);
- $this->modifiedColumns[] = CcSchedulePeer::CUE_OUT;
- }
- } // if either are not null
+ if ($this->cue_out !== $v || $this->isNew()) {
+ $this->cue_out = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::CUE_OUT;
+ }
return $this;
} // setDbCueOut()
@@ -856,6 +715,26 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this;
} // setDbInstanceId()
+ /**
+ * Set the value of [status] column.
+ *
+ * @param int $v new value
+ * @return CcSchedule The current object (for fluent API support)
+ */
+ public function setDbStatus($v)
+ {
+ if ($v !== null) {
+ $v = (int) $v;
+ }
+
+ if ($this->status !== $v || $this->isNew()) {
+ $this->status = $v;
+ $this->modifiedColumns[] = CcSchedulePeer::STATUS;
+ }
+
+ return $this;
+ } // setDbStatus()
+
/**
* Indicates whether the columns in this object are only set to default values.
*
@@ -890,6 +769,10 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return false;
}
+ if ($this->status !== 1) {
+ return false;
+ }
+
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
@@ -923,6 +806,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->cue_out = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->media_item_played = ($row[$startcol + 9] !== null) ? (boolean) $row[$startcol + 9] : null;
$this->instance_id = ($row[$startcol + 10] !== null) ? (int) $row[$startcol + 10] : null;
+ $this->status = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
$this->resetModified();
$this->setNew(false);
@@ -931,7 +815,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->ensureConsistency();
}
- return $startcol + 11; // 11 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
+ return $startcol + 12; // 12 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcSchedule object", $e);
@@ -1310,6 +1194,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
case 10:
return $this->getDbInstanceId();
break;
+ case 11:
+ return $this->getDbStatus();
+ break;
default:
return null;
break;
@@ -1345,6 +1232,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$keys[8] => $this->getDbCueOut(),
$keys[9] => $this->getDbMediaItemPlayed(),
$keys[10] => $this->getDbInstanceId(),
+ $keys[11] => $this->getDbStatus(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcShowInstances) {
@@ -1417,6 +1305,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
case 10:
$this->setDbInstanceId($value);
break;
+ case 11:
+ $this->setDbStatus($value);
+ break;
} // switch()
}
@@ -1452,6 +1343,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
if (array_key_exists($keys[8], $arr)) $this->setDbCueOut($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setDbMediaItemPlayed($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setDbInstanceId($arr[$keys[10]]);
+ if (array_key_exists($keys[11], $arr)) $this->setDbStatus($arr[$keys[11]]);
}
/**
@@ -1474,6 +1366,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
if ($this->isColumnModified(CcSchedulePeer::CUE_OUT)) $criteria->add(CcSchedulePeer::CUE_OUT, $this->cue_out);
if ($this->isColumnModified(CcSchedulePeer::MEDIA_ITEM_PLAYED)) $criteria->add(CcSchedulePeer::MEDIA_ITEM_PLAYED, $this->media_item_played);
if ($this->isColumnModified(CcSchedulePeer::INSTANCE_ID)) $criteria->add(CcSchedulePeer::INSTANCE_ID, $this->instance_id);
+ if ($this->isColumnModified(CcSchedulePeer::STATUS)) $criteria->add(CcSchedulePeer::STATUS, $this->status);
return $criteria;
}
@@ -1545,6 +1438,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$copyObj->setDbCueOut($this->cue_out);
$copyObj->setDbMediaItemPlayed($this->media_item_played);
$copyObj->setDbInstanceId($this->instance_id);
+ $copyObj->setDbStatus($this->status);
$copyObj->setNew(true);
$copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
@@ -1706,6 +1600,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->cue_out = null;
$this->media_item_played = null;
$this->instance_id = null;
+ $this->status = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->clearAllReferences();
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php b/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php
index e11d284a7..2aa1199f7 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcSchedulePeer.php
@@ -26,7 +26,7 @@ abstract class BaseCcSchedulePeer {
const TM_CLASS = 'CcScheduleTableMap';
/** The total number of columns. */
- const NUM_COLUMNS = 11;
+ const NUM_COLUMNS = 12;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -64,6 +64,9 @@ abstract class BaseCcSchedulePeer {
/** the column name for the INSTANCE_ID field */
const INSTANCE_ID = 'cc_schedule.INSTANCE_ID';
+ /** the column name for the STATUS field */
+ const STATUS = 'cc_schedule.STATUS';
+
/**
* An identiy map to hold any loaded instances of CcSchedule objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
@@ -80,12 +83,12 @@ abstract class BaseCcSchedulePeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
- BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', ),
- BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', ),
- BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbStatus', ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbStatus', ),
+ BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, self::STATUS, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'STATUS', ),
+ BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'status', ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@@ -95,12 +98,12 @@ abstract class BaseCcSchedulePeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
- BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbClipLength' => 4, 'DbFadeIn' => 5, 'DbFadeOut' => 6, 'DbCueIn' => 7, 'DbCueOut' => 8, 'DbMediaItemPlayed' => 9, 'DbInstanceId' => 10, ),
- BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbClipLength' => 4, 'dbFadeIn' => 5, 'dbFadeOut' => 6, 'dbCueIn' => 7, 'dbCueOut' => 8, 'dbMediaItemPlayed' => 9, 'dbInstanceId' => 10, ),
- BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::CLIP_LENGTH => 4, self::FADE_IN => 5, self::FADE_OUT => 6, self::CUE_IN => 7, self::CUE_OUT => 8, self::MEDIA_ITEM_PLAYED => 9, self::INSTANCE_ID => 10, ),
- BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'CLIP_LENGTH' => 4, 'FADE_IN' => 5, 'FADE_OUT' => 6, 'CUE_IN' => 7, 'CUE_OUT' => 8, 'MEDIA_ITEM_PLAYED' => 9, 'INSTANCE_ID' => 10, ),
- BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'clip_length' => 4, 'fade_in' => 5, 'fade_out' => 6, 'cue_in' => 7, 'cue_out' => 8, 'media_item_played' => 9, 'instance_id' => 10, ),
- BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
+ BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbClipLength' => 4, 'DbFadeIn' => 5, 'DbFadeOut' => 6, 'DbCueIn' => 7, 'DbCueOut' => 8, 'DbMediaItemPlayed' => 9, 'DbInstanceId' => 10, 'DbStatus' => 11, ),
+ BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbClipLength' => 4, 'dbFadeIn' => 5, 'dbFadeOut' => 6, 'dbCueIn' => 7, 'dbCueOut' => 8, 'dbMediaItemPlayed' => 9, 'dbInstanceId' => 10, 'dbStatus' => 11, ),
+ BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::CLIP_LENGTH => 4, self::FADE_IN => 5, self::FADE_OUT => 6, self::CUE_IN => 7, self::CUE_OUT => 8, self::MEDIA_ITEM_PLAYED => 9, self::INSTANCE_ID => 10, self::STATUS => 11, ),
+ BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'CLIP_LENGTH' => 4, 'FADE_IN' => 5, 'FADE_OUT' => 6, 'CUE_IN' => 7, 'CUE_OUT' => 8, 'MEDIA_ITEM_PLAYED' => 9, 'INSTANCE_ID' => 10, 'STATUS' => 11, ),
+ BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'clip_length' => 4, 'fade_in' => 5, 'fade_out' => 6, 'cue_in' => 7, 'cue_out' => 8, 'media_item_played' => 9, 'instance_id' => 10, 'status' => 11, ),
+ BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
);
/**
@@ -183,6 +186,7 @@ abstract class BaseCcSchedulePeer {
$criteria->addSelectColumn(CcSchedulePeer::CUE_OUT);
$criteria->addSelectColumn(CcSchedulePeer::MEDIA_ITEM_PLAYED);
$criteria->addSelectColumn(CcSchedulePeer::INSTANCE_ID);
+ $criteria->addSelectColumn(CcSchedulePeer::STATUS);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.STARTS');
@@ -195,6 +199,7 @@ abstract class BaseCcSchedulePeer {
$criteria->addSelectColumn($alias . '.CUE_OUT');
$criteria->addSelectColumn($alias . '.MEDIA_ITEM_PLAYED');
$criteria->addSelectColumn($alias . '.INSTANCE_ID');
+ $criteria->addSelectColumn($alias . '.STATUS');
}
}
diff --git a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php
index 4c661ad56..dc26a7311 100644
--- a/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php
+++ b/airtime_mvc/application/models/airtime/om/BaseCcScheduleQuery.php
@@ -17,6 +17,7 @@
* @method CcScheduleQuery orderByDbCueOut($order = Criteria::ASC) Order by the cue_out column
* @method CcScheduleQuery orderByDbMediaItemPlayed($order = Criteria::ASC) Order by the media_item_played column
* @method CcScheduleQuery orderByDbInstanceId($order = Criteria::ASC) Order by the instance_id column
+ * @method CcScheduleQuery orderByDbStatus($order = Criteria::ASC) Order by the status column
*
* @method CcScheduleQuery groupByDbId() Group by the id column
* @method CcScheduleQuery groupByDbStarts() Group by the starts column
@@ -29,6 +30,7 @@
* @method CcScheduleQuery groupByDbCueOut() Group by the cue_out column
* @method CcScheduleQuery groupByDbMediaItemPlayed() Group by the media_item_played column
* @method CcScheduleQuery groupByDbInstanceId() Group by the instance_id column
+ * @method CcScheduleQuery groupByDbStatus() Group by the status column
*
* @method CcScheduleQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcScheduleQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -56,6 +58,7 @@
* @method CcSchedule findOneByDbCueOut(string $cue_out) Return the first CcSchedule filtered by the cue_out column
* @method CcSchedule findOneByDbMediaItemPlayed(boolean $media_item_played) Return the first CcSchedule filtered by the media_item_played column
* @method CcSchedule findOneByDbInstanceId(int $instance_id) Return the first CcSchedule filtered by the instance_id column
+ * @method CcSchedule findOneByDbStatus(int $status) Return the first CcSchedule filtered by the status column
*
* @method array findByDbId(int $id) Return CcSchedule objects filtered by the id column
* @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column
@@ -68,6 +71,7 @@
* @method array findByDbCueOut(string $cue_out) Return CcSchedule objects filtered by the cue_out column
* @method array findByDbMediaItemPlayed(boolean $media_item_played) Return CcSchedule objects filtered by the media_item_played column
* @method array findByDbInstanceId(int $instance_id) Return CcSchedule objects filtered by the instance_id column
+ * @method array findByDbStatus(int $status) Return CcSchedule objects filtered by the status column
*
* @package propel.generator.airtime.om
*/
@@ -290,29 +294,20 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
/**
* Filter the query on the clip_length column
*
- * @param string|array $dbClipLength The value to use as filter.
- * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
+ * @param string $dbClipLength 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 CcScheduleQuery The current query, for fluid interface
*/
public function filterByDbClipLength($dbClipLength = null, $comparison = null)
{
- if (is_array($dbClipLength)) {
- $useMinMax = false;
- if (isset($dbClipLength['min'])) {
- $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbClipLength['max'])) {
- $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
+ if (null === $comparison) {
+ if (is_array($dbClipLength)) {
$comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbClipLength)) {
+ $dbClipLength = str_replace('*', '%', $dbClipLength);
+ $comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcSchedulePeer::CLIP_LENGTH, $dbClipLength, $comparison);
@@ -383,29 +378,20 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
/**
* Filter the query on the cue_in column
*
- * @param string|array $dbCueIn The value to use as filter.
- * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
+ * @param string $dbCueIn 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 CcScheduleQuery The current query, for fluid interface
*/
public function filterByDbCueIn($dbCueIn = null, $comparison = null)
{
- if (is_array($dbCueIn)) {
- $useMinMax = false;
- if (isset($dbCueIn['min'])) {
- $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbCueIn['max'])) {
- $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
+ if (null === $comparison) {
+ if (is_array($dbCueIn)) {
$comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCueIn)) {
+ $dbCueIn = str_replace('*', '%', $dbCueIn);
+ $comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcSchedulePeer::CUE_IN, $dbCueIn, $comparison);
@@ -414,29 +400,20 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
/**
* Filter the query on the cue_out column
*
- * @param string|array $dbCueOut The value to use as filter.
- * Accepts an associative array('min' => $minValue, 'max' => $maxValue)
+ * @param string $dbCueOut 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 CcScheduleQuery The current query, for fluid interface
*/
public function filterByDbCueOut($dbCueOut = null, $comparison = null)
{
- if (is_array($dbCueOut)) {
- $useMinMax = false;
- if (isset($dbCueOut['min'])) {
- $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut['min'], Criteria::GREATER_EQUAL);
- $useMinMax = true;
- }
- if (isset($dbCueOut['max'])) {
- $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut['max'], Criteria::LESS_EQUAL);
- $useMinMax = true;
- }
- if ($useMinMax) {
- return $this;
- }
- if (null === $comparison) {
+ if (null === $comparison) {
+ if (is_array($dbCueOut)) {
$comparison = Criteria::IN;
+ } elseif (preg_match('/[\%\*]/', $dbCueOut)) {
+ $dbCueOut = str_replace('*', '%', $dbCueOut);
+ $comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CcSchedulePeer::CUE_OUT, $dbCueOut, $comparison);
@@ -490,6 +467,37 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
return $this->addUsingAlias(CcSchedulePeer::INSTANCE_ID, $dbInstanceId, $comparison);
}
+ /**
+ * Filter the query on the status column
+ *
+ * @param int|array $dbStatus 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 CcScheduleQuery The current query, for fluid interface
+ */
+ public function filterByDbStatus($dbStatus = null, $comparison = null)
+ {
+ if (is_array($dbStatus)) {
+ $useMinMax = false;
+ if (isset($dbStatus['min'])) {
+ $this->addUsingAlias(CcSchedulePeer::STATUS, $dbStatus['min'], Criteria::GREATER_EQUAL);
+ $useMinMax = true;
+ }
+ if (isset($dbStatus['max'])) {
+ $this->addUsingAlias(CcSchedulePeer::STATUS, $dbStatus['max'], Criteria::LESS_EQUAL);
+ $useMinMax = true;
+ }
+ if ($useMinMax) {
+ return $this;
+ }
+ if (null === $comparison) {
+ $comparison = Criteria::IN;
+ }
+ }
+ return $this->addUsingAlias(CcSchedulePeer::STATUS, $dbStatus, $comparison);
+ }
+
/**
* Filter the query by a related CcShowInstances object
*
diff --git a/airtime_mvc/application/models/formatters/TimeFilledFormatter.php b/airtime_mvc/application/models/formatters/TimeFilledFormatter.php
new file mode 100644
index 000000000..6a894d194
--- /dev/null
+++ b/airtime_mvc/application/models/formatters/TimeFilledFormatter.php
@@ -0,0 +1,46 @@
+_seconds = $seconds;
+ }
+
+ public function format()
+ {
+ $formatted = "";
+ $sign = ($this->_seconds < 0) ? "-" : "+";
+
+ $time = Application_Model_Playlist::secondsToPlaylistTime(abs($this->_seconds));
+ Logging::log("time is: ".$time);
+ $info = explode(":", $time);
+
+ $formatted .= $sign;
+
+ if (intval($info[0]) > 0) {
+ $info[0] = ltrim($info[0], "0");
+ $formatted .= " {$info[0]}h";
+ }
+
+ if (intval($info[1]) > 0) {
+ $info[1] = ltrim($info[1], "0");
+ $formatted .= " {$info[1]}m";
+ }
+
+ if (intval($info[2]) > 0) {
+ $sec = round($info[2], 0);
+ $formatted .= " {$sec}s";
+ }
+
+ return $formatted;
+ }
+}
\ No newline at end of file
diff --git a/airtime_mvc/application/views/scripts/library/contents.phtml b/airtime_mvc/application/views/scripts/library/contents.phtml
deleted file mode 100644
index e69de29bb..000000000
diff --git a/airtime_mvc/application/views/scripts/library/context-menu.phtml b/airtime_mvc/application/views/scripts/library/context-menu.phtml
deleted file mode 100644
index e69de29bb..000000000
diff --git a/airtime_mvc/application/views/scripts/library/delete.phtml b/airtime_mvc/application/views/scripts/library/delete.phtml
deleted file mode 100644
index 5cbb9a545..000000000
--- a/airtime_mvc/application/views/scripts/library/delete.phtml
+++ /dev/null
@@ -1 +0,0 @@
-