function list_unapproved($user) { global $temp_fullname, $key, $login; //echo "Listing events for $user <BR>"; echo "<UL>\n"; $sql = "SELECT webcal_entry.cal_id, webcal_entry.cal_name, " . "webcal_entry.cal_description, " . "webcal_entry.cal_priority, webcal_entry.cal_date, " . "webcal_entry.cal_time, webcal_entry.cal_duration, " . "webcal_entry_user.cal_status " . "FROM webcal_entry, webcal_entry_user " . "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " . "AND ( webcal_entry.cal_ext_for_id IS NULL " . "OR webcal_entry.cal_ext_for_id = 0 ) AND " . "webcal_entry_user.cal_login = '******' AND " . "webcal_entry_user.cal_status = 'W' " . "ORDER BY webcal_entry.cal_date"; $res = dbi_query($sql); $count = 0; $eventinfo = ""; if ($res) { while ($row = dbi_fetch_row($res)) { $key++; $id = $row[0]; $name = $row[1]; $description = $row[2]; $pri = $row[3]; $date = $row[4]; $time = $row[5]; $duration = $row[6]; $status = $row[7]; $divname = "eventinfo-{$id}-{$key}"; echo "<LI><A CLASS=\"entry\" HREF=\"view_entry.php?id={$id}"; echo "\" onMouseOver=\"window.status='" . translate("View this entry") . "'; show(event, '{$divname}'); return true;\" onMouseOut=\"hide('{$divname}'); return true;\">"; $timestr = ""; if ($time > 0) { $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); } } echo htmlspecialchars($name); echo "</A>"; echo " (" . date_to_str($date) . ")\n"; echo ": <A HREF=\"approve_entry.php?id={$id}&ret=list"; if ($user == "__public__") { echo "&public=1"; } echo "\" CLASS=\"navlinks\" onClick=\"return confirm('" . translate("Approve this entry?") . "');\">" . translate("Approve/Confirm") . "</A>, "; echo "<A HREF=\"reject_entry.php?id={$id}&ret=list"; if ($user == "__public__") { echo "&public=1"; } echo "\" CLASS=\"navlinks\" onClick=\"return confirm('" . translate("Reject this entry?") . "');\">" . translate("Reject") . "</A>"; $eventinfo .= build_event_popup($divname, $user, $description, $timestr, $time); $count++; } dbi_free_result($res); } echo "</UL><P>\n"; if ($count == 0) { user_load_variables($user, "temp_"); echo translate("No unapproved events for") . " " . $temp_fullname . "."; } else { echo $eventinfo; } }
function list_unapproved($user) { global $temp_fullname, $key, $login; //echo "Listing events for $user <br>"; $sql = "SELECT webcal_entry.cal_id, webcal_entry.cal_name, " . "webcal_entry.cal_description, " . "webcal_entry.cal_priority, webcal_entry.cal_date, " . "webcal_entry.cal_time, webcal_entry.cal_duration, " . "webcal_entry_user.cal_status " . "FROM webcal_entry, webcal_entry_user " . "WHERE webcal_entry.cal_id = webcal_entry_user.cal_id " . "AND ( webcal_entry.cal_ext_for_id IS NULL " . "OR webcal_entry.cal_ext_for_id = 0 ) AND " . "webcal_entry_user.cal_login = '******' AND " . "webcal_entry_user.cal_status = 'W' " . "ORDER BY webcal_entry.cal_date"; $res = dbi_query($sql); $count = 0; $eventinfo = ""; if ($res) { while ($row = dbi_fetch_row($res)) { if ($count == 0) { echo "<ul>\n"; } $key++; $id = $row[0]; $name = $row[1]; $description = $row[2]; $pri = $row[3]; $date = $row[4]; $time = $row[5]; $duration = $row[6]; $status = $row[7]; $divname = "eventinfo-{$id}-{$key}"; echo "<li><a title=\"" . translate("View this entry") . "\" class=\"entry\" href=\"view_entry.php?id={$id}&user={$user}"; echo "\" onmouseover=\"window.status='" . translate("View this entry") . "'; show(event, '{$divname}'); return true;\" onmouseout=\"hide('{$divname}'); return true;\">"; $timestr = ""; if ($time > 0) { $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); } } echo htmlspecialchars($name); echo "</a>"; echo " (" . date_to_str($date) . ")\n"; //approve echo ": <a title=\"" . translate("Approve/Confirm") . "\" href=\"approve_entry.php?id={$id}&ret=list&user={$user}"; if ($user == "__public__") { echo "&public=1"; } echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Approve this entry?") . "');\">" . translate("Approve/Confirm") . "</a>, "; //reject echo "<a title=\"" . translate("Reject") . "\" href=\"reject_entry.php?id={$id}&ret=list&user={$user}"; if ($user == "__public__") { echo "&public=1"; } echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Reject this entry?") . "');\">" . translate("Reject") . "</a>"; //delete echo ", <a title=\"" . translate("Delete") . "\" href=\"del_entry.php?id={$id}&ret=list"; if ($user != $login) { echo "&user={$user}"; } echo "\" class=\"nav\" onclick=\"return confirm('" . translate("Are you sure you want to delete this entry?") . "');\">" . translate("Delete") . "</a>"; echo "\n</li>\n"; $eventinfo .= build_event_popup($divname, $user, $description, $timestr, site_extras_for_popup($id)); $count++; } dbi_free_result($res); if ($count > 0) { echo "</ul>\n"; } } if ($count == 0) { user_load_variables($user, "temp_"); echo "<span class=\"nounapproved\">" . translate("No unapproved events for") . " " . $temp_fullname . ".</span>\n"; } else { if (!empty($eventinfo)) { echo $eventinfo; } } }
function print_entry_timebar($id, $date, $time, $duration, $name, $description, $status, $pri, $access, $event_owner, $hide_icons) { global $eventinfo, $login, $user, $PHP_SELF; static $key = 0; global $layers; // compute time offsets in % of total table width $day_start = $prefarray["WORK_DAY_START_HOUR"] * 60; if ($day_start == 0) { $day_start = 9 * 60; } $day_end = $prefarray["WORK_DAY_END_HOUR"] * 60; if ($day_end == 0) { $day_end = 19 * 60; } if ($day_end <= $day_start) { $day_end = $day_start + 60; } //avoid exceptions if ($time >= 0) { $ev_start = $time / 10000 * 60 + $time / 100 % 100; $ev_start = round(100 * ($ev_start - $day_start) / ($day_end - $day_start)); } else { $ev_start = 0; } if ($duration > 0) { $ev_duration = round(100 * $duration / ($day_end - $day_start)); if ($ev_start + $ev_duration > 100) { $ev_duration = 100 - $ev_start; } } else { if ($time >= 0) { $ev_duration = 1; } else { $ev_duration = 100 - $ev_start; } } $ev_padding = 100 - $ev_start - $ev_duration; // choose where to position the text (pos=0->before,pos=1->on,pos=2->after) if ($ev_duration > 20) { $pos = 1; } elseif ($ev_padding > 20) { $pos = 2; } else { $pos = 0; } echo "<TABLE WIDTH=\"100%\" BGCOLOR=\"black\" BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">\n"; echo "<TR>"; echo "<TD ALIGN=\"right\" WIDTH=\"{$ev_start}%\" BGCOLOR=\"white\">"; if ($pos > 0) { echo " </TD>"; echo "<TD WIDTH=\"{$ev_duration}%\">\n <TABLE WIDTH=\"100%\" BORDER=\"0\" BGCOLOR=\"black\" CELLSPACING=\"1\">\n <TR><TD ALIGN=\"middle\" BGCOLOR=\"#F5DEB3\">"; if ($pos > 1) { echo " </TD></TR></TABLE></TD>"; echo "<TD ALIGN=\"left\" WIDTH=\"{$ev_padding}%\" BGCOLOR=\"white\">"; } } echo "<FONT SIZE=\"-1\">"; 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 ($pri == 3) { echo "<B>"; } if (!$hide_icons) { $divname = "eventinfo-{$id}-{$key}"; $key++; echo "<A CLASS=\"{$class}\" HREF=\"view_entry.php?id={$id}&date={$date}"; if (strlen($user) > 0) { echo "&user="******"\" onMouseOver=\"window.status='" . translate("View this entry") . "'; show(event, '{$divname}'); return true;\" onMouseOut=\"hide('{$divname}'); return true;\">"; } if ($login != $event_owner && strlen($event_owner)) { for ($index = 0; $index < sizeof($layers); $index++) { if ($layers[$index]['cal_layeruser'] == $event_owner) { echo "<FONT COLOR=\"" . $layers[$index]['cal_color'] . "\">"; } } } echo "[{$event_owner}]"; $timestr = ""; if ($duration == 24 * 60) { $timestr = translate("All day event"); } else { if ($time >= 0) { $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); } } } if ($login != $user && $access == 'R' && strlen($user)) { echo "(" . translate("Private") . ")"; } else { if ($login != $event_owner && $access == 'R' && strlen($event_owner)) { echo "(" . translate("Private") . ")"; } else { if ($login != $event_owner && strlen($event_owner)) { echo htmlspecialchars($name); echo "</FONT>"; } else { echo htmlspecialchars($name); } } } echo "</A>"; if ($pri == 3) { echo "</B>"; } echo "</FONT>"; echo "</TD>"; if ($pos < 2) { if ($pos < 1) { echo "<TD WIDTH=\"{$ev_duration}%\"> <TABLE WIDTH=\"100%\"\n BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"1\"\n BGCOLOR=\"black\"><TR><TD ALIGN=\"middle\"\n BGCOLOR=\"#F5DEB3\"> </TD>"; } echo "</TR></TABLE></TD>"; echo "<TD ALIGN=\"left\" WIDTH=\"{$ev_padding}%\" BGCOLOR=\"white\"> </TD>"; } echo "</TR></TABLE>"; if (!$hide_icons) { 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, $timestr); } } } }
function print_entry_timebar($id, $date, $time, $duration, $name, $description, $status, $pri, $access, $event_owner) { global $eventinfo, $login, $user, $PHP_SELF, $prefarray; static $key = 0; global $layers; // compute time offsets in % of total table width $day_start = $prefarray["WORK_DAY_START_HOUR"] * 60; if ($day_start == 0) { $day_start = 9 * 60; } $day_end = $prefarray["WORK_DAY_END_HOUR"] * 60; if ($day_end == 0) { $day_end = 19 * 60; } if ($day_end <= $day_start) { $day_end = $day_start + 60; } //avoid exceptions if ($time >= 0) { $ev_start = $time / 10000 * 60 + $time / 100 % 100; $ev_start = round(100 * ($ev_start - $day_start) / ($day_end - $day_start)); } else { $ev_start = 0; } if ($duration > 0) { $ev_duration = round(100 * $duration / ($day_end - $day_start)); if ($ev_start + $ev_duration > 100) { $ev_duration = 100 - $ev_start; } } else { if ($time >= 0) { $ev_duration = 1; } else { $ev_duration = 100 - $ev_start; } } $ev_padding = 100 - $ev_start - $ev_duration; // choose where to position the text (pos=0->before,pos=1->on,pos=2->after) if ($ev_duration > 20) { $pos = 1; } elseif ($ev_padding > 20) { $pos = 2; } else { $pos = 0; } echo "\n<!-- ENTRY BAR -->\n<table class=\"entrycont\">\n"; echo "<tr>\n"; echo "<td style=\"text-align:right; width:{$ev_start}%;\">"; if ($pos > 0) { echo " </td>\n"; echo "<td style=\"width:{$ev_duration}%;\">\n<table class=\"entrybar\">\n<tr>\n<td class=\"entry\">"; if ($pos > 1) { echo " </td>\n</tr>\n</table></td>\n"; echo "<td style=\"text-align:left; width:{$ev_padding}%;\">"; } } //TODO: The following section has several nested spans. 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 ($pri == 3) { echo "<span style=\"font-weight:bold;\">"; } $popupid = "eventinfo-{$id}-{$key}"; $key++; echo "<a class=\"{$class}\" href=\"view_entry.php?id={$id}&date={$date}"; if (strlen($user) > 0) { echo "&user="******"\" onmouseover=\"window.status='" . translate("View this entry") . "'; show(event, '{$popupid}'); return true;\" onmouseout=\"hide('{$popupid}'); return true;\">"; if ($login != $event_owner && strlen($event_owner)) { if ($layers) { foreach ($layers as $layer) { if ($layer['cal_layeruser'] == $event_owner) { echo "<span style=\"color:" . $layer['cal_color'] . ";\">"; } } } } echo "[{$event_owner}] "; $timestr = ""; if ($duration == 24 * 60) { $timestr = translate("All day event"); } else { if ($time >= 0) { $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); } } } if ($login != $user && $access == 'R' && strlen($user)) { echo "(" . translate("Private") . ")"; } else { if ($login != $event_owner && $access == 'R' && strlen($event_owner)) { echo "(" . translate("Private") . ")"; } else { if ($login != $event_owner && strlen($event_owner)) { echo htmlspecialchars($name); echo "</span>"; //end color span } else { echo htmlspecialchars($name); } } } echo "</a>"; if ($pri == 3) { echo "</span>"; } //end font-weight span echo "</td>\n"; if ($pos < 2) { if ($pos < 1) { echo "<td style=\"width:{$ev_duration}%;\"><table style=\"width:100%; border-width:0px; background-color:#000000;\" cellpadding=\"0\" cellspacing=\"1\">\n<tr>\n<td style=\"text-align:center; background-color:#F5DEB3;\"> </td>\n"; } echo "</tr>\n</table></td>\n"; echo "<td style=\"text-align:left; width:{$ev_padding}%;\"> </td>\n"; } echo "</tr>\n</table>\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)); } } }