function print_date_entries_timebar($date, $user, $ssi) { global $DISPLAY_UNAPPROVED, $events, $is_admin, $PUBLIC_ACCESS, $PUBLIC_ACCESS_CAN_ADD, $readonly, $totalSlots; $ret = ''; $cnt = 0; $get_unapproved = $DISPLAY_UNAPPROVED == 'Y'; $year = substr($date, 0, 4); $month = substr($date, 4, 2); $day = substr($date, 6, 2); $can_add = $readonly == 'N' || $is_admin; if ($PUBLIC_ACCESS == 'Y' && $PUBLIC_ACCESS_CAN_ADD != 'Y' && $GLOBALS['login'] == '__public__') { $can_add = false; } $cur_rep = 0; // Combine and sort the event arrays. $ev = combine_and_sort_events(get_entries($date, $get_unapproved), get_repeating_entries($user, $date)); $evcnt = count($ev); for ($i = 0; $i < $evcnt; $i++) { if ($get_unapproved || $ev[$i]->getStatus() == 'A') { $ret .= print_entry_timebar($ev[$i], $date); $cnt++; } } return $ret . ($cnt == 0 ? ' <tr> <td colspan="' . $totalSlots . '"> </td> </tr>' : ''); }
function print_det_date_entries($date, $user, $ssi) { global $events, $is_admin, $readonly; $date = mktime(0, 0, 0, substr($date, 4, 2), substr($date, 6, 2), substr($date, 0, 4)); // . // Get and sort all the repeating and non-repeating events for this date. $ev = combine_and_sort_events(get_entries($date), get_repeating_entries($user, $date)); for ($i = 0, $cnt = count($ev); $i < $cnt; $i++) { if (!empty($DISPLAY_UNAPPROVED) && $DISPLAY_UNAPPROVED != 'N' || $ev[$i]->getStatus() == 'A') { print_detailed_entry($ev[$i], $date); } } }
if ($WS_DEBUG) { ws_log_message($debug); } return $out; } $out .= ' <!-- ' . str_replace('XXX', array($user, $login), translate('Reminders for user XXX, login XXX.')) . ' --> '; $startdate = time(); // today for ($d = 0; $d < $DAYS_IN_ADVANCE; $d++) { $date = date('Ymd', time() + $d * 86400); // echo "Date: $date\n"; // Get non-repeating events for this date. // An event will be included one time for each participant. $ev = get_entries($date); // Keep track of duplicates. $completed_ids = array(); for ($i = 0, $evCnt = count($ev); $i < $evCnt; $i++) { $id = $ev[$i]->getID(); if (!empty($completed_ids[$id])) { continue; } $completed_ids[$id] = 1; $out .= process_event($id, $ev[$i]->getName(), $date, $ev[$i]->getTime()); } $rep = get_repeating_entries($user, $date); for ($i = 0, $repCnt = count($rep); $i < $repCnt; $i++) { $id = $rep[$i]->getID(); if (!empty($completed_ids[$id])) { continue;
send_reminder($id, $event_date); // now update the db... log_reminder($id, $extra_name, $event_date); } } } } } $startdate = time(); // today for ($d = 0; $d < $DAYS_IN_ADVANCE; $d++) { $date = date("Ymd", time() + $d * 24 * 3600); //echo "Date: $date\n"; // Get non-repeating events for this date. // An event will be included one time for each participant. $ev = get_entries("", $date); // Keep track of duplicates $completed_ids = array(); for ($i = 0; $i < count($ev); $i++) { $id = $ev[$i]['cal_id']; if (!empty($completed_ids[$id])) { continue; } $completed_ids[$id] = 1; process_event($id, $ev[$i]['cal_name'], $date, $ev[$i]['cal_time']); } $rep = get_repeating_entries("", $date); for ($i = 0; $i < count($rep); $i++) { $id = $rep[$i]['cal_id']; if (!empty($completed_ids[$id])) { continue;
?> "><?php echo date("l, \\t\\h dS", strtotime("{$year}-{$month}-{$day}")); ?> </a></li> <?php } ?> </ul> </li> <?php } ?> </ul> </li> <?php } ?> </ul> </div> <div id="entries"> <?php echo get_entries($_GET['date']); ?> </div> </div><!--end #main--> <div id="footer"> </div><!--end #footer--> </div><!--end #wrapper--> </body> </html>
/* Pre-load the non-repeating events for quicker access */ $events = read_events($username, $date, $endDate, $cat_id); // Print header without custom header and no style sheet ?> <html> <head> <title>Upcoming Events</title> </head> <body> <?php print "<dl>\n"; print "<!-- \nstartTime: {$startTime}\nendTime: {$endTime}\nstartDate: {$date}\nnumDays: {$numDays}\nuser: {$username}\nevents: " . count($events) . "\nrevents: " . count($revents) . " -->\n"; $numEvents = 0; for ($i = $startTime; date("Ymd", $i) <= date("Ymd", $endTime) && $numEvents < $maxEvents; $i += 24 * 3600) { $d = date("Ymd", $i); $entries = get_entries($username, $d); $rentries = get_repeating_entries($username, $d); print "<!-- {$d} " . count($entries) . "/" . count($rentries) . " -->\n"; if (count($entries) > 0 || count($rentries) > 0) { print "<!-- XXX -->\n"; print "<dt>" . date_to_str($d) . "</dt>\n<dd>"; for ($j = 0; $j < count($entries) && $numEvents < $maxEvents; $j++) { print_upcoming_event($entries[$j]); $numEvents++; } for ($j = 0; $j < count($rentries) && $numEvents < $maxEvents; $j++) { print_upcoming_event($rentries[$j]); $numEvents++; } print "</dd>\n"; }
function TimeMatrix($date, $participants) { global $CELLBG, $TODAYCELLBG, $THFG, $THBG, $TABLEBG; global $user_fullname, $nowYmd, $repeated_events, $events; global $thismonth, $thisday, $thisyear; $increment = 15; $interval = 4; $cell_pix = 6; $participant_pix = '170'; //$interval = (int)(60 / $increment); $first_hour = $GLOBALS["WORK_DAY_START_HOUR"]; $last_hour = $GLOBALS["WORK_DAY_END_HOUR"]; $hours = $last_hour - $first_hour; $cols = $hours * $interval + 1; $total_pix = (int) ($cell_pix * $interval * $hours + $participant_pix); ?> <br /> <table class="matrixd" style="width:<?php echo $total_pix; ?> px;" cellspacing="0" cellpadding="0"> <tr><td class="matrix" colspan="<?php echo $cols; ?> "> <img src="pix.gif" alt="spacer" /> </td></tr> <tr><th style="width:<?php echo $participant_pix; ?> px;"> <?php etranslate("Participants"); ?> </th> <?php $str = ''; $MouseOut = "onmouseout=\"window.status=''; this.style.backgroundColor='" . $CELLBG . "';\""; $CC = 1; for ($i = $first_hour; $i < $last_hour; $i++) { for ($j = 0; $j < $interval; $j++) { $str .= ' <td style="width:' . $cell_pix . 'px;" id="C' . $CC . '" class="dailymatrix" '; switch ($j) { case 0: if ($interval == 4) { $k = $i <= 9 ? '0' : substr($i, 0, 1); } $str .= 'onmousedown="schedule_event(' . $i . ',' . $increment * $j . ");\" onmouseover=\"window.status='Schedule a " . $i . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . " appointment.'; this.style.backgroundColor='#CCFFCC'; return true;\" " . $MouseOut . " title=\"Schedule an appointment for " . $i . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . ".\">"; $str .= $k . "</td>\n"; break; case 1: if ($interval == 4) { $k = $i <= 9 ? substr($i, 0, 1) : substr($i, 1, 2); } $str .= 'onmousedown="schedule_event(' . $i . ',' . $increment * $j . ");\" onmouseover=\"window.status='Schedule a " . $i . ':' . $increment * $j . " appointment.'; this.style.backgroundColor='#CCFFCC'; return true;\" " . $MouseOut . " title=\"Schedule an appointment for " . $i . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . ".\">"; $str .= $k . "</td>\n"; break; default: $str .= 'onmousedown="schedule_event(' . $i . ',' . $increment * $j . ");\" onmouseover=\"window.status='Schedule a " . $i . ':' . $increment * $j . " appointment.'; this.style.backgroundColor='#CCFFCC'; return true;\" " . $MouseOut . " title=\"Schedule an appointment for " . $i . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . ".\">"; $str .= " </td>\n"; break; } $CC++; } } echo $str . "</tr>\n<tr><td class=\"matrix\" colspan=\"{$cols}\">\n<img src=\"pix.gif\" alt=\"spacer\" />\n</td></tr>\n"; // Display each participant for ($i = 0; $i < count($participants); $i++) { user_load_variables($participants[$i], "user_"); /* Pre-Load the repeated events for quckier access */ $repeated_events = read_repeated_events($participants[$i], "", $nowYmd); /* Pre-load the non-repeating events for quicker access */ $events = read_events($participants[$i], $nowYmd, $nowYmd); // get all the repeating events for this date and store in array $rep $rep = get_repeating_entries($participants[$i], $nowYmd); // get all the non-repeating events for this date and store in $ev $ev = get_entries($participants[$i], $nowYmd); // combine into a single array for easy processing $ALL = array_merge($rep, $ev); $all_events = array(); // exchange space for to keep from breaking $user_nospace = preg_replace('/\\s/', ' ', $user_fullname); foreach ($ALL as $E) { $E['cal_time'] = sprintf("%06d", $E['cal_time']); $Tmp['START'] = mktime(substr($E['cal_time'], 0, 2), substr($E['cal_time'], 2, 2), 0, $thismonth, $thisday, $thisyear); $Tmp['END'] = $Tmp['START'] + $E['cal_duration'] * 60; $Tmp['ID'] = $E['cal_id']; $all_events[] = $Tmp; } echo "<tr>\n<th class=\"row\" style=\"width:{$participant_pix}px;\">" . $user_nospace . "</th>\n"; $col = 1; for ($j = $first_hour; $j < $last_hour; $j++) { for ($k = 0; $k < $interval; $k++) { $border = $k == '0' ? ' border-left: 1px solid #000000;' : ""; $RC = $CELLBG; $TIME = mktime(sprintf("%02d", $j), $increment * $k, 0, $thismonth, $thisday, $thisyear); $space = " "; foreach ($all_events as $ET) { if ($TIME >= $ET['START'] && $TIME < $ET['END']) { $space = "<a class=\"matrix\" href=\"view_entry.php?id={$ET['ID']}\"><img src=\"pix.gif\" alt=\"spacer\" /></a>"; } } echo "\t<td class=\"matrixappts\" style=\"width:{$cell_pix}px;{$border}\">{$space}</td>\n"; $col++; } } echo "</tr><tr>\n<td class=\"matrix\" colspan=\"{$cols}\"><img src=\"pix.gif\" alt=\"spacer\" /></td></tr>\n"; } // End foreach participant echo "</table>\n"; }
<?php /* Copyright (c) 2014 Freeder * Released under a MIT License. * See the file LICENSE at the root of this repo for copying permission. */ require_once 'inc/init.php'; require_once 'inc/entries.php'; require_once 'inc/feeds.php'; $view = isset($_GET['view']) ? $_GET['view'] : '_home'; $page = isset($_GET['p']) ? (int) $_GET['p'] : 0; $tpl->assign('view', $view); $tpl->assign('entries', get_entries($view, $page), RainTPL::RAINTPL_XSS_SANITIZE); $nb_entries = get_entries_count($view, $page); $tpl->assign('nb_entries', intval($nb_entries)); $tpl->assign('nb_pages', intval($nb_entries / $config->entries_per_page) + 1, RainTPL::RAINTPL_XSS_SANITIZE); $tpl->assign('feeds', get_feeds(), RainTPL::RAINTPL_XSS_SANITIZE); $tpl->draw('index');
function display_people($project_id, $startdate) { $entries = get_entries($project_id, $startdate); if (sizeOf($entries) > 0) { foreach ($entries as $key => $entry) { ?> <div id="<?php echo $entry['entry_id']; ?> " tb:entry_id="<?php echo $entry['entry_id']; ?> " class="person person-<?php echo $entry['person_role']; ?> person-<?php echo $entry['person_id']; ?> " tb:person_id="<?php echo $entry['person_id']; ?> " title="<?php echo $entry['person_long_name']; ?> "><?php echo $entry['person_name']; ?> </div> <?php } } }
$get_unapproved = false; $datem = date('m'); $dateY = date('Y'); // Start date is beginning of this month. $startdate = mktime(0, 0, 0, $datem, 0, $dateY); // End date is one year from now. // Seems kind of arbitrary, eh? $enddate = mktime(0, 0, 0, $datem, 1, $dateY + 1); /* Pre-Load the repeated events for quicker access. */ $repeated_events = read_repeated_events($user, $startdate, $enddate, ''); /* Pre-load the non-repeating events for quicker access. */ $events = read_events($user, $startdate, $enddate); // Loop from start date until we reach end date... $event_text = ''; for ($d = $startdate; $d <= $enddate; $d += 86400) { $dYmd = date('Ymd', $d); $ev = get_entries($dYmd, $get_unapproved); $evcnt = count($ev); for ($i = 0; $i < $evcnt; $i++) { $event_text .= fb_export_time($dYmd, $ev[$i]->getDuration(), $ev[$i]->getTime(), 'ical'); } $revents = get_repeating_entries($user, $dYmd, $get_unapproved); $recnt = count($revents); for ($i = 0; $i < $recnt; $i++) { $event_text .= fb_export_time($dYmd, $revents[$i]->getDuration(), $revents[$i]->getTime(), 'ical'); } } header('Content-Type: text/calendar'); header('Content-Disposition: attachment; filename="' . $login . '.ifb"'); echo 'BEGIN:VCALENDAR' . "\r\n" . 'X-WR-CALNAME;VALUE=TEXT:' . str_replace(',', '\\,', empty($publish_fullname) ? $user : translate($publish_fullname)) . "\r\n" . generate_prodid() . 'VERSION:2.0' . "\r\n" . 'METHOD:PUBLISH' . "\r\n" . 'BEGIN:VFREEBUSY' . "\r\n" . 'DTSTART:' . export_get_utc_date(date('Ymd', $startdate), 0) . "\r\n" . 'DTEND:' . export_get_utc_date(date('Ymd', $enddate), '235959') . "\r\n" . $event_text . 'URL:' . $GLOBALS['SERVER_URL'] . 'freebusy.php/' . $user . '.ifb' . "\r\n" . 'END:VFREEBUSY' . "\r\n" . 'END:VCALENDAR' . "\r\n"; exit;
} if ($showTitle) { echo '<h3 class="cal_upcoming_title">' . translate($upcoming_title) . '</h3>'; } ?> <div class="vcalendar"> <?php echo "<dl>\n"; echo "<!-- \nstartTime: {$startDate}\nendTime: {$endDate}\nstartDate: " . "{$date}\nnumDays: {$numDays}\nuser: {$username}\nevents: " . count($events) . "\nrepeated_events: " . count($repeated_events) . " -->\n"; $eventinfo = ''; $numEvents = 0; $endDateYmd = date('Ymd', $endDate); for ($i = $startDate; date('Ymd', $i) <= $endDateYmd && $numEvents < $maxEvents; $i += ONE_DAY) { $d = date('Ymd', $i); $entries = get_entries($d, $get_unapproved); $rentries = get_repeating_entries($username, $d, $get_unapproved); $ev = combine_and_sort_events($entries, $rentries); $tentries = get_tasks($d, $get_unapproved); $ev = combine_and_sort_events($ev, $tentries); $ev_cnt = count($ev); echo "<!-- {$d} " . count($ev) . " -->\n"; if ($ev_cnt > 0) { echo "<!-- XXX -->\n"; //print "<dt>" . date_to_str ( $d, translate ( '__month__ __dd__' ), true, true ) . "</dt>\n<dd>"; echo '<dt>' . date_to_str($d) . "</dt>\n<dd>"; for ($j = 0; $j < $ev_cnt && $numEvents < $maxEvents; $j++) { print_upcoming_event($ev[$j], $d); $numEvents++; } echo "</dd>\n";
<description><![CDATA[' . $appStr . ']]></description> <language>' . $lang . '</language> <generator>:"http://www.k5n.us/webcalendar.php?v=' . $PROGRAM_VERSION . '"</generator> <image> <title><![CDATA[' . $appStr . ']]></title> <link>' . $SERVER_URL . '</link> <url>http://www.k5n.us/k5n_small.gif</url> </image>'; $endtimeYmd = date('Ymd', $endTime); $numEvents = 0; $reventIds = array(); for ($i = $startTime; date('Ymd', $i) <= $endtimeYmd && $numEvents < $maxEvents; $i += 86400) { $d = date('Ymd', $i); $eventIds = array(); $pubDate = gmdate('D, d M Y', $i); $entries = get_entries($d, false); $rentries = get_repeating_entries($username, $d); $entrycnt = count($entries); $rentrycnt = count($rentries); if ($debug) { echo ' countentries==' . $entrycnt . ' ' . $rentrycnt . ' '; } if ($entrycnt > 0 || $rentrycnt > 0) { for ($j = 0; $j < $entrycnt && $numEvents < $maxEvents; $j++) { // Prevent non-Public events from feeding if (in_array($entries[$j]->getAccess(), $allow_access)) { $eventIds[] = $entries[$j]->getID();
} } } } 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]); $rep = get_repeating_entries($user, $dateYmd); $cur_rep = 0; // Get static non-repeating events $ev = get_entries($dateYmd, $get_unapproved, 1, 1); $hour_arr = array(); $rowspan_arr = array(); $evcnt = count($ev); $repcnt = count($rep); for ($i = 0; $i < $evcnt; $i++) { // print out any repeating events that are before this one... while ($cur_rep < $repcnt && $rep[$cur_rep]->getTime() < $ev[$i]->getTime()) { if ($get_unapproved || $rep[$cur_rep]->getStatus() == 'A') { if ($rep[$cur_rep]->getDuration() == 1440) { $all_day[$d] = 1; } html_for_event_week_at_a_glance($rep[$cur_rep], $dateYmd, 'small', $show_time); } $cur_rep++; }
function print_day_at_a_glance($date, $user, $can_add = 0) { global $CELLBG, $DISPLAY_TASKS_IN_GRID, $DISPLAY_UNAPPROVED, $first_slot, $hour_arr, $last_slot, $rowspan, $rowspan_arr, $TABLEBG, $THBG, $THFG, $TIME_SLOTS, $today, $TODAYCELLBG, $WORK_DAY_END_HOUR, $WORK_DAY_START_HOUR; if (empty($TIME_SLOTS)) { return translate('Error TIME_SLOTS undefined!') . "<br />\n"; } $get_unapproved = $DISPLAY_UNAPPROVED == 'Y'; // Get, combine and sort the events for this date. $ev = combine_and_sort_events(get_entries($date, $get_unapproved), get_repeating_entries($user, $date)); if ($date >= date('Ymd') && (empty($DISPLAY_TASKS_IN_GRID) || $DISPLAY_TASKS_IN_GRID == 'Y')) { $ev = combine_and_sort_events($ev, get_tasks($date, $get_unapproved)); } $hour_arr = $rowspan_arr = array(); $interval = 1440 / $TIME_SLOTS; // Number of minutes per slot $first_slot = intval($WORK_DAY_START_HOUR * 60 / $interval); $last_slot = intval($WORK_DAY_END_HOUR * 60 / $interval); for ($i = 0, $cnt = count($ev); $i < $cnt; $i++) { if ($get_unapproved || $ev[$i]->getStatus() == 'A') { html_for_event_day_at_a_glance($ev[$i], $date); } } $last_row = -1; $ret = ''; $rowspan = 0; // Squish events that use the same cell into the same cell. // For example, an event from 8:00-9:15 and another from 9:30-9:45 both // want to show up in the 8:00-9:59 cell. for ($i = $first_slot < 0 ? $first_slot : 0; $i < $TIME_SLOTS; $i++) { if ($rowspan > 1) { if (!empty($hour_arr[$i])) { $diff_start_time = $i - $last_row; if (!empty($rowspan_arr[$i])) { if ($rowspan_arr[$i] > 1 && $rowspan_arr[$i] + $diff_start_time > $rowspan_arr[$last_row]) { $rowspan_arr[$last_row] = $rowspan_arr[$i] + $diff_start_time; } $rowspan += $rowspan_arr[$i] - 1; } else { $rowspan_arr[$last_row] += $rowspan_arr[$i]; } // This will move entries apart that appear in one field, // yet start on different hours. for ($u = $diff_start_time; $u > 0; $u--) { $hour_arr[$last_row] .= "<br />\n"; } $hour_arr[$last_row] .= $hour_arr[$i]; $hour_arr[$i] = ''; $rowspan_arr[$i] = 0; } $rowspan--; } else { if (!empty($rowspan_arr[$i]) && $rowspan_arr[$i] > 1) { $last_row = $i; $rowspan = $rowspan_arr[$i]; } } } $ret .= ' <table class="main glance" cellspacing="0" cellpadding="0">' . (empty($hour_arr[9999]) ? '' : ' <tr> <th class="empty"> </th> <td class="hasevents">' . $hour_arr[9999] . '</td> </tr>'); $rowspan = 0; for ($i = $first_slot; $i <= $last_slot; $i++) { $time_h = intval($i * $interval / 60); $time_m = $i * $interval % 60; $addIcon = $can_add ? html_for_add_icon($date, $time_h, $time_m, $user) : ''; $ret .= ' <tr> <th class="row">' . display_time(($time_h * 100 + $time_m) * 100) . '</th>'; if ($rowspan > 1) { // This might mean there's an overlap, or it could mean one event // ends at 11:15 and another starts at 11:30. if (!empty($hour_arr[$i])) { $ret .= ' <td class="hasevents">' . $addIcon . $hour_arr[$i] . '</td>'; } $rowspan--; } else { $ret .= ' <td '; if (empty($hour_arr[$i])) { $ret .= ($date == date('Ymd', $today) ? ' class="today"' : '') . '>' . ($can_add ? $addIcon : ' '); } else { $rowspan = empty($rowspan_arr[$i]) ? '' : $rowspan_arr[$i]; $ret .= ($rowspan > 1 ? 'rowspan="' . $rowspan . '"' : '') . 'class="hasevents">' . $addIcon . $hour_arr[$i]; } $ret .= '</td>'; } $ret .= ' </tr>'; } return $ret . ' </table>'; }
if (!empty($end_date)) { $thismonth = date('m', $end_date); $thisyear = date('Y', $end_date); } if (empty($error) && empty($list)) { $cat_id = empty($report_cat_id) ? '' : $report_cat_id; $repeated_events = read_repeated_events($report_user, $start_date, $end_date, $cat_id); $events = read_events($report_user, $start_date, $end_date, $cat_id); $get_unapproved = $DISPLAY_UNAPPROVED == 'Y'; // Loop through each day. // Get events for each day (both normal and repeating). // (Most of this code was copied from week.php.) for ($cur_time = $start_date; $cur_time <= $end_date; $cur_time += 86400) { $event_str = ''; $dateYmd = date('Ymd', $cur_time); $ev = combine_and_sort_events(get_entries($dateYmd), get_repeating_entries($report_user, $dateYmd)); for ($i = 0, $cnt = count($ev); $i < $cnt; $i++) { if ($get_unapproved || $ev[$i]->getStatus() == 'A') { $event_str .= event_to_text($ev[$i], $dateYmd); } } if (!empty($event_str) || $report_include_empty == 'Y' || $report_time_range < 10) { $date_str = date_to_str($dateYmd, '', false); $date_full_str = date_to_str($dateYmd); $day_str .= str_replace(array('${date}', '${events}', '${fulldate}', '${report_id}'), array($date_str, $event_str, $date_full_str, $report_id), $day_template); } } } if (!empty($error)) { echo print_error($error) . print_trailer(); exit;
$interval = 24 * 60 / $TIME_SLOTS; $first_slot = (int) (($WORK_DAY_START_HOUR - $TZ_OFFSET) * 60 / $interval); $last_slot = (int) (($WORK_DAY_END_HOUR - $TZ_OFFSET) * 60 / $interval); $untimed_found = false; $get_unapproved = $GLOBALS["DISPLAY_UNAPPROVED"] == "Y"; if ($login == "__public__") { $get_unapproved = false; } $all_day = array(); for ($d = $start_ind; $d < $end_ind; $d++) { // get all the repeating events for this date and store in array $rep $date = date("Ymd", $days[$d]); $rep = get_repeating_entries($user, $date); $cur_rep = 0; // Get static non-repeating events $ev = get_entries($user, $date); $hour_arr = array(); $rowspan_arr = array(); for ($i = 0; $i < count($ev); $i++) { // print out any repeating events that are before this one... while ($cur_rep < count($rep) && $rep[$cur_rep]['cal_time'] < $ev[$i]['cal_time']) { if ($get_unapproved || $rep[$cur_rep]['cal_status'] == 'A') { if (!empty($rep[$cur_rep]['cal_ext_for_id'])) { $viewid = $rep[$cur_rep]['cal_ext_for_id']; $viewname = $rep[$cur_rep]['cal_name'] . " (" . translate("cont.") . ")"; } else { $viewid = $rep[$cur_rep]['cal_id']; $viewname = $rep[$cur_rep]['cal_name']; } if ($rep['cal_duration'] == 24 * 60) { $all_day[$d] = 1;
<?php include 'functions.php'; session_start(); check_valid_user(); do_html_header('Blog', array('ajax_functions.js')); $_SESSION['author_id'] = get_authorid($_SESSION['author']); $result = get_entries($_SESSION['author_id']); display_entries($result); do_html_url('blog/write_post.php', 'Write post'); do_html_url('blog/logout.php', 'logout'); do_html_footer();
$start_month = substr($start_date, 4, 2); $start_day = substr($start_date, 6, 2); $start_time = mktime(3, 0, 0, $start_month, $start_day, $start_year); $end_year = substr($end_date, 0, 4); $end_month = substr($end_date, 4, 2); $end_day = substr($end_date, 6, 2); $end_time = mktime(3, 0, 0, $end_month, $end_day, $end_year); $day_str = ''; // Loop through each day // Get events for each day (both normal and repeating). // (Most of this code was copied from week.php) for ($cur_time = $start_time; $cur_time <= $end_time; $cur_time += $ONE_DAY) { $event_str = ''; $dateYmd = date("Ymd", $cur_time); $rep = get_repeating_entries(empty($user) ? $login : $user, $dateYmd); $ev = get_entries(empty($user) ? $login : $user, $dateYmd); $cur_rep = 0; //echo "DATE: $dateYmd <br />\n"; for ($i = 0; $i < count($ev); $i++) { // print out any repeating events that are before this one... while ($cur_rep < count($rep) && $rep[$cur_rep]['cal_time'] < $ev[$i]['cal_time']) { if ($get_unapproved || $rep[$cur_rep]['cal_status'] == 'A') { if (!empty($rep[$cur_rep]['cal_ext_for_id'])) { $viewid = $rep[$cur_rep]['cal_ext_for_id']; $viewname = $rep[$cur_rep]['cal_name'] . " (" . translate("cont.") . ")"; } else { $viewid = $rep[$cur_rep]['cal_id']; $viewname = $rep[$cur_rep]['cal_name']; } $event_str .= event_to_text($viewid, $dateYmd, $rep[$cur_rep]['cal_time'], $rep[$cur_rep]['cal_duration'], $viewname, $rep[$cur_rep]['cal_description'], $rep[$cur_rep]['cal_status'], $rep[$cur_rep]['cal_priority'], $rep[$cur_rep]['cal_access'], $rep[$cur_rep]['cal_login']); }
$navStr = display_navigation('week'); for ($i = $start_ind; $i <= $end_ind; $i++) { $days[$i] = $wkstart + 86400 * $i + 43200; $weekdays[$i] = weekday_name(($i + $WEEK_START) % 7, $DISPLAY_LONG_DAYS); $dateYmd = date('Ymd', $days[$i]); $header[$i] = $weekdays[$i] . '<br />' . date_to_str($dateYmd, $DATE_FORMAT_MD, false, true); // . // Generate header row. $class = $dateYmd == date('Ymd', $today) ? ' class="today"' : (is_weekend($days[$i]) ? ' class="weekend"' : ''); $headerStr .= ' <th ' . $class . '>' . ($can_add ? html_for_add_icon($dateYmd, '', '', $user) : '') . '<p style="margin:.75em 0 0 0"><a href="day.php?' . $u_url . 'date=' . $dateYmd . $caturl . '">' . $header[$i] . '</a></p></th>'; $date = date('Ymd', $days[$i]); $hour_arr = $rowspan_arr = $tk = array(); // . // Get, combine and sort, static and repeating events for this date. $ev = combine_and_sort_events(get_entries($date, $get_unapproved), get_repeating_entries($user, $date)); // . // Then sort in any tasks due for this day and before. $ev = combine_and_sort_events($ev, $date >= date('Ymd') ? get_tasks($date, $get_unapproved) : $tk); for ($j = 0, $cnt = count($ev); $j < $cnt; $j++) { if ($get_unapproved || $ev[$j]->getStatus() == 'A') { html_for_event_week_at_a_glance($ev[$j], $date); } } // . // Squish events that use the same cell into the same cell. // For example, an event from 8:00-9:15 and another from 9:30-9:45 // both want to show up in the 8:00-9:59 cell. $last_row = -1; $rowspan = 0; for ($j = 0; $j < $TIME_SLOTS; $j++) {
if ($_SERVER['PHP_AUTH_USER'] !== USERNAME || $_SERVER['PHP_AUTH_PW'] !== PASSWORD) { header('WWW-Authenticate: Basic realm="Cloud Notes"'); header('HTTP/1.0 401 Unauthorized'); exit; } header('Content-type: application/json; charset=utf-8'); // Parse incoming data $remote_index = (array) json_decode(stripslashes($_POST['index']), true); unset($_POST['index']); $remote_entries = $_POST; // Process $local_index = get_entry('_index'); $diff_index = array_diff_key($local_index, $remote_index); $debug = array(); $debug['new entries'] = $remote_entries; $debug['old entries'] = get_entries(); foreach ($remote_index as $id => $item) { if (array_key_exists($id, $local_index)) { if ($item['timestamp'] == 0) { // Remote entry has been deleted, remove the local too $local_index[$id] = $item; delete_entry($id); unset($remote_index[$id]); unset($remote_entries[$id]); } elseif ($local_index[$id]['timestamp'] == 0) { // Local entry has been deleted, remove local entry too $remote_index[$id] = $local_index[$id]; delete_entry($id); unset($remote_index[$id]); unset($remote_entries[$id]); } elseif ($item['timestamp'] > $local_index[$id]['timestamp']) {
echo "<title>" . translate($application_name) . "</title>\n"; ?> </head> <body> <?php if (!empty($error)) { echo "<h2>" . translate("Error") . "</h2>\n" . $error; echo "\n<br /><br />\n</body></html>"; exit; } print "<dl>\n"; print "<!-- \nstartTime: {$startTime}\nendTime: {$endTime}\nstartDate: " . "{$date}\nnumDays: {$numDays}\nuser: {$username}\nevents: " . count($events) . "\nrepeated_events: " . count($repeated_events) . " -->\n"; $numEvents = 0; for ($i = $startTime; date("Ymd", $i) <= date("Ymd", $endTime) && $numEvents < $maxEvents; $i += 24 * 3600) { $d = date("Ymd", $i); $entries = get_entries($username, $d, $get_unapproved); $rentries = get_repeating_entries($username, $d, $get_unapproved); print "<!-- {$d} " . count($entries) . "/" . count($rentries) . " -->\n"; if (count($entries) > 0 || count($rentries) > 0) { print "<!-- XXX -->\n"; print "<dt>" . date_to_str($d) . "</dt>\n<dd>"; for ($j = 0; $j < count($entries) && $numEvents < $maxEvents; $j++) { print_upcoming_event($entries[$j]); $numEvents++; } for ($j = 0; $j < count($rentries) && $numEvents < $maxEvents; $j++) { print_upcoming_event($rentries[$j]); $numEvents++; } print "</dd>\n"; }
/** * Retrieve a single SugarBean based on ID. * * @param String $session -- Session ID returned by a previous call to login. * @param String $module_name -- The name of the module to return records from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method).. * @param String $id -- The SugarBean's ID value. * @param Array $select_fields -- A list of the fields to be included in the results. This optional parameter allows for only needed fields to be retrieved. * @return unknown */ function get_entry($session, $module_name, $id, $select_fields) { return get_entries($session, $module_name, array($id), $select_fields); }
$interval = 24 * 60 / $TIME_SLOTS; $first_slot = (int) (($WORK_DAY_START_HOUR - $TZ_OFFSET) * 60 / $interval); $last_slot = (int) (($WORK_DAY_END_HOUR - $TZ_OFFSET) * 60 / $interval); $untimed_found = false; $get_unapproved = $GLOBALS["DISPLAY_UNAPPROVED"] == "Y"; if ($login == "__public__") { $get_unapproved = false; } $all_day = array(); for ($d = $start_ind; $d < $end_ind; $d++) { // get all the repeating events for this date and store in array $rep $date = date("Ymd", $days[$d]); $rep = get_repeating_entries($user, $date); $cur_rep = 0; // Get static non-repeating events $ev = get_entries($user, $date, $get_unapproved); $hour_arr = array(); $rowspan_arr = array(); for ($i = 0; $i < count($ev); $i++) { // print out any repeating events that are before this one... while ($cur_rep < count($rep) && $rep[$cur_rep]['cal_time'] < $ev[$i]['cal_time']) { if ($get_unapproved || $rep[$cur_rep]['cal_status'] == 'A') { if (!empty($rep[$cur_rep]['cal_ext_for_id'])) { $viewid = $rep[$cur_rep]['cal_ext_for_id']; $viewname = $rep[$cur_rep]['cal_name'] . " (" . translate("cont.") . ")"; } else { $viewid = $rep[$cur_rep]['cal_id']; $viewname = $rep[$cur_rep]['cal_name']; } if ($rep[$cur_rep]['cal_duration'] == 24 * 60) { $all_day[$d] = 1;
function print_det_date_entries($date, $user, $ssi) { global $events, $readonly, $is_admin; $year = substr($date, 0, 4); $month = substr($date, 4, 2); $day = substr($date, 6, 2); $dateu = mktime(2, 0, 0, $month, $day, $year); // get all the repeating events for this date and store in array $rep $rep = get_repeating_entries($user, $date); $cur_rep = 0; // get all the non-repeating events for this date and store in $ev $ev = get_entries($user, $date); for ($i = 0; $i < count($ev); $i++) { // print out any repeating events that are before this one... while ($cur_rep < count($rep) && $rep[$cur_rep]['cal_time'] < $ev[$i]['cal_time']) { if ($GLOBALS["DISPLAY_UNAPPROVED"] != "N" || $rep[$cur_rep]['cal_status'] == 'A') { print_detailed_entry($rep[$cur_rep]['cal_id'], $date, $rep[$cur_rep]['cal_time'], $rep[$cur_rep]['cal_duration'], $rep[$cur_rep]['cal_name'], $rep[$cur_rep]['cal_description'], $rep[$cur_rep]['cal_status'], $rep[$cur_rep]['cal_priority'], $rep[$cur_rep]['cal_access'], $rep[$cur_rep]['cal_login']); } $cur_rep++; } if ($GLOBALS["DISPLAY_UNAPPROVED"] != "N" || $ev[$i]['cal_status'] == 'A') { print_detailed_entry($ev[$i]['cal_id'], $date, $ev[$i]['cal_time'], $ev[$i]['cal_duration'], $ev[$i]['cal_name'], $ev[$i]['cal_description'], $ev[$i]['cal_status'], $ev[$i]['cal_priority'], $ev[$i]['cal_access'], $ev[$i]['cal_login']); } } // print out any remaining repeating events while ($cur_rep < count($rep)) { if ($GLOBALS["DISPLAY_UNAPPROVED"] != "N" || $rep[$cur_rep]['cal_status'] == 'A') { print_detailed_entry($rep[$cur_rep]['cal_id'], $date, $rep[$cur_rep]['cal_time'], $rep[$cur_rep]['cal_duration'], $rep[$cur_rep]['cal_name'], $rep[$cur_rep]['cal_description'], $rep[$cur_rep]['cal_status'], $rep[$cur_rep]['cal_priority'], $rep[$cur_rep]['cal_access'], $rep[$cur_rep]['cal_login']); } $cur_rep++; } }
$retrys--; if (VERBOSE) { echo 'Couldn\'t get content.. retrying (' . $retrys-- . ')' . "\r\n"; } } } while (!$content && $retrys > 0); $retrys = 3; do { $html = str_get_html($content); if (!$html) { if (VERBOSE) { echo 'Couldn\'t parse content.. retrying (' . $retrys-- . ')' . "\r\n"; } } } while (!$html && $retrys > 0); $entries_page = get_entries($html); $entries = $entries + $entries_page; if (VERBOSE) { echo 'Found ' . count($entries_page) . ' Entries' . "\r\n"; } // get page count only after first run if ($i === 1) { $ul_pager = $html->find('ul[data-is24-qa=paging_pages]'); // get page count only if paging element was found if ($ul_pager) { $pages = (int) $ul_pager[0]->last_child()->children(0)->innertext; if (VERBOSE) { echo 'Found ' . $pages . ' Pages' . "\r\n"; } } }
function create_makerfaire_scheduler($faire_id) { $transport = new \Kendo\Data\DataSourceTransport(); $create = new \Kendo\Data\DataSourceTransportCreate(); $create->url('makerfaire-scheduling-tasks.php?type=create')->contentType('application/json')->type('POST')->dataType('json'); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('makerfaire-scheduling-tasks.php?type=read')->contentType('application/json')->type('GET')->dataType('json'); $update = new \Kendo\Data\DataSourceTransportUpdate(); $update->url('makerfaire-scheduling-tasks.php?type=update')->contentType('application/json')->type('POST')->dataType('json'); $destroy = new \Kendo\Data\DataSourceTransportDestroy(); $destroy->url('makerfaire-scheduling-tasks.php?type=destroy')->contentType('application/json')->type('POST')->dataType('json'); $transport->create($create)->read($read)->update($update)->destroy($destroy)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $locationIdField = new \Kendo\Data\DataSourceSchemaModelField('locationID'); $locationIdField->type('number')->from('locationID')->nullable(true); $titleField = new \Kendo\Data\DataSourceSchemaModelField('title'); $titleField->from('Title')->defaultValue('No title')->validation(array('required' => false)); $startField = new \Kendo\Data\DataSourceSchemaModelField('start'); $startField->type('date')->from('Start'); $endField = new \Kendo\Data\DataSourceSchemaModelField('end'); $endField->type('date')->from('End'); $isAllDayField = new \Kendo\Data\DataSourceSchemaModelField('isAllDay'); $isAllDayField->type('boolean')->from('IsAllDay'); $subareaIdField = new \Kendo\Data\DataSourceSchemaModelField('subareaId'); $subareaIdField->from('SubareaID')->nullable(true); $entriesField = new \Kendo\Data\DataSourceSchemaModelField('entries'); $entriesField->from('Entries')->nullable(true); $model->id('locationID')->addField($locationIdField)->addField($titleField)->addField($startField)->addField($endField)->addField($isAllDayField)->addField($subareaIdField)->addField($entriesField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->model($model); $dataSource = new \Kendo\Data\DataSource(); $dataSource->transport($transport)->schema($schema)->batch(false); $subareasResource = new \Kendo\UI\SchedulerResource(); $locations_array = get_entry_locations($faire_id); $subareasResource->field('subareaId')->title('Stage')->name('Stages')->dataSource($locations_array); $entries = get_entries($faire_id); $entriesResource = new \Kendo\UI\SchedulerResource(); $entriesResource->field('entries')->title('Presenter')->multiple(true)->name('Presenters')->dataSource($entries); $pdf = new \Kendo\UI\SchedulerPdf(); $pdf->fileName('Kendo UI Scheduler Export.pdf')->proxyURL('makerfaire-scheduling.php?type=save'); $scheduler = new \Kendo\UI\Scheduler('scheduler'); $scheduler->eventTemplateId('presentation-template')->timezone('UTC')->currentTimeMarker(false)->date(new DateTime('2015/9/26 00:00', new DateTimeZone('UTC')))->height(900)->pdf($pdf)->addToolbarItem(new \Kendo\UI\SchedulerToolbarItem('pdf'))->addResource($subareasResource, $entriesResource)->group(array('resources' => array('Stages')))->addView(array('type' => 'day', 'majorTick' => 30, 'showWorkHours' => true, 'workWeekEnd' => 7, 'workDayStart' => new DateTime('2015/1/1 15:00', new DateTimeZone('UTC')), 'workDayEnd' => new DateTime('2015/1/1 24:00', new DateTimeZone('UTC'))), array('type' => 'workWeek', 'majorTick' => 30, 'selected' => true, 'workWeekStart' => 5, 'workWeekEnd' => 7, 'showWorkHours' => true, 'workDayStart' => new DateTime('2015/1/1 15:00', new DateTimeZone('UTC')), 'workDayEnd' => new DateTime('2015/1/1 24:00', new DateTimeZone('UTC'))), 'agenda')->dataSource($dataSource); return $scheduler; }
/** * Draws a daily outlook style availability grid showing events that are * approved and awaiting approval. * * @param string $date Date to show the grid for * @param array $participants Which users should be included in the grid * @param string $popup Not used */ function daily_matrix($date, $participants, $popup = '') { global $CELLBG, $TODAYCELLBG, $THFG, $THBG, $TABLEBG; global $user_fullname, $repeated_events, $events; global $WORK_DAY_START_HOUR, $WORK_DAY_END_HOUR, $TZ_OFFSET, $ignore_offset; $increment = 15; $interval = 4; $participant_pct = '20%'; //use percentage $first_hour = $WORK_DAY_START_HOUR; $last_hour = $WORK_DAY_END_HOUR; $hours = $last_hour - $first_hour; $cols = $hours * $interval + 1; $total_pct = '80%'; $cell_pct = 80 / ($hours * $interval); $master = array(); // Build a master array containing all events for $participants for ($i = 0; $i < count($participants); $i++) { /* Pre-Load the repeated events for quckier access */ $repeated_events = read_repeated_events($participants[$i], "", $date); /* Pre-load the non-repeating events for quicker access */ $events = read_events($participants[$i], $date, $date); // get all the repeating events for this date and store in array $rep $rep = get_repeating_entries($participants[$i], $date); // get all the non-repeating events for this date and store in $ev $ev = get_entries($participants[$i], $date); // combine into a single array for easy processing $ALL = array_merge($rep, $ev); foreach ($ALL as $E) { if ($E['cal_time'] == 0) { $E['cal_time'] = $first_hour . "0000"; $E['cal_duration'] = 60 * ($last_hour - $first_hour); } else { $E['cal_time'] = sprintf("%06d", $E['cal_time']); } $hour = substr($E['cal_time'], 0, 2); $mins = substr($E['cal_time'], 2, 2); // Timezone Offset if (!$ignore_offset) { $hour += $TZ_OFFSET; } while ($hour < 0) { $hour += 24; } while ($hour > 23) { $hour -= 24; } // Make sure hour is 2 digits $hour = sprintf("%02d", $hour); // convert cal_time to slot if ($mins < 15) { $slot = $hour . ''; } elseif ($mins >= 15 && $mins < 30) { $slot = $hour . '.25'; } elseif ($mins >= 30 && $mins < 45) { $slot = $hour . '.5'; } elseif ($mins >= 45) { $slot = $hour . '.75'; } // convert cal_duration to bars $bars = $E['cal_duration'] / $increment; // never replace 'A' with 'W' for ($q = 0; $bars > $q; $q++) { $slot = sprintf("%02.2f", $slot); if (strlen($slot) == 4) { $slot = '0' . $slot; } // add leading zeros $slot = $slot . ''; // convert to a string if (empty($master['_all_'][$slot]) || $master['_all_'][$slot]['stat'] != 'A') { $master['_all_'][$slot]['stat'] = $E['cal_status']; } if (empty($master[$participants[$i]][$slot]) || $master[$participants[$i]][$slot]['stat'] != 'A') { $master[$participants[$i]][$slot]['stat'] = $E['cal_status']; $master[$participants[$i]][$slot]['ID'] = $E['cal_id']; } $slot = $slot + '0.25'; } } } ?> <br /> <table align="center" class="matrixd" style="width:<?php echo $total_pct; ?> ;" cellspacing="0" cellpadding="0"> <tr><td class="matrix" colspan="<?php echo $cols; ?> "></td></tr> <tr><th style="width:<?php echo $participant_pct; ?> ;"> <?php etranslate("Participants"); ?> </th> <?php $str = ''; $MouseOut = "onmouseout=\"window.status=''; this.style.backgroundColor='" . $THBG . "';\""; $CC = 1; for ($i = $first_hour; $i < $last_hour; $i++) { $hour = $i; if ($GLOBALS["TIME_FORMAT"] == "12") { $hour %= 12; if ($hour == 0) { $hour = 12; } } for ($j = 0; $j < $interval; $j++) { $str .= ' <td id="C' . $CC . '" class="dailymatrix" '; $MouseDown = 'onmousedown="schedule_event(' . $i . ',' . sprintf("%02d", $increment * $j) . ');"'; switch ($j) { case 1: if ($interval == 4) { $k = $hour <= 9 ? '0' : substr($hour, 0, 1); } $str .= 'style="width:' . $cell_pct . '%; text-align:right;" ' . $MouseDown . " onmouseover=\"window.status='Schedule a " . $hour . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . " appointment.'; this.style.backgroundColor='#CCFFCC'; return true;\" " . $MouseOut . " title=\"Schedule an appointment for " . $hour . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . ".\">"; $str .= $k . "</td>\n"; break; case 2: if ($interval == 4) { $k = $hour <= 9 ? substr($hour, 0, 1) : substr($hour, 1, 2); } $str .= 'style="width:' . $cell_pct . '%; text-align:left;" ' . $MouseDown . " onmouseover=\"window.status='Schedule a " . $hour . ':' . $increment * $j . " appointment.'; this.style.backgroundColor='#CCFFCC'; return true;\" " . $MouseOut . " title=\"Schedule an appointment for " . $hour . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . ".\">"; $str .= $k . "</td>\n"; break; default: $str .= 'style="width:' . $cell_pct . '%;" ' . $MouseDown . " onmouseover=\"window.status='Schedule a " . $hour . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . " appointment.'; this.style.backgroundColor='#CCFFCC'; return true;\" " . $MouseOut . " title=\"Schedule an appointment for " . $hour . ':' . ($increment * $j <= 9 ? '0' : '') . $increment * $j . ".\">"; $str .= " </td>\n"; break; } $CC++; } } echo $str . "</tr>\n<tr><td class=\"matrix\" colspan=\"{$cols}\"></td></tr>\n"; // Add user _all_ to beginning of $participants array array_unshift($participants, '_all_'); // Javascript for cells $MouseOver = "onmouseover=\"this.style.backgroundColor='#CCFFCC';\""; $MouseOut = "onmouseout=\"this.style.backgroundColor='" . $CELLBG . "';\""; // Display each participant for ($i = 0; $i < count($participants); $i++) { if ($participants[$i] != '_all_') { // Load full name of user user_load_variables($participants[$i], "user_"); // exchange space for to keep from breaking $user_nospace = preg_replace('/\\s/', ' ', $user_fullname); } else { $user_nospace = translate("All Attendees"); $user_nospace = preg_replace('/\\s/', ' ', $user_nospace); } echo "<tr>\n<th class=\"row\" style=\"width:{$participant_pct};\">" . $user_nospace . "</th>\n"; $col = 1; $viewMsg = translate("View this entry"); // check each timebar for ($j = $first_hour; $j < $last_hour; $j++) { for ($k = 0; $k < $interval; $k++) { $border = $k == '0' ? ' border-left: 1px solid #000000;' : ""; $MouseDown = 'onmousedown="schedule_event(' . $j . ',' . sprintf("%02d", $increment * $k) . ');"'; $RC = $CELLBG; //$space = ''; $space = " "; $r = sprintf("%02d", $j) . '.' . sprintf("%02d", 25 * $k) . ''; if (empty($master[$participants[$i]][$r])) { // ignore this.. } else { if (empty($master[$participants[$i]][$r]['ID'])) { // This is the first line for 'all' users. No event here. $space = "<span class=\"matrix\"><img src=\"pix.gif\" alt=\"\" style=\"height: 8px\" /></span>"; } else { if ($master[$participants[$i]][$r]['stat'] == "A") { $space = "<a class=\"matrix\" href=\"view_entry.php?id={$master[$participants[$i]][$r]['ID']}\"><img src=\"pix.gif\" title=\"{$viewMsg}\" alt=\"{$viewMsg}\" /></a>"; } else { if ($master[$participants[$i]][$r]['stat'] == "W") { $space = "<a class=\"matrix\" href=\"view_entry.php?id={$master[$participants[$i]][$r]['ID']}\"><img src=\"pixb.gif\" title=\"{$viewMsg}\" alt=\"{$viewMsg}\" /></a>"; } } } } echo "<td class=\"matrixappts\" style=\"width:{$cell_pct}%;{$border}\" "; if ($space == " ") { echo "{$MouseDown} {$MouseOver} {$MouseOut}"; } echo ">{$space}</td>\n"; $col++; } } echo "</tr><tr>\n<td class=\"matrix\" colspan=\"{$cols}\">" . "<img src=\"pix.gif\" alt=\"-\" /></td></tr>\n"; } // End foreach participant echo "</table><br />\n"; $busy = translate("Busy"); $tentative = translate("Tentative"); echo "<table align=\"center\"><tr><td class=\"matrixlegend\" >\n"; echo "<img src=\"pix.gif\" title=\"{$busy}\" alt=\"{$busy}\" /> {$busy} \n"; echo "<img src=\"pixb.gif\" title=\"{$tentative}\" alt=\"{$tentative}\" /> {$tentative}\n"; echo "</td></tr></table>\n"; }
function print_date_entries_timebar($date, $user, $hide_icons, $ssi) { global $events, $readonly, $is_admin, $public_access, $public_access_can_add; $cnt = 0; $get_unapproved = $GLOBALS["DISPLAY_UNAPPROVED"] == "Y"; // public access events always must be approved before being displayed if ($GLOBALS["login"] == "__public__") { $get_unapproved = false; } $year = substr($date, 0, 4); $month = substr($date, 4, 2); $day = substr($date, 6, 2); $dateu = mktime(3, 0, 0, $month, $day, $year); $can_add = $readonly == "N" || $is_admin; if ($public_access == "Y" && $public_access_can_add != "Y" && $GLOBALS["login"] == "__public__") { $can_add = false; } // get all the repeating events for this date and store in array $rep $rep = get_repeating_entries($users[$i], $date); $cur_rep = 0; // get all the non-repeating events for this date and store in $ev $ev = get_entries($users[$i], $date); for ($i = 0; $i < count($ev); $i++) { // print out any repeating events that are before this one... while ($cur_rep < count($rep) && $rep[$cur_rep]['cal_time'] < $ev[$i]['cal_time']) { if ($get_unapproved || $rep[$cur_rep]['cal_status'] == 'A') { print_entry_timebar($rep[$cur_rep]['cal_id'], $date, $rep[$cur_rep]['cal_time'], $rep[$cur_rep]['cal_duration'], $rep[$cur_rep]['cal_name'], $rep[$cur_rep]['cal_description'], $rep[$cur_rep]['cal_status'], $rep[$cur_rep]['cal_priority'], $rep[$cur_rep]['cal_access'], $rep[$cur_rep]['cal_login'], $hide_icons); $cnt++; } $cur_rep++; } if ($get_unapproved || $ev[$i]['cal_status'] == 'A') { print_entry_timebar($ev[$i]['cal_id'], $date, $ev[$i]['cal_time'], $ev[$i]['cal_duration'], $ev[$i]['cal_name'], $ev[$i]['cal_description'], $ev[$i]['cal_status'], $ev[$i]['cal_priority'], $ev[$i]['cal_access'], $ev[$i]['cal_login'], $hide_icons); $cnt++; } } // print out any remaining repeating events while ($cur_rep < count($rep)) { if ($get_unapproved || $rep[$cur_rep]['cal_status'] == 'A') { print_entry_timebar($rep[$cur_rep]['cal_id'], $date, $rep[$cur_rep]['cal_time'], $rep[$cur_rep]['cal_duration'], $rep[$cur_rep]['cal_name'], $rep[$cur_rep]['cal_description'], $rep[$cur_rep]['cal_status'], $rep[$cur_rep]['cal_priority'], $rep[$cur_rep]['cal_access'], $rep[$cur_rep]['cal_login'], $hide_icons); $cnt++; } $cur_rep++; } if ($cnt == 0) { echo " "; } // so the table cell has at least something }
function get_directory_usage($path, $expand_directories) { $tmp = get_entries($path); $out = array(); foreach ($tmp as $entry => $size) { if (!isset($expand_directories[$entry])) { $out[$entry] = $size; } else { $tmp2 = get_entries("{$path}/{$entry}"); foreach ($tmp2 as $entry2 => $size2) { $alias = $expand_directories[$entry]; $out["{$alias}/{$entry2}"] = $size2; } } } return $out; }