Revision: 2528
          https://sourceforge.net/p/mrbs/code/2528/
Author:   cimorrison
Date:     2012-10-25 16:33:36 +0000 (Thu, 25 Oct 2012)
Log Message:
-----------
Restructured code

Modified Paths:
--------------
    mrbs/trunk/web/report.php

Modified: mrbs/trunk/web/report.php
===================================================================
--- mrbs/trunk/web/report.php   2012-10-25 16:17:57 UTC (rev 2527)
+++ mrbs/trunk/web/report.php   2012-10-25 16:33:36 UTC (rev 2528)
@@ -160,6 +160,72 @@
 }
 
 
+function generate_presentation_options(&$vars)
+{
+  global $times_somewhere;
+  
+  echo "<fieldset>\n";
+  echo "<legend>" . get_vocab("presentation_options") . "</legend>\n";
+        
+  echo "<div id=\"div_output\">\n";
+  $buttons = array(REPORT  => "report",
+                   SUMMARY => "summary");
+  $params = array('label'   => get_vocab('output') . ":",
+                  'name'    => 'output',
+                  'value'   => $vars['output'],
+                  'options' => $buttons);
+  generate_radio_group($params);                  
+  echo "</div>\n";
+        
+  echo "<div id=\"div_format\">\n";
+  $buttons = array(OUTPUT_HTML => "html",
+                   OUTPUT_CSV  => "csv");
+  // The iCal output button
+  if ($times_somewhere) // We can't do iCalendars for periods yet
+  {
+    $buttons[OUTPUT_ICAL] = "ical";
+  }
+  $params = array('label'   => get_vocab('format') . ":",
+                  'name'    => 'output_format',
+                  'value'   => $vars['output_format'],
+                  'options' => $buttons);
+  generate_radio_group($params);
+  echo "</div>\n";
+
+  echo "<div id=\"div_sortby\">\n";
+  $options = array('r' => get_vocab("room"),
+                   's' => get_vocab("sort_rep_time"));
+  $params = array('label'   => get_vocab("sort_rep") . ':',
+                  'name'    => 'sortby',
+                  'options' => $options,
+                  'value'   => $vars['sortby']);
+  generate_radio_group($params);
+  echo "</div>\n";
+
+  echo "<div id=\"div_sumby\">\n";
+  $options = array('d' => get_vocab("sum_by_descrip"),
+                   'c' => get_vocab("sum_by_creator"),
+                   't' => get_vocab("sum_by_type"));
+  $params = array('label'   => get_vocab("summarize_by") . ':',
+                  'name'    => 'sumby',
+                  'options' => $options,
+                  'value'   => $vars['sumby']);
+  generate_radio_group($params);
+  echo "</div>\n";
+  
+  echo "</fieldset>\n";
+}
+
+
+function generate_submit_buttons()
+{
+  echo "<div id=\"report_submit\">\n";
+  echo "<input type=\"hidden\" name=\"phase\" value=\"2\">\n";
+  echo "<input class=\"submit\" type=\"submit\" value=\"" . 
get_vocab("submitquery") . "\">\n";
+  echo "</div>\n";
+}
+
+
 // Converts a string from the standard MRBS character set to the character set
 // to be used for CSV files
 function csv_conv($string)
@@ -1240,6 +1306,7 @@
   echo "<fieldset>\n";
   echo "<legend>" . get_vocab("report_on") . "</legend>\n";
   
+  // Do the search criteria fieldset
   $search_var_keys = array('from_day', 'from_month', 'from_year',
                            'to_day', 'to_month', 'to_year',
                            'areamatch', 'roommatch',
@@ -1251,69 +1318,22 @@
   {
     $search_vars[$var] = $$var;
   }
+  generate_search_criteria($search_vars);
   
-  generate_search_criteria($search_vars);  
-
-      
-        
-  echo "<fieldset>\n";
-  echo "<legend>" . get_vocab("presentation_options") . "</legend>\n";
-        
-  echo "<div id=\"div_output\">\n";
-  $buttons = array(REPORT  => "report",
-                   SUMMARY => "summary");
-  $params = array('label'   => get_vocab('output') . ":",
-                  'name'    => 'output',
-                  'value'   => $output,
-                  'options' => $buttons);
-  generate_radio_group($params);                  
-  echo "</div>\n";
-        
-  echo "<div id=\"div_format\">\n";
-  $buttons = array(OUTPUT_HTML => "html",
-                   OUTPUT_CSV  => "csv");
-  // The iCal output button
-  if ($times_somewhere) // We can't do iCalendars for periods yet
+  // Then the presentation options fieldset
+  $presentation_var_keys = array('output', 'output_format',
+                                 'sortby', 'sumby');
+  $presentation_vars = array();
+  foreach($presentation_var_keys as $var)
   {
-    $buttons[OUTPUT_ICAL] = "ical";
+    $presentation_vars[$var] = $$var;
   }
-  $params = array('label'   => get_vocab('format') . ":",
-                  'name'    => 'output_format',
-                  'value'   => $output_format,
-                  'options' => $buttons);
-  generate_radio_group($params);
-  echo "</div>\n";
+  generate_presentation_options($presentation_vars);
+        
+  // Then the submit buttons
+  generate_submit_buttons();
 
-  echo "<div id=\"div_sortby\">\n";
-  $options = array('r' => get_vocab("room"),
-                   's' => get_vocab("sort_rep_time"));
-  $params = array('label'   => get_vocab("sort_rep") . ':',
-                  'name'    => 'sortby',
-                  'options' => $options,
-                  'value'   => $sortby);
-  generate_radio_group($params);
-  echo "</div>\n";
-
-  echo "<div id=\"div_sumby\">\n";
-  $options = array('d' => get_vocab("sum_by_descrip"),
-                   'c' => get_vocab("sum_by_creator"),
-                   't' => get_vocab("sum_by_type"));
-  $params = array('label'   => get_vocab("summarize_by") . ':',
-                  'name'    => 'sumby',
-                  'options' => $options,
-                  'value'   => $sumby);
-  generate_radio_group($params);
-  echo "</div>\n";
-  
   echo "</fieldset>\n";
-
-  echo "<div id=\"report_submit\">\n";
-  echo "<input type=\"hidden\" name=\"phase\" value=\"2\">\n";
-  echo "<input class=\"submit\" type=\"submit\" value=\"" . 
get_vocab("submitquery") . "\">\n";
-  echo "</div>\n";
-        
-      
-  echo "</fieldset>\n";
   echo "</form>\n";
   echo "</div>\n";
 }
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to