Fix for playlists in the scheduler spanning across day boundaries or even multiple days. Part of #2050.

This commit is contained in:
paul 2006-11-29 17:45:02 +00:00
parent e79a684041
commit 50c781da5d
2 changed files with 41 additions and 14 deletions

View File

@ -69,9 +69,10 @@
{/if}
{if $_entrys[$_hour].span}
<div {include file="scheduler/removeitem.tpl"}>
...
</div>
{assign var="i" value=$_entrys[$_hour].span}
<div {include file="scheduler/removeitem.tpl"}>
&nbsp;&nbsp;&nbsp;&nbsp;... <i><b>{$i.title}</b> ##continued##</i> ...
</div>
{/if}
</td>
</tr>

View File

@ -397,17 +397,43 @@ class uiScheduler extends uiCalendar {
'startsyesterday' => $startsYesterday);
}
// If the item spans more than one hour
if ( ($endHour - $startHour) > 1) {
for ($i = $startHour + 1; $i < $endHour; $i++) {
$items[$i]['span'][] =
array('id' => $id,
'scheduleid' => $val['id'],
'start' => $startTime,
'end' => $endTime,
'title' => $title,
'creator' => $creator,
'type' => 'Playlist');
$diffHours = floor(($end - $start)/3600);
// If the item spans three hours or more
if ( $diffHours > 2 ) {
// $skip becomes true if we dont actually have to do
// this section.
$skip = false;
if (strftime('%Y%m%d', $start) === $thisDay) {
// For the edge case of starting at the end of
// today.
if ($startHour == 23) {
$skip = true;
}
$countStart = $startHour + 1;
} else {
$countStart = 0;
}
if (strftime('%Y%m%d', $end) === $thisDay) {
// For the edge case of ending at the beginning
// of today.
if ($endHour == 0) {
$skip = true;
}
$countEnd = $endHour - 1;
} else {
$countEnd = 23;
}
if (!$skip) {
for ($i = $countStart; $i <= $countEnd; $i++) {
$items[$i]['span'] =
array('id' => $id,
'scheduleid' => $val['id'],
'start' => $startTime,
'end' => $endTime,
'title' => $title,
'creator' => $creator,
'type' => 'Playlist');
}
}
}
}