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_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 }