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

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
campcaster/src/modules/htmlUI/var

View File

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

View File

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