1 回答
TA贡献1942条经验 获得超3个赞
如果您向主要活动索引添加时间,日历将无法直接确定给定日期是否有活动。您可以添加在找到给定日期的事件后使用的辅助索引(添加两个本地解释变量,$date并$time更改它们的名称,以防与代码的其余部分发生冲突):
$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'
);
}
现在您需要更改事件的显示方式(潜在的渲染问题留给您解决 - 它只会直接将单个事件的副本添加到表格单元格中):
...
// 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 关注
- 70 浏览
添加回答
举报