Changeset:
        ccc32cc82ba7
        
https://sourceforge.net/p/mrbs/hg-code/ci/ccc32cc82ba7001a0f5fece35347912a9da3abfc
Author:
        Campbell Morrison <[email protected]>
Date:
        Sat Aug 27 15:11:51 2016 +0100
Log message:

Restructured code

diffstat:

 web/month.php |  50 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 31 insertions(+), 19 deletions(-)

diffs (67 lines):

diff -r 7e4376b7d270 -r ccc32cc82ba7 web/month.php
--- a/web/month.php     Sat Aug 27 14:44:51 2016 +0100
+++ b/web/month.php     Sat Aug 27 15:11:51 2016 +0100
@@ -89,6 +89,35 @@
 }
 
 
+function get_table_head()
+{
+  global $weekstarts;
+  
+  $html = '';
+  
+  // Weekday name header row:
+  $html .= "<thead>\n";
+  $html .= "<tr>\n";
+  for ($i = 0; $i< 7; $i++)
+  {
+    if (is_hidden_day(($i + $weekstarts) % 7))
+    {
+      // These days are to be hidden in the display (as they are hidden, just 
give the
+      // day of the week in the header row 
+      $html .= "<th class=\"hidden_day\">" . day_name(($i + $weekstarts)%7) . 
"</th>";
+    }
+    else
+    {
+      $html .= "<th>" . day_name(($i + $weekstarts)%7) . "</th>";
+    }
+  }
+  $html .= "\n</tr>\n";
+  $html .= "</thead>\n";
+  
+  return $html;
+}
+
+
 function month_table_innerhtml($day, $month, $year, $room, $area)
 {
   global $tbl_entry;
@@ -193,25 +222,8 @@
     $html .= "</pre>\n";
   }
   
-  // Weekday name header row:
-  $html .= "<thead>\n";
-  $html .= "<tr>\n";
-  for ($weekcol = 0; $weekcol < 7; $weekcol++)
-  {
-    if (is_hidden_day(($weekcol + $weekstarts) % 7))
-    {
-      // These days are to be hidden in the display (as they are hidden, just 
give the
-      // day of the week in the header row 
-      $html .= "<th class=\"hidden_day\">" . day_name(($weekcol + 
$weekstarts)%7) . "</th>";
-    }
-    else
-    {
-      $html .= "<th>" . day_name(($weekcol + $weekstarts)%7) . "</th>";
-    }
-  }
-  $html .= "\n</tr>\n";
-  $html .= "</thead>\n";
-
+  $html .= get_table_head();
+  
   // Main body
   $html .= "<tbody>\n";
   $html .= "<tr>\n";

------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to