function render_operation($id, $highlight_object_id) { $operation = get_operation($id); $sdesc = htmlspecialchars($operation['sdesc']); $desc = $operation['desc']; $parent_id = $operation['parent_id']; $code_url = get_code_block_link($operation['code_start_id'], $operation['code_end_id']); $breadcrumbs = get_operation_breadcrumbs($parent_id); echo "{$breadcrumbs}"; echo "<table cellpadding=\"2px\"><tr>"; echo "<td><a href=\"index.php\" class=\"btn btn-small\"><i class=\"icon-home\"></i></a></td>"; echo "<td><a href=\"dump.php?id={$parent_id}\" class=\"btn btn-small\"><i class=\"icon-arrow-up\"></i></a></td>"; echo "<td></td>"; echo "<td><h2 style=\"margin-left: 0.3em;\">{$sdesc}</h2></td></tr></table>"; echo "<p>{$desc}</p>"; $result = array(); get_op_ios($id, $result); get_op_children($id, $result); ksort($result); echo "<table class=\"table table-condensed\">"; foreach ($result as $r) { $objId = $r['object_id']; if ($r['op_type'] == 'io' && $objId == $highlight_object_id) { echo '<tr class="highlight">'; } else { echo "<tr>"; } echo '<td>' . $r['id'] . '</td>'; if ($r['op_type'] == 'op') { $sub_code_url = get_code_block_link($r['code_start_id'], $r['code_end_id']); echo '<td><i class="icon-chevron-right"></i></td> ' . '<td colspan="3">' . get_operation_link($r, -1) . '</td><td><a href="' . $sub_code_url . '"><i class="icon-tasks"></i></a></td>'; } else { if ($r['op_type'] == 'io') { echo render_io($r, $allSame, 'object', ''); } } echo "</tr>"; } echo "</table>"; }
function get_op_children($id, &$result) { global $operation_id_stmt; $operation_id_stmt->bindParam('id', $id); $operation_id_stmt->execute(); while ($child = $operation_id_stmt->fetch(PDO::FETCH_ASSOC)) { $child_operation = get_operation($child['id']); $child_operation['op_type'] = 'op'; $result[$child_operation['id']] = $child_operation; } $operation_id_stmt->closeCursor(); return $result; }