Exemplo n.º 1
0
function vis_structure($io, $prev_value, &$allSame)
{
    $id = $io['id'];
    $value = $io['value'];
    $ios = get_child_ios($id);
    $result = '';
    if (count($ios) == 0) {
        $result = vis_value($value, $prev_value, $allSame);
    } else {
        $childrenSame = true;
        $result2 = '';
        $result2 .= '<table class="table table-condensed">';
        $dttoMode = false;
        $dttoNames = '';
        foreach ($ios as $cio) {
            $childSame = true;
            $object = get_object($cio['object_id']);
            $result3 = '<tr><td>';
            $result3 .= get_object_link($object, $cio['name'], $cio['operation_id']);
            $result3 .= '</td><td>';
            $result3 .= render_value($cio, $object, $childSame);
            $result3 .= '</td></tr>';
            $childrenSame = $childrenSame && $childSame;
            if (!$childSame) {
                if ($dttoMode) {
                    $result2 .= "<tr><td title=\"These members are unchanged: {$dttoNames}\">&#x22ee;</td><td></td></tr>";
                    $dttoMode = false;
                    $dttoNames = '';
                }
                $result2 .= $result3;
            } else {
                $dttoMode = true;
                $dttoNames .= " " . htmlentities($cio['name']);
            }
        }
        $result2 .= '</table>';
        if ($childrenSame) {
            $result = dtto();
        } else {
            $allSame = false;
            $result = $result2;
        }
    }
    return $result;
}
Exemplo n.º 2
0
function render_value($io, $io_obj = null, &$allSame = true, $hint = '')
{
    global $prev_ios;
    $id = $io['id'];
    $value = $io['value'];
    if (is_null($io_obj)) {
        $io_obj = get_object($io['object_id']);
    }
    $type = $io_obj['type'];
    $prev_value = null;
    if (array_key_exists($io_obj['id'], $prev_ios)) {
        $prev_value = $prev_ios[$io_obj['id']];
    }
    $result = '';
    if ($type == 'std::vector<float>' || $type == 'std::vector<int>' || $type == 'std::vector<double>') {
        $result .= vis_vector($value, $id, $prev_value, $allSame);
    } else {
        if ($type == 'freicore::PeakPreData') {
            $result .= vis_spectrum($value, $id, $prev_value, $allSame, $hint);
        } else {
            if ($type == 'freicore::PeakSpectrum<PeakInfo>') {
                $result .= vis_spectrum($value, $id, $prev_value, $allSame, $hint);
            } else {
                if ($type == 'FragmentTypes') {
                    $fragments = 'abcxyzZ';
                    $result .= '<pre>' . substr($fragments, intval($value), 1) . '</pre>';
                } else {
                    if ($type == 'freicore::myrimatch::MzToleranceRule') {
                        $result .= vis_enum($value, $prev_value, array('0' => 'auto', '1' => 'monoisotopic', '2' => 'average'), $allSame);
                    } else {
                        if ($type == 'char') {
                            if ($value == $prev_value) {
                                $result .= dtto();
                            } else {
                                $allSame = false;
                                $result .= "<pre>{$value}</pre> " . chr(intval($value));
                            }
                        } else {
                            if (startsWith($type, 'std::map<') || $type == 'pwiz::proteome::ModificationMap') {
                                $result .= vis_map($id, $allSame);
                            } else {
                                $result .= vis_structure($io, $prev_value, $allSame);
                            }
                        }
                    }
                }
            }
        }
    }
    $prev_ios[$io_obj['id']] = $value;
    return $result;
}