corrected span-over hour/midnight display

This commit is contained in:
sebastian 2005-10-01 14:46:26 +00:00
parent 9236c4671a
commit f6ef66b894
2 changed files with 50 additions and 19 deletions

View file

@ -1,7 +1,7 @@
{$SCHEDULER->buildDay()} {$SCHEDULER->buildDay()}
{assign var="_scale" value=$SCHEDULER->getDayTimingScale()} {* get the 24h scale *} {assign var="_scale" value=$SCHEDULER->getDayTimingScale()} {* get the 24h scale *}
{assign var="_entrys" value=$SCHEDULER->getDayEntrys()} {* get all entrys on given day from scheduler *} {assign var="_entrys" value=$SCHEDULER->getDayEntrys()} {* get all entrys on given day from scheduler *}
{assign var="_day" value=$SCHEDULER->curr} {* to have year, month, day in between_additem.tpl *} {assign var="_day" value=$SCHEDULER->curr} {* to have year, month, day in between_additem.tpl *}
<div class="content"> <div class="content">
<div class="container_elements"> <div class="container_elements">
@ -22,11 +22,22 @@
{if is_array($_entrys[$_hour])} {if is_array($_entrys[$_hour])}
<tr class="blue1"> <tr class="blue1">
<td style="border-left: 1px solid #ccc; cursor: pointer" {include file="scheduler/day_additem.tpl"}> <td style="border-left: 1px solid #ccc; cursor: pointer" {include file="scheduler/day_additem.tpl"}>
{$_hour|string_format:"%02d"}:00 {$_hour|string_format:"%02d"}:00
</td> </td>
<td style="border-right: 1px solid #ccc;"> <td style="border-right: 1px solid #ccc;">
{if $_entrys[$_hour].end} {if $_entrys[$_hour].end}
{foreach from=$_entrys[$_hour].end item="i"}
{if $i.startsyesterday}
<div {include file="scheduler/removeitem.tpl"}>
<img src="img/playlist.png" border="0" {include file="sub/alttext.tpl"}>
&nbsp;
<b>{$i.title}</b>
##yesterday## {$i.start} - {$i.end}
<i>{$i.creator}</i>
</div>
{/if}
{/foreach}
{include file="scheduler/between_additem.tpl"} {include file="scheduler/between_additem.tpl"}
{/if} {/if}
@ -36,11 +47,17 @@
<img src="img/playlist.png" border="0" {include file="sub/alttext.tpl"}> <img src="img/playlist.png" border="0" {include file="sub/alttext.tpl"}>
&nbsp; &nbsp;
<b>{$i.title}</b> <b>{$i.title}</b>
{$i.start}-{$i.end}
{$i.creator} {if $i.endstoday}
{if $i.endshere} {$i.start} - {$i.end}
{include file="scheduler/between_additem.tpl"} <i>{$i.creator}</i>
{/if} {if $i.endshere}
{include file="scheduler/between_additem.tpl"}
{/if}
{else}
{$i.start} - ##tomorrow## {$i.end}
<i>{$i.creator}</i>
{/if}
</div> </div>
{/foreach} {/foreach}
{/if} {/if}
@ -48,7 +65,7 @@
{if $_entrys.span[$_hour]} {if $_entrys.span[$_hour]}
span span
{/if} {/if}
</td> </td>
</tr> </tr>
{else} {else}
<tr class="blue2" {include file="scheduler/day_additem.tpl"}> <tr class="blue2" {include file="scheduler/day_additem.tpl"}>

View file

@ -227,15 +227,15 @@ class uiScheduler extends uiCalendar
return FALSE; return FALSE;
foreach ($arr as $key => $val) { foreach ($arr as $key => $val) {
$start = $this->_datetime2timestamp($val['start']); $start = $this->_datetime2timestamp($val['start']);
$end = $this->_datetime2timestamp($val['end']); $end = $this->_datetime2timestamp($val['end']);
$Y = strftime('%Y', $start); $Y = strftime('%Y', $start);
$m = number_format(strftime('%m', $start)); $m = number_format(strftime('%m', $start));
$d = number_format(strftime('%d', $start)); $d = number_format(strftime('%d', $start));
$h = number_format(strftime('%H', $start)); $h = number_format(strftime('%H', $start));
$M = number_format(strftime('%i', $start)); $M = number_format(strftime('%i', $start));
## item starts today -> put metadata to array ## item starts today
if (strftime('%Y%m%d', $start) === $thisDay) { if (strftime('%Y%m%d', $start) === $thisDay) {
$items[number_format(strftime('%H', $start))]['start'][] = array( $items[number_format(strftime('%H', $start))]['start'][] = array(
'id' => $this->Base->gb->_idFromGunid($val['playlistId']), 'id' => $this->Base->gb->_idFromGunid($val['playlistId']),
@ -245,16 +245,30 @@ class uiScheduler extends uiCalendar
'title' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE), 'title' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE),
'creator' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR), 'creator' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR),
'type' => 'Playlist', 'type' => 'Playlist',
'endshere' => strftime('%H', $start) === strftime('%H', $end) ? TRUE : FALSE 'endstoday' => strftime('%d', $start) === strftime('%d', $end) ? TRUE : FALSE,
'endshere' => strftime('%H', $start) === strftime('%H', $end) ? TRUE : FALSE
); );
} }
/* mark the span as in use /* mark the span as in use
for ($n = number_format(strftime('%H', $start))+1; $n <= number_format(strftime('%H', $end)); $n++) { for ($n = number_format(strftime('%H', $start))+1; $n <= number_format(strftime('%H', $end)); $n++) {
$items['span'][$n] = TRUE; $items['span'][$n] = TRUE;
} */ }
## item which end today */
## item ends today
if (strftime('%Y%m%d', $end) === $thisDay && strftime('%H', $start) !== strftime('%H', $end)) { if (strftime('%Y%m%d', $end) === $thisDay && strftime('%H', $start) !== strftime('%H', $end)) {
$items[number_format(strftime('%H', $end))]['end'] = TRUE; $items[number_format(strftime('%H', $end))]['end'][] =
array(
'id' => $this->Base->gb->_idFromGunid($val['playlistId']),
'scheduleid'=> $val['id'],
'start' => substr($val['start'], strpos($val['start'], 'T')+1),
'end' => substr($val['end'], strpos($val['end'], 'T') + 1),
'title' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_TITLE),
'creator' => $this->Base->_getMDataValue($this->Base->gb->_idFromGunid($val['playlistId']), UI_MDATA_KEY_CREATOR),
'type' => 'Playlist',
'startsyesterday' => strftime('%d', $start) === strftime('%d', $end) ? FALSE : TRUE,
);
} }
} }