1<?php
2
3/*
4	Phoronix Test Suite
5	URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
6	Copyright (C) 2013 - 2015, Phoronix Media
7	Copyright (C) 2013 - 2015, Michael Larabel
8
9	This program is free software; you can redistribute it and/or modify
10	it under the terms of the GNU General Public License as published by
11	the Free Software Foundation; either version 3 of the License, or
12	(at your option) any later version.
13
14	This program is distributed in the hope that it will be useful,
15	but WITHOUT ANY WARRANTY; without even the implied warranty of
16	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17	GNU General Public License for more details.
18
19	You should have received a copy of the GNU General Public License
20	along with this program. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23
24class pts_webui_main implements pts_webui_interface
25{
26	public static function page_title()
27	{
28		return 'Available Tests';
29	}
30	public static function page_header()
31	{
32		return null;
33	}
34	public static function preload($PAGE)
35	{
36		return true;
37	}
38	public static function render_page_process($PATH)
39	{
40		echo '<div style="background: #CCC; padding: 10px; margin: 10px 20px;">Thanks for trying out the Phoronix Test Suite GUI. With Phoronix Test Suite 5.0 the GUI is still considered in an <strong>experimental / tech preview state</strong>. The GUI should be more end-user friendly and reach feature parity with the command-line interface in forthcoming releases. Your feedback is appreciated on the GUI while the command-line interface continues to be our primary focus along with remotely-managed enterprise features like <a href="http://www.phoromatic.com/">Phoromatic</a> and <a href="http://openbenchmarking.org/">OpenBenchmarking.org</a>. <a href="/early">Read more details on the GUI</a>.</div>';
41
42		echo '<h1>' . pts_core::program_title(false) . '</h1>';
43
44		echo '<div id="pts_side_pane">';
45
46			$hw_component_modal = array('CPU' => phodevi::read_property('cpu', 'model'), 'Motherboard' => phodevi::read_property('motherboard', 'identifier'), 'Memory' => phodevi::read_property('memory', 'identifier'), 'Disk' => phodevi::read_property('disk', 'identifier'), 'GPU' => phodevi::read_property('gpu', 'model'));
47
48			echo '<ul>';
49			foreach($hw_component_modal as $type => $component)
50			{
51				echo '<a href="/?component/' . $type . '"><li>' . $component . '</li></a>';
52			}
53			echo '</ul>';
54			echo '<hr />';
55
56			$sw_component_modal = array(1 => phodevi::read_property('system', 'operating-system'), 2 => phodevi::read_property('system', 'kernel-string'), 3 => phodevi::read_property('system', 'display-driver-string'), 4 => 'OpenGL ' . phodevi::read_property('system', 'opengl-driver'), 5 => phodevi::read_property('system', 'compiler'));
57
58			echo '<ul>';
59			foreach($sw_component_modal as $type => $component)
60			{
61				echo '<a href="/?component/Software"><li>' . $component . '</li></a>';
62			}
63			echo '</ul>';
64
65			echo '<div class="pts_pane_window"><strong>OpenBenchmarking.org</strong><br />Log-in to gain access to additional features.</div>';
66
67			echo '<ul>';
68			echo '<a href="/?settings"><li>Software Settings</li></a>';
69			echo '<a href="/?about"><li>About The Phoronix Test Suite</li></a>';
70			echo '</ul>';
71
72		echo '</div>';
73
74		echo '<div id="pts_search_bar">';
75		echo 'SEARCH: <input type="text" size="30" id="pts_search" name="search" onkeydown="if(event.keyCode == 13) { if(document.getElementById(\'pts_search\').value.length < 3) { alert(\'Please enter a longer search query.\'); return false; } else { window.location.href = \'/?search/\' + document.getElementById(\'pts_search\').value; } return false; }" />';
76		echo '</div>';
77
78		// Graphs
79		echo '<div id="svg_graphs" style="margin: 10px 0; text-align: right;"></div>';
80		echo '<div style="overflow: hidden;">';
81
82		echo '<div class="pts_list_box">';
83
84			$results = pts_tests::test_results_by_date();
85			$result_count = count($results);
86			$results = array_slice($results, 0, 10, true);
87			echo '<ol>';
88			echo '<li><u>Recent Benchmark Results</u></li>';
89			foreach($results as $result)
90			{
91				$result_file = new pts_result_file($result);
92				echo '<a href="?result/' . $result . '"><li>' . $result_file->get_title() . '</li></a>';
93			}
94			echo '<a href="?results"><li><strong>' . $result_count . ' Results Saved</strong></li></a>';
95			echo '</ol>';
96		echo '</div>';
97
98		echo '<div class="pts_list_box">';
99
100			$tests = pts_openbenchmarking_client::recently_updated_tests(10);
101			echo '<ol>';
102			echo '<li><u>Recently Updated Tests</u></li>';
103			foreach($tests as $test)
104			{
105				$test_profile = new pts_test_profile($test);
106				echo '<a href="?test/' . $test . '"><li>' . $test_profile->get_title() . '</li></a>';
107			}
108			echo '<a href="?tests"><li><strong>' . pts_openbenchmarking_client::tests_available() . ' Tests Available</strong></li></a>';
109			echo '</ol>';
110		echo '</div>';
111
112		echo '<div class="pts_list_box">';
113
114			$tests = pts_openbenchmarking_client::popular_tests(10);
115			echo '<ol>';
116			echo '<li><u>Most Popular Tests</u></li>';
117			foreach($tests as $test)
118			{
119				$test_profile = new pts_test_profile($test);
120				echo '<a href="?test/' . $test . '"><li>' . $test_profile->get_title() . '</li></a>';
121			}
122			echo '<a href="?tests"><li><strong>' . pts_openbenchmarking_client::tests_available() . ' Tests Available</strong></li></a>';
123			echo '</ol>';
124		echo '</div>';
125
126		echo '</div>';
127
128		echo '<script text="text/javascript">
129
130			pts_web_socket.add_onopen_event("user-svg-system-graphs");
131			setInterval(function(){if(pts_web_socket.is_connected()) { pts_web_socket.send("user-svg-system-graphs"); }},1000);
132			pts_web_socket.add_onmessage_event("svg_graphs", "update_svg_graph_space");
133		</script>';
134	}
135}
136
137?>
138