1<?php 2 3/* 4 Phoronix Test Suite 5 URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/ 6 Copyright (C) 2014, Phoronix Media 7 Copyright (C) 2014, 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 phoromatic_component_table implements pts_webui_interface 25{ 26 public static function page_title() 27 { 28 return 'System Component Table'; 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 phoromatic_webui_header_logged_in(); 41 42 $main = '<h1>System Components</h1>'; 43 $main .= '<p>Detected hardware/software components via Phoronix Test Suite\'s Phodevi implementation on the Phoromatic client systems.</p>'; 44 $stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, Hardware, Software, ClientVersion, NetworkWakeOnLAN, NetworkMAC FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY Title ASC'); 45 $stmt->bindValue(':account_id', $_SESSION['AccountID']); 46 $result = $stmt->execute(); 47 48 while($row = $result->fetchArray()) 49 { 50 $components[$row['SystemID']] = array_merge(pts_result_file_analyzer::system_component_string_to_array($row['Software'], array('OS', 'Kernel', 'OpenGL', 'File-System')), pts_result_file_analyzer::system_component_string_to_array($row['Hardware'], array('Processor', 'Motherboard', 'Memory', 'Disk', 'Graphics'))); 51 $components[$row['SystemID']]['Phoronix Test Suite'] = $row['ClientVersion']; 52 $components[$row['SystemID']]['WoL Info'] = $row['NetworkWakeOnLAN']; 53 $components[$row['SystemID']]['MAC'] = $row['NetworkMAC']; 54 $system_ids[$row['SystemID']] = $row['Title']; 55 } 56 57 $main .= '<div style="margin: 10px auto; overflow: auto;"><table>'; 58 $component_types = array('MAC', 'Processor', 'Motherboard', 'Memory', 'Disk', 'Graphics', 'OS', 'Kernel', 'OpenGL', 'File-System', 'Phoronix Test Suite', 'WoL Info'); 59 $main .= '<tr><th> </th>'; 60 foreach($component_types as $type) 61 { 62 $main .= '<th>' . $type . '</th>'; 63 } 64 foreach($components as $system_id => $component_array) 65 { 66 $main .= '<tr>'; 67 $main .= '<th><a href="/?systems/' . $system_id . '">' . $system_ids[$system_id] . '</a></th>'; 68 foreach($component_types as $type) 69 { 70 $c = (isset($component_array[$type]) ? $component_array[$type] : 'N/A'); 71 if(($x = stripos($c, ' @ ')) !== false) 72 { 73 $c = substr($c, 0, $x); 74 } 75 if(($x = stripos($c, ' (')) !== false) 76 { 77 $c = substr($c, 0, $x); 78 } 79 80 $main .= '<td>' . $c . '</td>'; 81 } 82 83 $main .= '</tr>'; 84 85 86 } 87 $main .= '</table></div>'; 88 89 $right = null; 90 echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in($right)); 91 echo phoromatic_webui_footer(); 92 } 93} 94 95?> 96