public static function render_page_process($PATH)
 {
     echo '<h1>' . self::$result_file->get_title() . '</h2>';
     $extra_attributes = array();
     $intent = null;
     if (self::$result_file->get_system_count() == 1 || ($intent = pts_result_file_analyzer::analyze_result_file_intent(self::$result_file, $intent, true))) {
         $table = new pts_ResultFileCompactSystemsTable(self::$result_file, $intent);
     } else {
         $table = new pts_ResultFileSystemsTable(self::$result_file);
     }
     echo '<p class="result_object">' . pts_render::render_graph_inline_embed($table, self::$result_file, $extra_attributes) . '</p>';
     foreach (self::$result_file->get_result_objects() as $i => $result_object) {
         echo '<h2><a name="r-' . $i . '"></a>' . $result_object->test_profile->get_title() . '</h2>';
         echo '<p class="result_object">';
         echo pts_render::render_graph_inline_embed($result_object, self::$result_file, $extra_attributes);
         echo '</p>';
     }
 }
Exemplo n.º 2
0
 public static function report_system_notes_to_table(&$result_file, &$table)
 {
     $identifier_count = 0;
     $system_attributes = array();
     foreach ($result_file->get_systems() as $s) {
         $json = $s->get_json();
         $identifier = $s->get_identifier();
         $identifier_count++;
         if (isset($json['kernel-parameters']) && $json['kernel-parameters'] != null) {
             $system_attributes['Kernel'][$identifier] = $json['kernel-parameters'];
         }
         if (isset($json['environment-variables']) && $json['environment-variables'] != null) {
             $system_attributes['Environment'][$identifier] = $json['environment-variables'];
         }
         if (isset($json['compiler-configuration']) && $json['compiler-configuration'] != null) {
             $system_attributes['Compiler'][$identifier] = $json['compiler-configuration'];
         }
         if (isset($json['disk-scheduler']) && isset($json['disk-mount-options'])) {
             $system_attributes['Disk'][$identifier] = $json['disk-scheduler'] . ' / ' . $json['disk-mount-options'];
         }
         if (isset($json['cpu-scaling-governor'])) {
             $system_attributes['Processor'][$identifier] = 'Scaling Governor: ' . $json['cpu-scaling-governor'];
         }
         if (isset($json['graphics-2d-acceleration']) || isset($json['graphics-aa']) || isset($json['graphics-af'])) {
             $report = array();
             foreach (array('graphics-2d-acceleration', 'graphics-aa', 'graphics-af') as $check) {
                 if (isset($json[$check]) && !empty($json[$check])) {
                     array_push($report, $json[$check]);
                 }
             }
             $system_attributes['Graphics'][$identifier] = implode(' - ', $report);
         }
         if (isset($json['graphics-compute-cores'])) {
             $system_attributes['OpenCL'][$identifier] = 'GPU Compute Cores: ' . $json['graphics-compute-cores'];
         }
     }
     if (isset($system_attributes['compiler']) && count($system_attributes['compiler']) == 1 && ($result_file->get_system_count() > 1 && ($intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true)) && isset($intent[0]) && is_array($intent[0]) && array_shift($intent[0]) == 'Compiler') == false) {
         // Only show compiler strings when it's meaningful (since they tend to be long strings)
         unset($system_attributes['compiler']);
     }
     foreach ($system_attributes as $index_name => $attributes) {
         $unique_attribue_count = count(array_unique($attributes));
         $section = $identifier_count > 1 ? ucwords($index_name) : null;
         switch ($unique_attribue_count) {
             case 0:
                 break;
             case 1:
                 if ($identifier_count == count($attributes)) {
                     // So there is something for all of the test runs and it's all the same...
                     $table->addTestNote(array_pop($attributes), null, $section);
                 } else {
                     // There is missing data for some test runs for this value so report the runs this is relevant to.
                     $table->addTestNote(implode(', ', array_keys($attributes)) . ': ' . array_pop($attributes), null, $section);
                 }
                 break;
             default:
                 foreach ($attributes as $identifier => $configuration) {
                     $table->addTestNote($identifier . ': ' . $configuration, null, $section);
                 }
                 break;
         }
     }
 }
Exemplo n.º 3
0
 public static function generate_result_file_graphs($test_results_identifier, $save_to_dir = false, $extra_attributes = null)
 {
     if ($save_to_dir) {
         if (pts_file_io::mkdir($save_to_dir . '/result-graphs') == false) {
             // Directory must exist, so remove any old graph files first
             foreach (pts_file_io::glob($save_to_dir . '/result-graphs/*') as $old_file) {
                 unlink($old_file);
             }
         }
     }
     if ($test_results_identifier instanceof pts_result_file) {
         $result_file =& $test_results_identifier;
     } else {
         $result_file = new pts_result_file($test_results_identifier);
     }
     $generated_graphs = array();
     $generated_graph_tables = false;
     // Render overview chart
     if ($save_to_dir) {
         $chart = new pts_ResultFileTable($result_file);
         $chart->renderChart($save_to_dir . '/result-graphs/overview.BILDE_EXTENSION');
         $intent = -1;
         if (($intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true)) || $result_file->get_system_count() == 1) {
             $chart = new pts_ResultFileCompactSystemsTable($result_file, $intent);
         } else {
             $chart = new pts_ResultFileSystemsTable($result_file);
         }
         $chart->renderChart($save_to_dir . '/result-graphs/systems.BILDE_EXTENSION');
         unset($chart);
         if ($intent && is_dir($save_to_dir . '/system-logs/')) {
             $chart = new pts_DetailedSystemComponentTable($result_file, $save_to_dir . '/system-logs/', $intent);
             if ($chart) {
                 $chart->renderChart($save_to_dir . '/result-graphs/detailed_component.BILDE_EXTENSION');
             }
         }
     }
     $result_objects = $result_file->get_result_objects();
     $test_titles = array();
     foreach ($result_objects as &$result_object) {
         array_push($test_titles, $result_object->test_profile->get_title());
     }
     $offset = 0;
     foreach ($result_objects as $key => &$result_object) {
         $save_to = $save_to_dir;
         $offset++;
         if ($save_to_dir && is_dir($save_to_dir)) {
             $save_to .= '/result-graphs/' . $offset . '.BILDE_EXTENSION';
             if (PTS_IS_CLIENT) {
                 if ($result_file->is_multi_way_comparison(null, $extra_attributes) || pts_client::read_env('GRAPH_GROUP_SIMILAR')) {
                     $table_keys = array();
                     foreach ($test_titles as $this_title_index => $this_title) {
                         if (isset($test_titles[$key]) && $this_title == $test_titles[$key]) {
                             array_push($table_keys, $this_title_index);
                         }
                     }
                 } else {
                     $table_keys = $key;
                 }
                 $chart = new pts_ResultFileTable($result_file, null, $table_keys);
                 $chart->renderChart($save_to_dir . '/result-graphs/' . $offset . '_table.BILDE_EXTENSION');
                 unset($chart);
                 $generated_graph_tables = true;
             }
         }
         $graph = pts_render::render_graph($result_object, $result_file, $save_to, $extra_attributes);
         array_push($generated_graphs, $graph);
     }
     // Generate mini / overview graphs
     if ($save_to_dir) {
         $graph = new pts_OverviewGraph($result_file);
         if ($graph->doSkipGraph() == false) {
             $graph->renderGraph();
             // Check to see if skip_graph was realized during the rendering process
             if ($graph->doSkipGraph() == false) {
                 $graph->svg_dom->output($save_to_dir . '/result-graphs/visualize.BILDE_EXTENSION');
             }
         }
         unset($graph);
         $graph = new pts_RadarOverviewGraph($result_file);
         if ($graph->doSkipGraph() == false) {
             $graph->renderGraph();
             // Check to see if skip_graph was realized during the rendering process
             if ($graph->doSkipGraph() == false) {
                 $graph->svg_dom->output($save_to_dir . '/result-graphs/radar.BILDE_EXTENSION');
             }
         }
         unset($graph);
     }
     // Save XSL
     if (count($generated_graphs) > 0 && $save_to_dir) {
         file_put_contents($save_to_dir . '/pts-results-viewer.xsl', pts_client::xsl_results_viewer_graph_template($generated_graph_tables));
     }
     return $generated_graphs;
 }
Exemplo n.º 4
0
 public static function compact_result_file_test_object(&$mto, &$result_table = false, &$result_file, $extra_attributes = null)
 {
     $identifiers_inverted = $result_file && $result_file->is_multi_way_inverted();
     // TODO: this may need to be cleaned up, its logic is rather messy
     $condense_multi_way = isset($extra_attributes['condense_multi_way']);
     if (count($mto->test_profile->get_result_scale_offset()) > 0) {
         // It's already doing something
         return;
     }
     $scale_special = array();
     $days = array();
     $systems = array();
     $prev_date = null;
     $is_tracking = true;
     $sha1_short_count = 0;
     $buffer_count = $mto->test_result_buffer->get_count();
     if ($identifiers_inverted) {
         $system_index = 0;
         $date_index = 1;
     } else {
         $system_index = 1;
         $date_index = 0;
     }
     foreach ($mto->test_result_buffer->get_buffer_items() as $buffer_item) {
         $identifier = array_map('trim', explode(':', $buffer_item->get_result_identifier()));
         switch (count($identifier)) {
             case 2:
                 $system = $identifier[$system_index];
                 $date = $identifier[$date_index];
                 break;
             case 1:
                 $system = 0;
                 $date = $identifier[0];
                 break;
             default:
                 return;
                 break;
         }
         if (!isset($systems[$system])) {
             $systems[$system] = 0;
         }
         if (!isset($days[$date])) {
             $days[$date] = null;
         }
         if ($is_tracking) {
             // First do a dirty SHA1 hash check
             if (strlen($date) != 40 || strpos($date, ' ') !== false) {
                 if (($x = strpos($date, ' + ')) !== false) {
                     $date = substr($date, 0, $x);
                 }
                 // Check to see if only numeric changes are being made
                 $sha1_short_hash_ending = isset($date[7]) && ctype_alnum(substr($date, -8));
                 $date = str_replace('s', null, pts_strings::remove_from_string($date, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DASH | pts_strings::CHAR_DECIMAL));
                 if ($sha1_short_hash_ending) {
                     $sha1_short_count++;
                 }
                 if ($prev_date != null && $date != $prev_date && $sha1_short_hash_ending == false && $sha1_short_count < 3) {
                     $is_tracking = false;
                 }
                 $prev_date = $date;
             }
         }
     }
     if ($is_tracking) {
         $prev_date_r = explode(' ', $prev_date);
         if (count($prev_date_r) == 2 && ctype_alpha($prev_date_r[0])) {
             // This check should make it so when like testing every Ubuntu releases (Ubuntu 11.04, Ubuntu 11.10, etc) it's not in a line graph
             $is_tracking = false;
         }
     } else {
         if ($is_tracking == false && $sha1_short_count > 5) {
             // It's probably actually tracking..... based upon Stefan's Wine 1.4 example on 15 March 2012
             $is_tracking = true;
         }
     }
     foreach (array_keys($days) as $day_key) {
         $days[$day_key] = $systems;
     }
     $raw_days = $days;
     $json_days = $days;
     foreach ($mto->test_result_buffer->get_buffer_items() as $buffer_item) {
         $identifier = array_map('trim', explode(':', $buffer_item->get_result_identifier()));
         switch (count($identifier)) {
             case 2:
                 $system = $identifier[$system_index];
                 $date = $identifier[$date_index];
                 break;
             case 1:
                 $system = 0;
                 $date = $identifier[0];
                 break;
             default:
                 return;
                 break;
         }
         $days[$date][$system] = $buffer_item->get_result_value();
         $raw_days[$date][$system] = $buffer_item->get_result_raw();
         $json_days[$date][$system] = $buffer_item->get_result_json();
         if (!is_numeric($days[$date][$system])) {
             return;
         }
     }
     $mto->test_result_buffer = new pts_test_result_buffer();
     $day_keys = array_keys($days);
     if ($condense_multi_way) {
         $mto->set_used_arguments_description($mto->get_arguments_description() . ' | Composite Of: ' . implode(' - ', array_keys($days)));
         foreach (array_keys($systems) as $system_key) {
             $sum = 0;
             $count = 0;
             foreach ($day_keys as $day_key) {
                 $sum += $days[$day_key][$system_key];
                 $count++;
             }
             $mto->test_result_buffer->add_test_result($system_key, $sum / $count);
         }
     } else {
         $mto->test_profile->set_result_scale($mto->test_profile->get_result_scale() . ' | ' . implode(',', array_keys($days)));
         if ($is_tracking && $buffer_count < 16 && $result_file && pts_result_file_analyzer::analyze_result_file_intent($result_file) == false) {
             // It can't be a tracker if the result file is comparing hardware/software, etc
             $is_tracking = false;
         }
         switch ($mto->test_profile->get_display_format()) {
             //case 'HORIZONTAL_BOX_PLOT':
             //	$mto->test_profile->set_display_format('HORIZONTAL_BOX_PLOT_MULTI');
             //	break;
             case 'SCATTER_PLOT':
                 break;
             default:
                 $line_graph_type = 'LINE_GRAPH';
                 $mto->test_profile->set_display_format(!isset($extra_attributes['force_tracking_line_graph']) && (count($days) < 5 || $is_tracking == false && !isset($extra_attributes['force_line_graph_compact'])) ? 'BAR_ANALYZE_GRAPH' : $line_graph_type);
                 break;
         }
         foreach (array_keys($systems) as $system_key) {
             $results = array();
             $raw_results = array();
             $json_results = array();
             foreach ($day_keys as $day_key) {
                 array_push($results, $days[$day_key][$system_key]);
                 array_push($raw_results, $raw_days[$day_key][$system_key]);
                 pts_arrays::unique_push($json_results, $json_days[$day_key][$system_key]);
             }
             // TODO XXX: Make JSON data work for multi-way comparisons!
             if (count($json_results) == 1) {
                 $json = array_shift($json_results);
             } else {
                 $json = null;
             }
             $mto->test_result_buffer->add_test_result($system_key, implode(',', $results), implode(',', $raw_results), $json);
         }
     }
     if ($result_table !== false) {
         foreach (array_keys($systems) as $system_key) {
             foreach ($day_keys as $day_key) {
                 if (!isset($result_table[$system_key][$day_key])) {
                     $result_table[$system_key][$day_key] = array();
                 }
                 array_push($result_table[$system_key][$day_key], $days[$day_key][$system_key], $raw_days[$day_key][$system_key]);
             }
         }
     }
 }
    public static function render_page_process($PATH)
    {
        $main = null;
        if (isset($PATH[0])) {
            $upload_ids = explode(',', $PATH[0]);
            foreach ($upload_ids as $i => $upload_id) {
                if (isset($upload_id[5]) && substr($upload_id, 0, 2) == 'S:') {
                    $t = explode(':', $upload_id);
                    $stmt = phoromatic_server::$db->prepare('SELECT UploadID, UploadTime FROM phoromatic_results WHERE AccountID = :account_id AND ScheduleID = :schedule_id ORDER BY UploadTime DESC');
                    $stmt->bindValue(':account_id', $_SESSION['AccountID']);
                    $stmt->bindValue(':schedule_id', $t[1]);
                    $test_result_result = $stmt->execute();
                    $cutoff_time = is_numeric($t[2]) ? strtotime('today -' . $t[2] . ' days') : false;
                    while ($test_result_row = $test_result_result->fetchArray()) {
                        if ($cutoff_time !== false && strtotime($test_result_row['UploadTime']) < $cutoff_time) {
                            break;
                        }
                        $upload_ids[] = $test_result_row['UploadID'];
                    }
                    unset($upload_ids[$i]);
                }
            }
            $upload_ids = array_unique($upload_ids);
            $result_files = array();
            $display_rows = array();
            $system_types = array();
            $schedule_types = array();
            $trigger_types = array();
            $upload_times = array();
            $benchmark_tickets = array();
            $xml_result_hash = array();
            $tickets = array();
            foreach ($upload_ids as $id) {
                $result_share_opt = phoromatic_server::read_setting('force_result_sharing') ? '1 = 1' : 'AccountID = (SELECT AccountID FROM phoromatic_account_settings WHERE LetOtherGroupsViewResults = "1" AND AccountID = phoromatic_results.AccountID)';
                $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE PPRID = :pprid AND (AccountID = :account_id OR ' . $result_share_opt . ') LIMIT 1');
                $stmt->bindValue(':pprid', $id);
                $stmt->bindValue(':account_id', $_SESSION['AccountID']);
                $result = $stmt->execute();
                $row = $result->fetchArray();
                if (false && empty($row)) {
                    // TODO XXX
                    // XXX this code is ultimately dead
                    $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND UploadID = :upload_id LIMIT 1');
                    $stmt->bindValue(':account_id', $_SESSION['AccountID']);
                    $stmt->bindValue(':upload_id', $id);
                    $result = $stmt->execute();
                    $row = $result->fetchArray();
                }
                if (empty($row)) {
                    continue;
                }
                $composite_xml = phoromatic_server::phoromatic_account_result_path($row['AccountID'], $row['UploadID']) . 'composite.xml';
                if (!is_file($composite_xml)) {
                    echo 'File Not Found: ' . $composite_xml;
                    return false;
                }
                $display_rows[$composite_xml] = $row;
                pts_arrays::unique_push($benchmark_tickets, $row['BenchmarkTicketID']);
                pts_arrays::unique_push($upload_times, $row['UploadTime']);
                pts_arrays::unique_push($xml_result_hash, $row['XmlUploadHash']);
                pts_arrays::unique_push($system_types, $row['SystemID']);
                pts_arrays::unique_push($schedule_types, $row['ScheduleID']);
                pts_arrays::unique_push($trigger_types, $row['Trigger']);
                pts_arrays::unique_push($tickets, $row['BenchmarkTicketID']);
                // Update view counter
                $stmt_view = phoromatic_server::$db->prepare('UPDATE phoromatic_results SET TimesViewed = (TimesViewed + 1) WHERE AccountID = :account_id AND UploadID = :upload_id');
                $stmt_view->bindValue(':account_id', $_SESSION['AccountID']);
                $stmt_view->bindValue(':upload_id', $row['UploadID']);
                $stmt_view->execute();
            }
            $result_file_title = null;
            if (count($system_types) == 1) {
                $result_file_title = phoromatic_system_id_to_name($system_types[0]) . ' Tests';
            }
            if (!empty($tickets) && $tickets[0] != null) {
                $system_name_format = 'ORIGINAL_DATA';
            } else {
                if (count($trigger_types) == 1 && $trigger_types[0] != null && $benchmark_tickets[0] != null && count($display_rows) > 1) {
                    $system_name_format = 'TRIGGER_AND_SYSTEM';
                } else {
                    if (empty($schedule_types[0])) {
                        $system_name_format = 'ORIGINAL_DATA';
                    } else {
                        if (count($display_rows) == 1) {
                            $system_name_format = 'SYSTEM_NAME';
                        } else {
                            if (count($schedule_types) == 1 && count($system_types) == 1) {
                                $system_name_format = 'TRIGGER';
                                $result_file_title = phoromatic_schedule_id_to_name($schedule_types[0]);
                            } else {
                                if (count($schedule_types) == 1) {
                                    $system_name_format = 'TRIGGER_AND_SYSTEM';
                                } else {
                                    if (false && count($trigger_types) == 1) {
                                        // TODO XXX: this approach yields garbage strings generally without refining the selector
                                        // i.e. first make sure all the schedules match or are comparable
                                        $system_name_format = 'SYSTEM_AND_SCHEDULE';
                                    } else {
                                        $system_name_format = null;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (count($schedule_types) == 1 && $schedule_types[0] != 0) {
                self::$schedule_id = $schedule_types[0];
            }
            foreach ($display_rows as $composite_xml => $row) {
                //  $row['SystemID'] . ' ' . $row['ScheduleID'] . ' ' . $row['Trigger']
                switch ($system_name_format) {
                    case 'ORIGINAL_DATA':
                        $system_name = null;
                        break;
                    case 'SYSTEM_NAME':
                        $system_name = phoromatic_system_id_to_name($row['SystemID']);
                        break;
                    case 'TRIGGER':
                        $system_name = $row['Trigger'];
                        break;
                    case 'TRIGGER_AND_SYSTEM':
                        $system_name = phoromatic_system_id_to_name($row['SystemID']) . ': ' . $row['Trigger'];
                        break;
                    case 'SYSTEM_AND_SCHEDULE':
                        $system_name = phoromatic_schedule_id_to_name($row['ScheduleID']) . ': ' . $row['Trigger'];
                        break;
                    default:
                        $system_name = phoromatic_system_id_to_name($row['SystemID']) . ' - ' . phoromatic_schedule_id_to_name($row['ScheduleID']) . ' - ' . $row['Trigger'];
                }
                if ($system_name == null) {
                    $rf = new pts_result_file($composite_xml);
                    $identifiers = $rf->get_system_identifiers();
                    if (count($identifiers) == 1) {
                        $system_name = $identifiers[0];
                    }
                }
                $system_name = str_replace('.SYSTEM', phoromatic_system_id_to_name($row['SystemID']), $system_name);
                $system_name = str_replace('.GROUP', phoromatic_account_id_to_group_name($row['AccountID']), $system_name);
                $system_variables = explode(';', phoromatic_server::system_id_variables($row['SystemID'], $row['AccountID']));
                foreach ($system_variables as $var) {
                    $var = explode('=', $var);
                    if (count($var) == 2) {
                        $system_name = str_replace('.' . $var[0], $var[1], $system_name);
                    }
                }
                $result_files[] = new pts_result_merge_select($composite_xml, null, $system_name);
            }
            $result_file = new pts_result_file(null, true);
            $result_file->set_title('Phoromatic Results');
            if (!empty($result_files)) {
                $attributes = array('new_result_file_title' => $result_file_title);
                if (!empty($result_files)) {
                    $result_file->merge($result_files, $attributes);
                }
            }
            $extra_attributes = array();
            if (isset($_GET['upload_to_openbenchmarking'])) {
                $ob_url = pts_openbenchmarking_client::upload_test_result($result_file, false);
                if ($ob_url) {
                    header('Location: ' . $ob_url);
                }
            }
            $attribute_options = array('normalize_results' => 'normalize_result_buffer', 'sort_by_performance' => 'sort_result_buffer_values', 'sort_by_reverse' => 'reverse_result_buffer', 'sort_by_name' => 'sort_result_buffer', 'condense_comparison' => 'condense_multi_way', 'force_line_graph' => 'force_tracking_line_graph');
            $url_append = null;
            foreach ($attribute_options as $web_var => $attr_var) {
                if (isset($_REQUEST[$web_var])) {
                    $extra_attributes[$attr_var] = true;
                    $url_append .= '&' . $web_var . '=1';
                }
            }
            if (isset($_POST['transpose_comparison'])) {
                $result_file->invert_multi_way_invert();
            }
            $intent = null;
            if (isset($_GET['download']) && $_GET['download'] == 'csv') {
                $result_csv = pts_result_file_output::result_file_to_csv($result_file);
                header('Content-Description: File Transfer');
                header('Content-Type: application/csv');
                header('Content-Disposition: attachment; filename=phoromatic-result.csv');
                header('Expires: 0');
                header('Cache-Control: must-revalidate');
                header('Pragma: public');
                header('Content-Length: ' . strlen($result_csv));
                ob_clean();
                flush();
                echo $result_csv;
                return;
            } else {
                if (isset($_GET['download']) && $_GET['download'] == 'txt') {
                    $result_txt = pts_result_file_output::result_file_to_text($result_file);
                    header('Content-Description: File Transfer');
                    header('Content-Type: application/txt');
                    header('Content-Disposition: attachment; filename=phoromatic-result.txt');
                    header('Expires: 0');
                    header('Cache-Control: must-revalidate');
                    header('Pragma: public');
                    header('Content-Length: ' . strlen($result_txt));
                    ob_clean();
                    flush();
                    echo $result_txt;
                    return;
                } else {
                    if (isset($_GET['download']) && $_GET['download'] == 'pdf') {
                        ob_start();
                        $_REQUEST['force_format'] = 'PNG';
                        // Force to PNG renderer
                        $_REQUEST['svg_dom_gd_no_interlacing'] = true;
                        // Otherwise FPDF will fail
                        $tdir = pts_client::create_temporary_directory();
                        pts_client::generate_result_file_graphs($result_file, $tdir, $extra_attributes);
                        $pdf = new pts_pdf_template($result_file->get_title(), null);
                        $pdf->AddPage();
                        $pdf->Image(PTS_CORE_STATIC_PATH . 'images/pts-308x160.png', 69, 85, 73, 38);
                        $pdf->Ln(120);
                        $pdf->WriteStatementCenter('www.phoronix-test-suite.com');
                        $pdf->Ln(15);
                        $pdf->WriteBigHeaderCenter($result_file->get_title());
                        $pdf->WriteText($result_file->get_description());
                        $pdf->AddPage();
                        $pdf->Ln(15);
                        $pdf->SetSubject($result_file->get_title() . ' Benchmarks');
                        //$pdf->SetKeywords(implode(', ', $identifiers));
                        $pdf->WriteHeader('Test Systems:');
                        foreach ($result_file->get_systems() as $s) {
                            $pdf->WriteMiniHeader($s->get_identifier());
                            $pdf->WriteText($s->get_hardware());
                            $pdf->WriteText($s->get_software());
                        }
                        $pdf->AddPage();
                        $placement = 1;
                        $results = $result_file->get_result_objects();
                        for ($i = 1; $i <= count($results); $i++) {
                            if (is_file($tdir . 'result-graphs/' . $i . '.png')) {
                                $pdf->Ln(100);
                                $pdf->Image($tdir . 'result-graphs/' . $i . '.png', 50, 40 + ($placement - 1) * 120, 120);
                            }
                            if ($placement == 2) {
                                $placement = 0;
                                if ($i != count($results)) {
                                    $pdf->AddPage();
                                }
                            }
                            $placement++;
                        }
                        ob_get_clean();
                        $pdf->Output('phoromatic.pdf', 'I');
                        //pts_file_io::delete($tdir, null, true);
                        return;
                    } else {
                        if (isset($_GET['download']) && $_GET['download'] == 'xml') {
                            echo $result_file->get_xml();
                            return;
                        }
                    }
                }
            }
            $main .= '<h1>' . $result_file->get_title() . '</h1>';
            $main .= phoromatic_annotate_entry('RESULT', implode(',', $upload_ids), 'TOP');
            if ($result_file->get_system_count() == 1 || ($intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true))) {
                $table = new pts_ResultFileCompactSystemsTable($result_file, $intent);
            } else {
                $table = new pts_ResultFileSystemsTable($result_file);
            }
            $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>';
            $table = new pts_ResultFileTable($result_file, $intent);
            $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>';
            $main .= '<div id="pts_results_area">';
            foreach ($result_file->get_result_objects(isset($_POST['show_only_changed_results']) ? 'ONLY_CHANGED_RESULTS' : -1) as $i => $result_object) {
                $main .= '<h2><a name="r-' . $i . '"></a><a name="' . $result_object->get_comparison_hash(true, false) . '"></a>' . $result_object->test_profile->get_title() . '</h2>';
                $main .= phoromatic_annotate_entry('RESULT', implode(',', $upload_ids), $result_object->get_comparison_hash(true, false));
                $main .= '<p class="result_object">';
                $main .= pts_render::render_graph_inline_embed($result_object, $result_file, $extra_attributes);
                $main .= '</p>';
            }
            $main .= '</div>';
        } else {
            // No result
        }
        $right = null;
        if (self::$schedule_id && !empty(self::$schedule_id)) {
            $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_schedules WHERE AccountID = :account_id AND ScheduleID = :schedule_id LIMIT 1');
            $stmt->bindValue(':account_id', $_SESSION['AccountID']);
            $stmt->bindValue(':schedule_id', self::$schedule_id);
            $result = $stmt->execute();
            $row = $result->fetchArray();
            if (!empty($row)) {
                $right .= '<h3><a href="?schedules/' . $row['ScheduleID'] . '">' . $row['Title'] . '</a></h3>';
                if (!empty($row['ActiveOn'])) {
                    $right .= '<p align="center"><strong>' . phoromatic_schedule_activeon_string($row['ActiveOn'], $row['RunAt']) . '</strong></p>';
                }
                $right .= '<p>Compare this result file to the latest results from the past: ';
                $right .= '<select name="view_results_from_past" id="view_results_from_past" onchange="phoromatic_jump_to_results_from(\'' . $row['ScheduleID'] . '\', \'view_results_from_past\', \'' . $PATH[0] . ',\');">';
                $oldest_upload_time = strtotime(phoromatic_oldest_result_for_schedule(self::$schedule_id));
                $opts = array('Week' => 7, 'Three Weeks' => 21, 'Month' => 30, 'Quarter' => 90, 'Six Months' => 180, 'Year' => 365);
                foreach ($opts as $str_name => $time_offset) {
                    if ($oldest_upload_time > time() - 86400 * $time_offset) {
                        break;
                    }
                    $right .= '<option value="' . $time_offset . '">' . $str_name . '</option>';
                }
                $right .= '<option value="all">All Results</option>';
                $right .= '</select>';
                $right .= '</p>';
            }
        }
        if (true) {
            $compare_results = array();
            $hash_matches = 0;
            $ticket_matches = 0;
            $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND ComparisonHash = :comparison_hash AND PPRID NOT IN (:pprid) ORDER BY UploadTime DESC LIMIT 12');
            $stmt->bindValue(':account_id', $_SESSION['AccountID']);
            $stmt->bindValue(':comparison_hash', $result_file->get_contained_tests_hash(false));
            $stmt->bindValue(':pprid', implode(',', $upload_ids));
            $result = $stmt->execute();
            while ($row = $result->fetchArray()) {
                $compare_results[$row['PPRID']] = $row;
                $hash_matches++;
            }
            foreach ($benchmark_tickets as $ticket_id) {
                $stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND BenchmarkTicketID = :ticket_id AND PPRID NOT IN (:pprid) ORDER BY UploadTime DESC LIMIT 12');
                $stmt->bindValue(':account_id', $_SESSION['AccountID']);
                $stmt->bindValue(':ticket_id', $ticket_id);
                $stmt->bindValue(':pprid', implode(',', $upload_ids));
                $result = $stmt->execute();
                while ($row = $result->fetchArray()) {
                    $compare_results[$row['PPRID']] = $row;
                    $ticket_matches++;
                }
            }
            if (!empty($compare_results)) {
                $right .= '<hr /><h3>Compare Results</h3><form name="compare_similar_results" onsubmit="return false;">
						<input type="hidden" value="' . implode(',', $upload_ids) . '" id="compare_similar_results_this" />';
                foreach ($compare_results as &$row) {
                    $right .= '<p><input type="checkbox" value="' . $row['PPRID'] . '" name="compare_results" /> ' . $row['Title'] . '<br /><em>' . phoromatic_system_id_to_name($row['SystemID'], $row['AccountID']) . '</em></p>';
                }
                $right .= '<p><input type="submit" value="Compare Results" id="compare_results_submit" onclick="javascript:phoromatic_do_custom_compare_results(this); return false;" /></p></form>';
                if ($ticket_matches > 3) {
                    $right .= '<p><a href="/results/ticket/' . $ticket_id . '">Find All Matching Results</a>';
                } else {
                    if ($hash_matches > 3) {
                        $right .= '<p><a href="/results/hash/' . $result_file->get_contained_tests_hash(false) . '">Find All Matching Results</a>';
                    }
                }
            }
        }
        if (count($upload_ids) > 1) {
            $checkbox_options = array('normalize_results' => 'Normalize Results', 'sort_by_performance' => 'Sort Results By Performance', 'sort_by_name' => 'Reverse Result By Identifier', 'sort_by_reverse' => 'Reverse Result Order', 'show_only_changed_results' => 'Show Only Results With Result Variation', 'force_line_graph' => 'Force Line Graph');
            if ($result_file->is_multi_way_comparison()) {
                $checkbox_options['condense_comparison'] = 'Condense Comparison';
                $checkbox_options['transpose_comparison'] = 'Transpose Comparison';
            }
            $right .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="update_result_view" method="post"><hr /><h3>Result Analysis Options</h3><p align="left">' . PHP_EOL;
            foreach ($checkbox_options as $val => $name) {
                $right .= '<input type="checkbox" name="' . $val . '" value="1" ' . (isset($_POST[$val]) ? 'checked="checked" ' : null) . '/> ' . $name . '<br />';
            }
            $right .= '<br /><input type="submit" value="Refresh Results"></p></form>';
        }
        if (self::$schedule_id && !empty(self::$schedule_id) && $system_types[0] && $trigger_types[0]) {
            $stmt = phoromatic_server::$db->prepare('SELECT UserContextStep FROM phoromatic_system_context_logs WHERE AccountID = :account_id AND ScheduleID = :schedule_id AND SystemID = :system_id AND TriggerID = :trigger_id');
            $stmt->bindValue(':account_id', $_SESSION['AccountID']);
            $stmt->bindValue(':system_id', $system_types[0]);
            $stmt->bindValue(':schedule_id', self::$schedule_id);
            $stmt->bindValue(':trigger_id', $trigger_types[0]);
            $result = $stmt->execute();
            if ($row = $result->fetchArray()) {
                $right .= '<hr /><h3>User Context Logs</h3>';
                do {
                    $right .= '<p><a href="?logs/context/' . $system_types[0] . ',' . self::$schedule_id . ',' . base64_encode($trigger_types[0]) . '">' . $row['UserContextStep'] . '</a></p>';
                } while ($row = $result->fetchArray());
            }
        }
        $right .= '<hr /><h3>Result Export</h3>';
        $right .= '<p><a href="/public.php?t=result&ut=' . implode(',', $upload_ids) . $url_append . '">Public Viewer</a></p>';
        $right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=pdf' . $url_append . '">Download As PDF</a></p>';
        $right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=csv">Download As CSV</a></p>';
        $right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=xml">Download As XML</a></p>';
        $right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&download=txt">Download As TEXT</a></p>';
        $right .= '<p><a href="?' . $_SERVER['QUERY_STRING'] . '/&upload_to_openbenchmarking">Upload To OpenBenchmarking.org</a></p>';
        if (is_file(phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $row['UploadID']) . 'system-logs.zip')) {
            $right .= '<hr /><p><a href="?logs/system/' . $row['UploadID'] . '">View System Logs</a></p>';
        }
        echo phoromatic_webui_header_logged_in();
        echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in($right));
        echo phoromatic_webui_footer();
    }
 protected function auto_generate_description()
 {
     $hw_components = array(pts_result_file_analyzer::system_component_string_to_array(phodevi::system_hardware(true)));
     $sw_components = array(pts_result_file_analyzer::system_component_string_to_array(phodevi::system_software(true)));
     if ($this->is_new_result_file) {
         $existing_identifiers = array();
         $hw_components = array();
         $sw_components = array();
         foreach ($this->result_file->get_systems() as $s) {
             array_push($hw_components, pts_result_file_analyzer::system_component_string_to_array($s->get_hardware()));
             array_push($sw_components, pts_result_file_analyzer::system_component_string_to_array($s->get_software()));
             array_push($existing_identifiers, $s->get_identifier());
         }
         $existing_identifier_count = count($existing_identifiers);
     } else {
         $existing_identifier_count = 0;
     }
     $auto_description = 'Running ' . implode(', ', array_unique($this->get_tests_to_run_identifiers()));
     $subsystems_to_test = $this->subsystems_under_test();
     // TODO: hook into $hw_components and $sw_components for leveraging existing result file data for comparisons already in existent
     // dropped: count($subsystems_to_test) == 1 && $
     if ($existing_identifier_count == 0) {
         switch ($subsystems_to_test) {
             case 'Graphics':
                 $auto_description = phodevi::read_property('gpu', 'model') . ' graphics testing with ' . phodevi::read_property('system', 'display-driver-string') . ' / ' . phodevi::read_property('system', 'opengl-driver');
                 break;
             case 'Disk':
                 $auto_description = phodevi::read_name('disk') . ' testing on ' . phodevi::read_property('system', 'operating-system') . ' with a ' . phodevi::read_property('system', 'filesystem') . ' file-system';
                 break;
             case 'Memory':
             case 'Processor':
                 $auto_description = phodevi::read_property('cpu', 'model') . ' testing with a ' . phodevi::read_name('motherboard') . ' on ' . phodevi::read_property('system', 'operating-system');
                 break;
             default:
                 if (phodevi::read_property('system', 'system-layer')) {
                     // Virtualization, Wine testing...
                     $auto_description = phodevi::read_property('system', 'system-layer') . ' testing on ' . phodevi::read_property('system', 'operating-system');
                 } else {
                     if (phodevi::read_name('motherboard') != null && phodevi::read_property('gpu', 'model') != null) {
                         // Standard description
                         $auto_description = phodevi::read_property('cpu', 'model') . ' testing with a ' . phodevi::read_name('motherboard') . ' and ' . phodevi::read_property('gpu', 'model') . ' on ' . phodevi::read_property('system', 'operating-system');
                     } else {
                         // A virtualized environment or a BSD or other OS where not all hardware info is available...
                         $auto_description = phodevi::read_property('cpu', 'model') . ' testing on ' . phodevi::read_property('system', 'operating-system');
                     }
                 }
                 break;
         }
     } else {
         if ($this->is_new_result_file) {
             $result_file_intent = pts_result_file_analyzer::analyze_result_file_intent($this->result_file);
             if (is_array($result_file_intent) && $result_file_intent[0] != 'Unknown') {
                 $auto_description = 'A ' . $result_file_intent[0] . ' comparison';
             }
         }
     }
     $auto_description .= ' via the Phoronix Test Suite.';
     return $auto_description;
 }
    public static function render_page_process($PATH)
    {
        echo phoromatic_webui_header_logged_in();
        $main = null;
        if (isset($PATH[0]) && !empty($PATH[0])) {
            ini_set('memory_limit', '4G');
            if (isset($_POST['view_results_from_past']) && is_numeric($_POST['view_results_from_past'])) {
                $cut_duration = $_POST['view_results_from_past'];
            } else {
                $cut_duration = 21;
            }
            $stmt = phoromatic_server::$db->prepare('SELECT UploadID, UploadTime, ScheduleID, Trigger, SystemID FROM phoromatic_results WHERE AccountID = :account_id AND ScheduleID = :schedule_id ORDER BY UploadTime DESC');
            $stmt->bindValue(':account_id', $_SESSION['AccountID']);
            $stmt->bindValue(':schedule_id', $PATH[0]);
            $test_result_result = $stmt->execute();
            $cutoff_time = is_numeric($cut_duration) ? strtotime('today -' . $cut_duration . ' days') : false;
            $show_only_latest_systems = array();
            $result_files = array();
            while ($test_result_result && ($row = $test_result_result->fetchArray())) {
                if ($cutoff_time !== false && strtotime($row['UploadTime']) < $cutoff_time) {
                    break;
                }
                $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 = phoromatic_server::system_id_to_name($row['SystemID']) . ': ' . $row['Trigger'];
                array_push($result_files, new pts_result_merge_select($composite_xml, null, $system_name));
                if (!isset($show_only_latest_systems[$_SESSION['AccountID'] . $row['SystemID']])) {
                    $show_only_latest_systems[$_SESSION['AccountID'] . $row['SystemID']] = new pts_result_merge_select($composite_xml, null, $system_name);
                }
            }
            if (count($result_files) < 21) {
                $show_only_latest_systems = null;
            }
            $attributes = array('new_result_file_title' => phoromatic_schedule_id_to_name($row['ScheduleID']));
            $result_file = new pts_result_file(null, true);
            $result_file->merge($result_files, $attributes);
            $extra_attributes = array('reverse_result_buffer' => true, 'force_simple_keys' => true, 'force_line_graph_compact' => true, 'force_tracking_line_graph' => true);
            if (isset($_POST['normalize_results']) && $_POST['normalize_results']) {
                $extra_attributes['normalize_result_buffer'] = true;
            }
            $main .= '<h1>' . $result_file->get_title() . '</h1>';
            if ($result_file->get_system_count() == 1 || ($intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true))) {
                $table = new pts_ResultFileCompactSystemsTable($result_file, $intent);
            } else {
                $table = new pts_ResultFileSystemsTable($result_file);
            }
            $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>';
            $table = new pts_ResultFileTable($result_file, $intent);
            $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>';
            $main .= '<div id="pts_results_area">';
            foreach ($result_file->get_result_objects(isset($_POST['show_only_changed_results']) ? 'ONLY_CHANGED_RESULTS' : -1) as $i => $result_object) {
                $main .= '<h2><a name="r-' . $i . '"></a><a name="' . $result_object->get_comparison_hash(true, false) . '"></a>' . $result_object->test_profile->get_title() . '</h2>';
                $main .= '<p class="result_object">';
                $main .= pts_render::render_graph_inline_embed($result_object, $result_file, $extra_attributes);
                $main .= '</p>';
            }
            $main .= '</div>';
            $right = '<form action="' . $_SERVER['REQUEST_URI'] . '" name="update_result_view" method="post">';
            $right .= '<p>Compare results for the past: ';
            $right .= '<select name="view_results_from_past" id="view_results_from_past">';
            $oldest_upload_time = strtotime(phoromatic_oldest_result_for_schedule($PATH[0]));
            $opts = array('Two Weeks' => 14, 'Three Weeks' => 21, 'One Month' => 30, 'Two Months' => 60, 'Quarter' => 90, 'Six Months' => 180, 'Year' => 365);
            foreach ($opts as $str_name => $time_offset) {
                if ($oldest_upload_time > time() - 86400 * $time_offset) {
                    break;
                }
                $right .= '<option value="' . $time_offset . '">' . $str_name . '</option>';
            }
            $right .= '<option value="all">All Results</option>';
            $right .= '</select>';
            $right .= '</p>';
            $right .= '<p><input type="checkbox" name="normalize_results" value="1" ' . (isset($_POST['normalize_results']) ? 'checked="checked" ' : null) . '/> Normalize Results?</p>';
            $right .= '<p><input type="submit" value="Refresh Results"></p></form>';
        } else {
            if (empty($PATH)) {
                $main .= '<h1>Phoromatic Tracker</h1>
					<p>The Phoromatic Tracker will show result schedules that have enough uploaded test results from the associated systems to begin providing concise overviews of performance over time.</p>
					<div class="pts_phoromatic_info_box_area">
					<ul>
						<li><h1>Trackable Results</h1></li>';
                $stmt = phoromatic_server::$db->prepare('SELECT Title, ScheduleID, Description, RunTargetSystems, RunTargetGroups, RunAt, ActiveOn, (SELECT COUNT(*) FROM phoromatic_results WHERE ScheduleID = phoromatic_schedules.ScheduleID) AS UploadedResultCount FROM phoromatic_schedules WHERE AccountID = :account_id AND State >= 1 ORDER BY Title ASC');
                $stmt->bindValue(':account_id', $_SESSION['AccountID']);
                $result = $stmt->execute();
                $row = $result->fetchArray();
                if ($row == false) {
                    $main .= '<li class="light" style="text-align: center;">No Relevant Schedules Found</li>';
                } else {
                    do {
                        if ($row['UploadedResultCount'] > ($row['RunTargetSystems'] + $row['RunTargetGroups'] + 1) * 7) {
                            $stmt_tests = phoromatic_server::$db->prepare('SELECT COUNT(*) AS TestCount FROM phoromatic_schedules_tests WHERE AccountID = :account_id AND ScheduleID = :schedule_id ORDER BY TestProfile ASC');
                            $stmt_tests->bindValue(':account_id', $_SESSION['AccountID']);
                            $stmt_tests->bindValue(':schedule_id', $row['ScheduleID']);
                            $result_tests = $stmt_tests->execute();
                            $row_tests = $result_tests->fetchArray();
                            $test_count = !empty($row_tests) ? $row_tests['TestCount'] : 0;
                            $group_count = empty($row['RunTargetGroups']) ? 0 : count(explode(',', $row['RunTargetGroups']));
                            $main .= '<a href="?tracker/' . $row['ScheduleID'] . '"><li>' . $row['Title'] . '<br /><table><tr><td>' . pts_strings::plural_handler(count(phoromatic_server::systems_associated_with_schedule($_SESSION['AccountID'], $row['ScheduleID'])), 'System') . '</td><td>' . pts_strings::plural_handler($group_count, 'Group') . '</td><td>' . pts_strings::plural_handler($test_count, 'Test') . '</td><td>' . pts_strings::plural_handler($row['UploadedResultCount'], 'Result') . ' Total</td></tr></table></li></a>';
                        }
                    } while ($row = $result->fetchArray());
                }
                $main .= '</ul>
			</div>';
                $right = null;
            }
        }
        echo phoromatic_webui_main($main, $right);
        echo phoromatic_webui_footer();
    }
 public function __construct(&$result_file, $log_location, $intent = false)
 {
     if (!is_readable($log_location)) {
         return false;
     }
     if ($intent == false) {
         $intent = -1;
         $intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true);
     }
     if (!isset($intent[0])) {
         return false;
     }
     if (is_array($intent[0]) && in_array('Processor', $intent[0])) {
         $component_report = 'Processor';
     } else {
         if (is_array($intent[0]) && in_array('Graphics', $intent[0])) {
             $component_report = 'Graphics';
         } else {
             return false;
         }
     }
     $this->rows = array();
     $this->columns = array();
     $this->table_data = array();
     $logs_to_capture = array();
     if ($component_report == 'Processor') {
         $this->columns = array('Model Name', 'Core Count', 'Thread Count', 'L2 Cache', 'Cache Size', 'Virtualization', 'Features', 'Flags');
         $logs_to_capture = array('cpuinfo', 'lscpu');
     } else {
         if ($component_report == 'Graphics') {
             $this->columns = array('OpenGL Renderer', 'OpenGL Version', 'GLSL Version', 'OpenGL Extensions');
             $logs_to_capture = array('glxinfo');
         }
     }
     if (is_dir($log_location)) {
         foreach ($result_file->get_system_identifiers() as $system_identifier) {
             phodevi::$vfs->clear_cache();
             foreach ($logs_to_capture as $log_file_name) {
                 if (is_file($log_location . $system_identifier . '/' . $log_file_name)) {
                     phodevi::$vfs->set_cache_item($log_file_name, file_get_contents($log_location . $system_identifier . '/' . $log_file_name));
                 }
             }
             if (count(phodevi::$vfs->cache_index()) > 0) {
                 switch ($component_report) {
                     case 'Processor':
                         $this->generate_processor_data($result_file, $system_identifier);
                         break;
                     case 'Graphics':
                         $this->generate_graphics_data($result_file, $system_identifier);
                         break;
                 }
             }
             phodevi::$vfs->clear_cache();
         }
     }
     if (empty($this->rows)) {
         return false;
     }
     foreach (array(array('Processor', 'Flags', 'Common CPU Flags'), array('Graphics', 'OpenGL Extensions', 'Common OpenGL Extensions')) as $set) {
         if ($component_report == $set[0]) {
             $flags_data = $this->table_data[array_search($set[1], $this->columns)];
             foreach ($flags_data as $i => &$flags) {
                 $flags = explode(' ', $flags);
                 sort($flags);
             }
             if ($flags_data == null || count($flags_data) < 2) {
                 continue;
             }
             $intersect = call_user_func_array('array_intersect', $flags_data);
             sort($intersect);
             foreach ($flags_data as $i => &$flags) {
                 $flags = array_diff($flags, $intersect);
                 $flags = implode(' ', $flags);
             }
             $this->table_data[array_search($set[1], $this->columns)] = $flags_data;
             $intersect_label = $set[2];
             break;
         }
     }
     parent::__construct($this->rows, $this->columns, $this->table_data);
     if (isset($intersect) && !empty($intersect)) {
         $this->addTestNote(trim(implode(' ', $intersect)), null, $intersect_label);
     }
 }
Exemplo n.º 9
0
 $result_file->merge($result_files, $attributes);
 $extra_attributes = array();
 $attribute_options = array('normalize_results' => 'normalize_result_buffer', 'sort_by_performance' => 'sort_result_buffer_values', 'sort_by_reverse' => 'reverse_result_buffer', 'sort_by_name' => 'sort_result_buffer', 'condense_comparison' => 'condense_multi_way');
 foreach ($attribute_options as $web_var => $attr_var) {
     if (isset($_REQUEST[$web_var])) {
         $extra_attributes[$attr_var] = true;
     }
 }
 if (isset($_POST['transpose_comparison'])) {
     $result_file->invert_multi_way_invert();
 }
 $intent = null;
 $main .= '<h1>' . $result_file->get_title() . '</h1>';
 $main .= '<p>' . $result_file->get_description() . '</p>';
 $main .= phoromatic_annotate_entry('RESULT', implode(',', $result_ids), 'TOP');
 if ($result_file->get_system_count() == 1 || ($intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true))) {
     $table = new pts_ResultFileCompactSystemsTable($result_file, $intent);
 } else {
     $table = new pts_ResultFileSystemsTable($result_file);
 }
 $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>';
 $table = new pts_ResultFileTable($result_file, $intent);
 $main .= '<p style="text-align: center; overflow: auto;" class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>';
 $main .= '<div id="pts_results_area">';
 foreach ($result_file->get_result_objects(isset($_POST['show_only_changed_results']) ? 'ONLY_CHANGED_RESULTS' : -1) as $i => $result_object) {
     $main .= '<h2><a name="r-' . $i . '"></a><a name="' . $result_object->get_comparison_hash(true, false) . '"></a>' . $result_object->test_profile->get_title() . '</h2>';
     $main .= phoromatic_annotate_entry('RESULT', implode(',', $result_ids), $result_object->get_comparison_hash(true, false));
     $main .= '<p style="text-align: center; overflow: auto;">';
     $main .= pts_render::render_graph_inline_embed($result_object, $result_file, $extra_attributes);
     $main .= '</p>';
 }