style(legacy): fix code format with php-cs-fixer (#1674)

This commit is contained in:
Jonas L 2022-03-14 11:15:04 +01:00 committed by GitHub
parent e1dc69af9e
commit 69d8eae845
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
111 changed files with 1163 additions and 1163 deletions

View file

@ -31,15 +31,15 @@ class Application_Service_CalendarService
$isAdminOrPM = $this->currentUser->isAdminOrPM();
$isHostOfShow = $this->currentUser->isHostOfShow($this->ccShow->getDbId());
//DateTime objects in UTC
// DateTime objects in UTC
$startDT = $this->ccShowInstance->getDbStarts(null);
$endDT = $this->ccShowInstance->getDbEnds(null);
//timestamps
// timestamps
$start = $startDT->getTimestamp();
$end = $endDT->getTimestamp();
//show has ended
// show has ended
if ($now > $end) {
if ($this->ccShowInstance->isRecorded()) {
$ccFile = $this->ccShowInstance->getCcFiles();
@ -68,10 +68,10 @@ class Application_Service_CalendarService
$currentShowId = count($currentShow) == 1 ? $currentShow[0]['id'] : null;
$showIsLinked = $this->ccShow->isLinked();
//user can add/remove content if the show has not ended
// user can add/remove content if the show has not ended
if ($now < $end && ($isAdminOrPM || $isHostOfShow) && !$this->ccShowInstance->isRecorded()) {
//if the show is not linked OR if the show is linked AND not the current playing show
//the user can add/remove content
// if the show is not linked OR if the show is linked AND not the current playing show
// the user can add/remove content
if (!$showIsLinked || ($showIsLinked && $currentShowId != $this->ccShow->getDbId())) {
$menu['schedule'] = [
// "name"=> _("Add / Remove Content"),
@ -81,8 +81,8 @@ class Application_Service_CalendarService
}
}
//"Show Content" should be a menu item at all times except when
//the show is recorded
// "Show Content" should be a menu item at all times except when
// the show is recorded
if (!$this->ccShowInstance->isRecorded()) {
$menu['content'] = [
// "name"=> _("Show Content"),
@ -91,10 +91,10 @@ class Application_Service_CalendarService
'url' => $baseUrl . 'schedule/show-content-dialog', ];
}
//user can remove all content if the show has not started
// user can remove all content if the show has not started
if ($now < $start && ($isAdminOrPM || $isHostOfShow) && !$this->ccShowInstance->isRecorded()) {
//if the show is not linked OR if the show is linked AND not the current playing show
//the user can remove all content
// if the show is not linked OR if the show is linked AND not the current playing show
// the user can remove all content
if (!$showIsLinked || ($showIsLinked && $currentShowId != $this->ccShow->getDbId())) {
$menu['clear'] = [
// "name"=> _("Remove All Content"),
@ -104,7 +104,7 @@ class Application_Service_CalendarService
}
}
//show is currently playing and user is admin
// show is currently playing and user is admin
if ($start <= $now && $now < $end && $isAdminOrPM) {
// Menu separator
$menu['sep1'] = '-----------';
@ -171,13 +171,13 @@ class Application_Service_CalendarService
}
}
//show hasn't started yet and user is admin
// show hasn't started yet and user is admin
if ($now < $start && $isAdminOrPM) {
// Menu separator
$menu['sep3'] = '-----------';
//show is repeating so give user the option to delete all
//repeating instances or just the one
// show is repeating so give user the option to delete all
// repeating instances or just the one
if ($isRepeating) {
$menu['del'] = [
'name' => _('Delete'),
@ -263,9 +263,9 @@ class Application_Service_CalendarService
throw new Exception(_("Can't move a past show"));
}
//the user is moving the show on the calendar from the perspective of local time.
//incase a show is moved across a time change border offsets should be added to the localtime
//stamp and then converted back to UTC to avoid show time changes!
// the user is moving the show on the calendar from the perspective of local time.
// incase a show is moved across a time change border offsets should be added to the localtime
// stamp and then converted back to UTC to avoid show time changes!
$showTimezone = $this->ccShow->getFirstCcShowDay()->getDbTimezone();
$startsDateTime->setTimezone(new DateTimeZone($showTimezone));
$endsDateTime->setTimezone(new DateTimeZone($showTimezone));
@ -286,11 +286,11 @@ class Application_Service_CalendarService
The key lesson here is that in general: duration != end - start
... so be careful!
*/
//$newEndsDateTime = self::addDeltas($endsDateTime, $deltaDay, $deltaMin); <--- Wrong, don't do it.
// $newEndsDateTime = self::addDeltas($endsDateTime, $deltaDay, $deltaMin); <--- Wrong, don't do it.
$newEndsDateTime = clone $newStartsDateTime;
$newEndsDateTime = $newEndsDateTime->add($duration);
//convert our new starts/ends to UTC.
// convert our new starts/ends to UTC.
$newStartsDateTime->setTimezone(new DateTimeZone('UTC'));
$newEndsDateTime->setTimezone(new DateTimeZone('UTC'));
@ -298,7 +298,7 @@ class Application_Service_CalendarService
throw new Exception(_("Can't move show into past"));
}
//check if show is overlapping
// check if show is overlapping
$overlapping = Application_Model_Schedule::checkOverlappingShows(
$newStartsDateTime,
$newEndsDateTime,
@ -310,9 +310,9 @@ class Application_Service_CalendarService
}
if ($this->ccShow->isRecorded()) {
//rebroadcasts should start at max 1 hour after a recorded show has ended.
// rebroadcasts should start at max 1 hour after a recorded show has ended.
$minRebroadcastStart = self::addDeltas($newEndsDateTime, 0, 60);
//check if we are moving a recorded show less than 1 hour before any of its own rebroadcasts.
// check if we are moving a recorded show less than 1 hour before any of its own rebroadcasts.
$rebroadcasts = CcShowInstancesQuery::create()
->filterByDbOriginalShow($this->ccShow->getDbId())
->filterByDbStarts($minRebroadcastStart->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::LESS_THAN)
@ -350,7 +350,7 @@ class Application_Service_CalendarService
$con = Propel::getConnection();
$con->beginTransaction();
//new starts,ends are in UTC
// new starts,ends are in UTC
[$newStartsDateTime, $newEndsDateTime] = $this->validateShowMove(
$deltaDay,
$deltaMin
@ -364,8 +364,8 @@ class Application_Service_CalendarService
->save($con);
if (!$this->ccShowInstance->getCcShow()->isRebroadcast()) {
//we can get the first show day because we know the show is
//not repeating, and therefore will only have one show day entry
// we can get the first show day because we know the show is
// not repeating, and therefore will only have one show day entry
$ccShowDay = $this->ccShow->getFirstCcShowDay();
$showTimezone = new DateTimeZone($ccShowDay->getDbTimezone());
$ccShowDay
@ -390,7 +390,7 @@ class Application_Service_CalendarService
}
}
//TODO move the method resizeShow from Application_Model_Show here.
// TODO move the method resizeShow from Application_Model_Show here.
public function resizeShow($deltaDay, $deltaMin)
{
try {

View file

@ -19,7 +19,7 @@ class Application_Service_HistoryService
return [self::TEMPLATE_TYPE_ITEM, self::TEMPLATE_TYPE_FILE];
}
//opts is from datatables.
// opts is from datatables.
public function getPlayedItemData($startDT, $endDT, $opts, $instanceId = null)
{
$mainSqlQuery = '';
@ -52,8 +52,8 @@ class Application_Service_HistoryService
}
}
//-----------------------------------------------------------------------
//Using the instance_id to filter the data.
// -----------------------------------------------------------------------
// Using the instance_id to filter the data.
$historyRange = '(' .
'SELECT history.starts, history.ends, history.id AS history_id, history.instance_id' .
@ -88,14 +88,14 @@ class Application_Service_HistoryService
$numFileMdFields = count($fields_filemd);
if ($numFileMdFields > 0) {
//these 3 selects are only needed if $fields_filemd has some fields.
// these 3 selects are only needed if $fields_filemd has some fields.
$fileSelect = ['history_file.history_id'];
$nonNullFileSelect = ['file.id as file_id'];
$nullFileSelect = ['null_file.history_id'];
$fileMdFilters = [];
//populate the different dynamic selects with file info.
// populate the different dynamic selects with file info.
for ($i = 0; $i < $numFileMdFields; ++$i) {
$field = $fields_filemd[$i];
$key = $field['name'];
@ -110,7 +110,7 @@ class Application_Service_HistoryService
$paramMap["meta_{$key}"] = $key;
}
//the files associated with scheduled playback in Airtime.
// the files associated with scheduled playback in Airtime.
$historyFile = '(' .
'SELECT history.id AS history_id, history.file_id' .
' FROM cc_playout_history AS history' .
@ -124,15 +124,15 @@ class Application_Service_HistoryService
$fileMd = str_replace('%NON_NULL_FILE_SELECT%', implode(', ', $nonNullFileSelect), $fileMd);
//null files are from manually added data (filling in webstream info etc)
// null files are from manually added data (filling in webstream info etc)
$nullFile = '(' .
'SELECT history.id AS history_id' .
' FROM cc_playout_history AS history' .
' WHERE history.file_id IS NULL' .
') AS null_file';
//----------------------------------
//building the file inner query
// ----------------------------------
// building the file inner query
$fileSqlQuery =
'SELECT ' . implode(', ', $fileSelect) .
@ -172,8 +172,8 @@ class Application_Service_HistoryService
" LEFT JOIN {$filter} USING(history_id)";
}
//----------------------------------------------------------------------
//need to count the total rows to tell Datatables.
// ----------------------------------------------------------------------
// need to count the total rows to tell Datatables.
$stmt = $this->con->prepare($mainSqlQuery);
foreach ($paramMap as $param => $v) {
$stmt->bindValue($param, $v);
@ -187,8 +187,8 @@ class Application_Service_HistoryService
throw new Exception("Error: {$msg}");
}
//------------------------------------------------------------------------
//Using Datatables parameters to sort the data.
// ------------------------------------------------------------------------
// Using Datatables parameters to sort the data.
if (empty($opts['iSortingCols'])) {
$orderBys = [];
@ -209,7 +209,7 @@ class Application_Service_HistoryService
$orderBys[] = "{$key}_filter.{$key} {$sortDir}";
}
//throw new Exception("Error: $key is not part of the template.");
// throw new Exception("Error: $key is not part of the template.");
}
}
@ -220,11 +220,11 @@ class Application_Service_HistoryService
" ORDER BY {$orders}";
}
//---------------------------------------------------------------
//using Datatables parameters to add limits/offsets
// ---------------------------------------------------------------
// using Datatables parameters to add limits/offsets
$displayLength = empty($opts['iDisplayLength']) ? -1 : intval($opts['iDisplayLength']);
//limit the results returned.
// limit the results returned.
if ($displayLength !== -1) {
$mainSqlQuery .=
' OFFSET :offset LIMIT :limit';
@ -247,8 +247,8 @@ class Application_Service_HistoryService
throw new Exception("Error: {$msg}");
}
//-----------------------------------------------------------------------
//processing results.
// -----------------------------------------------------------------------
// processing results.
$timezoneUTC = new DateTimeZone('UTC');
$timezoneLocal = new DateTimeZone($this->timezone);
@ -265,12 +265,12 @@ class Application_Service_HistoryService
$result[$field['label']] = (bool) $result[$field['name']];
}
//need to display the results in the station's timezone.
// need to display the results in the station's timezone.
$dateTime = new DateTime($result['starts'], $timezoneUTC);
$dateTime->setTimezone($timezoneLocal);
$result['starts'] = $dateTime->format(DEFAULT_TIMESTAMP_FORMAT);
//if ends is null we don't want it to default to "now"
// if ends is null we don't want it to default to "now"
if (isset($result['ends'])) {
$dateTime = new DateTime($result['ends'], $timezoneUTC);
$dateTime->setTimezone($timezoneLocal);
@ -282,17 +282,17 @@ class Application_Service_HistoryService
$result[MDATA_KEY_DURATION] = $formatter->format();
}
//need to add a checkbox..
// need to add a checkbox..
$result['checkbox'] = '';
//$unicodeChar = '\u2612';
//$result["new"] = json_decode('"'.$unicodeChar.'"');
//$result["new"] = "U+2612";
// $unicodeChar = '\u2612';
// $result["new"] = json_decode('"'.$unicodeChar.'"');
// $result["new"] = "U+2612";
}
return [
'sEcho' => empty($opts['sEcho']) ? null : intval($opts['sEcho']),
//"iTotalDisplayRecords" => intval($totalDisplayRows),
// "iTotalDisplayRecords" => intval($totalDisplayRows),
'iTotalDisplayRecords' => intval($totalRows),
'iTotalRecords' => intval($totalRows),
'history' => $rows,
@ -343,8 +343,8 @@ class Application_Service_HistoryService
'SELECT ' . implode(', ', $select) .
" FROM {$fileSummaryTable}";
//-------------------------------------------------------------------------
//need to count the total rows to tell Datatables.
// -------------------------------------------------------------------------
// need to count the total rows to tell Datatables.
$stmt = $this->con->prepare($mainSqlQuery);
foreach ($paramMap as $param => $v) {
$stmt->bindValue($param, $v);
@ -358,8 +358,8 @@ class Application_Service_HistoryService
throw new Exception("Error: {$msg}");
}
//------------------------------------------------------------------------
//Using Datatables parameters to sort the data.
// ------------------------------------------------------------------------
// Using Datatables parameters to sort the data.
$numOrderColumns = $opts['iSortingCols'];
$orderBys = [];
@ -379,8 +379,8 @@ class Application_Service_HistoryService
" ORDER BY {$orders}";
}
//------------------------------------------------------------
//using datatables params to add limits/offsets
// ------------------------------------------------------------
// using datatables params to add limits/offsets
$displayLength = intval($opts['iDisplayLength']);
if ($displayLength !== -1) {
$mainSqlQuery .=
@ -404,8 +404,8 @@ class Application_Service_HistoryService
throw new Exception("Error: {$msg}");
}
//-----------------------------------------------------------------
//processing the results
// -----------------------------------------------------------------
// processing the results
foreach ($rows as &$row) {
if (isset($row[MDATA_KEY_DURATION])) {
$formatter = new LengthFormatter($row[MDATA_KEY_DURATION]);
@ -415,7 +415,7 @@ class Application_Service_HistoryService
return [
'sEcho' => intval($opts['sEcho']),
//"iTotalDisplayRecords" => intval($totalDisplayRows),
// "iTotalDisplayRecords" => intval($totalDisplayRows),
'iTotalDisplayRecords' => intval($totalRows),
'iTotalRecords' => intval($totalRows),
'history' => $rows,
@ -436,7 +436,7 @@ class Application_Service_HistoryService
Logging::info($shows);
//need to filter the list to only their shows
// need to filter the list to only their shows
if ((!empty($user)) && ($user->isHost())) {
$showIds = [];
@ -475,7 +475,7 @@ class Application_Service_HistoryService
$timezoneLocal = new DateTimeZone($this->timezone);
foreach ($filteredShows as &$result) {
//need to display the results in the station's timezone.
// need to display the results in the station's timezone.
$dateTime = new DateTime($result['starts'], $timezoneUTC);
$dateTime->setTimezone($timezoneLocal);
$result['starts'] = $dateTime->format(DEFAULT_TIMESTAMP_FORMAT);
@ -495,7 +495,7 @@ class Application_Service_HistoryService
try {
$item = CcScheduleQuery::create()->findPK($schedId, $this->con);
//TODO figure out how to combine these all into 1 query.
// TODO figure out how to combine these all into 1 query.
$showInstance = $item->getCcShowInstances($this->con);
$show = $showInstance->getCcShow($this->con);
@ -539,13 +539,13 @@ class Application_Service_HistoryService
throw new Exception('Invalid schedule id: ' . $schedId);
}
//TODO figure out how to combine these all into 1 query.
// TODO figure out how to combine these all into 1 query.
$showInstance = $item->getCcShowInstances($this->con);
$show = $showInstance->getCcShow($this->con);
$fileId = $item->getDbFileId();
//don't add webstreams
// don't add webstreams
if (isset($fileId)) {
$metadata = [];
$metadata['showname'] = $show->getDbName();
@ -555,7 +555,7 @@ class Application_Service_HistoryService
$recordStart = $item->getDbStarts(null);
$recordEnd = ($instanceEnd < $itemEnd) ? $instanceEnd : $itemEnd;
//first check if this is a duplicate
// first check if this is a duplicate
// (caused by restarting liquidsoap)
$prevRecord = CcPlayoutHistoryQuery::create()
@ -640,7 +640,7 @@ class Application_Service_HistoryService
$value = $metadata[$key];
}
//need to convert to the station's local time first.
// need to convert to the station's local time first.
if ($field['type'] == TEMPLATE_DATETIME && !is_null($value)) {
$timezoneUTC = new DateTimeZone('UTC');
$timezoneLocal = new DateTimeZone($this->timezone);
@ -771,7 +771,7 @@ class Application_Service_HistoryService
$field = $fields[$i];
$key = $field['name'];
//required is delt with before this loop.
// required is delt with before this loop.
if (in_array($key, $required)) {
continue;
}
@ -793,7 +793,7 @@ class Application_Service_HistoryService
$f->setDbColMetadata($md);
}
//Use this array to update existing values.
// Use this array to update existing values.
$mds = $historyRecord->getCcPlayoutHistoryMetaDatas();
foreach ($mds as $md) {
$prevmd[$md->getDbKey()] = $md;
@ -820,7 +820,7 @@ class Application_Service_HistoryService
}
}
//start,end timestamp strings in local timezone.
// start,end timestamp strings in local timezone.
public function populateShowInstances($start, $end)
{
$timezoneLocal = new DateTimeZone($this->timezone);
@ -1004,14 +1004,14 @@ class Application_Service_HistoryService
}
}
//---------------- Following code is for History Templates --------------------------//
// ---------------- Following code is for History Templates --------------------------//
public function getFieldTypes()
{
return [
//TEMPLATE_DATE,
//TEMPLATE_TIME,
//TEMPLATE_DATETIME,
// TEMPLATE_DATE,
// TEMPLATE_TIME,
// TEMPLATE_DATETIME,
TEMPLATE_STRING,
TEMPLATE_BOOLEAN,
TEMPLATE_INT,
@ -1026,7 +1026,7 @@ class Application_Service_HistoryService
TEMPLATE_TIME => 'strval',
TEMPLATE_DATETIME => 'strval',
TEMPLATE_STRING => 'strval',
TEMPLATE_BOOLEAN => 'intval', //boolval only exists in php 5.5+
TEMPLATE_BOOLEAN => 'intval', // boolval only exists in php 5.5+
TEMPLATE_INT => 'intval',
TEMPLATE_FLOAT => 'floatval',
];
@ -1083,7 +1083,7 @@ class Application_Service_HistoryService
$fields[] = ['name' => 'starts', 'label' => _('Start Time'), 'type' => TEMPLATE_DATETIME, 'isFileMd' => false];
$fields[] = ['name' => 'ends', 'label' => _('End Time'), 'type' => TEMPLATE_DATETIME, 'isFileMd' => false];
$fields[] = ['name' => MDATA_KEY_TITLE, 'label' => _('Title'), 'type' => TEMPLATE_STRING, 'isFileMd' => true]; //these fields can be populated from an associated file.
$fields[] = ['name' => MDATA_KEY_TITLE, 'label' => _('Title'), 'type' => TEMPLATE_STRING, 'isFileMd' => true]; // these fields can be populated from an associated file.
$fields[] = ['name' => MDATA_KEY_CREATOR, 'label' => _('Creator'), 'type' => TEMPLATE_STRING, 'isFileMd' => true];
$template['name'] = 'Log Sheet ' . date(DEFAULT_TIMESTAMP_FORMAT) . ' Template';
@ -1219,7 +1219,7 @@ class Application_Service_HistoryService
public function getDatatablesLogSheetColumns()
{
//need to prepend a checkbox column.
// need to prepend a checkbox column.
$checkbox = [
'sTitle' => '',
'mDataProp' => 'checkbox',

View file

@ -34,12 +34,12 @@ class Application_Service_MediaService
$importedStorageDirectory = $storDir->getDirectory() . '/imported/' . $ownerId;
}
//Copy the temporary file over to the "organize" folder so that it's off our webserver
//and accessible by libretime-analyzer which could be running on a different machine.
// Copy the temporary file over to the "organize" folder so that it's off our webserver
// and accessible by libretime-analyzer which could be running on a different machine.
$newTempFilePath = Application_Model_StoredFile::moveFileToStor($filePath, $originalFilename, $copyFile);
//Dispatch a message to libretime-analyzer through RabbitMQ,
//notifying it that there's a new upload to process!
// Dispatch a message to libretime-analyzer through RabbitMQ,
// notifying it that there's a new upload to process!
$storageBackend = new ProxyStorageBackend($CC_CONFIG['current_backend']);
Application_Model_RabbitMq::SendMessageToAnalyzer(
$newTempFilePath,
@ -75,13 +75,13 @@ class Application_Service_MediaService
if ($media->getPropelOrm()->isValidPhysicalFile()) {
$filename = $media->getPropelOrm()->getFilename();
//Download user left clicks a track and selects Download.
// Download user left clicks a track and selects Download.
if (!$inline) {
//We are using Content-Disposition to specify
//to the browser what name the file should be saved as.
// We are using Content-Disposition to specify
// to the browser what name the file should be saved as.
header('Content-Disposition: attachment; filename="' . $filename . '"');
} else {
//user clicks play button for track and downloads it.
// user clicks play button for track and downloads it.
header('Content-Disposition: inline; filename="' . $filename . '"');
}
@ -100,7 +100,7 @@ class Application_Service_MediaService
assert(is_array($filePaths));
do {
//Read from $filePath and stream it to the browser.
// Read from $filePath and stream it to the browser.
$filePath = array_shift($filePaths);
try {
@ -108,14 +108,14 @@ class Application_Service_MediaService
$mimeType = $media->getPropelOrm()->getDbMime();
Application_Common_FileIO::smartReadFile($filePath, $size, $mimeType);
break; //Break out of the loop if we successfully read the file!
break; // Break out of the loop if we successfully read the file!
} catch (LibreTimeFileNotFoundException $e) {
//If we have no alternate filepaths left, then let the exception bubble up.
// If we have no alternate filepaths left, then let the exception bubble up.
if (count($filePaths) == 0) {
throw $e;
}
}
//Retry with the next alternate filepath in the list
// Retry with the next alternate filepath in the list
} while (count($filePaths) > 0);
exit;

View file

@ -471,7 +471,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
} else {
$enclosure = $item->get_enclosure();
}
//Logging::info($enclosure);
// Logging::info($enclosure);
$itemId = $item->get_id();
$ingested = in_array($itemId, $episodeIds) ? (empty($episodeFiles[$itemId]) ? -1 : 1) : 0;
$file = $ingested > 0 && !empty($episodeFiles[$itemId]) ?

View file

@ -51,7 +51,7 @@ class Application_Service_PodcastService
*/
public static function createFromFeedUrl($feedUrl)
{
//TODO: why is this so slow?
// TODO: why is this so slow?
$rss = self::getPodcastFeed($feedUrl);
if (!$rss) {
throw new InvalidPodcastException();
@ -84,7 +84,7 @@ class Application_Service_PodcastService
}
$podcastArray['category'] = htmlspecialchars(implode('', $categories));
//TODO: put in constants
// TODO: put in constants
$itunesChannel = 'http://www.itunes.com/dtds/podcast-1.0.dtd';
$itunesSubtitle = $rss->get_channel_tags($itunesChannel, 'subtitle');
@ -224,7 +224,7 @@ class Application_Service_PodcastService
return $podcast->getDbId();
}
//TODO move this somewhere where it makes sense
// TODO move this somewhere where it makes sense
private static function getOwnerId()
{
try {
@ -467,53 +467,53 @@ class Application_Service_PodcastService
$item = $channel->addChild('item');
$publishedFile = CcFilesQuery::create()->findPk($episode->getDbFileId());
//title
// title
self::addEscapedChild($item, 'title', $publishedFile->getDbTrackTitle());
//link - do we need this?
// link - do we need this?
//pubDate
// pubDate
self::addEscapedChild($item, 'pubDate', gmdate(DATE_RFC2822, strtotime($episode->getDbPublicationDate())));
//category
// category
foreach ($itunesCategories as $c) {
if (!empty($c)) {
self::addEscapedChild($item, 'category', $c);
}
}
//guid
// guid
$guid = self::addEscapedChild($item, 'guid', $episode->getDbEpisodeGuid());
$guid->addAttribute('isPermaLink', 'false');
//description
// description
self::addEscapedChild($item, 'description', $publishedFile->getDbDescription());
//encolsure - url, length, type attribs
// encolsure - url, length, type attribs
$enclosure = $item->addChild('enclosure');
$enclosure->addAttribute('url', $episode->getDbDownloadUrl());
$enclosure->addAttribute('length', $publishedFile->getDbFilesize());
$enclosure->addAttribute('type', $publishedFile->getDbMime());
//itunes:subtitle
// itunes:subtitle
// From http://www.apple.com/ca/itunes/podcasts/specs.html#subtitle :
// 'The contents of the <itunes:subtitle> tag are displayed in the Description column in iTunes.'
// self::addEscapedChild($item, "xmlns:itunes:subtitle", $publishedFile->getDbTrackTitle());
self::addEscapedChild($item, 'xmlns:itunes:subtitle', $publishedFile->getDbDescription());
//itunes:summary
// itunes:summary
self::addEscapedChild($item, 'xmlns:itunes:summary', $publishedFile->getDbDescription());
//itunes:author
// itunes:author
self::addEscapedChild($item, 'xmlns:itunes:author', $publishedFile->getDbArtistName());
//itunes:explicit - skip this?
// itunes:explicit - skip this?
//itunes:duration
// itunes:duration
self::addEscapedChild($item, 'xmlns:itunes:duration', explode('.', $publishedFile->getDbLength())[0]);
}
//Format it nicely with newlines...
// Format it nicely with newlines...
$dom = new DOMDocument();
$dom->loadXML($xml->asXML());
$dom->formatOutput = true;

View file

@ -11,7 +11,7 @@ class Application_Service_SchedulerService
'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
'type' => 0, // default type of '0' to represent files. type '1' represents a webstream
];
private $epochNow;
@ -23,10 +23,10 @@ class Application_Service_SchedulerService
{
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
//subtracting one because sometimes when we cancel a track, we set its end time
//to epochNow and then send the new schedule to pypo. Sometimes the currently cancelled
//track can still be included in the new schedule because it may have a few ms left to play.
//subtracting 1 second from epochNow resolves this issue.
// subtracting one because sometimes when we cancel a track, we set its end time
// to epochNow and then send the new schedule to pypo. Sometimes the currently cancelled
// track can still be included in the new schedule because it may have a few ms left to play.
// subtracting 1 second from epochNow resolves this issue.
$this->epochNow = microtime(true) - 1;
$this->nowDT = DateTime::createFromFormat('U.u', $this->epochNow, new DateTimeZone('UTC'));
@ -85,7 +85,7 @@ class Application_Service_SchedulerService
foreach ($ccShowInstances as $instance) {
Logging::info('Removing gaps from show instance #' . $instance->getDbId());
//DateTime object
// DateTime object
$itemStart = $instance->getDbStarts(null);
$ccScheduleItems = CcScheduleQuery::create()
@ -95,7 +95,7 @@ class Application_Service_SchedulerService
->find();
foreach ($ccScheduleItems as $ccSchedule) {
//DateTime object
// DateTime object
$itemEnd = $this->findEndTime($itemStart, $ccSchedule->getDbClipLength());
$ccSchedule->setDbStarts($itemStart)
@ -118,14 +118,14 @@ class Application_Service_SchedulerService
$startEpoch = $instanceStart->format('U.u');
$durationSeconds = Application_Common_DateHelper::playlistTimeToSeconds($clipLength);
//add two float numbers to 6 subsecond precision
//DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number.
// add two float numbers to 6 subsecond precision
// DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number.
$endEpoch = bcadd($startEpoch, (string) $durationSeconds, 6);
$dt = DateTime::createFromFormat('U.u', $endEpoch, new DateTimeZone('UTC'));
if ($dt === false) {
//PHP 5.3.2 problem
// PHP 5.3.2 problem
$dt = DateTime::createFromFormat('U', intval($endEpoch), new DateTimeZone('UTC'));
}
@ -136,14 +136,14 @@ class Application_Service_SchedulerService
{
$startEpoch = $p_startDT->format('U.u');
//add two float numbers to 6 subsecond precision
//DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number.
// add two float numbers to 6 subsecond precision
// DateTime::createFromFormat("U.u") will have a problem if there is no decimal in the resulting number.
$newEpoch = bcsub($startEpoch, (string) $p_seconds, 6);
$dt = DateTime::createFromFormat('U.u', $newEpoch, new DateTimeZone('UTC'));
if ($dt === false) {
//PHP 5.3.2 problem
// PHP 5.3.2 problem
$dt = DateTime::createFromFormat('U', intval($newEpoch), new DateTimeZone('UTC'));
}
@ -210,11 +210,11 @@ class Application_Service_SchedulerService
*/
public static function fillLinkedInstances($ccShow, $instanceIdsToFill, $instanceId = null)
{
//Get the "template" schedule for the linked show (contents of the linked show) that will be
//copied into to all the new show instances.
// Get the "template" schedule for the linked show (contents of the linked show) that will be
// copied into to all the new show instances.
$linkedShowSchedule = self::getLinkedShowSchedule($ccShow->getDbId(), $instanceIdsToFill, $instanceId);
//get time_filled so we can update cc_show_instances
// get time_filled so we can update cc_show_instances
if (!empty($linkedShowSchedule)) {
$timeFilled_sql = 'SELECT time_filled FROM cc_show_instances ' .
"WHERE id = {$linkedShowSchedule[0]['instance_id']}";
@ -224,8 +224,8 @@ class Application_Service_SchedulerService
Application_Common_Database::COLUMN
);
} else {
//We probably shouldn't return here because the code below will
//set this on each empty show instance...
// We probably shouldn't return here because the code below will
// set this on each empty show instance...
$timeFilled = '00:00:00';
}
@ -233,23 +233,23 @@ class Application_Service_SchedulerService
$con = Propel::getConnection();
//Here we begin to fill the new show instances (as specified by $instanceIdsToFill)
//with content from $linkedShowSchedule.
// Here we begin to fill the new show instances (as specified by $instanceIdsToFill)
// with content from $linkedShowSchedule.
try {
$con->beginTransaction();
if (!empty($linkedShowSchedule)) {
foreach ($instanceIdsToFill as $id) {
//Start by clearing the show instance that needs to be filling. This ensure
//we're not going to get in trouble in case there's an programming error somewhere else.
// Start by clearing the show instance that needs to be filling. This ensure
// we're not going to get in trouble in case there's an programming error somewhere else.
self::clearShowInstanceContents($id);
// Now fill the show instance with the same content that $linkedShowSchedule has.
$instanceStart_sql = 'SELECT starts FROM cc_show_instances ' .
"WHERE id = {$id} " . 'ORDER BY starts';
//What's tricky here is that when we copy the content, we have to adjust
//the start and end times of each track so they're inside the new show instance's time slot.
// What's tricky here is that when we copy the content, we have to adjust
// the start and end times of each track so they're inside the new show instance's time slot.
$nextStartDT = new DateTime(
Application_Common_Database::prepareAndExecute(
$instanceStart_sql,
@ -287,7 +287,7 @@ class Application_Service_SchedulerService
$endTimeDT,
$defaultCrossfadeDuration
);
} //foreach show item
} // foreach show item
if (!empty($values)) {
$insert_sql = 'INSERT INTO cc_schedule (starts, ends, ' .
@ -301,13 +301,13 @@ class Application_Service_SchedulerService
);
}
//update cc_schedule status column
// update cc_schedule status column
$instance = CcShowInstancesQuery::create()->findPk($id);
$instance->updateScheduleStatus($con);
} //foreach linked instance
} // foreach linked instance
}
//update time_filled and last_scheduled in cc_show_instances
// update time_filled and last_scheduled in cc_show_instances
$now = gmdate(DEFAULT_TIMESTAMP_FORMAT);
$whereClause = new Criteria();
$whereClause->add(CcShowInstancesPeer::ID, $instanceIdsToFill, Criteria::IN);
@ -363,7 +363,7 @@ class Application_Service_SchedulerService
$endTimeDT,
Application_Model_Preference::GetDefaultCrossfadeDuration()
);
} //foreach show item
} // foreach show item
$ccShowInstance
->setDbTimeFilled($timeFilled)
@ -376,7 +376,7 @@ class Application_Service_SchedulerService
/** Clears a show instance's schedule (which is actually clearing cc_schedule during that show instance's time slot.) */
private static function clearShowInstanceContents($instanceId)
{
//Application_Common_Database::prepareAndExecute($delete_sql, array(), Application_Common_Database::EXECUTE);
// Application_Common_Database::prepareAndExecute($delete_sql, array(), Application_Common_Database::EXECUTE);
$con = Propel::getConnection();
$query = $con->prepare('DELETE FROM cc_schedule WHERE instance_id = :instance_id');
$query->bindParam(':instance_id', $instanceId);

View file

@ -122,7 +122,7 @@ class Application_Service_ShowFormService
public function delegateShowFormPopulation($forms)
{
$this->populateFormWhat($forms['what']);
//local show start DT
// local show start DT
$this->populateFormAutoPlaylist($forms['autoplaylist']);
$showStart = $this->populateFormWhen($forms['when']);
$this->populateFormRepeats($forms['repeats'], $showStart);
@ -175,10 +175,10 @@ class Application_Service_ShowFormService
$showStart = $ccShowDay->getLocalStartDateAndTime();
$showEnd = $ccShowDay->getLocalEndDateAndTime();
//check if the first show is in the past
// check if the first show is in the past
if ($ccShowDay->isShowStartInPast()) {
//for a non-repeating show, we should never allow user to change the start time.
//for a repeating show, we should allow because the form works as repeating template form
// for a non-repeating show, we should never allow user to change the start time.
// for a repeating show, we should allow because the form works as repeating template form
if (!$ccShowDay->isRepeating()) {
$form->disableStartDateAndTime();
} else {
@ -193,7 +193,7 @@ class Application_Service_ShowFormService
}
}
//Disable starting a show 'now' when editing an existing show.
// Disable starting a show 'now' when editing an existing show.
$form->getElement('add_show_start_now')->setAttrib('disable', ['now']);
$form->populate(
@ -237,23 +237,23 @@ class Application_Service_ShowFormService
{
$ccShowInstance = CcShowInstancesQuery::create()->findPk($this->instanceId);
//get timezone the show is created in
// get timezone the show is created in
$timezone = $ccShowInstance->getCcShow()->getFirstCcShowDay()->getDbTimezone();
//$timezone = new DateTimeZone(Application_Model_Preference::GetDefaultTimezone());
// $timezone = new DateTimeZone(Application_Model_Preference::GetDefaultTimezone());
//DateTime object in UTC
// DateTime object in UTC
$showStart = $ccShowInstance->getDbStarts(null);
$showStart->setTimezone(new DateTimeZone($timezone));
$showEnd = $ccShowInstance->getDbEnds(null);
$showEnd->setTimezone(new DateTimeZone($timezone));
//if the show has started, do not allow editing on the start time
// if the show has started, do not allow editing on the start time
if ($showStart->getTimestamp() <= time()) {
$form->disableStartDateAndTime();
}
//Disable starting a show 'now' when editing an existing show.
// Disable starting a show 'now' when editing an existing show.
$form->getElement('add_show_start_now')->setAttrib('disable', ['now']);
$form->populate(
@ -297,18 +297,18 @@ class Application_Service_ShowFormService
$service_show = new Application_Service_ShowService($this->ccShow->getDbId());
$repeatEndDate = $service_show->getRepeatingEndDate();
//end dates are stored non-inclusively so we need to
//subtract one day
// end dates are stored non-inclusively so we need to
// subtract one day
if (!is_null($repeatEndDate)) {
$repeatEndDate->sub(new DateInterval('P1D'));
}
//default monthly repeat type
// default monthly repeat type
$monthlyRepeatType = 2;
$repeatType = $ccShowDays[0]->getDbRepeatType();
if ($repeatType == REPEAT_MONTHLY_WEEKLY) {
$monthlyRepeatType = $repeatType;
//a repeat type of 2 means the show is repeating monthly
// a repeat type of 2 means the show is repeating monthly
$repeatType = 2;
} elseif ($repeatType == REPEAT_MONTHLY_MONTHLY) {
$monthlyRepeatType = $repeatType;
@ -445,7 +445,7 @@ class Application_Service_ShowFormService
$formValues = [];
$i = 1;
foreach ($absolutRebroadcasts as $ar) {
//convert dates to user's local time
// convert dates to user's local time
$start = new DateTime($ar->getDbStarts(), new DateTimeZone('UTC'));
$start->setTimezone(new DateTimeZone($timezone));
$formValues["add_show_rebroadcast_date_absolute_{$i}"] = $start->format('Y-m-d');
@ -486,15 +486,15 @@ class Application_Service_ShowFormService
$validateStartDate = $formData['start_date_disabled'] === 'false';
$validateStartTime = $formData['start_time_disabled'] === 'false';
//CcShowDays object of the show currently being edited
// CcShowDays object of the show currently being edited
$currentShowDay = $this->ccShow->getFirstCcShowDay();
//DateTime object
// DateTime object
$dt = $currentShowDay->getLocalStartDateAndTime();
$formData['add_show_record'] = $currentShowDay->getDbRecord();
//if the show is repeating, set the start date to the next
//repeating instance in the future
// if the show is repeating, set the start date to the next
// repeating instance in the future
$originalShowStartDateTime = $this->getCurrentOrNextInstanceStartTime();
if (!$originalShowStartDateTime) {
$originalShowStartDateTime = $dt;

View file

@ -23,9 +23,9 @@ class Application_Service_ShowService
private $origShowRepeatStatus;
private $instanceIdsForScheduleUpdates;
//keeps track of which show instances are new from either adding a new show
//day or changing the repeat type day during a show edit, or when a user moves
//forward in the calendar
// keeps track of which show instances are new from either adding a new show
// day or changing the repeat type day during a show edit, or when a user moves
// forward in the calendar
private $newInstanceIdsCreated;
public function __construct($showId = null, $showData = null, $isUpdate = false)
@ -70,12 +70,12 @@ class Application_Service_ShowService
$showId = $showData['add_show_id'];
// UPDATE SCHEDULE START TIME
//get the ccShow object to which this instance belongs
//so we can get the original start date and time
// get the ccShow object to which this instance belongs
// so we can get the original start date and time
$this->ccShow = CcShowQuery::create()
->findPk($showId);
//DateTime in shows's local time
// DateTime in shows's local time
$newStartDateTime = new DateTime(
$showData['add_show_start_date'] . ' ' .
$showData['add_show_start_time'],
@ -85,7 +85,7 @@ class Application_Service_ShowService
$ccShowInstanceOrig = CcShowInstancesQuery::create()
->findPk($showData['add_show_instance_id']);
//convert original start time into the show's local timezone
// convert original start time into the show's local timezone
$origLocalStartDateTime = $ccShowInstanceOrig->getLocalStartDateTime();
$diff = $this->calculateShowStartDiff(
@ -143,7 +143,7 @@ class Application_Service_ShowService
$this->getPopulateShowUntilDateTIme()
);
//update cc_schedule with the new instance id
// update cc_schedule with the new instance id
$con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
$selectCriteria = new Criteria();
$selectCriteria->add(CcSchedulePeer::INSTANCE_ID, $showData['add_show_instance_id']);
@ -157,7 +157,7 @@ class Application_Service_ShowService
->setDbDescription($showData['add_show_instance_description'])
->save();
//delete the edited instance from the repeating sequence
// delete the edited instance from the repeating sequence
$ccShowInstanceOrig
->setDbModifiedInstance(true)
->setDbDescription($showData['add_show_instance_description'])
@ -211,7 +211,7 @@ class Application_Service_ShowService
throw new Exception('Permission denied');
}
//update ccShow
// update ccShow
$this->setCcShow($showData);
$daysAdded = [];
@ -237,23 +237,23 @@ class Application_Service_ShowService
$this->deleteCcShowHosts();
if ($this->isRebroadcast) {
//delete entry in cc_show_rebroadcast
// delete entry in cc_show_rebroadcast
$this->deleteCcShowRebroadcasts();
}
$this->storeInstanceIds();
}
//update ccShowDays
// update ccShowDays
$this->setCcShowDays($showData);
//update ccShowRebroadcasts
// update ccShowRebroadcasts
$this->setCcShowRebroadcasts($showData);
//update ccShowHosts
// update ccShowHosts
$this->setCcShowHosts($showData);
//create new ccShowInstances
// create new ccShowInstances
$this->delegateInstanceCreation($daysAdded);
if ($this->isUpdate) {
@ -332,7 +332,7 @@ class Application_Service_ShowService
if ($this->ccShow->isRepeating()) {
$ccShowDays = $this->ccShow->getRepeatingCcShowDays();
} else {
//$ccShowDays = $this->ccShow->getCcShowDayss();
// $ccShowDays = $this->ccShow->getCcShowDayss();
/* Cannot use the above statement to get the cc_show_days
* object because it's getting the old object before the
@ -364,8 +364,8 @@ class Application_Service_ShowService
$ccShows[$show_id] = $day->getccShow();
}
//keep track of the new show instances getting created
//so we can fill their schedule after
// keep track of the new show instances getting created
// so we can fill their schedule after
if (!isset($this->newInstanceIdsCreated[$show_id])) {
$this->newInstanceIdsCreated[$show_id] = [];
}
@ -535,23 +535,23 @@ SQL;
$daysAdded = [];
//CcShowDay object
// CcShowDay object
if ($this->ccShow->isRepeating()) {
$currentShowDay = $this->ccShow->getFirstRepeatingCcShowDay();
//all cc_show_days
// all cc_show_days
$ccShowDays = $this->ccShow->getRepeatingCcShowDays();
} else {
$currentShowDay = $this->ccShow->getFirstCcShowDay();
//all cc_show_days
// all cc_show_days
$ccShowDays = $this->ccShow->getCcShowDayss();
}
//new end date in the show's timezone (from the select box)
// new end date in the show's timezone (from the select box)
$endDateTime = $this->calculateEndDate($showData);
//repeat option was toggled
// repeat option was toggled
if ($showData['add_show_repeats'] != $currentShowDay->isRepeating()) {
$this->deleteAllRepeatInstances($currentShowDay, $showId);
@ -559,9 +559,9 @@ SQL;
$this->deleteAllShowDays($showId);
}
//if repeat option was checked we need to treat the current show day
//as a new show day so the repeat instances get created properly
//in createWeeklyRepeatInstances()
// if repeat option was checked we need to treat the current show day
// as a new show day so the repeat instances get created properly
// in createWeeklyRepeatInstances()
if ($showData['add_show_repeats']) {
array_push($daysAdded, $currentShowDay->getDbDay());
}
@ -570,29 +570,29 @@ SQL;
if ($showData['add_show_repeats']) {
$localShowStart = $currentShowDay->getLocalStartDateAndTime();
//if the start date changes, these are the repeat types
//that require show instance deletion
// if the start date changes, these are the repeat types
// that require show instance deletion
$deleteRepeatTypes = [REPEAT_BI_WEEKLY, REPEAT_TRI_WEEKLY, REPEAT_QUAD_WEEKLY, REPEAT_MONTHLY_MONTHLY,
REPEAT_MONTHLY_WEEKLY, ];
if (in_array($this->repeatType, $deleteRepeatTypes)
&& $showData['add_show_start_date'] != $localShowStart->format('Y-m-d')) {
//Start date has changed when repeat type is bi-weekly or monthly.
//This screws up the repeating positions of show instances, so
//we need to delete them (CC-2351)
// Start date has changed when repeat type is bi-weekly or monthly.
// This screws up the repeating positions of show instances, so
// we need to delete them (CC-2351)
$this->deleteAllInstances($showId);
}
$currentRepeatType = $currentShowDay->getDbRepeatType();
//only delete instances if the show being edited was already repeating
//and the repeat type changed
// only delete instances if the show being edited was already repeating
// and the repeat type changed
if ($currentRepeatType != -1 && $this->repeatType != $currentRepeatType) {
$this->deleteAllInstances($showId);
$this->deleteAllShowDays($showId);
// when repeating by day of the month (1st, 2nd, etc.) we do not store the repeat week days
} elseif ($currentRepeatType != 2) {
//repeat type is the same, check if the days of the week are the same
// repeat type is the same, check if the days of the week are the same
$repeatingDaysChanged = false;
$showDays = [];
@ -601,7 +601,7 @@ SQL;
}
if (count($showData['add_show_day_check']) == count($showDays)) {
//same number of days checked, lets see if they are the same numbers
// same number of days checked, lets see if they are the same numbers
$intersect = array_intersect($showData['add_show_day_check'], $showDays);
if (count($intersect) != count($showData['add_show_day_check'])) {
$repeatingDaysChanged = true;
@ -618,8 +618,8 @@ SQL;
}
if (count($daysRemoved) > 0) {
//delete repeating show instances for the repeating
//days that were removed
// delete repeating show instances for the repeating
// days that were removed
/*if ($this->ccShow->isLinked()) {
$this->preserveLinkedShowContent();
}*/
@ -633,30 +633,30 @@ SQL;
if ($showData['add_show_start_date'] != $localShowStart->format('Y-m-d')
|| $showData['add_show_start_time'] != $localShowStart->format('H:i')) {
//start date has been pushed forward so we need to delete
//any instances of this show scheduled before the new start date
// start date has been pushed forward so we need to delete
// any instances of this show scheduled before the new start date
if ($showData['add_show_start_date'] > $localShowStart->format('Y-m-d')) {
$this->deleteInstancesBeforeDate($showData['add_show_start_date'], $showId);
}
}
}
//get the endate from the past for this show.
//check if this is null if "no end"
// get the endate from the past for this show.
// check if this is null if "no end"
$currentShowEndDateTime = $this->getRepeatingEndDate();
if ($endDateTime && $currentShowEndDateTime != $endDateTime) {
$endDate = clone $endDateTime;
$endDate->setTimezone(new DateTimeZone('UTC'));
//show's "No End" option was toggled
//or the end date comes earlier
// show's "No End" option was toggled
// or the end date comes earlier
if (is_null($currentShowEndDateTime) || ($endDateTime < $currentShowEndDateTime)) {
//"No End" option was unchecked so we need to delete the
//repeat instances that are scheduled after the new end date
//OR
//end date was pushed back so we have to delete any
//instances of this show scheduled after the new end date
// "No End" option was unchecked so we need to delete the
// repeat instances that are scheduled after the new end date
// OR
// end date was pushed back so we have to delete any
// instances of this show scheduled after the new end date
$this->deleteInstancesFromDate($endDate->format('Y-m-d'), $showId);
}
}
@ -754,7 +754,7 @@ SQL;
{
$daysRemovedUTC = [];
//convert the start day of the week to UTC
// convert the start day of the week to UTC
foreach ($showDays as $showDay) {
if (in_array($showDay->getDbDay(), $daysRemoved)) {
$showDay->reload();
@ -764,7 +764,7 @@ SQL;
}
foreach ($daysRemoved as $day) {
//delete the cc_show_day entries as well
// delete the cc_show_day entries as well
CcShowDaysQuery::create()
->filterByDbShowId($showId)
->filterByDbDay($day)
@ -854,14 +854,14 @@ SQL;
->setDbModifiedInstance(true)
->save();
//delete the rebroadcasts of the removed recorded show
// delete the rebroadcasts of the removed recorded show
if ($ccShowInstance->isRecorded()) {
CcShowInstancesQuery::create()
->filterByDbOriginalShow($instanceId)
->delete();
}
//delete all files scheduled in cc_schedules table
// delete all files scheduled in cc_schedules table
CcScheduleQuery::create()
->filterByDbInstanceId($instanceId)
->delete();
@ -895,7 +895,7 @@ SQL;
*/
$lastShowDays = [];
//get the show's timezone
// get the show's timezone
$ccShow = CcShowQuery::create()->findPk($showId);
if ($ccShow->isRepeating()) {
$showTimezone = $ccShow->getFirstRepeatingCcShowDay()->getDbTimezone();
@ -1013,11 +1013,11 @@ SQL;
*/
private function calculateEndDate($showData)
{
//if no end return null
// if no end return null
if ($showData['add_show_no_end']) {
$endDate = null;
}
//if the show is repeating & ends, then return the end date
// if the show is repeating & ends, then return the end date
elseif ($showData['add_show_repeats']) {
$endDate = new DateTime(
$showData['add_show_end_date'],
@ -1025,7 +1025,7 @@ SQL;
);
$endDate->add(new DateInterval('P1D'));
}
//the show doesn't repeat, so add one day to the start date.
// the show doesn't repeat, so add one day to the start date.
else {
$endDate = new DateTime(
$showData['add_show_start_date'],
@ -1040,7 +1040,7 @@ SQL;
private function updateScheduleStartEndTimes($showData)
{
$showId = $this->ccShow->getDbId();
//DateTime in show's local time
// DateTime in show's local time
$newStartDateTime = new DateTime(
$showData['add_show_start_date'] . ' ' .
$showData['add_show_start_time'],
@ -1145,7 +1145,7 @@ SQL;
*/
private function createNonRepeatingInstance($showDay, $populateUntil)
{
//DateTime object
// DateTime object
$start = $showDay->getLocalStartDateAndTime();
[$utcStartDateTime, $utcEndDateTime] = $this->createUTCStartEndDateTime(
@ -1156,7 +1156,7 @@ SQL;
if ($utcStartDateTime->getTimestamp() < $populateUntil->getTimestamp()) {
$ccShowInstance = new CcShowInstances();
if ($this->isUpdate) {
//use original cc_show_day object to get the current cc_show_instance
// use original cc_show_day object to get the current cc_show_instance
$origStartDateTime = new DateTime(
$this->origCcShowDay->getDbFirstShow() . ' ' . $this->origCcShowDay->getDbStartTime(),
new DateTimeZone($this->origCcShowDay->getDbTimezone())
@ -1200,21 +1200,21 @@ SQL;
$daysAdded = null
) {
$show_id = $showDay->getDbShowId();
$first_show = $showDay->getDbFirstShow(); //non-UTC
$last_show = $showDay->getDbLastShow(); //non-UTC
$first_show = $showDay->getDbFirstShow(); // non-UTC
$last_show = $showDay->getDbLastShow(); // non-UTC
$duration = $showDay->getDbDuration();
$day = $showDay->getDbDay();
$record = $showDay->getDbRecord();
$timezone = $showDay->getDbTimezone();
//DateTime local
// DateTime local
$start = $this->getNextRepeatingPopulateStartDateTime($showDay);
if (is_null($repeatInterval) && $repeatType == REPEAT_MONTHLY_WEEKLY) {
$repeatInterval = self::getMonthlyWeeklyRepeatInterval($start, $timezone);
}
//DatePeriod in user's local time
// DatePeriod in user's local time
$datePeriod = $this->getDatePeriod(
$start,
$timezone,
@ -1302,14 +1302,14 @@ SQL;
private function createMonthlyRepeatInstances($showDay, $populateUntil)
{
$show_id = $showDay->getDbShowId();
$first_show = $showDay->getDbFirstShow(); //non-UTC
$last_show = $showDay->getDbLastShow(); //non-UTC
$first_show = $showDay->getDbFirstShow(); // non-UTC
$last_show = $showDay->getDbLastShow(); // non-UTC
$duration = $showDay->getDbDuration();
$day = $showDay->getDbDay();
$record = $showDay->getDbRecord();
$timezone = $showDay->getDbTimezone();
//DateTime local
// DateTime local
$start = $this->getNextRepeatingPopulateStartDateTime($showDay);
if (isset($last_show)) {
$end = new DateTime($last_show, new DateTimeZone($timezone));
@ -1589,7 +1589,7 @@ SQL;
$ccShowInstance = CcShowInstancesQuery::create()
->filterByDbStarts($temp->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::EQUAL)
->filterByDbShowId($this->ccShow->getDbId(), Criteria::EQUAL)
//->filterByDbModifiedInstance(false, Criteria::EQUAL)
// ->filterByDbModifiedInstance(false, Criteria::EQUAL)
->filterByDbRebroadcast(0, Criteria::EQUAL)
->limit(1)
->find();
@ -1653,10 +1653,10 @@ SQL;
$ccShow->setDbAutoPlaylistId($showData['add_show_autoplaylist_id']);
}
//Here a user has edited a show and linked it.
//We need to grab the existing show instances ids and fill their content
//with the content from the show instance that was clicked on to edit the show.
//We do this because linked show instances need to have the same content in each.
// Here a user has edited a show and linked it.
// We need to grab the existing show instances ids and fill their content
// with the content from the show instance that was clicked on to edit the show.
// We do this because linked show instances need to have the same content in each.
if ($this->isUpdate && (!$ccShow->getDbLinked() && $showData['add_show_linked'])) {
$existingShowInstanceIds = $ccShow->getFutureInstanceIds(new Criteria());
Application_Service_SchedulerService::fillLinkedInstances($ccShow, $existingShowInstanceIds, $showData['add_show_instance_id']);
@ -1693,8 +1693,8 @@ SQL;
$endDate = null;
}
//Our calculated start DOW must be used for non repeating since a day has not been selected.
//For all repeating shows, only the selected days of the week will be repeated on.
// Our calculated start DOW must be used for non repeating since a day has not been selected.
// For all repeating shows, only the selected days of the week will be repeated on.
$startDow = $startDateTime->format('w');
if (!$showData['add_show_repeats']) {
$showData['add_show_day_check'] = [$startDow];
@ -1708,7 +1708,7 @@ SQL;
->filterByDbRepeatType($this->origCcShowDay->getDbRepeatType())
->findOne();
if (!$showDay) {
//repeat type changed so we have to create a new show_day rule
// repeat type changed so we have to create a new show_day rule
$showDay = new CcShowDays();
}
} else {
@ -1723,8 +1723,8 @@ SQL;
$showDay->setDbRepeatType($this->repeatType);
$showDay->setDbShowId($showId);
$showDay->setDbRecord($this->isRecorded);
//in case we are editing a show we need to set this to the first show
//so when editing, the date period iterator will start from the beginning
// in case we are editing a show we need to set this to the first show
// so when editing, the date period iterator will start from the beginning
$showDay->setDbNextPopDate($startDateTime->format('Y-m-d'));
$showDay->save();
} else {
@ -1746,7 +1746,7 @@ SQL;
|| $this->origCcShowDay->getDbRepeatType() == 3) {
$day = null;
} elseif (!$this->origShowRepeatStatus) {
//keep current show day to use for updating cc_show_day rule
// keep current show day to use for updating cc_show_day rule
$keepDay = $day;
$day = $this->origCcShowDay->getDbDay();
}
@ -1757,9 +1757,9 @@ SQL;
->filterByDbDay($day)
->findOne();
if (!$showDay) {
//if no show day object was found it is because a new
//repeating day of the week was added OR the repeat
//type has changed
// if no show day object was found it is because a new
// repeating day of the week was added OR the repeat
// type has changed
$showDay = new CcShowDays();
}
@ -1779,8 +1779,8 @@ SQL;
$showDay->setDbRepeatType($this->repeatType);
$showDay->setDbShowId($showId);
$showDay->setDbRecord($this->isRecorded);
//in case we are editing a show we need to set this to the first show
//so when editing, the date period iterator will start from the beginning
// in case we are editing a show we need to set this to the first show
// so when editing, the date period iterator will start from the beginning
$showDay->setDbNextPopDate($startDateTimeClone->format('Y-m-d'));
$showDay->save();
}
@ -1899,8 +1899,8 @@ SQL;
$timezone = $startDateTime->getTimezone();
if (isset($offset)) {
//$offset["hours"] and $offset["mins"] represents the start time
//of a rebroadcast show
// $offset["hours"] and $offset["mins"] represents the start time
// of a rebroadcast show
$startDateTime = new DateTime($startDateTime->format('Y-m-d') . ' ' .
$offset['hours'] . ':' . $offset['mins'], $timezone);
$startDateTime->add(new DateInterval("P{$offset['days']}D"));