function html_for_event_day_at_a_glance($id, $date, $time, $name, $description, $status, $pri, $access, $duration, $event_owner, $hide_icons) { global $first_slot, $last_slot, $hour_arr, $rowspan_arr, $rowspan, $eventinfo, $login, $user; static $key = 0; global $layers, $PHP_SELF, $TIME_SLOTS, $TZ_OFFSET; $divname = "eventinfo-day-{$id}-{$key}"; $key++; if ($login != $user && $access == 'R' && strlen($user)) { $eventinfo .= build_event_popup($divname, $event_owner, translate("This event is confidential"), ""); } else { if ($login != $event_owner && $access == 'R' && strlen($event_owner)) { $eventinfo .= build_event_popup($divname, $event_owner, translate("This event is confidential"), ""); } else { $eventinfo .= build_event_popup($divname, $event_owner, $description, ""); } } // 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> ind = $ind <BR> first_slot = $first_slot <BR>"; 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"; } if (!$hide_icons) { $hour_arr[$ind] .= "<A 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, '{$divname}'); return true;\" onMouseOut=\"hide('{$divname}'); return true;\">"; } if ($pri == 3) { $hour_arr[$ind] .= "<B>"; } if ($login != $event_owner && strlen($event_owner)) { for ($index = 0; $index < sizeof($layers); $index++) { if ($layers[$index]['cal_layeruser'] == $event_owner) { $hour_arr[$ind] .= "<FONT COLOR=\"" . $layers[$index]['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 ($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] .= "</FONT>"; } else { $hour_arr[$ind] .= htmlspecialchars($name); } } } if ($pri == 3) { $hour_arr[$ind] .= "</B>"; } $hour_arr[$ind] .= "</A><BR>"; }
function html_for_event_week_at_a_glance($event, $date, $override_class = '', $show_time = true) { global $categories, $DISPLAY_ICONS, $DISPLAY_TZ, $eventinfo, $first_slot, $hour_arr, $is_assistant, $is_nonuser_admin, $last_slot, $layers, $login, $PHP_SELF, $rowspan, $rowspan_arr, $TIME_SPACER, $user; static $key = 0; $can_access = CAN_DOALL; $catAlt = $href = $timestr = ''; $getCalTypeName = $event->getCalTypeName(); $getCat = abs($event->getCategory()); $getClone = $event->getClone(); $getDatetime = $event->getDatetime(); $getLoginStr = $event->getLogin(); $getPri = $event->getPriority(); $id = $event->getID(); $ind = 9999; $isAllDay = $event->isAllDay(); $isUntime = $event->isUntimed(); $linkid = "pop{$id}-{$key}"; $name = $event->getName(); $time_only = 'N'; $title = '<a title="'; $catIcon = 'icons/cat-' . $getCat . '.gif'; $key++; if (access_is_enabled()) { $can_access = access_user_calendar('view', $getLoginStr, '', $event->getCalType(), $event->getAccess()); $time_only = access_user_calendar('time', $getLoginStr); if ($getCalTypeName == 'task' && $can_access == 0) { return false; } } // Figure out which time slot it goes in. Put tasks in with AllDay and Untimed. if (!$isUntime && !$isAllDay && $getCalTypeName != 'task') { $tz_time = date('His', $event->getDateTimeTS()); $ind = calc_time_slot($tz_time); if ($ind < $first_slot) { $first_slot = $ind; } if ($ind > $last_slot) { $last_slot = $ind; } } $class = ($login != $getLoginStr && strlen($getLoginStr) ? 'layer' : ($event->getStatus() == 'W' ? 'unapproved' : '')) . 'entry'; // If we are looking at a view, then always use "entry". if (strstr($PHP_SELF, 'view_m.php') || strstr($PHP_SELF, 'view_r.php') || strstr($PHP_SELF, 'view_t.php') || strstr($PHP_SELF, 'view_v.php') || strstr($PHP_SELF, 'view_w.php')) { $class = 'entry'; } if (!empty($override_class)) { $class .= ' ' . $override_class; } // Avoid PHP warning for undefined array index. if (empty($hour_arr[$ind])) { $hour_arr[$ind] = ''; } if ($getCat > 0 && file_exists($catIcon)) { $catAlt = translate('Category') . ': ' . $categories[$getCat]['cat_name']; $hour_arr[$ind] .= '<img src="' . $catIcon . '" alt="' . $catAlt . '" title="' . $catAlt . '" />'; } // Build entry link if UAC permits viewing. if ($can_access != 0 && $time_only != 'Y') { // Make sure clones have parents URL date. $href = 'href="view_entry.php?id=' . $id . '&date=' . ($getClone ? $getClone : $date); if ($getCalTypeName == 'task') { $hour_arr[$ind] .= '<img src="images/task.gif" class="bullet" alt="*" /> '; $title .= translate('View this task'); } else { // Must be event. if ($isAllDay || $isUntime && $catAlt == '') { $hour_arr[$ind] .= '<img src="images/circle.gif" class="bullet" alt="*" /> '; } $title .= translate('View this event'); } } $hour_arr[$ind] .= $title . '" class="' . $class . '" id="' . $linkid . '" ' . $href . (strlen($GLOBALS['user']) > 0 ? '&user='******'user'] : ($class == 'layerentry' ? '&user='******'')) . '">' . ($getPri == 3 ? '<strong>' : ''); if ($login != $getLoginStr && strlen($getLoginStr)) { if ($layers) { foreach ($layers as $layer) { if ($layer['cal_layeruser'] == $getLoginStr) { $hour_arr[$ind] .= '<span style="color:' . $layer['cal_color'] . ';">'; $in_span = true; } } } // Check to see if Category Colors are set. } else { if (!empty($categories[$getCat]['cat_color'])) { $cat_color = $categories[$getCat]['cat_color']; if ($cat_color != '#000000') { $hour_arr[$ind] .= '<span style="color:' . $cat_color . ';">'; $in_span = true; } } } if ($isAllDay) { $timestr = translate('All day event'); // Set start cell of all-day event to beginning of work hours. if (empty($rowspan_arr[$first_slot])) { $rowspan_arr[$first_slot] = 0; } // Avoid warning below. // We'll skip tasks here as well. } else { if ($event->getTime() >= 0 && $getCalTypeName != 'task') { if ($show_time) { $hour_arr[$ind] .= display_time($getDatetime) . ($time_only == 'Y' ? '' : $TIME_SPACER); } $timestr = display_time($getDatetime); if ($event->getDuration() > 0) { $end_time = date('His', $event->getEndDateTimeTS()); $timestr .= '-' . display_time($event->getEndDateTime(), $DISPLAY_TZ); // This fixes the improper display if an event ends at or after midnight. if ($end_time < $tz_time) { $end_time += 240000; } } 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); $rowspan = $endind == $ind ? 0 : $endind - $ind + 1; if ($rowspan > $rowspan_arr[$ind] && $rowspan > 1) { $rowspan_arr[$ind] = $rowspan; } } } $hour_arr[$ind] .= build_entry_label($event, 'eventinfo-' . $linkid, $can_access, $timestr, $time_only) . (empty($in_span) ? '' : '</span>') . ($getPri == 3 ? '</strong>' : '') . '</a>' . "<br />\n"; }
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"; }
if ($rep[$j]->getDuration() > 0 && $rep[$j]->getDuration() != 1440) { $slot = calc_time_slot($rep[$j]->getTime(), false); if ($slot < $first_slot) { $first_slot = $slot; } } } } $ev = get_entries($dateYmd, $get_unapproved, 1, 1); $evcnt = count($ev); for ($j = 0; $j < $evcnt; $j++) { if (!isset($am_part[$ev[$j]->getID()])) { $am_part[$ev[$j]->getID()] = user_is_participant($ev[$j]->getID(), $login); } if ($ev[$j]->getDuration() > 0 && $ev[$j]->getDuration() != 1440) { $slot = calc_time_slot($ev[$j]->getTime(), false); if ($slot < $first_slot) { $first_slot = $slot; } } } } } for ($d = $start_ind; $d <= $end_ind; $d++) { for ($u = 0; $u < $viewusercnt; $u++) { $untimed = array(); $user = $viewusers[$u]; $events = $e_save[$u]; $repeated_events = $re_save[$u]; // get all the repeating events for this date and store in array $rep $dateYmd = date('Ymd', $days[$d]);