CC-4961: Show linking

This commit is contained in:
denise 2013-04-26 13:43:30 -04:00
parent 0f1383d541
commit 52655ab375
11 changed files with 164 additions and 75 deletions

View file

@ -432,7 +432,7 @@ class Application_Model_Scheduler
* array of schedule item info, what gets inserted into cc_schedule
* @param $adjustSched
*/
private function insertAfter($scheduleItems, $mediaItems, $filesToInsert=null, $adjustSched=true)
private function insertAfter($scheduleItems, $mediaItems, $filesToInsert=null, $adjustSched=true, $moveAction=false)
{
try {
$affectedShowInstances = array();
@ -613,7 +613,9 @@ class Application_Model_Scheduler
/* Reset files to insert so we can get a new set of files. We have
* to do this in case we are inserting a dynamic block
*/
$filesToInsert = null;
if (!$moveAction) {
$filesToInsert = null;
}
/* If we are adjusting start and end times for items
* after the insert location, we need to exclude the
@ -817,7 +819,7 @@ class Application_Model_Scheduler
$startProfile = microtime(true);
$this->insertAfter($afterItems, null, $movedData, $adjustSched);
$this->insertAfter($afterItems, null, $movedData, $adjustSched, true);
$endProfile = microtime(true);
Logging::debug("inserting after removing gaps.");

View file

@ -134,6 +134,11 @@ class CcShow extends BaseCcShow {
return $this->getDbLinked();
}
public function isLinkable()
{
return $this->getDbIsLinkable();
}
/**
* Gets an array of CcShowInstances objects which contain a foreign key that references this object.
*

View file

@ -50,6 +50,7 @@ class CcShowTableMap extends TableMap {
$this->addColumn('LIVE_STREAM_USER', 'DbLiveStreamUser', 'VARCHAR', false, 255, null);
$this->addColumn('LIVE_STREAM_PASS', 'DbLiveStreamPass', 'VARCHAR', false, 255, null);
$this->addColumn('LINKED', 'DbLinked', 'BOOLEAN', true, null, false);
$this->addColumn('IS_LINKABLE', 'DbIsLinkable', 'BOOLEAN', true, null, true);
// validators
} // initialize()

View file

@ -102,6 +102,13 @@ abstract class BaseCcShow extends BaseObject implements Persistent
*/
protected $linked;
/**
* The value for the is_linkable field.
* Note: this column has a database default value of: true
* @var boolean
*/
protected $is_linkable;
/**
* @var array CcShowInstances[] Collection to store aggregation of CcShowInstances objects.
*/
@ -150,6 +157,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->live_stream_using_airtime_auth = false;
$this->live_stream_using_custom_auth = false;
$this->linked = false;
$this->is_linkable = true;
}
/**
@ -282,6 +290,16 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this->linked;
}
/**
* Get the [is_linkable] column value.
*
* @return boolean
*/
public function getDbIsLinkable()
{
return $this->is_linkable;
}
/**
* Set the value of [id] column.
*
@ -522,6 +540,26 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return $this;
} // setDbLinked()
/**
* Set the value of [is_linkable] column.
*
* @param boolean $v new value
* @return CcShow The current object (for fluent API support)
*/
public function setDbIsLinkable($v)
{
if ($v !== null) {
$v = (boolean) $v;
}
if ($this->is_linkable !== $v || $this->isNew()) {
$this->is_linkable = $v;
$this->modifiedColumns[] = CcShowPeer::IS_LINKABLE;
}
return $this;
} // setDbIsLinkable()
/**
* Indicates whether the columns in this object are only set to default values.
*
@ -556,6 +594,10 @@ abstract class BaseCcShow extends BaseObject implements Persistent
return false;
}
if ($this->is_linkable !== true) {
return false;
}
// otherwise, everything was equal, so return TRUE
return true;
} // hasOnlyDefaultValues()
@ -590,6 +632,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->live_stream_user = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
$this->live_stream_pass = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
$this->linked = ($row[$startcol + 11] !== null) ? (boolean) $row[$startcol + 11] : null;
$this->is_linkable = ($row[$startcol + 12] !== null) ? (boolean) $row[$startcol + 12] : null;
$this->resetModified();
$this->setNew(false);
@ -598,7 +641,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->ensureConsistency();
}
return $startcol + 12; // 12 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 13; // 13 = CcShowPeer::NUM_COLUMNS - CcShowPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcShow object", $e);
@ -1005,6 +1048,9 @@ abstract class BaseCcShow extends BaseObject implements Persistent
case 11:
return $this->getDbLinked();
break;
case 12:
return $this->getDbIsLinkable();
break;
default:
return null;
break;
@ -1040,6 +1086,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$keys[9] => $this->getDbLiveStreamUser(),
$keys[10] => $this->getDbLiveStreamPass(),
$keys[11] => $this->getDbLinked(),
$keys[12] => $this->getDbIsLinkable(),
);
return $result;
}
@ -1107,6 +1154,9 @@ abstract class BaseCcShow extends BaseObject implements Persistent
case 11:
$this->setDbLinked($value);
break;
case 12:
$this->setDbIsLinkable($value);
break;
} // switch()
}
@ -1143,6 +1193,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if (array_key_exists($keys[9], $arr)) $this->setDbLiveStreamUser($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setDbLiveStreamPass($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setDbLinked($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setDbIsLinkable($arr[$keys[12]]);
}
/**
@ -1166,6 +1217,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_USER)) $criteria->add(CcShowPeer::LIVE_STREAM_USER, $this->live_stream_user);
if ($this->isColumnModified(CcShowPeer::LIVE_STREAM_PASS)) $criteria->add(CcShowPeer::LIVE_STREAM_PASS, $this->live_stream_pass);
if ($this->isColumnModified(CcShowPeer::LINKED)) $criteria->add(CcShowPeer::LINKED, $this->linked);
if ($this->isColumnModified(CcShowPeer::IS_LINKABLE)) $criteria->add(CcShowPeer::IS_LINKABLE, $this->is_linkable);
return $criteria;
}
@ -1238,6 +1290,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$copyObj->setDbLiveStreamUser($this->live_stream_user);
$copyObj->setDbLiveStreamPass($this->live_stream_pass);
$copyObj->setDbLinked($this->linked);
$copyObj->setDbIsLinkable($this->is_linkable);
if ($deepCopy) {
// important: temporarily setNew(false) because this affects the behavior of
@ -1841,6 +1894,7 @@ abstract class BaseCcShow extends BaseObject implements Persistent
$this->live_stream_user = null;
$this->live_stream_pass = null;
$this->linked = null;
$this->is_linkable = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->clearAllReferences();

View file

@ -26,7 +26,7 @@ abstract class BaseCcShowPeer {
const TM_CLASS = 'CcShowTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 12;
const NUM_COLUMNS = 13;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@ -67,6 +67,9 @@ abstract class BaseCcShowPeer {
/** the column name for the LINKED field */
const LINKED = 'cc_show.LINKED';
/** the column name for the IS_LINKABLE field */
const IS_LINKABLE = 'cc_show.IS_LINKABLE';
/**
* An identiy map to hold any loaded instances of CcShow objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
@ -83,12 +86,12 @@ abstract class BaseCcShowPeer {
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', 'DbLinked', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', 'dbLiveStreamUsingAirtimeAuth', 'dbLiveStreamUsingCustomAuth', 'dbLiveStreamUser', 'dbLiveStreamPass', 'dbLinked', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::URL, self::GENRE, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, self::LIVE_STREAM_USING_AIRTIME_AUTH, self::LIVE_STREAM_USING_CUSTOM_AUTH, self::LIVE_STREAM_USER, self::LIVE_STREAM_PASS, self::LINKED, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', 'LIVE_STREAM_USING_AIRTIME_AUTH', 'LIVE_STREAM_USING_CUSTOM_AUTH', 'LIVE_STREAM_USER', 'LIVE_STREAM_PASS', 'LINKED', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', 'live_stream_using_airtime_auth', 'live_stream_using_custom_auth', 'live_stream_user', 'live_stream_pass', 'linked', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbName', 'DbUrl', 'DbGenre', 'DbDescription', 'DbColor', 'DbBackgroundColor', 'DbLiveStreamUsingAirtimeAuth', 'DbLiveStreamUsingCustomAuth', 'DbLiveStreamUser', 'DbLiveStreamPass', 'DbLinked', 'DbIsLinkable', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbName', 'dbUrl', 'dbGenre', 'dbDescription', 'dbColor', 'dbBackgroundColor', 'dbLiveStreamUsingAirtimeAuth', 'dbLiveStreamUsingCustomAuth', 'dbLiveStreamUser', 'dbLiveStreamPass', 'dbLinked', 'dbIsLinkable', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::NAME, self::URL, self::GENRE, self::DESCRIPTION, self::COLOR, self::BACKGROUND_COLOR, self::LIVE_STREAM_USING_AIRTIME_AUTH, self::LIVE_STREAM_USING_CUSTOM_AUTH, self::LIVE_STREAM_USER, self::LIVE_STREAM_PASS, self::LINKED, self::IS_LINKABLE, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'NAME', 'URL', 'GENRE', 'DESCRIPTION', 'COLOR', 'BACKGROUND_COLOR', 'LIVE_STREAM_USING_AIRTIME_AUTH', 'LIVE_STREAM_USING_CUSTOM_AUTH', 'LIVE_STREAM_USER', 'LIVE_STREAM_PASS', 'LINKED', 'IS_LINKABLE', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'name', 'url', 'genre', 'description', 'color', 'background_color', 'live_stream_using_airtime_auth', 'live_stream_using_custom_auth', 'live_stream_user', 'live_stream_pass', 'linked', 'is_linkable', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
);
/**
@ -98,12 +101,12 @@ abstract class BaseCcShowPeer {
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, 'DbLiveStreamUsingAirtimeAuth' => 7, 'DbLiveStreamUsingCustomAuth' => 8, 'DbLiveStreamUser' => 9, 'DbLiveStreamPass' => 10, 'DbLinked' => 11, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, 'dbLiveStreamUsingAirtimeAuth' => 7, 'dbLiveStreamUsingCustomAuth' => 8, 'dbLiveStreamUser' => 9, 'dbLiveStreamPass' => 10, 'dbLinked' => 11, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::URL => 2, self::GENRE => 3, self::DESCRIPTION => 4, self::COLOR => 5, self::BACKGROUND_COLOR => 6, self::LIVE_STREAM_USING_AIRTIME_AUTH => 7, self::LIVE_STREAM_USING_CUSTOM_AUTH => 8, self::LIVE_STREAM_USER => 9, self::LIVE_STREAM_PASS => 10, self::LINKED => 11, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, 'LIVE_STREAM_USING_AIRTIME_AUTH' => 7, 'LIVE_STREAM_USING_CUSTOM_AUTH' => 8, 'LIVE_STREAM_USER' => 9, 'LIVE_STREAM_PASS' => 10, 'LINKED' => 11, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, 'live_stream_using_airtime_auth' => 7, 'live_stream_using_custom_auth' => 8, 'live_stream_user' => 9, 'live_stream_pass' => 10, 'linked' => 11, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, )
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbName' => 1, 'DbUrl' => 2, 'DbGenre' => 3, 'DbDescription' => 4, 'DbColor' => 5, 'DbBackgroundColor' => 6, 'DbLiveStreamUsingAirtimeAuth' => 7, 'DbLiveStreamUsingCustomAuth' => 8, 'DbLiveStreamUser' => 9, 'DbLiveStreamPass' => 10, 'DbLinked' => 11, 'DbIsLinkable' => 12, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbName' => 1, 'dbUrl' => 2, 'dbGenre' => 3, 'dbDescription' => 4, 'dbColor' => 5, 'dbBackgroundColor' => 6, 'dbLiveStreamUsingAirtimeAuth' => 7, 'dbLiveStreamUsingCustomAuth' => 8, 'dbLiveStreamUser' => 9, 'dbLiveStreamPass' => 10, 'dbLinked' => 11, 'dbIsLinkable' => 12, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NAME => 1, self::URL => 2, self::GENRE => 3, self::DESCRIPTION => 4, self::COLOR => 5, self::BACKGROUND_COLOR => 6, self::LIVE_STREAM_USING_AIRTIME_AUTH => 7, self::LIVE_STREAM_USING_CUSTOM_AUTH => 8, self::LIVE_STREAM_USER => 9, self::LIVE_STREAM_PASS => 10, self::LINKED => 11, self::IS_LINKABLE => 12, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'NAME' => 1, 'URL' => 2, 'GENRE' => 3, 'DESCRIPTION' => 4, 'COLOR' => 5, 'BACKGROUND_COLOR' => 6, 'LIVE_STREAM_USING_AIRTIME_AUTH' => 7, 'LIVE_STREAM_USING_CUSTOM_AUTH' => 8, 'LIVE_STREAM_USER' => 9, 'LIVE_STREAM_PASS' => 10, 'LINKED' => 11, 'IS_LINKABLE' => 12, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'name' => 1, 'url' => 2, 'genre' => 3, 'description' => 4, 'color' => 5, 'background_color' => 6, 'live_stream_using_airtime_auth' => 7, 'live_stream_using_custom_auth' => 8, 'live_stream_user' => 9, 'live_stream_pass' => 10, 'linked' => 11, 'is_linkable' => 12, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
);
/**
@ -187,6 +190,7 @@ abstract class BaseCcShowPeer {
$criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_USER);
$criteria->addSelectColumn(CcShowPeer::LIVE_STREAM_PASS);
$criteria->addSelectColumn(CcShowPeer::LINKED);
$criteria->addSelectColumn(CcShowPeer::IS_LINKABLE);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.NAME');
@ -200,6 +204,7 @@ abstract class BaseCcShowPeer {
$criteria->addSelectColumn($alias . '.LIVE_STREAM_USER');
$criteria->addSelectColumn($alias . '.LIVE_STREAM_PASS');
$criteria->addSelectColumn($alias . '.LINKED');
$criteria->addSelectColumn($alias . '.IS_LINKABLE');
}
}

View file

@ -18,6 +18,7 @@
* @method CcShowQuery orderByDbLiveStreamUser($order = Criteria::ASC) Order by the live_stream_user column
* @method CcShowQuery orderByDbLiveStreamPass($order = Criteria::ASC) Order by the live_stream_pass column
* @method CcShowQuery orderByDbLinked($order = Criteria::ASC) Order by the linked column
* @method CcShowQuery orderByDbIsLinkable($order = Criteria::ASC) Order by the is_linkable column
*
* @method CcShowQuery groupByDbId() Group by the id column
* @method CcShowQuery groupByDbName() Group by the name column
@ -31,6 +32,7 @@
* @method CcShowQuery groupByDbLiveStreamUser() Group by the live_stream_user column
* @method CcShowQuery groupByDbLiveStreamPass() Group by the live_stream_pass column
* @method CcShowQuery groupByDbLinked() Group by the linked column
* @method CcShowQuery groupByDbIsLinkable() Group by the is_linkable column
*
* @method CcShowQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method CcShowQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@ -67,6 +69,7 @@
* @method CcShow findOneByDbLiveStreamUser(string $live_stream_user) Return the first CcShow filtered by the live_stream_user column
* @method CcShow findOneByDbLiveStreamPass(string $live_stream_pass) Return the first CcShow filtered by the live_stream_pass column
* @method CcShow findOneByDbLinked(boolean $linked) Return the first CcShow filtered by the linked column
* @method CcShow findOneByDbIsLinkable(boolean $is_linkable) Return the first CcShow filtered by the is_linkable column
*
* @method array findByDbId(int $id) Return CcShow objects filtered by the id column
* @method array findByDbName(string $name) Return CcShow objects filtered by the name column
@ -80,6 +83,7 @@
* @method array findByDbLiveStreamUser(string $live_stream_user) Return CcShow objects filtered by the live_stream_user column
* @method array findByDbLiveStreamPass(string $live_stream_pass) Return CcShow objects filtered by the live_stream_pass column
* @method array findByDbLinked(boolean $linked) Return CcShow objects filtered by the linked column
* @method array findByDbIsLinkable(boolean $is_linkable) Return CcShow objects filtered by the is_linkable column
*
* @package propel.generator.airtime.om
*/
@ -433,6 +437,23 @@ abstract class BaseCcShowQuery extends ModelCriteria
return $this->addUsingAlias(CcShowPeer::LINKED, $dbLinked, $comparison);
}
/**
* Filter the query on the is_linkable column
*
* @param boolean|string $dbIsLinkable The value to use as filter.
* Accepts strings ('false', 'off', '-', 'no', 'n', and '0' are false, the rest is true)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcShowQuery The current query, for fluid interface
*/
public function filterByDbIsLinkable($dbIsLinkable = null, $comparison = null)
{
if (is_string($dbIsLinkable)) {
$is_linkable = in_array(strtolower($dbIsLinkable), array('false', 'off', '-', 'no', 'n', '0')) ? false : true;
}
return $this->addUsingAlias(CcShowPeer::IS_LINKABLE, $dbIsLinkable, $comparison);
}
/**
* Filter the query by a related CcShowInstances object
*

View file

@ -136,17 +136,6 @@ class Application_Service_SchedulerService
return $dt;
}
/**
*
* Enter description here ...
* @param $nextStartDT
* @param $showStamp array of ccSchedule objects
*/
private static function insertItems($showStamp, $ccShow)
{
}
public static function fillLinkedShows($ccShow)
{
if ($ccShow->isLinked()) {
@ -167,40 +156,47 @@ class Application_Service_SchedulerService
->filterByDbInstanceId($ccSchedule->getDbInstanceId())
->orderByDbStarts()
->find();
} else {
break;
}
//need to find out which linked instances are empty
foreach ($ccShow->getCcShowInstancess() as $ccShowInstance) {
$ccSchedules = CcScheduleQuery::create()
->filterByDbInstanceId($ccShowInstance->getDbId())
->find();
if ($ccSchedules->isEmpty()) {
$nextStartDT = $ccShowInstance->getDbStarts(null);
//get time_filled so we can update cc_show_instances
$timeFilled = $ccSchedule->getCcShowInstances()->getDbTimeFilled();
foreach ($showStamp as $item) {
$endTimeDT = self::findEndTime($nextStartDT, $item->getDbClipLength());
//need to find out which linked instances are empty
foreach ($ccShow->getCcShowInstancess() as $ccShowInstance) {
$ccSchedules = CcScheduleQuery::create()
->filterByDbInstanceId($ccShowInstance->getDbId())
->find();
if ($ccSchedules->isEmpty()) {
$nextStartDT = $ccShowInstance->getDbStarts(null);
$ccSchedule = new CcSchedule();
$ccSchedule
->setDbStarts($nextStartDT)
->setDbEnds($endTimeDT)
->setDbFileId($item->getDbFileId())
->setDbStreamId($item->getDbStreamId())
->setDbClipLength($item->getDbClipLength())
->setDbFadeIn($item->getDbFadeIn())
->setDbFadeOut($item->getDbFadeOut())
->setDbCuein($item->getDbCueIn())
->setDbCueOut($item->getDbCueOut())
->setDbInstanceId($ccShowInstance->getDbId())
->setDbPosition($item->getDbPosition())
foreach ($showStamp as $item) {
$endTimeDT = self::findEndTime($nextStartDT, $item->getDbClipLength());
$ccSchedule = new CcSchedule();
$ccSchedule
->setDbStarts($nextStartDT)
->setDbEnds($endTimeDT)
->setDbFileId($item->getDbFileId())
->setDbStreamId($item->getDbStreamId())
->setDbClipLength($item->getDbClipLength())
->setDbFadeIn($item->getDbFadeIn())
->setDbFadeOut($item->getDbFadeOut())
->setDbCuein($item->getDbCueIn())
->setDbCueOut($item->getDbCueOut())
->setDbInstanceId($ccShowInstance->getDbId())
->setDbPosition($item->getDbPosition())
->save();
$nextStartDT = $endTimeDT;
} //foreach show item
//update time_filled in cc_show_instances
$ccShowInstance
->setDbTimeFilled($timeFilled)
->setDbLastScheduled(gmdate("Y-m-d H:i:s"))
->save();
$nextStartDT = $endTimeDT;
} //foreach show item
}
} //foreach linked instance
}
} //foreach linked instance
} //if at least one linked instance has content
}
}
}

View file

@ -215,6 +215,10 @@ class Application_Service_ShowFormService
'add_show_end_date' => $repeatEndDate->format("Y-m-d"),
'add_show_no_end' => (!$service_show->getRepeatingEndDate()),
'add_show_monthly_repeat_type' => $monthlyRepeatType));
if (!$this->ccShow->isLinkable()) {
$form->getElement('add_show_linked')->setOptions(array('disabled' => true));
}
}
private function populateFormWho($form)
@ -337,7 +341,7 @@ class Application_Service_ShowFormService
* Returns 2 DateTime objects, in the user's local time,
* of the next future repeat show instance start and end time
*/
private function getNextFutureRepeatShowTime()
public function getNextFutureRepeatShowTime()
{
$sql = <<<SQL
SELECT starts, ends FROM cc_show_instances

View file

@ -94,6 +94,13 @@ class Application_Service_ShowService
->setDbModifiedInstance(true)
->save();
$service_showForm = new Application_Service_ShowFormService($showData["add_show_id"]);
list($start, $end) = $service_showForm->getNextFutureRepeatShowTime();
$oldCcShowDay = $oldCcShow->getFirstCcShowDay();
$oldCcShowDay
->setDbFirstShow($start->setTimezone(new DateTimeZone("UTC"))->format("Y-m-d"))
->save();
$con->commit();
Application_Model_RabbitMq::PushSchedule();
} catch (Exception $e) {
@ -108,17 +115,6 @@ class Application_Service_ShowService
$service_user = new Application_Service_UserService();
$currentUser = $service_user->getCurrentUser();
/*if ($showData["add_show_repeats"]) {
$repeatType = $showData["add_show_repeat_type"];
if ($showData["add_show_repeat_type"] == 2) {
$repeatType = $showData["add_show_monthly_repeat_type"];
}
} else {
$repeatType = -1;
}
$isRecorded = (isset($showData['add_show_record']) && $showData['add_show_record']) ? 1 : 0;
$isRebroadcast = (isset($showData['add_show_rebroadcast']) && $showData['add_show_rebroadcast']) ? 1 : 0;*/
$showData["add_show_duration"] = $this->formatShowDuration(
$showData["add_show_duration"]);
@ -860,14 +856,10 @@ SQL;
$ccShowInstance = $this->getInstance($utcStartDateTime);
$newInstance = false;
$updateScheduleStatus = true;
} elseif (in_array($day, $daysAdded)) {
} else {
$newInstance = true;
$ccShowInstance = new CcShowInstances();
$updateScheduleStatus = false;
} else {
//if we get here, an instance was edited on it's own and
//thus became it's own show so there is nothing to update
break 1;
}
} else {
$newInstance = true;
@ -1149,6 +1141,11 @@ SQL;
$ccShow->setDbLiveStreamUsingCustomAuth($showData['cb_custom_auth'] == 1);
$ccShow->setDbLiveStreamUser($showData['custom_username']);
$ccShow->setDbLiveStreamPass($showData['custom_password']);
// Once a show is unlinked it cannot be linked again
if ($ccShow->getDbLinked() && !$showData["add_show_linked"]) {
$ccShow->setDbIsLinkable(false);
}
$ccShow->setDbLinked($showData["add_show_linked"]);
$ccShow->save();

View file

@ -133,6 +133,9 @@
<column name="live_stream_user" phpName="DbLiveStreamUser" type="VARCHAR" size="255" required="false"/>
<column name="live_stream_pass" phpName="DbLiveStreamPass" type="VARCHAR" size="255" required="false"/>
<column name="linked" phpName="DbLinked" type="BOOLEAN" required="true" defaultValue="false" />
<column name="is_linkable" phpName="DbIsLinkable" type="BOOLEAN" required="true" defaultValue="true" />
<!-- A show is_linkable if it has never been linked before. Once a show becomes unlinked
it can not be linked again -->
</table>
<table name="cc_show_instances" phpName="CcShowInstances">
<column name="id" phpName="DbId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>

View file

@ -157,6 +157,7 @@ CREATE TABLE "cc_show"
"live_stream_user" VARCHAR(255),
"live_stream_pass" VARCHAR(255),
"linked" BOOLEAN default 'f' NOT NULL,
"is_linkable" BOOLEAN default 't' NOT NULL,
PRIMARY KEY ("id")
);