Merge branch '2.4.x' into ryerson-history

This commit is contained in:
Naomi 2013-08-30 16:07:41 -04:00
commit 4fd37a4fa0
37 changed files with 2385 additions and 175 deletions

View file

@ -45,11 +45,16 @@ class Application_Service_CalendarService
if ($this->ccShowInstance->isRecorded()) {
$ccFile = $this->ccShowInstance->getCcFiles();
$menu["view_recorded"] = array(
"name" => _("View Recorded File Metadata"),
"icon" => "overview",
"url" => $baseUrl."library/edit-file-md/id/".$ccFile->getDbId());
if (!isset($ccFile)) {
$menu["error when recording"] = array (
"name" => _("Record file doesn't exist"),
"icon" => "error");
}else {
$menu["view_recorded"] = array(
"name" => _("View Recorded File Metadata"),
"icon" => "overview",
"url" => $baseUrl."library/edit-file-md/id/".$ccFile->getDbId());
}
//recorded show can be uploaded to soundcloud
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {

View file

@ -248,22 +248,24 @@ class Application_Service_SchedulerService
}
} //foreach linked instance
$insert_sql = "INSERT INTO cc_schedule (starts, ends, ".
"clip_length, fade_in, fade_out, cue_in, cue_out, ".
"file_id, stream_id, instance_id, position) VALUES ".
implode($values, ",");
if (!empty($values)) {
$insert_sql = "INSERT INTO cc_schedule (starts, ends, ".
"clip_length, fade_in, fade_out, cue_in, cue_out, ".
"file_id, stream_id, instance_id, position) VALUES ".
implode($values, ",");
Application_Common_Database::prepareAndExecute(
$insert_sql, array(), Application_Common_Database::EXECUTE);
Application_Common_Database::prepareAndExecute(
$insert_sql, array(), Application_Common_Database::EXECUTE);
//update time_filled in cc_show_instances
$now = gmdate("Y-m-d H:i:s");
$update_sql = "UPDATE cc_show_instances SET ".
"time_filled = '{$timeFilled}', ".
"last_scheduled = '{$now}' ".
"WHERE show_id = {$ccShow->getDbId()}";
Application_Common_Database::prepareAndExecute(
$update_sql, array(), Application_Common_Database::EXECUTE);
//update time_filled in cc_show_instances
$now = gmdate("Y-m-d H:i:s");
$update_sql = "UPDATE cc_show_instances SET ".
"time_filled = '{$timeFilled}', ".
"last_scheduled = '{$now}' ".
"WHERE show_id = {$ccShow->getDbId()}";
Application_Common_Database::prepareAndExecute(
$update_sql, array(), Application_Common_Database::EXECUTE);
}
} //if at least one linked instance has content
}

View file

@ -441,7 +441,7 @@ class Application_Service_ShowFormService
$rebroadcast = true;
$absRebroadcast = true;
if ($formData["add_show_rebroadcast"]) {
if (isset($formData["add_show_rebroadcast"]) && $formData["add_show_rebroadcast"]) {
$formData["add_show_duration"] = Application_Service_ShowService::formatShowDuration(
$formData["add_show_duration"]);
$absRebroadcast = $forms["abs_rebroadcast"]->isValid($formData);

View file

@ -655,15 +655,16 @@ SQL;
->filterByDbDay($dayOfWeek)
->findOne();
$lastShowStartDT->setTimeZone(new DateTimeZone(
$ccShowDay->getDbTimezone()));
$lastShowEndDT = Application_Service_CalendarService::addDeltas(
$lastShowStartDT, 1, 0);
if (isset($ccShowDay)) {
$lastShowStartDT->setTimeZone(new DateTimeZone(
$ccShowDay->getDbTimezone()));
$lastShowEndDT = Application_Service_CalendarService::addDeltas(
$lastShowStartDT, 1, 0);
$ccShowDay
->setDbLastShow($lastShowEndDT->format("Y-m-d"))
->save();
$ccShowDay
->setDbLastShow($lastShowEndDT->format("Y-m-d"))
->save();
}
}
//remove the old repeating deleted instances.
@ -872,6 +873,7 @@ SQL;
private function createWeeklyRepeatInstances($showDay, $populateUntil,
$repeatType, $repeatInterval, $daysAdded=null)
{
$show_id = $showDay->getDbShowId();
$first_show = $showDay->getDbFirstShow(); //non-UTC
$last_show = $showDay->getDbLastShow(); //non-UTC
@ -894,10 +896,9 @@ SQL;
$utcLastShowDateTime = $last_show ?
Application_Common_DateHelper::ConvertToUtcDateTime($last_show, $timezone) : null;
$utcStartDateTime = new DateTime("now");
$previousDate = clone $start;
foreach ($datePeriod as $date) {
foreach ($datePeriod as $date) {
list($utcStartDateTime, $utcEndDateTime) = $this->createUTCStartEndDateTime(
$date, $duration);
/*
@ -911,6 +912,7 @@ SQL;
( is_null($utcLastShowDateTime) ||
$utcStartDateTime->format("Y-m-d H:i:s") < $utcLastShowDateTime->format("Y-m-d H:i:s")) ) {
$lastCreatedShow = clone $utcStartDateTime;
/* There may not always be an instance when editing a show
* This will be the case when we are adding a new show day to
* a repeating show
@ -954,12 +956,19 @@ SQL;
$previousDate = clone $date;
}
/* Set UTC to local time before setting the next repeat date. If we don't
* the next repeat date might be scheduled for the following day
/* We need to set the next populate date for repeat shows so when a user
* moves forward in the calendar we know when to start generating new
* show instances.
* If $utcStartDateTime is not set then we know zero new shows were
* created and we shouldn't update the next populate date.
*/
$utcStartDateTime->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
$nextDate = $utcStartDateTime->add($repeatInterval);
$this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id);
if (isset($lastCreatedShow)) {
/* Set UTC to local time before setting the next repeat date. If we don't
* the next repeat date might be scheduled for the following day */
$lastCreatedShow->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
$nextDate = $lastCreatedShow->add($repeatInterval);
$this->setNextRepeatingShowDate($nextDate->format("Y-m-d"), $day, $show_id);
}
}
private function createMonthlyRepeatInstances($showDay, $populateUntil)
@ -1001,6 +1010,7 @@ SQL;
( is_null($utcLastShowDateTime) ||
$utcStartDateTime->getTimestamp() < $utcLastShowDateTime->getTimestamp()) ) {
$lastCreatedShow = clone $utcStartDateTime;
/* There may not always be an instance when editing a show
* This will be the case when we are adding a new show day to
* a repeating show