Location: PHPKode > projects > ORS - On-line Resource Scheduler > install/dayview.php
<?php
//--------------------------------------------------------------
// ORS - Online Resource Scheduler
// Copyright (c) Jeremy Shaver 2002-2004
//
// See the license.html file for details on distribution and use
//
// This program is free software; you can redistribute it and/or 
//  modify it under the terms of the GNU General Public License 
//  as published by the Free Software Foundation; either version 
//  2 of the License, or (at your option) any later version.
//  
// This program is distributed in the hope that it will be useful, 
//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
//  GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public 
//  License (license.html) along with this program; if not, write 
//  to the Free Software Foundation, Inc., 59 Temple Place, Suite 
//  330, Boston, MA 02111-1307 USA
//  or visit: http://www.opensource.org/licenses/gpl-license.php
//
//--------------------------------------------------------------

// Display of week or day view?
if ($HTTP_POST_VARS['vi'] == 'day') {
    $myweeklength = 1;
    if (dayview_interval==0) 
        define("hour_interval",signup_interval);
    else
        define("hour_interval",dayview_interval);
} else {
    $myweeklength = default_week_length;
    if (weekview_interval==0) 
        define("hour_interval",signup_interval*2);
    else
        define("hour_interval",weekview_interval);
}

// - - - - - - - - - - - - - - - -
// display column header lines

if (count($resourcelist)>0) {
    if ($myweeklength > 1) {
        if (in_array("All",explode("+",$HTTP_POST_VARS['resource']))){
            if ($HTTP_POST_VARS['avonly']==1) {
                $todisp = array();
                foreach ($resourcelist as $res=>$item) if ($item['donotshow']!=1 && $HTTP_POST_VARS['starttime']!="" && $HTTP_POST_VARS['endtime']!="") $todisp[] = $res;
            } else {
                $todisp = array_keys($resourcelist);                //all = all items in resource list
            }
        } else $todisp = explode("+",$HTTP_POST_VARS['resource']);        //otherwise, just the resource(s) listed
    } else {
        if (!limit_day_view | in_array("All",explode("+",$HTTP_POST_VARS['resource']))) {
            if ($HTTP_POST_VARS['avonly']==1) {
                $todisp = array();
                foreach ($resourcelist as $res=>$item) if ($item['donotshow']!=1 && $HTTP_POST_VARS['starttime']!="" && $HTTP_POST_VARS['endtime']!="") $todisp[] = $res;
            } else {
                $todisp = array_keys($resourcelist);                //all = all items in resource list
            }
        } else $todisp = explode("+",$HTTP_POST_VARS['resource']);        //otherwise, just the resouce(s) listed
    }
} else {
    $todisp = array("0"); //no resources at all
}
echo '<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolor="#cccccc" bgcolor="#ffffff">';

//put resources into "order" order
$temp = array();
foreach ($todisp as $res)
    if (!$thisuserid || checkpermissions($users[$thisuserid]['resourceblock'],"0",$res)
       || $calendarauth || show_blocked_resources)
            $temp[] = $resourcelist[$res];
$temp = sortby($temp,'order');
$todisp = array();
foreach ($temp as $index=>$item) $todisp[$index] = $item['resource'];

if ($myweeklength > 1)        $resloop = $todisp;
else                         $resloop = array("x");        //only one loop of table

foreach ($resloop as $resloopindex=>$resource) {                //disp a table for each resource in "resource" array (one or all!)

if ($HTTP_POST_VARS['vi'] == 'week') {
    //Show weekends?
    if (noweekends) {
        if (date("w",$tabledate)==6) $tabledate += 2*60*60*24;  //sat->next monday
        $tabledate = $tabledate - (date("w",$tabledate)-1)*60*60*24;  //**NO WEEKEND MOD** round to previous monday (or next monday if we're on sunday)
        $myweeklength=5;
    }

    // Week View (days at top of each column)
    $otherforminfo = 'UID=' . $UID . '&st=' . $HTTP_POST_VARS['starttime'] . '&en=' . $HTTP_POST_VARS['endtime'] . '&co=' . make_get_str($HTTP_POST_VARS['comment']) . '&re=' . $HTTP_POST_VARS['resource'] . '&vi=' . $HTTP_POST_VARS['vi'] . '&';

    //Grand heading for each resource table
    echo "<tr><td colspan=\"";
    echo $myweeklength * num_signups + 2;
    echo "\"><b><center>";
    if (count(explode("+",$HTTP_POST_VARS['resource'])) > 1 | in_array("All",explode("+",$HTTP_POST_VARS['resource'])) )        //when more than one is selected, make resource "headings" hyperlinked to choose that resource
    echo "<a href=\"" . schedule_prog . '?' . $otherforminfo . "re=" . $resource . "&ta=" . $tabledate . "\">";
    echo $resourcelist[$resource]['long'] . "</a>&nbsp;";

    resourcelink($UID,$resourcelist[$resource]);  //add resource info links if necessary

    echo "</center></b></td></tr>";

    $mydate = $tabledate;

    //Date row (and read in each day's signups)
    echo "<tr valign=\"top\" align=\"center\">";
    echo '<td nowrap bgcolor=#dddddd><font size="-1"><a href="' . schedule_prog . '?' . $otherforminfo . 'ta=' . ($tabledate - (24*60*60*($myweeklength))) . '">&lt;Prev</a></font></td>';
    for ($dow = 1; $dow < $myweeklength+1; $dow++) {
        if (noweekends && (date("w",$mydate)==0 || date("w",$mydate)==6)) continue;  //**NO WEEKEND MOD** 

        $day_of_week = date("w",$mydate); 
        if (($day_of_week == 0) || ($day_of_week == 6)){ 
            $columncolor = weekend_color;
        } else {
            $columncolor = weekday_color;
        } 
        echo "<td nowrap bgcolor=" . $columncolor . " colspan=\"" . num_signups . "\"><font size=\"-1\">";

        if (date("m/d/Y",$mydate) == date("m/d/Y",zulutime())) echo "<b>";
        echo '<a href="' . schedule_prog . '?' . $otherforminfo . 'ta=' . ($mydate) . '">';
        echo date("D " . dateformat, $mydate) . "</a></b></font></td>";           //display date
        $week[$dow] = getday($mydate,$resource);                        //get this day's signups
        $week[$dow] = combineopen($week[$dow]);                         //and compress open slots for table
//        $mydate = strtotime(date( "m",$mydate) . "/" . (date("d",$mydate)+1) . "/" . date("Y",$mydate));
        $mydate = mktime(0,0,0,date( "m",$mydate),date("d",$mydate)+1,date("Y",$mydate));
    }
    echo '<td nowrap bgcolor=#dddddd><font size="-1"><a href="' . schedule_prog . '?' . $otherforminfo . 'ta=' . ($tabledate + (24*60*60*($myweeklength))) . '">Next&gt;</a></font></td>';
    echo "</tr>\n";
    
    $ncolumns = $myweeklength;

} else {
    // Day View (resources at top of each column)

    //Show weekends?
    if (noweekends) {
        if (date("w",$tabledate)==6) $tabledate += 2*60*60*24;  //sat->next monday
        if (date("w",$tabledate)==0) $tabledate -= 2*60*60*24;  //sun->last friday
    }

    $otherforminfo = 'UID=' . $UID . '&st=' . $HTTP_POST_VARS['starttime'] . '&en=' . $HTTP_POST_VARS['endtime'] . '&co=' . make_get_str($HTTP_POST_VARS['comment']) . '&re=' . $HTTP_POST_VARS['resource'] . '&vi=' . $HTTP_POST_VARS['vi'] . '&';

    $mydate = $tabledate;

    //Grand heading for the table
    echo "<tr><td colspan=\"";
    echo count($todisp) * num_signups + 2;
    echo "\"><center>";

    echo '<table width=100% border=0><tr><td align="left" width=60>';
    echo '<font size="-1"><a href="' . schedule_prog . '?' . $otherforminfo . 'ta=' . ($tabledate - (24*60*60*($myweeklength))) . '">&lt; Previous</a></font>';
    echo '</td>';

    echo '<td align="center"><center><b>' . date("D " . dateformat, $mydate) . "</b></center></td>";

    echo '<td align="right" width=60>';
    echo '<font size=-1><a href="' . schedule_prog . '?' . $otherforminfo . 'tabledate=' . ($tabledate + (24*60*60*($myweeklength))) . '">Next &gt;</a></font>';
    echo '</td></tr></table>';
    echo "</center></td></tr>";

    //Resource row (and read in each resource's signups)
    echo "<tr valign=\"top\" align=\"center\">";
    echo '<td nowrap bgcolor=#dddddd>&nbsp;</td>';
    foreach ($todisp as $loc=>$ind) {
        $otherforminfo = 'UID=' . $UID . '&st=' . $HTTP_POST_VARS['starttime'] . '&en=' . $HTTP_POST_VARS['endtime'] . '&co=' . make_get_str($HTTP_POST_VARS['comment']) . '&vi=' . $HTTP_POST_VARS['vi'] . '&';
        echo "<td nowrap bgcolor=#dddddd colspan=\"" . num_signups . "\"><font size=\"-1\">";
        if (in_array($ind,explode("+",$HTTP_POST_VARS['resource']))) echo "<b>";
        echo "<a href=\"" . schedule_prog . '?' . $otherforminfo . "re=" . $ind . "&ta=" . $tabledate . "\">";
        echo $resourcelist[$ind]['short'] . "</a></b></font>&nbsp;";
        resourcelink($UID,$resourcelist[$ind]);  //add resource info links if necessary
        echo "</td>";                  //display resource name (1st word)
        $week[$loc+1] = getday($mydate,$ind);                                        //get this resources's signups
        $week[$loc+1] = combineopen($week[$loc+1]);                                 //and compress open slots for table
    }

    $otherforminfo = 'UID=' . $UID . '&st=' . $HTTP_POST_VARS['starttime'] . '&en=' . $HTTP_POST_VARS['endtime'] . '&co=' . make_get_str($HTTP_POST_VARS['comment']) . '&re=' . $HTTP_POST_VARS['resource'] . '&vi=' . $HTTP_POST_VARS['vi'] . '&';

    echo '<td nowrap bgcolor=#dddddd>&nbsp;</td>';
    echo "</tr>\n";

    $ncolumns = count($todisp);

}

$colorcode = array(1=>"green", 2=>"yellow", 3=>"red");

// - - - - - - - - - - - - - - - -
//draw actual signup table for one resource or day

if (count($week[1])>0) foreach (array_keys($week[1]) as $hour) {
    echo '<tr valign="top" align="center">';
    echo "<td bgcolor=#dddddd width=60><font size=\"-1\">";
    if (($hour - floor($hour)) == 0)
        echo date(timeformat,mktime(floor($hour),($hour-floor($hour))*60,0,date( "m",$tabledate),date("d",$tabledate),date("Y",$tabledate)));
    else
        echo "&nbsp;&nbsp;&nbsp;" .date(":i",mktime(floor($hour),($hour-floor($hour))*60,0,date( "m",$tabledate),date("d",$tabledate),date("Y",$tabledate)));
    echo "</font></td>\n";
    for ($dow = 1; $dow <= $ncolumns; $dow++) {
        $data = $week[$dow][$hour];

//        if ($HTTP_POST_VARS['vi'] == 'week')         $datestamp = strtotime(date( "m",$tabledate) . "/" . (date("d",$tabledate)+$dow-1) . "/" . date("Y",$tabledate) . " " . hourtotime($hour));
//        else                                         $datestamp = strtotime(date("m/d/y",$tabledate) . " " . hourtotime($hour));
        if ($HTTP_POST_VARS['vi'] == 'week')         $datestamp = mktime(floor($hour),($hour-floor($hour))*60,0,date( "m",$tabledate),date("d",$tabledate)+$dow-1,date("Y",$tabledate));
        else                                         $datestamp = mktime(floor($hour),($hour-floor($hour))*60,0,date( "m",$tabledate),date("d",$tabledate),date("Y",$tabledate));

        if (noweekends && (date("w",$datestamp)==0 || date("w",$datestamp)==6)) continue;  //**NO WEEKEND MOD**  skip to next cycle of loop if sat or sun

        for ($priority = 1; $priority <= num_signups; $priority++) {

            if (($hour/3 - floor($hour/3))==0) {
                $blankcolor     = "ruleline.gif";
                $blankcolorcode = "";
            } else {
                $blankcolor = "white.gif";
                $blankcolorcode = "";
            }

            if (is_array($data[$priority])) {
                //-- Filled time block, give "edit" and "info" options --
                $info = getusersignups($data[$priority]['usn'],false);
                if (!$data[$priority]['recurring'])  {
                    $info = $info[$data[$priority]['signup']];
                } else {
                    $info = $data[$priority];  // this is all we've got for a recurring
                }

                if ($data[$priority]['usn']==0) {
                    $mycolor = "recurring";
                } elseif (color_from_status) {
                    if ($info['status']=="") {
                        $mycolor = "red";
                    } elseif ($info['status']==0) {
                        $mycolor = "green";
                    } else {
                        $mycolor = "yellow";
                    }
                } elseif (!automanage_alternates) {
                    $mycolor = "green";                
                } else {
                    $mycolor = $colorcode[$priority];
                    if ($mycolor == "") $mycolor = "red";
                }

                if (floor($datestamp/60/60/24) < floor($info['starttime']/60/60/24)) $info = array();
                if (strtolower($info['comment']) == "wx") $mycolor = "blue";

                $otherforminfo = 'UID=' . $UID . '&ta=' . $tabledate . '&usn=' . $data[$priority]['usn'] . '&si=' . $data[$priority]['signup'] . '&re=' . $info['resource'] . '&vi=' . $HTTP_POST_VARS['vi'] . '&';
                if (in_array("print",array_keys($HTTP_POST_VARS))) $mycolor = "white";
                
                if ($datestamp >= floor($info['starttime']/60/60/hour_interval)*60*60*hour_interval
                     & $HTTP_POST_VARS['usn'] == $data[$priority]['usn'] & $HTTP_POST_VARS['signup'] == $data[$priority]['signup'] )
                        $mycolor = "selected";

                if ($thisuserid || public_show_comment)
                    $comment = ' alt="' . stripcslashes($info['comment']) . '" ';

                $content = '';
                $link    = '';
                if ($data[$priority]['usn']!=0) {  //if this isn't a "no-user" signup
                    if ($calendarauth || allow_past_edit || ($datestamp+$data[$priority]['length']*60*60) >= (zulutime() + timezone + allow_signup_offset)) {
                        if ($HTTP_POST_VARS['usn'] == $data[$priority]['usn']
                             & $HTTP_POST_VARS['signup'] == $data[$priority]['signup']
                             & ($HTTP_POST_VARS['submit'] == "edit" | $HTTP_POST_VARS['submit']=="Delete")) {
                                $content .= '<b><em>';
                        } elseif ($thisuserid && ($thisuserid == $data[$priority]['usn'] | $calendarauth | edit_other_users)) {
                            $link = schedule_prog . '?submit=edit&' . $otherforminfo;
                            $content .= '<a href="' . schedule_prog . '?submit=edit&' . $otherforminfo . '"' . $comment . '>';
                            $content .= '<b><em>';
                        } elseif ($thisuserid) {
                            $link = schedule_prog . '?submit=info&' . $otherforminfo;
                            $content .= '<a href="' . schedule_prog . '?submit=info&' . $otherforminfo . '"' . $comment . '>';                        }
                    }
                }

                if ($info['starttime']%(hour_interval*60*60)>0 & date("m/d/Y",$info['starttime'])==date("m/d/Y",$datestamp)) 
                    $content .= '<img src="' . $blankcolor . '" width=100% height=10 align=center border=0>';

                $signupdesc = "";
                if ($thisuserid) {
                    if (show_comment && $info['comment']!="") {   //show signup's comment in block
                        $signupdesc = wordwrap(stripcslashes($info['comment']),hyphen_length,"<br>",1);
                    }
                    if ($signupdesc == "" || show_name) {  //force show name OR nothing in description yet
                        if (strlen($signupdesc)>0) $signupdesc = " - " . $signupdesc;
                        if (show_full_name) {
                            $signupdesc = hyphenated($users[$data[$priority]['usn']]['firstname'] . " " . $users[$data[$priority]['usn']]['lastname']) . $signupdesc;
                        } else {
                            if (show_first_name && $users[$data[$priority]['usn']]['firstname'] != "") {
                                $signupdesc = hyphenated($users[$data[$priority]['usn']]['firstname']) . $signupdesc;
                            } else {
                                $signupdesc = hyphenated($users[$data[$priority]['usn']]['lastname']) . $signupdesc;
                            }
                        }
                    }
                } else {  //limited public view
                    if (public_show_comment && $info['comment']!="") {   //show signup's comment in block
                        $signupdesc = wordwrap(stripcslashes($info['comment']),hyphen_length,"<br>",1);
                    }
                    if (public_show_name) { 
                        if (strlen($signupdesc)>0) $signupdesc = " - " . $signupdesc;
                        if (public_show_full_name) {
                            $signupdesc = hyphenated($users[$data[$priority]['usn']]['firstname'] . " " . $users[$data[$priority]['usn']]['lastname']) . $signupdesc;
                        } else {
                            if (public_show_first_name && $users[$data[$priority]['usn']]['firstname'] != "") {
                                $signupdesc = hyphenated($users[$data[$priority]['usn']]['firstname']) . $signupdesc;
                            } else {
                                $signupdesc = hyphenated($users[$data[$priority]['usn']]['lastname']) . $signupdesc;
                            }
                        }
                    }
                }
                $content .= $signupdesc;

                //add WX flag and/or * if comment exists or not even hour start or end
                if (strtolower($info['comment'])=="wx") {
                    $content .= " (WX)";
                    if ($info['starttime']%(hour_interval*60*60)>0) $content .= "*";
                } else if (($info['comment']!="" & !show_comment) | $info['starttime']%(hour_interval*60*60)>0) $content .= "*";

                $content .= '</b></em>';
                //add comments as mouse-over alt display
                $mouseover = 'Comment: ' . strtr(stripslashes($info['comment']),array('<br>'=>''));

                //does block continue partially into next time block? draw something to point that out
                if ($info['endtime']%(hour_interval*60*60)>0 & date("m/d/Y",$info['endtime'])==date("m/d/Y",$datestamp)) 
                    $content .= "<center><font size=\"-1\">(end +" . date("G:i",mktime(0,$info['endtime']%(hour_interval*60*60))) . ")</font></center>";

                echo '<td rowspan="' . $data[$priority]['rowspan'] . '" background="' . $mycolor . '.gif" ';
                if ($thisuserid || public_show_comment) {
                    echo 'onmouseover = "javascript:window.status=\'' . $mouseover . '\';" ';
                    echo 'onmouseout  = "javascript:window.status=\'\';" ';
                    if (!empty($info['comment'])) echo 'title="' . stripcslashes($info['comment']) . '" ';
                }
                if (!empty($link)) echo 'onclick="javascript:window.location=\'' . $link . '\';" ';
                echo '><font size="-1">';
                echo $content . "</a>&nbsp;</font></td>\n";

            } else {
                //-- Empty time block, give "select this time block" options --

                $mycolor = $blankcolor;
                $mycolorcode = $blankcolorcode;
                if ($data[$priority]) {
                    $content = '';
                    $link = '';
                    if ($thisuserid) {
                        if (($HTTP_POST_VARS['submit'] != "edit") & ($datestamp >= (zulutime()+timezone + allow_signup_offset) | $administrator)) {
                            if ($HTTP_POST_VARS['vi'] == 'week') {
                                $otherforminfo = 'UID=' . $UID . '&ta=' . $tabledate . '&co=' . make_get_str($HTTP_POST_VARS['comment']) . '&re=' . $resource . '&vi=' . $HTTP_POST_VARS['vi'] . '&';
                                $showstart = True;
                            } else {
                                $otherforminfo = 'UID=' . $UID . '&ta=' . $tabledate . '&co=' . make_get_str($HTTP_POST_VARS['comment']) . '&re=' . $todisp[$dow-1] . '&vi=' . $HTTP_POST_VARS['vi'] . '&';
                                $showstart = (in_array($todisp[$dow-1],explode("+",$HTTP_POST_VARS['resource'])) | in_array("All",explode("+",$HTTP_POST_VARS['resource'])));
                            }
                            if (in_array("starttime", array_keys ($HTTP_POST_VARS)) & $showstart) {
                                if ($datestamp == floor($HTTP_POST_VARS['starttime']/60/60/hour_interval)*60*60*hour_interval & !in_array($HTTP_POST_VARS['submit'],array("info","Delete","No-Show","edit"))) {
                                    if ($datestamp != floor(($HTTP_POST_VARS['endtime']-hour_interval)/60/60/hour_interval)*60*60*hour_interval) {
                                        $link = schedule_prog . '?' . $otherforminfo . 'st=' . $HTTP_POST_VARS['starttime'];
                                        $content .= '<a href="' . schedule_prog . '?' . $otherforminfo . 'st=' . $HTTP_POST_VARS['starttime'];
                                        $content .= '&en=' . ($datestamp+(hour_interval*60*60)) . '">';
                                        $content .= '&lt;<em><font size="-1">START</font></em>&gt;';
                                    } else
                                        $content .= '&lt;<em>START / END</em>&gt;';
                                } elseif ($datestamp == floor(($HTTP_POST_VARS['endtime']-hour_interval)/60/60/hour_interval)*60*60*hour_interval & !in_array($HTTP_POST_VARS['submit'],array("info","Delete","No-Show","edit"))) {
                                    $content .= '&lt;<em><font size="-1">END</font></em>&gt;';
                                } elseif ($datestamp > $HTTP_POST_VARS['starttime']) {
                                    $link = schedule_prog . '?' . $otherforminfo . 'st=' . $HTTP_POST_VARS['starttime'] . '&en=' . ($datestamp+(hour_interval*60*60));
                                    $content .= '<a href="' . schedule_prog . '?' . $otherforminfo . 'st=' . $HTTP_POST_VARS['starttime'];
                                    $content .= '&en=' . ($datestamp+(hour_interval*60*60)) . '">';
                                } else {
                                    $link = schedule_prog . '?' . $otherforminfo . 'st=' . $datestamp . '&en=' . $HTTP_POST_VARS['endtime'];
                                    $content .= '<a href="' . schedule_prog . '?' . $otherforminfo . 'st=' . $datestamp . '&en=' . $HTTP_POST_VARS['endtime'] . '">';
                                }
                            } else {
                                $link = schedule_prog . '?' . $otherforminfo . 'st=' . $datestamp;
                                $content .= '<a href="' . schedule_prog . '?' . $otherforminfo . 'st=' . $datestamp . '">';
                            }
                        }
                    }
                    $content .= "</a>&nbsp;</td>\n";
                    echo '<td colspan="' . $data[$priority] . '"' . $mycolorcode . ' width=10 background=' . $mycolor . ' ';
                    if (!empty($link)) echo 'onclick="javascript:window.location=\'' . $link .'\';" ';
                    echo '>' . $content;
                }
            }
        }
    }
    echo "<td bgcolor=#dddddd width=60><font size=\"-1\">";
    if (($hour - floor($hour)) == 0)
        echo date(timeformat,mktime(floor($hour),($hour-floor($hour))*60,0,date( "m",$tabledate),date("d",$tabledate),date("Y",$tabledate)));
    else
        echo "&nbsp;&nbsp;&nbsp;" .date(":i",mktime(floor($hour),($hour-floor($hour))*60,0,date( "m",$tabledate),date("d",$tabledate),date("Y",$tabledate)));
    echo "</font></td>";
    echo "</tr>\n";
}

if ($resloopindex==(count($resloop)-1)) {  //last item in list to show?
    //Do bottom line of table
    $otherforminfo = 'UID=' . $UID . '&st=' . $HTTP_POST_VARS['starttime'] . '&en=' . $HTTP_POST_VARS['endtime'] . '&co=' . make_get_str($HTTP_POST_VARS['comment']) . '&re=' . $HTTP_POST_VARS['resource'] .'&vi=' . $HTTP_POST_VARS['vi'] . '&';
    echo "<tr valign=\"top\" align=\"center\">";
    echo '<td nowrap bgcolor=#dddddd><font size="-1"><a href="' . schedule_prog . '?' . $otherforminfo . 'ta=' . ($tabledate - (24*60*60*($myweeklength))) . '">&lt;Prev</a></font></td>';

    if ($HTTP_POST_VARS['vi'] == 'day') {
        // Day View (resources at top of each column)
        $otherforminfo = 'UID=' . $UID . '&st=' . $HTTP_POST_VARS['starttime'] . '&en=' . $HTTP_POST_VARS['endtime'] . '&co=' . make_get_str($HTTP_POST_VARS['comment']) . '&vi=' . $HTTP_POST_VARS['vi'] . '&';
        foreach ($todisp as $loc=>$ind) {
            echo "<td nowrap bgcolor=#dddddd colspan=\"" . num_signups . "\"><font size=\"-1\">";
            if (in_array($ind,explode("+",$HTTP_POST_VARS['resource']))) echo "<b>";
            echo "<a href=\"" . schedule_prog . '?' . $otherforminfo . "re=" . $ind . "&ta=" . $tabledate . "\">";
            echo $resourcelist[$ind]['short'] . "</a></b></font>&nbsp;";
            resourcelink($UID,$resourcelist[$ind]);  //add resource info links if necessary
            echo "</td>";                  //display resource name (1st word)
        }
        //echo "<td nowrap bgcolor=#dddddd colspan=\"" . num_signups*$myweeklength . "\">&nbsp;</td>";
    } else {
        // Week View (days at top of each column)
        $mydate = $tabledate;
        for ($dow = 1; $dow <= $ncolumns; $dow++) {
            echo "<td nowrap bgcolor=#dddddd colspan=\"" . num_signups . "\"><font size=\"-1\">";
            if (date("m/d/Y",$mydate) == date("m/d/Y",zulutime())) echo "<b>";
            echo '<a href="' . schedule_prog . '?' . $otherforminfo . 'ta=' . ($mydate) . '">';
            echo date("D " . dateformat, $mydate) . "</a></b></font></td>";                          //display date
//            $mydate = strtotime(date( "m",$mydate) . "/" . (date("d",$mydate)+1) . "/" . date("Y",$mydate));
            $mydate = mktime(0,0,0,date( "m",$mydate),date("d",$mydate)+1,date("Y",$mydate));
        }
    }

    $otherforminfo = 'UID=' . $UID . '&st=' . $HTTP_POST_VARS['starttime'] . '&en=' . $HTTP_POST_VARS['endtime'] . '&co=' . make_get_str($HTTP_POST_VARS['comment']) . '&re=' . $HTTP_POST_VARS['resource'] .'&vi=' . $HTTP_POST_VARS['vi'] . '&';
    echo '<td nowrap bgcolor=#dddddd><font size="-1"><a href="' . schedule_prog . '?' . $otherforminfo . 'ta=' . ($tabledate + (24*60*60*($myweeklength))) . '">Next&gt;</a></font></td>';
    echo "<tr><td></td>";

}

for ($dow = 1; $dow <= $ncolumns; $dow++)
    for ($priority = 1; $priority <= num_signups; $priority++)
        echo '<td width=25></td>';
echo "<td></td>";
echo "</tr>\n";

} //end of foreach resource loop

echo "</table>\n";

//==============================================================================
//JMS 3/16/02
//  -move next and prev. in day view up to date line
//JMS 4/1/02
// -added full support of viewing only selected resources
// -fixed "wrong year" bug (use ".../Y" in date tests)
//JMS 11/14/02
// -added complete am/pm clock support
//CBW 11/23/02
// -fixed bug in resource listing when no resources exist (after initial installation)
//CBW 1/12/03
// -fixed bug with "resourceblock" field in userlist.csv file which used to
//      be limited to 15 resources.  The integer field was changed to a
//      "b-format" string which should be limitless (within reason)
//JMS 7/30/03
// -fixed 1/2-hour start bug which kept signup being edited from being shown as selected (week view only)
//JMS 8/18/03
// -revised handling of offset signups (length not even interval of hour_interval)
// -made hour_interval a configurable setting (with 0=automatic mode)
//JMS 10/01/03
// -fixed wrong-resource selected bug caused when limit_day_view is True
//JMS 11/01/03
// -added bottom-of-table next/prev and date/resource row
// -added public_lastname_view option
//JMS 12/11/03
// -fixed empty-resource bug
// -added comment_only option for time blocks
//JMS 12/13/03
// -converted checksec calls to variables
// -fixed logic of highlighting currently selected signup
// -added edit_other_users option
//JMS 12/30/03
// -separated logic of "myweeklength" from number of columns
//JMS 1/5/04
// -added euro-date support
//JMS 1/9/04
// -added different color for recurring signups
//JMS 1/27/04
// -added more name/comment display options
//JMS 2/5/04
// -added resource comment display
//JMS 2/6/04
// -added full suite of signup lableling configuration options
// -added better "zero resources" support
// -added better do-not-show resource
//JMS 2/7/04
// -fixed IE/table problems

?>
Return current item: ORS - On-line Resource Scheduler