general cleanups
This commit is contained in:
parent
ed7d233ca2
commit
89dcc18724
|
@ -762,10 +762,13 @@ class Application_Model_Show
|
|||
$date = new Application_Common_DateHelper;
|
||||
$timestamp = $date->getUtcTimestamp();
|
||||
|
||||
$sql = "UPDATE cc_show_days "
|
||||
."SET duration = '$p_data[add_show_duration]' "
|
||||
."WHERE show_id = $p_data[add_show_id]";
|
||||
$con->exec($sql);
|
||||
$stmt = $con->prepare("UPDATE cc_show_days "
|
||||
."SET duration = :add_show_duration"
|
||||
."WHERE show_id = :add_show_id" );
|
||||
$stmt->execute( array(
|
||||
':add_show_duration' => $p_data[add_show_duration],
|
||||
':add_show_id' => $p_data[add_show_id]
|
||||
));
|
||||
|
||||
$sql = "UPDATE cc_show_instances "
|
||||
."SET ends = starts + INTERVAL '$p_data[add_show_duration]' "
|
||||
|
@ -1667,12 +1670,17 @@ class Application_Model_Show
|
|||
$options["percent"] = Application_Model_Show::getPercentScheduled($show["starts"], $show["ends"], $show["time_filled"]);
|
||||
}
|
||||
|
||||
$utc = new DateTimeZone("UTC");
|
||||
|
||||
if (isset($show["parent_starts"])) {
|
||||
$parentStartsDT = new DateTime($show["parent_starts"], new DateTimeZone("UTC"));
|
||||
$parentStartsDT = new DateTime($show["parent_starts"], $utc);
|
||||
$parentStartsEpoch = intval($parentStartsDT->format("U"));
|
||||
}
|
||||
$startsDT = DateTime::createFromFormat("Y-m-d G:i:s", $show["starts"], new DateTimeZone("UTC"));
|
||||
$endsDT = DateTime::createFromFormat("Y-m-d G:i:s", $show["ends"], new DateTimeZone("UTC"));
|
||||
|
||||
$startsDT = DateTime::createFromFormat("Y-m-d G:i:s",
|
||||
$show["starts"],$utc);
|
||||
$endsDT = DateTime::createFromFormat("Y-m-d G:i:s",
|
||||
$show["ends"], $utc);
|
||||
|
||||
$startsEpochStr = $startsDT->format("U");
|
||||
$endsEpochStr = $endsDT->format("U");
|
||||
|
@ -1683,23 +1691,26 @@ class Application_Model_Show
|
|||
$startsDT->setTimezone(new DateTimeZone($timezone));
|
||||
$endsDT->setTimezone(new DateTimeZone($timezone));
|
||||
|
||||
if ($p_editable && $show["record"] && $nowEpoch > $startsEpoch) {
|
||||
if( $p_editable ) {
|
||||
if ($show["record"] && $nowEpoch > $startsEpoch) {
|
||||
$options["editable"] = false;
|
||||
} elseif ($p_editable && $show["rebroadcast"] && $nowEpoch > $parentStartsEpoch) {
|
||||
} elseif ($show["rebroadcast"] &&
|
||||
$nowEpoch > $parentStartsEpoch) {
|
||||
$options["editable"] = false;
|
||||
} elseif ($p_editable && $nowEpoch < $endsEpoch) {
|
||||
} elseif ($nowEpoch < $endsEpoch) {
|
||||
$options["editable"] = true;
|
||||
}
|
||||
|
||||
$showInstance = new Application_Model_ShowInstance($show["instance_id"]);
|
||||
$showContent = $showInstance->getShowListContent();
|
||||
if (empty($showContent)) {
|
||||
$options["show_empty"] = 1;
|
||||
} else {
|
||||
$options["show_empty"] = 0;
|
||||
}
|
||||
|
||||
$events[] = &self::makeFullCalendarEvent($show, $options, $startsDT, $endsDT, $startsEpochStr, $endsEpochStr);
|
||||
|
||||
$showInstance = new Application_Model_ShowInstance(
|
||||
$show["instance_id"]);
|
||||
$showContent = $showInstance->getShowListContent();
|
||||
|
||||
$options["show_empty"] = empty($showContent) ? 1 : 0;
|
||||
|
||||
$events[] = &self::makeFullCalendarEvent($show, $options,
|
||||
$startsDT, $endsDT, $startsEpochStr, $endsEpochStr);
|
||||
}
|
||||
|
||||
return $events;
|
||||
|
|
Loading…
Reference in New Issue