1 回答

TA貢獻(xiàn)1942條經(jīng)驗(yàn) 獲得超3個(gè)贊
如果您向主要活動(dòng)索引添加時(shí)間,日歷將無(wú)法直接確定給定日期是否有活動(dòng)。您可以添加在找到給定日期的事件后使用的輔助索引(添加兩個(gè)本地解釋變量,$date并$time更改它們的名稱,以防與代碼的其余部分發(fā)生沖突):
$events = array();
foreach ($partEvents as $event) {
$date = date('Y-m-d', strtotime($event['eventDate']));
$time = date('H:i', strtotime($event['eventDate']));
$events[$date][$time] = array(
'text' => $event['description'],
'href' => '/nsl/editGroupCoaching/'.$event['ID'],
'color' => '#edb01a'
);
}
foreach ($appointments as $event) {
$date = date('Y-m-d', strtotime($event['eventDate']));
$time = date('H:i', strtotime($event['eventDate']));
$events[$date][$time] = array(
'text' => $event['description'],
'href' => '#',
'color' => '#00898d'
);
}
現(xiàn)在您需要更改事件的顯示方式(潛在的渲染問(wèn)題留給您解決 - 它只會(huì)直接將單個(gè)事件的副本添加到表格單元格中):
...
// Insert an event for this day
if ($draw_event) {
ksort($events[$cur_date]);
foreach ($events[$cur_date] as $time => $event) {
$calendar .=
"<div class='{$css_cal_event}'>" .
"<a href='{$event['href']}' style='color:".$event['color'].";'>" .
$time.' Uhr: <br/>'.$event['text'] .
"</a>" .
"</div>";
}
}
...
- 1 回答
- 0 關(guān)注
- 117 瀏覽
添加回答
舉報(bào)