CC-1665: Scheduled stream rebroadcasting and recording

-getting closer to being able to schedule a webstream
This commit is contained in:
Martin Konecny 2012-07-24 22:24:08 -04:00
parent 3735579378
commit c90495d2d3
16 changed files with 1073 additions and 77 deletions

View File

@ -265,12 +265,18 @@ class Application_Model_Schedule
sched.fade_in AS fade_in, sched.fade_out AS fade_out,
sched.playout_status AS playout_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, ft.file_exists AS file_exists
--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, ft.file_exists AS file_exists
%%file_columns%%
FROM
((cc_schedule AS sched JOIN cc_files AS ft ON (sched.file_id = ft.id)
RIGHT OUTER JOIN cc_show_instances AS si ON (si.id = sched.instance_id))
((
--cc_schedule AS sched JOIN cc_files AS ft ON (sched.file_id = ft.id)
%%file_join%%
--JOIN cc_webstream AS ws ON (sched.stream_id = ws.id)
RIGHT JOIN cc_show_instances AS si ON (si.id = sched.instance_id))
JOIN cc_show AS showt ON (showt.id = si.show_id)
)
@ -284,11 +290,21 @@ class Application_Model_Schedule
$sql .= " AND show_id IN (".implode(",", $p_shows).")";
}
$sql .= " ORDER BY si.starts, sched.starts;";
$sql .= " ORDER BY si.starts, sched.starts";
$sql2 = $sql;
$sql = str_replace("%%file_columns%%", "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, ft.file_exists AS file_exists", $sql);
$sql = str_replace("%%file_join%%", "cc_schedule AS sched JOIN cc_files AS ft ON (sched.file_id = ft.id)", $sql);
$sql2 = str_replace("%%file_columns%%", "ws.name AS file_track_title, ws.login AS file_artist_name,
ws.description AS file_album_title, ws.length AS file_length, 't'::BOOL AS file_exists", $sql2);
$sql2 = str_replace("%%file_join%%", "cc_schedule AS sched JOIN cc_webstream AS ws ON (sched.stream_id = ws.id)", $sql2);
$sql = "($sql) UNION ($sql2)";
Logging::debug($sql);
$rows = $con->query($sql)->fetchAll();
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
return $rows;
}
@ -470,14 +486,21 @@ class Application_Model_Schedule
." st.cue_out AS cue_out,"
." st.fade_in AS fade_in,"
." st.fade_out AS fade_out,"
." st.type AS type,"
." si.starts AS show_start,"
." si.ends AS show_end,"
." f.id AS file_id"
." f.replay_gain AS replay_gain"
." f.file_path AS file_path"
." ws.id as stream_id"
." ws.url as url"
." FROM $CC_CONFIG[scheduleTable] AS st"
." LEFT JOIN $CC_CONFIG[showInstances] AS si"
." ON st.instance_id = si.id"
." LEFT JOIN $CC_CONFIG[filesTable] AS f"
." ON st.file_id = f.id";
." ON st.file_id = f.id"
." LEFT JOIN cc_webstream AS ws"
." ON st.stream_id = ws.id";
$predicates = " WHERE st.ends > '$p_startTime'"
." AND st.starts < '$p_endTime'"
@ -599,13 +622,27 @@ class Application_Model_Schedule
$item["end"] = $showEndDateTime->format("Y-m-d H:i:s");
}
$storedFile = Application_Model_StoredFile::Recall($item["file_id"]);
$uri = $storedFile->getFilePath();
Logging::log($item);
//TODO: need to know item type
//
//
if ($item['type'] == 0) {
//row is from cc_files
$media_id = $item['file_id'];
$uri = $item['file_path'];
$type = "file";
} else if ($item['type'] == 1) {
$media_id = $item['stream_id'];
$uri = $item['url'];
$type = "stream";
}
$start = Application_Model_Schedule::AirtimeTimeToPypoTime($item["start"]);
$data["media"][$start] = array(
'id' => $storedFile->getId(),
'type' => "file",
'id' => $media_id,
'type' => $type,
'row_id' => $item["id"],
'uri' => $uri,
'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]),

View File

@ -11,6 +11,7 @@ class Application_Model_Scheduler
"fadein" => "00:00:00",
"fadeout" => "00:00:00",
"sched_id" => null,
"type" => 0 //default type of '0' to represent files. type '1' represents a webstream
);
private $epochNow;
@ -145,8 +146,7 @@ class Application_Model_Scheduler
$files[] = $data;
}
}
else if ($type === "playlist") {
} else if ($type === "playlist") {
// find if the playslit is static or dynamic
$c = new Criteria();
@ -188,6 +188,28 @@ class Application_Model_Scheduler
$data["cliplength"] = $file->getDbLength();
}
}
$files[] = $data;
}
} else if ($type == "stream") {
//need to return
$stream = CcWebstreamQuery::create()->findPK($id, $this->con);
if (is_null($stream) /* || !$file->getDbFileExists() */) {
throw new Exception("A selected File does not exist!");
} else {
$data = $this->fileInfo;
$data["id"] = $id;
$data["cliplength"] = $stream->getDbLength();
$data["cueout"] = $stream->getDbLength();
$data["type"] = 1;
$defaultFade = Application_Model_Preference::GetDefaultFade();
if (isset($defaultFade)) {
//fade is in format SS.uuuuuu
$data["fadein"] = $defaultFade;
$data["fadeout"] = $defaultFade;
}
$files[] = $data;
}
}
@ -356,17 +378,27 @@ class Application_Model_Scheduler
} else {
$sched = new CcSchedule();
}
Logging::log(print_r($file,true));
Logging::log($file);
$sched->setDbStarts($nextStartDT)
->setDbEnds($endTimeDT)
->setDbFileId($file['id'])
->setDbCueIn($file['cuein'])
->setDbCueOut($file['cueout'])
->setDbFadeIn($file['fadein'])
->setDbFadeOut($file['fadeout'])
->setDbClipLength($file['cliplength'])
->setDbInstanceId($instance->getDbId())
->save($this->con);
->setDbInstanceId($instance->getDbId());
switch ($file["type"]){
case 0:
$sched->setDbFileId($file['id']);
break;
case 1:
$sched->setDbStreamId($file['id']);
break;
default: break;
}
$sched->save($this->con);
$nextStartDT = $endTimeDT;
}

View File

@ -42,6 +42,7 @@ 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->addForeignKey('STREAM_ID', 'DbStreamId', 'INTEGER', 'cc_webstream', 'ID', false, null, null);
$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');
@ -61,6 +62,7 @@ class CcScheduleTableMap extends TableMap {
{
$this->addRelation('CcShowInstances', 'CcShowInstances', RelationMap::MANY_TO_ONE, array('instance_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcFiles', 'CcFiles', RelationMap::MANY_TO_ONE, array('file_id' => 'id', ), 'CASCADE', null);
$this->addRelation('CcWebstream', 'CcWebstream', RelationMap::MANY_TO_ONE, array('stream_id' => 'id', ), 'CASCADE', null);
} // buildRelations()
} // CcScheduleTableMap

View File

@ -54,6 +54,7 @@ class CcWebstreamTableMap extends TableMap {
*/
public function buildRelations()
{
$this->addRelation('CcSchedule', 'CcSchedule', RelationMap::ONE_TO_MANY, array('id' => 'stream_id', ), 'CASCADE', null);
} // buildRelations()
} // CcWebstreamTableMap

View File

@ -4686,6 +4686,31 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
return $this->getCcSchedules($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcFiles is new, it will return
* an empty collection; or if this CcFiles has previously
* been saved, it will retrieve related CcSchedules from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in CcFiles.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return PropelCollection|array CcSchedule[] List of CcSchedule objects
*/
public function getCcSchedulesJoinCcWebstream($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcScheduleQuery::create(null, $criteria);
$query->joinWith('CcWebstream', $join_behavior);
return $this->getCcSchedules($query, $con);
}
/**
* Clears the current object and sets all attributes to their default values
*/

View File

@ -48,6 +48,12 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
*/
protected $file_id;
/**
* The value for the stream_id field.
* @var int
*/
protected $stream_id;
/**
* The value for the clip_length field.
* Note: this column has a database default value of: '00:00:00'
@ -120,6 +126,11 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
*/
protected $aCcFiles;
/**
* @var CcWebstream
*/
protected $aCcWebstream;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@ -248,6 +259,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this->file_id;
}
/**
* Get the [stream_id] column value.
*
* @return int
*/
public function getDbStreamId()
{
return $this->stream_id;
}
/**
* Get the [clip_length] column value.
*
@ -526,6 +547,30 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this;
} // setDbFileId()
/**
* Set the value of [stream_id] column.
*
* @param int $v new value
* @return CcSchedule The current object (for fluent API support)
*/
public function setDbStreamId($v)
{
if ($v !== null) {
$v = (int) $v;
}
if ($this->stream_id !== $v) {
$this->stream_id = $v;
$this->modifiedColumns[] = CcSchedulePeer::STREAM_ID;
}
if ($this->aCcWebstream !== null && $this->aCcWebstream->getDbId() !== $v) {
$this->aCcWebstream = null;
}
return $this;
} // setDbStreamId()
/**
* Set the value of [clip_length] column.
*
@ -838,15 +883,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->starts = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->ends = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->file_id = ($row[$startcol + 3] !== null) ? (int) $row[$startcol + 3] : null;
$this->clip_length = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
$this->fade_in = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
$this->fade_out = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
$this->cue_in = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$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->playout_status = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
$this->broadcasted = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null;
$this->stream_id = ($row[$startcol + 4] !== null) ? (int) $row[$startcol + 4] : null;
$this->clip_length = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
$this->fade_in = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
$this->fade_out = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
$this->cue_in = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
$this->cue_out = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
$this->media_item_played = ($row[$startcol + 10] !== null) ? (boolean) $row[$startcol + 10] : null;
$this->instance_id = ($row[$startcol + 11] !== null) ? (int) $row[$startcol + 11] : null;
$this->playout_status = ($row[$startcol + 12] !== null) ? (int) $row[$startcol + 12] : null;
$this->broadcasted = ($row[$startcol + 13] !== null) ? (int) $row[$startcol + 13] : null;
$this->resetModified();
$this->setNew(false);
@ -855,7 +901,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->ensureConsistency();
}
return $startcol + 13; // 13 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 14; // 14 = CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating CcSchedule object", $e);
@ -881,6 +927,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
if ($this->aCcFiles !== null && $this->file_id !== $this->aCcFiles->getDbId()) {
$this->aCcFiles = null;
}
if ($this->aCcWebstream !== null && $this->stream_id !== $this->aCcWebstream->getDbId()) {
$this->aCcWebstream = null;
}
if ($this->aCcShowInstances !== null && $this->instance_id !== $this->aCcShowInstances->getDbId()) {
$this->aCcShowInstances = null;
}
@ -925,6 +974,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->aCcShowInstances = null;
$this->aCcFiles = null;
$this->aCcWebstream = null;
} // if (deep)
}
@ -1054,6 +1104,13 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->setCcFiles($this->aCcFiles);
}
if ($this->aCcWebstream !== null) {
if ($this->aCcWebstream->isModified() || $this->aCcWebstream->isNew()) {
$affectedRows += $this->aCcWebstream->save($con);
}
$this->setCcWebstream($this->aCcWebstream);
}
if ($this->isNew() ) {
$this->modifiedColumns[] = CcSchedulePeer::ID;
}
@ -1160,6 +1217,12 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
}
}
if ($this->aCcWebstream !== null) {
if (!$this->aCcWebstream->validate($columns)) {
$failureMap = array_merge($failureMap, $this->aCcWebstream->getValidationFailures());
}
}
if (($retval = CcSchedulePeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
@ -1212,30 +1275,33 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this->getDbFileId();
break;
case 4:
return $this->getDbClipLength();
return $this->getDbStreamId();
break;
case 5:
return $this->getDbFadeIn();
return $this->getDbClipLength();
break;
case 6:
return $this->getDbFadeOut();
return $this->getDbFadeIn();
break;
case 7:
return $this->getDbCueIn();
return $this->getDbFadeOut();
break;
case 8:
return $this->getDbCueOut();
return $this->getDbCueIn();
break;
case 9:
return $this->getDbMediaItemPlayed();
return $this->getDbCueOut();
break;
case 10:
return $this->getDbInstanceId();
return $this->getDbMediaItemPlayed();
break;
case 11:
return $this->getDbPlayoutStatus();
return $this->getDbInstanceId();
break;
case 12:
return $this->getDbPlayoutStatus();
break;
case 13:
return $this->getDbBroadcasted();
break;
default:
@ -1266,15 +1332,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$keys[1] => $this->getDbStarts(),
$keys[2] => $this->getDbEnds(),
$keys[3] => $this->getDbFileId(),
$keys[4] => $this->getDbClipLength(),
$keys[5] => $this->getDbFadeIn(),
$keys[6] => $this->getDbFadeOut(),
$keys[7] => $this->getDbCueIn(),
$keys[8] => $this->getDbCueOut(),
$keys[9] => $this->getDbMediaItemPlayed(),
$keys[10] => $this->getDbInstanceId(),
$keys[11] => $this->getDbPlayoutStatus(),
$keys[12] => $this->getDbBroadcasted(),
$keys[4] => $this->getDbStreamId(),
$keys[5] => $this->getDbClipLength(),
$keys[6] => $this->getDbFadeIn(),
$keys[7] => $this->getDbFadeOut(),
$keys[8] => $this->getDbCueIn(),
$keys[9] => $this->getDbCueOut(),
$keys[10] => $this->getDbMediaItemPlayed(),
$keys[11] => $this->getDbInstanceId(),
$keys[12] => $this->getDbPlayoutStatus(),
$keys[13] => $this->getDbBroadcasted(),
);
if ($includeForeignObjects) {
if (null !== $this->aCcShowInstances) {
@ -1283,6 +1350,9 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
if (null !== $this->aCcFiles) {
$result['CcFiles'] = $this->aCcFiles->toArray($keyType, $includeLazyLoadColumns, true);
}
if (null !== $this->aCcWebstream) {
$result['CcWebstream'] = $this->aCcWebstream->toArray($keyType, $includeLazyLoadColumns, true);
}
}
return $result;
}
@ -1327,30 +1397,33 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->setDbFileId($value);
break;
case 4:
$this->setDbClipLength($value);
$this->setDbStreamId($value);
break;
case 5:
$this->setDbFadeIn($value);
$this->setDbClipLength($value);
break;
case 6:
$this->setDbFadeOut($value);
$this->setDbFadeIn($value);
break;
case 7:
$this->setDbCueIn($value);
$this->setDbFadeOut($value);
break;
case 8:
$this->setDbCueOut($value);
$this->setDbCueIn($value);
break;
case 9:
$this->setDbMediaItemPlayed($value);
$this->setDbCueOut($value);
break;
case 10:
$this->setDbInstanceId($value);
$this->setDbMediaItemPlayed($value);
break;
case 11:
$this->setDbPlayoutStatus($value);
$this->setDbInstanceId($value);
break;
case 12:
$this->setDbPlayoutStatus($value);
break;
case 13:
$this->setDbBroadcasted($value);
break;
} // switch()
@ -1381,15 +1454,16 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
if (array_key_exists($keys[1], $arr)) $this->setDbStarts($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setDbEnds($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setDbFileId($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setDbClipLength($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbFadeIn($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setDbFadeOut($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setDbCueIn($arr[$keys[7]]);
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->setDbPlayoutStatus($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setDbBroadcasted($arr[$keys[12]]);
if (array_key_exists($keys[4], $arr)) $this->setDbStreamId($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setDbClipLength($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setDbFadeIn($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setDbFadeOut($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setDbCueIn($arr[$keys[8]]);
if (array_key_exists($keys[9], $arr)) $this->setDbCueOut($arr[$keys[9]]);
if (array_key_exists($keys[10], $arr)) $this->setDbMediaItemPlayed($arr[$keys[10]]);
if (array_key_exists($keys[11], $arr)) $this->setDbInstanceId($arr[$keys[11]]);
if (array_key_exists($keys[12], $arr)) $this->setDbPlayoutStatus($arr[$keys[12]]);
if (array_key_exists($keys[13], $arr)) $this->setDbBroadcasted($arr[$keys[13]]);
}
/**
@ -1405,6 +1479,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
if ($this->isColumnModified(CcSchedulePeer::STARTS)) $criteria->add(CcSchedulePeer::STARTS, $this->starts);
if ($this->isColumnModified(CcSchedulePeer::ENDS)) $criteria->add(CcSchedulePeer::ENDS, $this->ends);
if ($this->isColumnModified(CcSchedulePeer::FILE_ID)) $criteria->add(CcSchedulePeer::FILE_ID, $this->file_id);
if ($this->isColumnModified(CcSchedulePeer::STREAM_ID)) $criteria->add(CcSchedulePeer::STREAM_ID, $this->stream_id);
if ($this->isColumnModified(CcSchedulePeer::CLIP_LENGTH)) $criteria->add(CcSchedulePeer::CLIP_LENGTH, $this->clip_length);
if ($this->isColumnModified(CcSchedulePeer::FADE_IN)) $criteria->add(CcSchedulePeer::FADE_IN, $this->fade_in);
if ($this->isColumnModified(CcSchedulePeer::FADE_OUT)) $criteria->add(CcSchedulePeer::FADE_OUT, $this->fade_out);
@ -1478,6 +1553,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$copyObj->setDbStarts($this->starts);
$copyObj->setDbEnds($this->ends);
$copyObj->setDbFileId($this->file_id);
$copyObj->setDbStreamId($this->stream_id);
$copyObj->setDbClipLength($this->clip_length);
$copyObj->setDbFadeIn($this->fade_in);
$copyObj->setDbFadeOut($this->fade_out);
@ -1628,6 +1704,55 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
return $this->aCcFiles;
}
/**
* Declares an association between this object and a CcWebstream object.
*
* @param CcWebstream $v
* @return CcSchedule The current object (for fluent API support)
* @throws PropelException
*/
public function setCcWebstream(CcWebstream $v = null)
{
if ($v === null) {
$this->setDbStreamId(NULL);
} else {
$this->setDbStreamId($v->getDbId());
}
$this->aCcWebstream = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the CcWebstream object, it will not be re-added.
if ($v !== null) {
$v->addCcSchedule($this);
}
return $this;
}
/**
* Get the associated CcWebstream object
*
* @param PropelPDO Optional Connection object.
* @return CcWebstream The associated CcWebstream object.
* @throws PropelException
*/
public function getCcWebstream(PropelPDO $con = null)
{
if ($this->aCcWebstream === null && ($this->stream_id !== null)) {
$this->aCcWebstream = CcWebstreamQuery::create()->findPk($this->stream_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aCcWebstream->addCcSchedules($this);
*/
}
return $this->aCcWebstream;
}
/**
* Clears the current object and sets all attributes to their default values
*/
@ -1637,6 +1762,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->starts = null;
$this->ends = null;
$this->file_id = null;
$this->stream_id = null;
$this->clip_length = null;
$this->fade_in = null;
$this->fade_out = null;
@ -1671,6 +1797,7 @@ abstract class BaseCcSchedule extends BaseObject implements Persistent
$this->aCcShowInstances = null;
$this->aCcFiles = null;
$this->aCcWebstream = null;
}
/**

View File

@ -26,7 +26,7 @@ abstract class BaseCcSchedulePeer {
const TM_CLASS = 'CcScheduleTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 13;
const NUM_COLUMNS = 14;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@ -43,6 +43,9 @@ abstract class BaseCcSchedulePeer {
/** the column name for the FILE_ID field */
const FILE_ID = 'cc_schedule.FILE_ID';
/** the column name for the STREAM_ID field */
const STREAM_ID = 'cc_schedule.STREAM_ID';
/** the column name for the CLIP_LENGTH field */
const CLIP_LENGTH = 'cc_schedule.CLIP_LENGTH';
@ -86,12 +89,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', 'DbPlayoutStatus', 'DbBroadcasted', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbPlayoutStatus', 'dbBroadcasted', ),
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::PLAYOUT_STATUS, self::BROADCASTED, ),
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', 'PLAYOUT_STATUS', 'BROADCASTED', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'playout_status', 'broadcasted', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
BasePeer::TYPE_PHPNAME => array ('DbId', 'DbStarts', 'DbEnds', 'DbFileId', 'DbStreamId', 'DbClipLength', 'DbFadeIn', 'DbFadeOut', 'DbCueIn', 'DbCueOut', 'DbMediaItemPlayed', 'DbInstanceId', 'DbPlayoutStatus', 'DbBroadcasted', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbStarts', 'dbEnds', 'dbFileId', 'dbStreamId', 'dbClipLength', 'dbFadeIn', 'dbFadeOut', 'dbCueIn', 'dbCueOut', 'dbMediaItemPlayed', 'dbInstanceId', 'dbPlayoutStatus', 'dbBroadcasted', ),
BasePeer::TYPE_COLNAME => array (self::ID, self::STARTS, self::ENDS, self::FILE_ID, self::STREAM_ID, self::CLIP_LENGTH, self::FADE_IN, self::FADE_OUT, self::CUE_IN, self::CUE_OUT, self::MEDIA_ITEM_PLAYED, self::INSTANCE_ID, self::PLAYOUT_STATUS, self::BROADCASTED, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'STARTS', 'ENDS', 'FILE_ID', 'STREAM_ID', 'CLIP_LENGTH', 'FADE_IN', 'FADE_OUT', 'CUE_IN', 'CUE_OUT', 'MEDIA_ITEM_PLAYED', 'INSTANCE_ID', 'PLAYOUT_STATUS', 'BROADCASTED', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'starts', 'ends', 'file_id', 'stream_id', 'clip_length', 'fade_in', 'fade_out', 'cue_in', 'cue_out', 'media_item_played', 'instance_id', 'playout_status', 'broadcasted', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
);
/**
@ -101,12 +104,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, 'DbPlayoutStatus' => 11, 'DbBroadcasted' => 12, ),
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, 'dbPlayoutStatus' => 11, 'dbBroadcasted' => 12, ),
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::PLAYOUT_STATUS => 11, self::BROADCASTED => 12, ),
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, 'PLAYOUT_STATUS' => 11, 'BROADCASTED' => 12, ),
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, 'playout_status' => 11, 'broadcasted' => 12, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, )
BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbStarts' => 1, 'DbEnds' => 2, 'DbFileId' => 3, 'DbStreamId' => 4, 'DbClipLength' => 5, 'DbFadeIn' => 6, 'DbFadeOut' => 7, 'DbCueIn' => 8, 'DbCueOut' => 9, 'DbMediaItemPlayed' => 10, 'DbInstanceId' => 11, 'DbPlayoutStatus' => 12, 'DbBroadcasted' => 13, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbStarts' => 1, 'dbEnds' => 2, 'dbFileId' => 3, 'dbStreamId' => 4, 'dbClipLength' => 5, 'dbFadeIn' => 6, 'dbFadeOut' => 7, 'dbCueIn' => 8, 'dbCueOut' => 9, 'dbMediaItemPlayed' => 10, 'dbInstanceId' => 11, 'dbPlayoutStatus' => 12, 'dbBroadcasted' => 13, ),
BasePeer::TYPE_COLNAME => array (self::ID => 0, self::STARTS => 1, self::ENDS => 2, self::FILE_ID => 3, self::STREAM_ID => 4, self::CLIP_LENGTH => 5, self::FADE_IN => 6, self::FADE_OUT => 7, self::CUE_IN => 8, self::CUE_OUT => 9, self::MEDIA_ITEM_PLAYED => 10, self::INSTANCE_ID => 11, self::PLAYOUT_STATUS => 12, self::BROADCASTED => 13, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'STARTS' => 1, 'ENDS' => 2, 'FILE_ID' => 3, 'STREAM_ID' => 4, 'CLIP_LENGTH' => 5, 'FADE_IN' => 6, 'FADE_OUT' => 7, 'CUE_IN' => 8, 'CUE_OUT' => 9, 'MEDIA_ITEM_PLAYED' => 10, 'INSTANCE_ID' => 11, 'PLAYOUT_STATUS' => 12, 'BROADCASTED' => 13, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'starts' => 1, 'ends' => 2, 'file_id' => 3, 'stream_id' => 4, 'clip_length' => 5, 'fade_in' => 6, 'fade_out' => 7, 'cue_in' => 8, 'cue_out' => 9, 'media_item_played' => 10, 'instance_id' => 11, 'playout_status' => 12, 'broadcasted' => 13, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, )
);
/**
@ -182,6 +185,7 @@ abstract class BaseCcSchedulePeer {
$criteria->addSelectColumn(CcSchedulePeer::STARTS);
$criteria->addSelectColumn(CcSchedulePeer::ENDS);
$criteria->addSelectColumn(CcSchedulePeer::FILE_ID);
$criteria->addSelectColumn(CcSchedulePeer::STREAM_ID);
$criteria->addSelectColumn(CcSchedulePeer::CLIP_LENGTH);
$criteria->addSelectColumn(CcSchedulePeer::FADE_IN);
$criteria->addSelectColumn(CcSchedulePeer::FADE_OUT);
@ -196,6 +200,7 @@ abstract class BaseCcSchedulePeer {
$criteria->addSelectColumn($alias . '.STARTS');
$criteria->addSelectColumn($alias . '.ENDS');
$criteria->addSelectColumn($alias . '.FILE_ID');
$criteria->addSelectColumn($alias . '.STREAM_ID');
$criteria->addSelectColumn($alias . '.CLIP_LENGTH');
$criteria->addSelectColumn($alias . '.FADE_IN');
$criteria->addSelectColumn($alias . '.FADE_OUT');
@ -590,6 +595,56 @@ abstract class BaseCcSchedulePeer {
}
/**
* Returns the number of rows matching criteria, joining the related CcWebstream table
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinCcWebstream(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcSchedulePeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects a collection of CcSchedule objects pre-filled with their CcShowInstances objects.
* @param Criteria $criteria
@ -722,6 +777,72 @@ abstract class BaseCcSchedulePeer {
}
/**
* Selects a collection of CcSchedule objects pre-filled with their CcWebstream objects.
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of CcSchedule objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinCcWebstream(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
}
CcSchedulePeer::addSelectColumns($criteria);
$startcol = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
CcWebstreamPeer::addSelectColumns($criteria);
$criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcSchedulePeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcSchedulePeer::addInstanceToPool($obj1, $key1);
} // if $obj1 already loaded
$key2 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol);
if ($key2 !== null) {
$obj2 = CcWebstreamPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcWebstreamPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol);
CcWebstreamPeer::addInstanceToPool($obj2, $key2);
} // if obj2 already loaded
// Add the $obj1 (CcSchedule) to $obj2 (CcWebstream)
$obj2->addCcSchedule($obj1);
} // if joined row was not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/**
* Returns the number of rows matching criteria, joining all related tables
*
@ -762,6 +883,8 @@ abstract class BaseCcSchedulePeer {
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
$criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
@ -801,10 +924,15 @@ abstract class BaseCcSchedulePeer {
CcFilesPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
CcWebstreamPeer::addSelectColumns($criteria);
$startcol5 = $startcol4 + (CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
$criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
@ -858,6 +986,24 @@ abstract class BaseCcSchedulePeer {
$obj3->addCcSchedule($obj1);
} // if joined row not null
// Add objects for joined CcWebstream rows
$key4 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol4);
if ($key4 !== null) {
$obj4 = CcWebstreamPeer::getInstanceFromPool($key4);
if (!$obj4) {
$cls = CcWebstreamPeer::getOMClass(false);
$obj4 = new $cls();
$obj4->hydrate($row, $startcol4);
CcWebstreamPeer::addInstanceToPool($obj4, $key4);
} // if obj4 loaded
// Add the $obj1 (CcSchedule) to the collection in $obj4 (CcWebstream)
$obj4->addCcSchedule($obj1);
} // if joined row not null
$results[] = $obj1;
}
$stmt->closeCursor();
@ -903,6 +1049,8 @@ abstract class BaseCcSchedulePeer {
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
$criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
@ -953,6 +1101,60 @@ abstract class BaseCcSchedulePeer {
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
$criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Returns the number of rows matching criteria, joining the related CcWebstream table
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return int Number of matching rows.
*/
public static function doCountJoinAllExceptCcWebstream(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(CcSchedulePeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
CcSchedulePeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY should not affect count
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
if ($con === null) {
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
@ -992,8 +1194,13 @@ abstract class BaseCcSchedulePeer {
CcFilesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
CcWebstreamPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
$criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
@ -1029,6 +1236,25 @@ abstract class BaseCcSchedulePeer {
// Add the $obj1 (CcSchedule) to the collection in $obj2 (CcFiles)
$obj2->addCcSchedule($obj1);
} // if joined row is not null
// Add objects for joined CcWebstream rows
$key3 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol3);
if ($key3 !== null) {
$obj3 = CcWebstreamPeer::getInstanceFromPool($key3);
if (!$obj3) {
$cls = CcWebstreamPeer::getOMClass(false);
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
CcWebstreamPeer::addInstanceToPool($obj3, $key3);
} // if $obj3 already loaded
// Add the $obj1 (CcSchedule) to the collection in $obj3 (CcWebstream)
$obj3->addCcSchedule($obj1);
} // if joined row is not null
$results[] = $obj1;
@ -1065,8 +1291,13 @@ abstract class BaseCcSchedulePeer {
CcShowInstancesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
CcWebstreamPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcWebstreamPeer::NUM_COLUMNS - CcWebstreamPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
$criteria->addJoin(CcSchedulePeer::STREAM_ID, CcWebstreamPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
@ -1102,6 +1333,122 @@ abstract class BaseCcSchedulePeer {
// Add the $obj1 (CcSchedule) to the collection in $obj2 (CcShowInstances)
$obj2->addCcSchedule($obj1);
} // if joined row is not null
// Add objects for joined CcWebstream rows
$key3 = CcWebstreamPeer::getPrimaryKeyHashFromRow($row, $startcol3);
if ($key3 !== null) {
$obj3 = CcWebstreamPeer::getInstanceFromPool($key3);
if (!$obj3) {
$cls = CcWebstreamPeer::getOMClass(false);
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
CcWebstreamPeer::addInstanceToPool($obj3, $key3);
} // if $obj3 already loaded
// Add the $obj1 (CcSchedule) to the collection in $obj3 (CcWebstream)
$obj3->addCcSchedule($obj1);
} // if joined row is not null
$results[] = $obj1;
}
$stmt->closeCursor();
return $results;
}
/**
* Selects a collection of CcSchedule objects pre-filled with all related objects except CcWebstream.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @param String $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
* @return array Array of CcSchedule objects.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectJoinAllExceptCcWebstream(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$criteria = clone $criteria;
// Set the correct dbName if it has not been overridden
// $criteria->getDbName() will return the same object if not set to another value
// so == check is okay and faster
if ($criteria->getDbName() == Propel::getDefaultDB()) {
$criteria->setDbName(self::DATABASE_NAME);
}
CcSchedulePeer::addSelectColumns($criteria);
$startcol2 = (CcSchedulePeer::NUM_COLUMNS - CcSchedulePeer::NUM_LAZY_LOAD_COLUMNS);
CcShowInstancesPeer::addSelectColumns($criteria);
$startcol3 = $startcol2 + (CcShowInstancesPeer::NUM_COLUMNS - CcShowInstancesPeer::NUM_LAZY_LOAD_COLUMNS);
CcFilesPeer::addSelectColumns($criteria);
$startcol4 = $startcol3 + (CcFilesPeer::NUM_COLUMNS - CcFilesPeer::NUM_LAZY_LOAD_COLUMNS);
$criteria->addJoin(CcSchedulePeer::INSTANCE_ID, CcShowInstancesPeer::ID, $join_behavior);
$criteria->addJoin(CcSchedulePeer::FILE_ID, CcFilesPeer::ID, $join_behavior);
$stmt = BasePeer::doSelect($criteria, $con);
$results = array();
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key1 = CcSchedulePeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj1 = CcSchedulePeer::getInstanceFromPool($key1))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj1->hydrate($row, 0, true); // rehydrate
} else {
$cls = CcSchedulePeer::getOMClass(false);
$obj1 = new $cls();
$obj1->hydrate($row);
CcSchedulePeer::addInstanceToPool($obj1, $key1);
} // if obj1 already loaded
// Add objects for joined CcShowInstances rows
$key2 = CcShowInstancesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
if ($key2 !== null) {
$obj2 = CcShowInstancesPeer::getInstanceFromPool($key2);
if (!$obj2) {
$cls = CcShowInstancesPeer::getOMClass(false);
$obj2 = new $cls();
$obj2->hydrate($row, $startcol2);
CcShowInstancesPeer::addInstanceToPool($obj2, $key2);
} // if $obj2 already loaded
// Add the $obj1 (CcSchedule) to the collection in $obj2 (CcShowInstances)
$obj2->addCcSchedule($obj1);
} // if joined row is not null
// Add objects for joined CcFiles rows
$key3 = CcFilesPeer::getPrimaryKeyHashFromRow($row, $startcol3);
if ($key3 !== null) {
$obj3 = CcFilesPeer::getInstanceFromPool($key3);
if (!$obj3) {
$cls = CcFilesPeer::getOMClass(false);
$obj3 = new $cls();
$obj3->hydrate($row, $startcol3);
CcFilesPeer::addInstanceToPool($obj3, $key3);
} // if $obj3 already loaded
// Add the $obj1 (CcSchedule) to the collection in $obj3 (CcFiles)
$obj3->addCcSchedule($obj1);
} // if joined row is not null
$results[] = $obj1;

View File

@ -10,6 +10,7 @@
* @method CcScheduleQuery orderByDbStarts($order = Criteria::ASC) Order by the starts column
* @method CcScheduleQuery orderByDbEnds($order = Criteria::ASC) Order by the ends column
* @method CcScheduleQuery orderByDbFileId($order = Criteria::ASC) Order by the file_id column
* @method CcScheduleQuery orderByDbStreamId($order = Criteria::ASC) Order by the stream_id column
* @method CcScheduleQuery orderByDbClipLength($order = Criteria::ASC) Order by the clip_length column
* @method CcScheduleQuery orderByDbFadeIn($order = Criteria::ASC) Order by the fade_in column
* @method CcScheduleQuery orderByDbFadeOut($order = Criteria::ASC) Order by the fade_out column
@ -24,6 +25,7 @@
* @method CcScheduleQuery groupByDbStarts() Group by the starts column
* @method CcScheduleQuery groupByDbEnds() Group by the ends column
* @method CcScheduleQuery groupByDbFileId() Group by the file_id column
* @method CcScheduleQuery groupByDbStreamId() Group by the stream_id column
* @method CcScheduleQuery groupByDbClipLength() Group by the clip_length column
* @method CcScheduleQuery groupByDbFadeIn() Group by the fade_in column
* @method CcScheduleQuery groupByDbFadeOut() Group by the fade_out column
@ -46,6 +48,10 @@
* @method CcScheduleQuery rightJoinCcFiles($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcFiles relation
* @method CcScheduleQuery innerJoinCcFiles($relationAlias = '') Adds a INNER JOIN clause to the query using the CcFiles relation
*
* @method CcScheduleQuery leftJoinCcWebstream($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcWebstream relation
* @method CcScheduleQuery rightJoinCcWebstream($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcWebstream relation
* @method CcScheduleQuery innerJoinCcWebstream($relationAlias = '') Adds a INNER JOIN clause to the query using the CcWebstream relation
*
* @method CcSchedule findOne(PropelPDO $con = null) Return the first CcSchedule matching the query
* @method CcSchedule findOneOrCreate(PropelPDO $con = null) Return the first CcSchedule matching the query, or a new CcSchedule object populated from the query conditions when no match is found
*
@ -53,6 +59,7 @@
* @method CcSchedule findOneByDbStarts(string $starts) Return the first CcSchedule filtered by the starts column
* @method CcSchedule findOneByDbEnds(string $ends) Return the first CcSchedule filtered by the ends column
* @method CcSchedule findOneByDbFileId(int $file_id) Return the first CcSchedule filtered by the file_id column
* @method CcSchedule findOneByDbStreamId(int $stream_id) Return the first CcSchedule filtered by the stream_id column
* @method CcSchedule findOneByDbClipLength(string $clip_length) Return the first CcSchedule filtered by the clip_length column
* @method CcSchedule findOneByDbFadeIn(string $fade_in) Return the first CcSchedule filtered by the fade_in column
* @method CcSchedule findOneByDbFadeOut(string $fade_out) Return the first CcSchedule filtered by the fade_out column
@ -67,6 +74,7 @@
* @method array findByDbStarts(string $starts) Return CcSchedule objects filtered by the starts column
* @method array findByDbEnds(string $ends) Return CcSchedule objects filtered by the ends column
* @method array findByDbFileId(int $file_id) Return CcSchedule objects filtered by the file_id column
* @method array findByDbStreamId(int $stream_id) Return CcSchedule objects filtered by the stream_id column
* @method array findByDbClipLength(string $clip_length) Return CcSchedule objects filtered by the clip_length column
* @method array findByDbFadeIn(string $fade_in) Return CcSchedule objects filtered by the fade_in column
* @method array findByDbFadeOut(string $fade_out) Return CcSchedule objects filtered by the fade_out column
@ -295,6 +303,37 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
return $this->addUsingAlias(CcSchedulePeer::FILE_ID, $dbFileId, $comparison);
}
/**
* Filter the query on the stream_id column
*
* @param int|array $dbStreamId 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 filterByDbStreamId($dbStreamId = null, $comparison = null)
{
if (is_array($dbStreamId)) {
$useMinMax = false;
if (isset($dbStreamId['min'])) {
$this->addUsingAlias(CcSchedulePeer::STREAM_ID, $dbStreamId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($dbStreamId['max'])) {
$this->addUsingAlias(CcSchedulePeer::STREAM_ID, $dbStreamId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CcSchedulePeer::STREAM_ID, $dbStreamId, $comparison);
}
/**
* Filter the query on the clip_length column
*
@ -661,6 +700,70 @@ abstract class BaseCcScheduleQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'CcFiles', 'CcFilesQuery');
}
/**
* Filter the query by a related CcWebstream object
*
* @param CcWebstream $ccWebstream the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcScheduleQuery The current query, for fluid interface
*/
public function filterByCcWebstream($ccWebstream, $comparison = null)
{
return $this
->addUsingAlias(CcSchedulePeer::STREAM_ID, $ccWebstream->getDbId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcWebstream relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcScheduleQuery The current query, for fluid interface
*/
public function joinCcWebstream($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcWebstream');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcWebstream');
}
return $this;
}
/**
* Use the CcWebstream relation CcWebstream object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcWebstreamQuery A secondary query class using the current class as primary query
*/
public function useCcWebstreamQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcWebstream($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcWebstream', 'CcWebstreamQuery');
}
/**
* Exclude object from result
*

View File

@ -1992,6 +1992,31 @@ abstract class BaseCcShowInstances extends BaseObject implements Persistent
return $this->getCcSchedules($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcShowInstances is new, it will return
* an empty collection; or if this CcShowInstances has previously
* been saved, it will retrieve related CcSchedules from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in CcShowInstances.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return PropelCollection|array CcSchedule[] List of CcSchedule objects
*/
public function getCcSchedulesJoinCcWebstream($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcScheduleQuery::create(null, $criteria);
$query->joinWith('CcWebstream', $join_behavior);
return $this->getCcSchedules($query, $con);
}
/**
* Clears the current object and sets all attributes to their default values
*/

View File

@ -73,6 +73,11 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
*/
protected $utime;
/**
* @var array CcSchedule[] Collection to store aggregation of CcSchedule objects.
*/
protected $collCcSchedules;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
@ -566,6 +571,8 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
if ($deep) { // also de-associate any related objects?
$this->collCcSchedules = null;
} // if (deep)
}
@ -699,6 +706,14 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
}
if ($this->collCcSchedules !== null) {
foreach ($this->collCcSchedules as $referrerFK) {
if (!$referrerFK->isDeleted()) {
$affectedRows += $referrerFK->save($con);
}
}
}
$this->alreadyInSave = false;
}
@ -770,6 +785,14 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
}
if ($this->collCcSchedules !== null) {
foreach ($this->collCcSchedules as $referrerFK) {
if (!$referrerFK->validate($columns)) {
$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
}
}
}
$this->alreadyInValidation = false;
}
@ -1033,6 +1056,20 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
$copyObj->setDbMtime($this->mtime);
$copyObj->setDbUtime($this->utime);
if ($deepCopy) {
// important: temporarily setNew(false) because this affects the behavior of
// the getter/setter methods for fkey referrer objects.
$copyObj->setNew(false);
foreach ($this->getCcSchedules() as $relObj) {
if ($relObj !== $this) { // ensure that we don't try to copy a reference to ourselves
$copyObj->addCcSchedule($relObj->copy($deepCopy));
}
}
} // if ($deepCopy)
$copyObj->setNew(true);
$copyObj->setDbId(NULL); // this is a auto-increment column, so set to default value
}
@ -1075,6 +1112,165 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
return self::$peer;
}
/**
* Clears out the collCcSchedules collection
*
* This does not modify the database; however, it will remove any associated objects, causing
* them to be refetched by subsequent calls to accessor method.
*
* @return void
* @see addCcSchedules()
*/
public function clearCcSchedules()
{
$this->collCcSchedules = null; // important to set this to NULL since that means it is uninitialized
}
/**
* Initializes the collCcSchedules collection.
*
* By default this just sets the collCcSchedules collection to an empty array (like clearcollCcSchedules());
* however, you may wish to override this method in your stub class to provide setting appropriate
* to your application -- for example, setting the initial array to the values stored in database.
*
* @return void
*/
public function initCcSchedules()
{
$this->collCcSchedules = new PropelObjectCollection();
$this->collCcSchedules->setModel('CcSchedule');
}
/**
* Gets an array of CcSchedule objects which contain a foreign key that references this object.
*
* If the $criteria is not null, it is used to always fetch the results from the database.
* Otherwise the results are fetched from the database the first time, then cached.
* Next time the same method is called without $criteria, the cached collection is returned.
* If this CcWebstream is new, it will return
* an empty collection or the current collection; the criteria is ignored on a new object.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @return PropelCollection|array CcSchedule[] List of CcSchedule objects
* @throws PropelException
*/
public function getCcSchedules($criteria = null, PropelPDO $con = null)
{
if(null === $this->collCcSchedules || null !== $criteria) {
if ($this->isNew() && null === $this->collCcSchedules) {
// return empty collection
$this->initCcSchedules();
} else {
$collCcSchedules = CcScheduleQuery::create(null, $criteria)
->filterByCcWebstream($this)
->find($con);
if (null !== $criteria) {
return $collCcSchedules;
}
$this->collCcSchedules = $collCcSchedules;
}
}
return $this->collCcSchedules;
}
/**
* Returns the number of related CcSchedule objects.
*
* @param Criteria $criteria
* @param boolean $distinct
* @param PropelPDO $con
* @return int Count of related CcSchedule objects.
* @throws PropelException
*/
public function countCcSchedules(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
if(null === $this->collCcSchedules || null !== $criteria) {
if ($this->isNew() && null === $this->collCcSchedules) {
return 0;
} else {
$query = CcScheduleQuery::create(null, $criteria);
if($distinct) {
$query->distinct();
}
return $query
->filterByCcWebstream($this)
->count($con);
}
} else {
return count($this->collCcSchedules);
}
}
/**
* Method called to associate a CcSchedule object to this object
* through the CcSchedule foreign key attribute.
*
* @param CcSchedule $l CcSchedule
* @return void
* @throws PropelException
*/
public function addCcSchedule(CcSchedule $l)
{
if ($this->collCcSchedules === null) {
$this->initCcSchedules();
}
if (!$this->collCcSchedules->contains($l)) { // only add it if the **same** object is not already associated
$this->collCcSchedules[]= $l;
$l->setCcWebstream($this);
}
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcWebstream is new, it will return
* an empty collection; or if this CcWebstream has previously
* been saved, it will retrieve related CcSchedules from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in CcWebstream.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return PropelCollection|array CcSchedule[] List of CcSchedule objects
*/
public function getCcSchedulesJoinCcShowInstances($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcScheduleQuery::create(null, $criteria);
$query->joinWith('CcShowInstances', $join_behavior);
return $this->getCcSchedules($query, $con);
}
/**
* If this collection has already been initialized with
* an identical criteria, it returns the collection.
* Otherwise if this CcWebstream is new, it will return
* an empty collection; or if this CcWebstream has previously
* been saved, it will retrieve related CcSchedules from storage.
*
* This method is protected by default in order to keep the public
* api reasonable. You can provide public methods for those you
* actually need in CcWebstream.
*
* @param Criteria $criteria optional Criteria object to narrow the query
* @param PropelPDO $con optional connection object
* @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
* @return PropelCollection|array CcSchedule[] List of CcSchedule objects
*/
public function getCcSchedulesJoinCcFiles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = CcScheduleQuery::create(null, $criteria);
$query->joinWith('CcFiles', $join_behavior);
return $this->getCcSchedules($query, $con);
}
/**
* Clears the current object and sets all attributes to their default values
*/
@ -1109,8 +1305,14 @@ abstract class BaseCcWebstream extends BaseObject implements Persistent
public function clearAllReferences($deep = false)
{
if ($deep) {
if ($this->collCcSchedules) {
foreach ((array) $this->collCcSchedules as $o) {
$o->clearAllReferences($deep);
}
}
} // if ($deep)
$this->collCcSchedules = null;
}
/**

View File

@ -373,6 +373,9 @@ abstract class BaseCcWebstreamPeer {
*/
public static function clearRelatedInstancePool()
{
// Invalidate objects in CcSchedulePeer instance pool,
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
CcSchedulePeer::clearInstancePool();
}
/**

View File

@ -28,6 +28,10 @@
* @method CcWebstreamQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method CcWebstreamQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method CcWebstreamQuery leftJoinCcSchedule($relationAlias = '') Adds a LEFT JOIN clause to the query using the CcSchedule relation
* @method CcWebstreamQuery rightJoinCcSchedule($relationAlias = '') Adds a RIGHT JOIN clause to the query using the CcSchedule relation
* @method CcWebstreamQuery innerJoinCcSchedule($relationAlias = '') Adds a INNER JOIN clause to the query using the CcSchedule relation
*
* @method CcWebstream findOne(PropelPDO $con = null) Return the first CcWebstream matching the query
* @method CcWebstream findOneOrCreate(PropelPDO $con = null) Return the first CcWebstream matching the query, or a new CcWebstream object populated from the query conditions when no match is found
*
@ -346,6 +350,70 @@ abstract class BaseCcWebstreamQuery extends ModelCriteria
return $this->addUsingAlias(CcWebstreamPeer::UTIME, $dbUtime, $comparison);
}
/**
* Filter the query by a related CcSchedule object
*
* @param CcSchedule $ccSchedule the related object to use as filter
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return CcWebstreamQuery The current query, for fluid interface
*/
public function filterByCcSchedule($ccSchedule, $comparison = null)
{
return $this
->addUsingAlias(CcWebstreamPeer::ID, $ccSchedule->getDbStreamId(), $comparison);
}
/**
* Adds a JOIN clause to the query using the CcSchedule relation
*
* @param string $relationAlias optional alias for the relation
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcWebstreamQuery The current query, for fluid interface
*/
public function joinCcSchedule($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
$tableMap = $this->getTableMap();
$relationMap = $tableMap->getRelation('CcSchedule');
// create a ModelJoin object for this join
$join = new ModelJoin();
$join->setJoinType($joinType);
$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
if ($previousJoin = $this->getPreviousJoin()) {
$join->setPreviousJoin($previousJoin);
}
// add the ModelJoin to the current object
if($relationAlias) {
$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
$this->addJoinObject($join, $relationAlias);
} else {
$this->addJoinObject($join, 'CcSchedule');
}
return $this;
}
/**
* Use the CcSchedule relation CcSchedule object
*
* @see useQuery()
*
* @param string $relationAlias optional alias for the relation,
* to be used as main alias in the secondary query
* @param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
*
* @return CcScheduleQuery A secondary query class using the current class as primary query
*/
public function useCcScheduleQuery($relationAlias = '', $joinType = Criteria::LEFT_JOIN)
{
return $this
->joinCcSchedule($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'CcSchedule', 'CcScheduleQuery');
}
/**
* Exclude object from result
*

View File

@ -1,4 +1,5 @@
<button id="spl_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
<button id="ws_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New Stream</button>
<?php if (isset($this->obj)) : ?>
<button id="spl_delete" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">Delete</button>
<a href="#" id="spl_crossfade" class="ui-button ui-button-icon-only ui-widget ui-state-default crossfade-main-button">

View File

@ -216,7 +216,7 @@
0: audiotrack
1: webstream
-->
<column name="type" phpName="DbType" type="INTEGER" required="true" default="0"/>
<column name="type" phpName="DbType" type="SMALLINT" required="true" default="0"/>
<column name="position" phpName="DbPosition" type="INTEGER" required="false"/>
<column name="cliplength" phpName="DbCliplength" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00"/>
<column name="cuein" phpName="DbCuein" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00"/>
@ -303,6 +303,7 @@
<column name="starts" phpName="DbStarts" type="TIMESTAMP" required="true"/>
<column name="ends" phpName="DbEnds" type="TIMESTAMP" required="true"/>
<column name="file_id" phpName="DbFileId" type="INTEGER" required="false"/>
<column name="stream_id" phpName="DbStreamId" type="INTEGER" required="false"/>
<column name="clip_length" phpName="DbClipLength" type="VARCHAR" sqlType="interval" required="false" defaultValue="00:00:00"/>
<column name="fade_in" phpName="DbFadeIn" type="TIME" required="false" defaultValue="00:00:00"/>
<column name="fade_out" phpName="DbFadeOut" type="TIME" required="false" defaultValue="00:00:00"/>
@ -322,7 +323,10 @@
<foreign-key foreignTable="cc_files" name="cc_show_file_fkey" onDelete="CASCADE">
<reference local="file_id" foreign="id"/>
</foreign-key>
</table>
<foreign-key foreignTable="cc_webstream" name="cc_show_stream_fkey" onDelete="CASCADE">
<reference local="stream_id" foreign="id"/>
</foreign-key>
</table>
<table name="cc_sess" phpName="CcSess">
<column name="sessid" phpName="Sessid" type="CHAR" size="32" primaryKey="true" required="true"/>
<column name="userid" phpName="Userid" type="INTEGER" required="false"/>

View File

@ -411,6 +411,7 @@ CREATE TABLE "cc_schedule"
"starts" TIMESTAMP NOT NULL,
"ends" TIMESTAMP NOT NULL,
"file_id" INTEGER,
"stream_id" INTEGER,
"clip_length" interval default '00:00:00',
"fade_in" TIME default '00:00:00',
"fade_out" TIME default '00:00:00',
@ -685,6 +686,8 @@ ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_inst_fkey" FOREIGN KEY ("insta
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_file_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_schedule" ADD CONSTRAINT "cc_show_stream_fkey" FOREIGN KEY ("stream_id") REFERENCES "cc_webstream" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_sess" ADD CONSTRAINT "cc_sess_userid_fkey" FOREIGN KEY ("userid") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
ALTER TABLE "cc_subjs_token" ADD CONSTRAINT "cc_subjs_token_userid_fkey" FOREIGN KEY ("user_id") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;

View File

@ -658,6 +658,19 @@ var AIRTIME = (function(AIRTIME){
redrawLib();
});
};
mod.fnWsNew = function() {
var url = '/Webstream/new';
stopAudioPreview();
$.post(url,
{format: "json"},
function(json){
openPlaylist(json);
redrawLib();
});
};
mod.fnNewBlock = function() {
var url = '/Playlist/new';
@ -797,6 +810,9 @@ var AIRTIME = (function(AIRTIME){
$pl.delegate("#spl_new",
{"click": AIRTIME.playlist.fnNew});*/
$pl.delegate("#ws_new",
{"click": AIRTIME.playlist.fnWsNew});
$pl.delegate("#spl_delete", {"click": function(ev){
AIRTIME.playlist.fnDelete();
}});