function html_for_event_day_at_a_glance($id, $date, $time, $name, $description, $status, $pri, $access, $duration, $event_owner) { global $first_slot, $last_slot, $hour_arr, $rowspan_arr, $rowspan, $eventinfo, $login, $user; static $key = 0; global $layers, $PHP_SELF, $TIME_SLOTS, $TZ_OFFSET; $popupid = "eventinfo-day-{$id}-{$key}"; $key++; if ($login != $user && $access == 'R' && strlen($user)) { $eventinfo .= build_event_popup($popupid, $event_owner, translate("This event is confidential"), ""); } else { if ($login != $event_owner && $access == 'R' && strlen($event_owner)) { $eventinfo .= build_event_popup($popupid, $event_owner, translate("This event is confidential"), ""); } else { $eventinfo .= build_event_popup($popupid, $event_owner, $description, "", site_extras_for_popup($id)); } } // calculate slot length in minutes $interval = 60 * 24 / $TIME_SLOTS; // If TZ_OFFSET make this event before the start of the day or // after the end of the day, adjust the time slot accordingly. if ($time >= 0 && $duration != 24 * 60) { if ($time + $TZ_OFFSET * 10000 > 240000) { $time -= 240000; } else { if ($time + $TZ_OFFSET * 10000 < 0) { $time += 240000; } } $ind = calc_time_slot($time); if ($ind < $first_slot) { $first_slot = $ind; } if ($ind > $last_slot) { $last_slot = $ind; } } else { $ind = 9999; } //echo "time = $time <br />\nind = $ind <br />\nfirst_slot = $first_slot<br />\n"; if (empty($hour_arr[$ind])) { $hour_arr[$ind] = ""; } if ($login != $event_owner && strlen($event_owner)) { $class = "layerentry"; } else { $class = "entry"; if ($status == "W") { $class = "unapprovedentry"; } } // if we are looking at a view, then always use "entry" if (strstr($PHP_SELF, "view_m.php") || strstr($PHP_SELF, "view_w.php") || strstr($PHP_SELF, "view_v.php") || strstr($PHP_SELF, "view_t.php")) { $class = "entry"; } // TODO: The following section has several nested spans. $hour_arr[$ind] .= "<a title=\"" . translate("View this entry") . "\" class=\"{$class}\" href=\"view_entry.php?id={$id}&date={$date}"; if (strlen($GLOBALS["user"]) > 0) { $hour_arr[$ind] .= "&user="******"user"]; } $hour_arr[$ind] .= "\" onmouseover=\"window.status='" . translate("View this entry") . "'; show(event, '{$popupid}'); return true;\" onmouseout=\"hide('{$popupid}'); return true;\">"; if ($pri == 3) { $hour_arr[$ind] .= "<span style=\"font-weight:bold;\">"; } if ($login != $event_owner && strlen($event_owner)) { if ($layers) { foreach ($layers as $layer) { if ($layer['cal_layeruser'] == $event_owner) { $hour_arr[$ind] .= "<span style=\"color:" . $layer['cal_color'] . ";\">"; } } } } if ($duration == 24 * 60) { $hour_arr[$ind] .= "[" . translate("All day event") . "] "; } else { if ($time >= 0) { $hour_arr[$ind] .= "[" . display_time($time); if ($duration > 0) { // calc end time $h = (int) ($time / 10000); $m = $time / 100 % 100; $m += $duration; $d = $duration; while ($m >= 60) { $h++; $m -= 60; } $end_time = sprintf("%02d%02d00", $h, $m); $hour_arr[$ind] .= "-" . display_time($end_time); // which slot is end time in? take one off so we don't // show 11:00-12:00 as taking up both 11 and 12 slots. $endind = calc_time_slot($end_time, true); if ($endind == $ind) { $rowspan = 0; } else { $rowspan = $endind - $ind + 1; } if (!isset($rowspan_arr[$ind])) { $rowspan_arr[$ind] = 0; } if ($rowspan > $rowspan_arr[$ind] && $rowspan > 1) { $rowspan_arr[$ind] = $rowspan; } } $hour_arr[$ind] .= "] "; } } if ($login != $user && $access == 'R' && strlen($user)) { $hour_arr[$ind] .= "(" . translate("Private") . ")"; } else { if ($login != $event_owner && $access == 'R' && strlen($event_owner)) { $hour_arr[$ind] .= "(" . translate("Private") . ")"; } else { if ($login != $event_owner && strlen($event_owner)) { $hour_arr[$ind] .= htmlspecialchars($name); $hour_arr[$ind] .= "</span>"; //end color span } else { $hour_arr[$ind] .= htmlspecialchars($name); } } } if ($pri == 3) { $hour_arr[$ind] .= "</span>"; } //end font-weight span $hour_arr[$ind] .= "</a>"; if ($GLOBALS["DISPLAY_DESC_PRINT_DAY"] == "Y") { $hour_arr[$ind] .= "\n<dl class=\"desc\">\n"; $hour_arr[$ind] .= "<dt>Description:</dt>\n<dd>"; $hour_arr[$ind] .= htmlspecialchars($description); $hour_arr[$ind] .= "</dd>\n</dl>\n"; } $hour_arr[$ind] .= "<br />\n"; // affiche le picto $hour_arr[$ind] = get_picto($id) . ' ' . $hour_arr[$ind]; }
function html_for_event_week_at_a_glance($id, $date, $time, $name, $description, $status, $pri, $access, $duration, $event_owner) { global $first_slot, $last_slot, $hour_arr, $rowspan_arr, $rowspan, $eventinfo, $login, $user; static $key = 0; global $DISPLAY_ICONS, $PHP_SELF, $TIME_SLOTS; global $layers; $popupid = "eventinfo-day-{$id}-{$key}"; $key++; // Figure out which time slot it goes in. if ($time >= 0 && $duration != 24 * 60) { $ind = calc_time_slot($time); if ($ind < $first_slot) { $first_slot = $ind; } if ($ind > $last_slot) { $last_slot = $ind; } } else { $ind = 9999; } if ($login != $event_owner && strlen($event_owner)) { $class = "layerentry"; } else { $class = "entry"; if ($status == "W") { $class = "unapprovedentry"; } } // if we are looking at a view, then always use "entry" if (strstr($PHP_SELF, "view_m.php") || strstr($PHP_SELF, "view_w.php") || strstr($PHP_SELF, "view_v.php") || strstr($PHP_SELF, "view_t.php")) { $class = "entry"; } // avoid php warning for undefined array index if (empty($hour_arr[$ind])) { $hour_arr[$ind] = ""; } $hour_arr[$ind] .= "<a title=\"" . translate("View this entry") . "\" class=\"{$class}\" href=\"view_entry.php?id={$id}&date={$date}"; if (strlen($GLOBALS["user"]) > 0) { $hour_arr[$ind] .= "&user="******"user"]; } $hour_arr[$ind] .= "\" onmouseover=\"window.status='" . translate("View this entry") . "'; show(event, '{$popupid}'); return true;\" onmouseout=\"hide('{$popupid}'); return true;\">"; if ($pri == 3) { $hour_arr[$ind] .= "<span style=\"font-weight:bold;\">"; } if ($login != $event_owner && strlen($event_owner)) { if ($layers) { foreach ($layers as $layer) { if ($layer['cal_layeruser'] == $event_owner) { $hour_arr[$ind] .= "<span style=\"color:" . $layer['cal_color'] . ";\">"; } } } } if ($duration == 24 * 60) { $timestr = translate("All day event"); } else { if ($time >= 0) { $hour_arr[$ind] .= display_time($time) . "» "; $timestr = display_time($time); if ($duration > 0) { // calc end time $h = (int) ($time / 10000); $m = $time / 100 % 100; $m += $duration; $d = $duration; while ($m >= 60) { $h++; $m -= 60; } $end_time = sprintf("%02d%02d00", $h, $m); $timestr .= "-" . display_time($end_time); } else { $end_time = 0; } if (empty($rowspan_arr[$ind])) { $rowspan_arr[$ind] = 0; } // avoid warning below // which slot is end time in? take one off so we don't // show 11:00-12:00 as taking up both 11 and 12 slots. $endind = calc_time_slot($end_time, true); if ($endind == $ind) { $rowspan = 0; } else { $rowspan = $endind - $ind + 1; } if ($rowspan > $rowspan_arr[$ind] && $rowspan > 1) { $rowspan_arr[$ind] = $rowspan; } } else { $timestr = ""; } } // affiche le picto $hour_arr[$ind] = get_picto($id) . ' ' . $hour_arr[$ind]; // avoid php warning of undefined index when using .= below if (empty($hour_arr[$ind])) { $hour_arr[$ind] = ""; } if ($login != $user && $access == 'R' && strlen($user)) { $hour_arr[$ind] .= "(" . translate("Private") . ")"; } else { if ($login != $event_owner && $access == 'R' && strlen($event_owner)) { $hour_arr[$ind] .= "(" . translate("Private") . ")"; } else { if ($login != $event_owner && strlen($event_owner)) { $hour_arr[$ind] .= htmlspecialchars($name); $hour_arr[$ind] .= "</span>"; //end color span } else { $hour_arr[$ind] .= htmlspecialchars($name); } } } if ($pri == 3) { $hour_arr[$ind] .= "</span>"; } //end font-weight span $hour_arr[$ind] .= "</a>"; //if ( $DISPLAY_ICONS == "Y" ) { // $hour_arr[$ind] .= icon_text ( $id, true, true ); //} $hour_arr[$ind] .= "<br />\n"; if ($login != $user && $access == 'R' && strlen($user)) { $eventinfo .= build_event_popup($popupid, $event_owner, translate("This event is confidential"), ""); } else { if ($login != $event_owner && $access == 'R' && strlen($event_owner)) { $eventinfo .= build_event_popup($popupid, $event_owner, translate("This event is confidential"), ""); } else { $eventinfo .= build_event_popup($popupid, $event_owner, $description, $timestr, site_extras_for_popup($id)); } } }