ona  18.1.1
About: OpenNetAdmin provides a database managed inventory of your IP network (with Web and CLI interface).
  Fossies Dox: ona-18.1.1.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

display_report.inc.php
Go to the documentation of this file.
1 <?php
2 
3 
5 // Function: ws_display()
6 //
7 // Description:
8 // Displays a report in the work_space div.
10 function ws_display($window_name, $form='') {
11  global $conf, $self, $onadb;
12  global $images, $color, $style;
13  $html = '';
14  $js = '';
15 
16  // If the user supplied an array in a string, build the array and store it in $form
17  $form = parse_options_string($form);
18 
19  // Get the plugin location info.
20  $reportlist = plugin_list('report');
21 
22  // Loop through the list of reports until we find the matching name
23  foreach($reportlist as $report) {
24  if ($report['name'] == $form['report']) {
25  // Load the report include file
26  $rpt_inc_path = $report['path'];
27  }
28  }
29 
30  // try and include the report, fail otherwise
31  if (!@include_once($rpt_inc_path)) {
32  array_pop($_SESSION['ona']['work_space']['history']);
33  $html .= "<br><center><font color=\"red\"><b>The report {$form['report']} doesn't exist!</b></font></center>";
34  $response = new xajaxResponse();
35  $response->addAssign("work_space_content", "innerHTML", $html);
36  return($response->getXML());
37  }
38 
39  // Update History Title
40  $history = array_pop($_SESSION['ona']['work_space']['history']);
41  $js .= "xajax_window_submit('work_space', ' ', 'rewrite_history');";
42  if ($history['title'] == $window_name) {
43  $history['title'] = $form['report'];
44  array_push($_SESSION['ona']['work_space']['history'], $history);
45  }
46 
47  // Get the html form for this report
48  list($status, $rpt_html_form, $rpt_js) = rpt_html_form($form['report'],$form);
49 
50  $html .= <<<EOL
51  <!-- FORMATTING TABLE -->
52  <div class="content_box">
53  {$rpt_html_form}
54  </div>
55  <!-- END OF TOP SECTION -->
56 
57  <!-- REPORT CONTENT -->
58 
59  <div id='report_content'>
60  {$conf['loading_icon']}
61  </div>
62 
63 
64 EOL;
65 
66  // Now tell the window to call the actual code to run the report and replace the loading_icon
67  $js .= "xajax_window_submit('display_report', xajax.getFormValues('{$form['report']}_report_form'), 'run_report');";
68 
69  // Insert the new html into the window
70  // Instantiate the xajaxResponse object
71  $response = new xajaxResponse();
72  $response->addAssign("work_space_content", "innerHTML", $html);
73  if ($js) { $response->addScript($js); }
74  if ($rpt_js) { $response->addScript($rpt_js); }
75  return($response->getXML());
76 }
77 
78 
79 
81 // Function: ws_run_report()
82 //
83 // Description:
84 // Executes the report and replaces the report_content div with the output
86 function ws_run_report($window_name, $form='') {
87 
88  // Get the plugin location info.
89  $reportlist = plugin_list('report');
90 
91  // Loop through the list of reports till we find the matching name
92  foreach($reportlist as $report) {
93  if ($report['name'] == $form['report']) {
94  // Load the report include file
95  if (require_once($report['path'])) {
96  // Run the report and put it in the report_content box
97  list($status, $report_output) = rpt_run($form, 'html');
98  }
99  }
100  }
101 
102  // Insert the new html into the window
103  // Instantiate the xajaxResponse object
104  $response = new xajaxResponse();
105  $response->addAssign("report_content", "innerHTML", $report_output);
106  if ($js) { $response->addScript($js); }
107  return($response->getXML());
108 }
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 ?>
ws_run_report
ws_run_report($window_name, $form='')
Definition: display_report.inc.php:86
$status
$status
Definition: install.php:12
$onadb
global $onadb
Definition: 2-to-3.php:15
rpt_run
rpt_run($form, $output_format='html')
Definition: report.inc.php:18
ws_display
ws_display($window_name, $form='')
Definition: display_report.inc.php:10
$images
$images
Definition: config.inc.php:26
EOL
< a style="text-decoration: none;" href="/">< input class='edit' type="button" value="I don't like free stuff?" onclick=""/></a ></center ></div > EOL
Definition: install.php:40
rpt_html_form
rpt_html_form($report_name, $rptform='', $rptjs='')
Definition: report.inc.php:65
$_SESSION
$_SESSION['ona']['auth']
Definition: login.php:14
$conf
global $conf
Definition: 2-to-3.php:15
xajaxResponse
Definition: xajaxResponse.inc.php:68
$style
$style['font-family']
Definition: config.inc.php:158
$self
global $self
Definition: 2-to-3.php:15
$color
if($_SERVER['SERVER_PORT']==443) $color['bg']
Definition: config.inc.php:119
plugin_list
plugin_list($type='')
Definition: functions_gui.inc.php:62
parse_options_string
parse_options_string($input)
Definition: xajax_setup.inc.php:88