protected static function search_test_profiles($q) { $ret = null; foreach (pts_openbenchmarking::available_tests() as $test) { $tp = new pts_test_profile($test); if (stripos($test, $q) !== false || stripos($tp->get_title(), $q) === 0) { $ret .= '<h3>' . $tp->get_title() . '</h3><p>' . $tp->get_description() . '<br /><a href="http://openbenchmarking.org/test/' . $tp->get_identifier(false) . '">Learn More On OpenBenchmarking.org</a></p>'; } } return $ret; }
public static function render_page_process($PATH) { $test_profile = new pts_test_profile($_GET['tp']); $name = $test_profile->get_title(); $description = $test_profile->get_description(); echo '<h2>' . $name . ' [' . $test_profile->get_identifier() . '] </h2>'; echo '<p><em>' . $description . '</em></p>'; echo '<p>More information on this test can be found via <a target="_blank" href="http://openbenchmarking.org/test/' . $test_profile->get_identifier() . '">OpenBenchmarking.org</a>.</p>'; $test_options = $test_profile->get_test_option_objects(); echo '<input type="hidden" name="test_add[]" value="' . $test_profile->get_identifier() . '" />'; $test_prefix = "test_option_" . str_replace('.', '-', microtime(true)) . "_"; echo '<input type="hidden" name="test_prefix[]" value="' . $test_prefix . '" />'; if (count($test_options) == 0) { echo '<p><strong>No configurable user options for this test.</strong></p>'; } else { for ($i = 0; $i < count($test_options); $i++) { $o = $test_options[$i]; $option_count = $o->option_count(); echo '<p id="' . $test_prefix . $o->get_identifier() . '_name">' . $o->get_name() . '</p>'; if ($option_count == 0) { echo '<p><input type="text" name="' . $test_prefix . $o->get_identifier() . '" id="' . $test_prefix . $o->get_identifier() . '" /></p>'; } else { echo '<input name="' . $test_prefix . $o->get_identifier() . '_selected" id="' . $test_prefix . $o->get_identifier() . '_selected" type="hidden" value="' . $o->get_name() . ': ' . $o->get_option_name(0) . '" />'; echo '<p><select name="' . $test_prefix . $o->get_identifier() . '" id="' . $test_prefix . $o->get_identifier() . '" onChange="phoromatic_test_select_update_selected_name(this);">'; $opts = array(); for ($j = 0; $j < $option_count; $j++) { $v = $o->format_option_value_from_input($o->get_option_value($j)); echo '<option value="' . $v . '">' . $o->get_option_name($j) . '</option>'; array_push($opts, $o->get_name() . ': ' . $o->get_option_name($j) . '::' . $v); } if ($j > 1) { echo '<option value="' . implode('||', $opts) . '">Test All Options</option>'; } echo '</select></p>'; } } } echo '<hr />'; }
public static function render_page_process($PATH) { $test_profile = new pts_test_profile($_GET['tp']); $name = $test_profile->get_title(); $description = $test_profile->get_description(); echo '<h2>' . $name . ' [' . $test_profile->get_identifier() . '] </h2>'; echo '<p><em>' . $description . '</em></p>'; echo '<p>More information on this test can be found via <a target="_blank" href="http://openbenchmarking.org/test/' . $test_profile->get_identifier() . '">OpenBenchmarking.org</a>.</p>'; $test_options = $test_profile->get_test_option_objects(); if (count($test_options) == 0) { echo '<p><strong>No configurable user options for this test.</strong></p>'; } else { for ($i = 0; $i < count($test_options); $i++) { $o = $test_options[$i]; $option_count = $o->option_count(); echo '<input type="hidden" name="test_add[]" value="' . $test_profile->get_identifier() . '" />'; if (isset($_GET['build_suite'])) { $test_prefix = "test_option_" . microtime() . "_"; echo '<input type="hidden" name="test_prefix[]" value="' . $test_prefix . '" />'; } else { $test_prefix = "test_option_" . $_GET['tp'] . "_"; } echo '<p id="' . $test_prefix . $o->get_identifier() . '_name">' . $o->get_name() . '</p>'; if ($option_count == 0) { echo '<p><input type="text" name="' . $test_prefix . $o->get_identifier() . '" id="' . $test_prefix . $o->get_identifier() . '" /></p>'; } else { echo '<input name="' . $test_prefix . $o->get_identifier() . '_selected" id="' . $test_prefix . $o->get_identifier() . '_selected" type="hidden" value="' . $o->get_name() . ': ' . $o->get_option_name(0) . '" />'; echo '<p><select name="' . $test_prefix . $o->get_identifier() . '" id="' . $test_prefix . $o->get_identifier() . '" onChange="phoromatic_test_select_update_selected_name(this);">'; for ($j = 0; $j < $option_count; $j++) { echo '<option value="' . $o->format_option_value_from_input($o->get_option_value($j)) . '">' . $o->get_option_name($j) . '</option>'; } echo '</select></p>'; } } } echo '<br /><br /><p><input name="submit" value="Add" type="submit" onclick="" /></p>'; }
public static function render_page_process($PATH) { $main = null; $identifier_item = isset($PATH[1]) ? $PATH[0] . '/' . $PATH[1] : false; if ($identifier_item && pts_test_profile::is_test_profile($identifier_item)) { $tp = new pts_test_profile($identifier_item); $tp_identifier = $tp->get_identifier(false); $main .= '<h1>' . $tp->get_title() . '</h1><p>' . $tp->get_description() . '</p>'; $main .= '<p><strong>' . $tp->get_test_hardware_type() . ' - ' . phoromatic_server::test_result_count_for_test_profile($_SESSION['AccountID'], $tp_identifier) . ' Results On This Account - ' . $tp->get_test_software_type() . ' - Maintained By: ' . $tp->get_maintainer() . ' - Supported Platforms: ' . implode(', ', $tp->get_supported_platforms()) . '</strong></p>'; $main .= '<p><a href="http://openbenchmarking.org/test/' . $tp_identifier . '">Find out more about this test profile on OpenBenchmarking.org</a>.</p>'; $main .= '<h2>Recent Results With This Test</h2>'; $stmt = phoromatic_server::$db->prepare('SELECT Title, PPRID FROM phoromatic_results WHERE AccountID = :account_id AND UploadID IN (SELECT DISTINCT UploadID FROM phoromatic_results_results WHERE AccountID = :account_id AND TestProfile LIKE :tp) ORDER BY UploadTime DESC LIMIT 30'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':tp', $tp_identifier . '%'); $result = $stmt->execute(); $recent_result_count = 0; while ($result && ($row = $result->fetchArray())) { $recent_result_count++; $main .= '<h2><a href="/?result/' . $row['PPRID'] . '">' . $row['Title'] . '</a></h2>'; } if ($recent_result_count == 0) { $main .= '<p>No results found on this Phoromatic Server for the ' . $tp->get_title() . ' test profile.</p>'; } else { if ($recent_result_count > 5) { $stmt = phoromatic_server::$db->prepare('SELECT UploadID, SystemID, UploadTime FROM phoromatic_results WHERE AccountID = :account_id AND UploadID IN (SELECT DISTINCT UploadID FROM phoromatic_results_results WHERE AccountID = :account_id AND TestProfile LIKE :tp) ORDER BY UploadTime DESC LIMIT 1000'); $stmt->bindValue(':account_id', $_SESSION['AccountID']); $stmt->bindValue(':tp', $tp_identifier . '%'); $result = $stmt->execute(); $recent_result_count = 0; $result_file = new pts_result_file(null, true); while ($result && ($row = $result->fetchArray())) { $composite_xml = phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $row['UploadID']) . 'composite.xml'; if (!is_file($composite_xml)) { continue; } // Add to result file $system_name = strtotime($row['UploadTime']) . ': ' . phoromatic_server::system_id_to_name($row['SystemID']); $sub_result_file = new pts_result_file($composite_xml, true); foreach ($sub_result_file->get_result_objects() as $obj) { if ($obj->test_profile->get_identifier(false) == $tp_identifier) { $obj->test_result_buffer->rename(null, $system_name); $result_file->add_result($obj); } } } $table = null; $extra_attributes = array('multi_way_comparison_invert_default' => false); $f = false; foreach ($result_file->get_result_objects() as $obj) { $obj->test_profile->set_display_format('SCATTER_PLOT'); foreach ($obj->test_result_buffer->buffer_items as $i => &$item) { if (!is_numeric(substr($item->get_result_identifier(), 0, strpos($item->get_result_identifier(), ':')))) { unset($obj->test_result_buffer->buffer_items[$i]); } } $result_file = null; $main .= '<p align="center">' . pts_render::render_graph_inline_embed($obj, $result_file, $extra_attributes) . '</p>'; } } } } else { $dc = pts_strings::add_trailing_slash(pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/CacheDirectory', PTS_DOWNLOAD_CACHE_PATH))); $dc_exists = is_file($dc . 'pts-download-cache.json'); if ($dc_exists) { $cache_json = file_get_contents($dc . 'pts-download-cache.json'); $cache_json = json_decode($cache_json, true); } $test_counts_for_account = phoromatic_server::test_result_count_for_test_profiles($_SESSION['AccountID']); foreach (pts_openbenchmarking::available_tests() as $test) { $cache_checked = false; if ($dc_exists) { if ($cache_json && isset($cache_json['phoronix-test-suite']['cached-tests'])) { $cache_checked = true; if (!in_array($test, $cache_json['phoronix-test-suite']['cached-tests'])) { //continue; } } } if (!$cache_checked && phoromatic_server::read_setting('show_local_tests_only') && pts_test_install_request::test_files_in_cache($test, true, true) == false) { continue; } $tp = new pts_test_profile($test); if ($tp->get_title() == null) { continue; } $test_count = 0; $tpid = $tp->get_identifier(false); foreach ($test_counts_for_account as $test => $count) { if (strpos($test, $tpid) !== false) { $test_count += $count; unset($test_counts_for_account[$test]); } } $main .= '<h1 style="margin-bottom: 0;"><a href="/?tests/' . $tp->get_identifier(false) . '">' . $tp->get_title() . '</a></h1>'; $main .= '<p style="font-size: 90%;"><strong>' . $tp->get_test_hardware_type() . '</strong> <em>-</em> ' . $test_count . ' Results On This Account' . ' </p>'; } } echo phoromatic_webui_header_logged_in(); echo '<div id="pts_phoromatic_main_area">' . $main . '</div>'; echo phoromatic_webui_footer(); }