Revision: 1275
http://mrbs.svn.sourceforge.net/mrbs/?rev=1275&view=rev
Author: cimorrison
Date: 2009-11-27 00:27:00 +0000 (Fri, 27 Nov 2009)
Log Message:
-----------
Added the ability to repeat the headers at the bottom of the table, controlled
by a new config setting $column_labels_both_ends
Modified Paths:
--------------
mrbs/trunk/web/day.php
mrbs/trunk/web/systemdefaults.inc.php
mrbs/trunk/web/week.php
Modified: mrbs/trunk/web/day.php
===================================================================
--- mrbs/trunk/web/day.php 2009-11-26 05:31:06 UTC (rev 1274)
+++ mrbs/trunk/web/day.php 2009-11-27 00:27:00 UTC (rev 1275)
@@ -304,7 +304,7 @@
// TABLE HEADER
echo "<thead>\n";
- echo "<tr>\n";
+ $header = "<tr>\n";
// We can display the table in two ways
@@ -316,61 +316,70 @@
$start_difference = ($start_last_slot - $start_first_slot) * 60; //
seconds
$n_slots = ($start_difference/$resolution) + 1;
$column_width = (int)(95 / $n_slots);
- echo "<th class=\"first_last\">" . get_vocab("room") . ":</th>";
+ $header .= "<th class=\"first_last\">" . get_vocab("room") . ":</th>";
for (
$t = mktime($morningstarts, $morningstarts_minutes, 0, $month,
$day+$j, $year);
$t <= mktime($eveningends, $eveningends_minutes, 0, $month, $day+$j,
$year);
$t += $resolution
)
{
- echo "<th style=\"width: $column_width%\">";
+ $header .= "<th style=\"width: $column_width%\">";
if ( $enable_periods )
{
// convert timestamps to HHMM format without leading zeros
$time_t = date($format, $t);
// and get a stripped version of the time for use with periods
$time_t_stripped = preg_replace( "/^0/", "", $time_t );
- echo $periods[$time_t_stripped];
+ $header .= $periods[$time_t_stripped];
}
else
{
- echo utf8_strftime(hour_min_format(),$t);
+ $header .= utf8_strftime(hour_min_format(),$t);
}
- echo "</th>\n";
+ $header .= "</th>\n";
}
// next: line to display times on right side
if ( FALSE != $row_labels_both_sides )
{
- echo "<th class=\"first_last\">" . get_vocab("room") . ":</th>";
+ $header .= "<th class=\"first_last\">" . get_vocab("room") . ":</th>";
}
} // end "times_along_top" view (for the header)
else
{
// the standard view, with rooms along the top and times down the side
- echo "<th class=\"first_last\">" . ($enable_periods ? get_vocab("period")
: get_vocab("time")) . ":</th>";
+ $header .= "<th class=\"first_last\">" . ($enable_periods ?
get_vocab("period") : get_vocab("time")) . ":</th>";
$column_width = (int)(95 / sql_count($res));
for ($i = 0; ($row = sql_row_keyed($res, $i)); $i++)
{
- echo "<th style=\"width: $column_width%\">
- <a
href=\"week.php?year=$year&month=$month&day=$day&area=$area&room=".$row['id']."\"
- title=\"" . get_vocab("viewweek") . "
".$row['description']."\">"
- . htmlspecialchars($row['room_name']) . ($row['capacity'] > 0 ?
"(".$row['capacity'].")" : "") . "</a></th>";
+ $header .= "<th style=\"width: $column_width%\">
+ <a
href=\"week.php?year=$year&month=$month&day=$day&area=$area&room=".$row['id']."\"
+ title=\"" . get_vocab("viewweek") . "
".$row['description']."\">" .
+ htmlspecialchars($row['room_name']) . ($row['capacity'] > 0
? "(".$row['capacity'].")" : "") . "</a></th>";
$rooms[] = $row['id'];
}
// next line to display times on right side
if ( FALSE != $row_labels_both_sides )
{
- echo "<th class=\"first_last\">" . ( $enable_periods ?
get_vocab("period") : get_vocab("time") ) . ":</th>";
+ $header .= "<th class=\"first_last\">" . ( $enable_periods ?
get_vocab("period") : get_vocab("time") ) . ":</th>";
}
} // end standard view (for the header)
- echo "</tr>\n";
+ $header .= "</tr>\n";
+ echo $header;
echo "</thead>\n";
+ // Now repeat the header in a footer if required
+ if ($column_labels_both_ends)
+ {
+ echo "<tfoot>\n";
+ echo $header;
+ echo "</tfoot>\n";
+ }
+
// TABLE BODY LISTING BOOKINGS
echo "<tbody>\n";
Modified: mrbs/trunk/web/systemdefaults.inc.php
===================================================================
--- mrbs/trunk/web/systemdefaults.inc.php 2009-11-26 05:31:06 UTC (rev
1274)
+++ mrbs/trunk/web/systemdefaults.inc.php 2009-11-27 00:27:00 UTC (rev
1275)
@@ -282,6 +282,10 @@
// (was called $times_right_side in earlier versions of MRBS)
$row_labels_both_sides = FALSE;
+// To display the column headers (times, rooms or days) on the bottom of the
table as
+// well as the top in the day and week views, set to TRUE;
+$column_labels_both_ends = FALSE;
+
// Define default starting view (month, week or day)
// Default is day
$default_view = "day";
Modified: mrbs/trunk/web/week.php
===================================================================
--- mrbs/trunk/web/week.php 2009-11-26 05:31:06 UTC (rev 1274)
+++ mrbs/trunk/web/week.php 2009-11-27 00:27:00 UTC (rev 1275)
@@ -324,7 +324,7 @@
// TABLE HEADER
echo "<thead>\n";
-echo "<tr>\n";
+$header = "<tr>\n";
if (empty($dateformat))
{
@@ -352,39 +352,39 @@
$start_difference = ($start_last_slot - $start_first_slot) * 60; //
seconds
$n_slots = ($start_difference/$resolution) + 1;
$column_width = (int)(95 / $n_slots);
- echo "<th class=\"first_last\">" . get_vocab("date") . ":</th>";
+ $header .= "<th class=\"first_last\">" . get_vocab("date") . ":</th>";
for (
$t = mktime($morningstarts, $morningstarts_minutes, 0, $month,
$day_start_week+$j, $year);
$t <= mktime($eveningends, $eveningends_minutes, 0, $month,
$day_start_week+$j, $year);
$t += $resolution
)
{
- echo "<th style=\"width: $column_width%\">";
+ $header .= "<th style=\"width: $column_width%\">";
if ( $enable_periods )
{
// convert timestamps to HHMM format without leading zeros
$time_t = date($format, $t);
// and get a stripped version of the time for use with periods
$time_t_stripped = preg_replace( "/^0/", "", $time_t );
- echo $periods[$time_t_stripped];
+ $header .= $periods[$time_t_stripped];
}
else
{
- echo utf8_strftime(hour_min_format(),$t);
+ $header .= utf8_strftime(hour_min_format(),$t);
}
- echo "</th>\n";
+ $header .= "</th>\n";
}
// next: line to display times on right side
if ( FALSE != $row_labels_both_sides )
{
- echo "<th class=\"first_last\">" . get_vocab("date") . ":</th>";
+ $header .= "<th class=\"first_last\">" . get_vocab("date") . ":</th>";
}
} // end "times_along_top" view (for the header)
else
{
// the standard view, with days along the top and times down the side
- echo "<th class=\"first_last\">".($enable_periods ? get_vocab("period") :
get_vocab("time")).":</th>";
+ $header .= "<th class=\"first_last\">".($enable_periods ?
get_vocab("period") : get_vocab("time")).":</th>";
for ($j = 0; $j<=($num_of_days-1) ; $j++)
{
$t = mktime( 12, 0, 0, $month, $day_start_week+$j, $year);
@@ -393,31 +393,40 @@
{
// These days are to be hidden in the display (as they are hidden, just
give the
// day of the week in the header row
- echo "<th class=\"hidden_day\">" . utf8_strftime('%a', $t) . "</th>\n";
+ $header .= "<th class=\"hidden_day\">" . utf8_strftime('%a', $t) .
"</th>\n";
}
else
{
- echo "<th><a href=\"day.php?year=" . strftime("%Y", $t) .
- "&month=" . strftime("%m", $t) . "&day=" . strftime("%d", $t)
.
- "&area=$area\" title=\"" . get_vocab("viewday") . "\">"
- . utf8_strftime($dformat, $t) . "</a></th>\n";
+ $header .= "<th><a href=\"day.php?year=" . strftime("%Y", $t) .
+ "&month=" . strftime("%m", $t) . "&day=" .
strftime("%d", $t) .
+ "&area=$area\" title=\"" . get_vocab("viewday") . "\">" .
+ utf8_strftime($dformat, $t) . "</a></th>\n";
}
}
// next line to display times on right side
if ( FALSE != $row_labels_both_sides )
{
- echo "<th class=\"first_last\">"
- . ( $enable_periods ? get_vocab("period") : get_vocab("time") )
- . ":</th>";
+ $header .= "<th class=\"first_last\">" .
+ ( $enable_periods ? get_vocab("period") : get_vocab("time") ) .
+ ":</th>";
}
} // end standard view (for the header)
-echo "</tr>\n";
+$header .= "</tr>\n";
+echo $header;
echo "</thead>\n";
+// Now repeat the header in a footer if required
+if ($column_labels_both_ends)
+{
+ echo "<tfoot>\n";
+ echo $header;
+ echo "</tfoot>\n";
+}
+
// TABLE BODY LISTING BOOKINGS
echo "<tbody>\n";
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits