ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
frame_code.html.php
Go to the documentation of this file.
1 <?php /* Display a code block for all frames in the stack.
2  * @todo: This should PROBABLY be done on-demand, lest
3  * we get 200 frames to process. */ ?>
4 <div class="frame-code-container <?php echo (!$has_frames ? 'empty' : '') ?>">
5  <?php foreach ($frames as $i => $frame): ?>
6  <?php $line = $frame->getLine(); ?>
7  <div class="frame-code <?php echo ($i == 0 ) ? 'active' : '' ?>" id="frame-code-<?php echo $i ?>">
8  <div class="frame-file">
9  <?php $filePath = $frame->getFile(); ?>
10  <?php if ($filePath && $editorHref = $handler->getEditorHref($filePath, (int) $line)): ?>
11  Open:
12  <a href="<?php echo $editorHref ?>" class="editor-link"<?php echo ($handler->getEditorAjax($filePath, (int) $line) ? ' data-ajax' : '') ?>>
13  <strong><?php echo $tpl->breakOnDelimiter('/', $tpl->escape($filePath ?: '<#unknown>')) ?></strong>
14  </a>
15  <?php else: ?>
16  <strong><?php echo $tpl->breakOnDelimiter('/', $tpl->escape($filePath ?: '<#unknown>')) ?></strong>
17  <?php endif ?>
18  </div>
19  <?php
20  // Do nothing if there's no line to work off
21  if ($line !== null):
22 
23  // the $line is 1-indexed, we nab -1 where needed to account for this
24  $range = $frame->getFileLines($line - 20, 40);
25 
26  // getFileLines can return null if there is no source code
27  if ($range):
28  $range = array_map(function ($line) { return empty($line) ? ' ' : $line;}, $range);
29  $start = key($range) + 1;
30  $code = join("\n", $range);
31  ?>
32  <pre id="frame-code-linenums-<?=$i?>" class="code-block linenums:<?php echo $start ?>"><?php echo $tpl->escape($code) ?></pre>
33 
34  <?php endif ?>
35  <?php endif ?>
36 
37  <?php $frameArgs = $tpl->dumpArgs($frame); ?>
38  <?php if ($frameArgs): ?>
39  <div class="frame-file">
40  Arguments
41  </div>
42  <div id="frame-code-args-<?=$i?>" class="code-block frame-args">
43  <?php echo $frameArgs; ?>
44  </div>
45  <?php endif ?>
46 
47  <?php
48  // Append comments for this frame
49  $comments = $frame->getComments();
50  ?>
51  <div class="frame-comments <?php echo empty($comments) ? 'empty' : '' ?>">
52  <?php foreach ($comments as $commentNo => $comment): ?>
53  <?php extract($comment) ?>
54  <div class="frame-comment" id="comment-<?php echo $i . '-' . $commentNo ?>">
55  <span class="frame-comment-context"><?php echo $tpl->escape($context) ?></span>
56  <?php echo $tpl->escapeButPreserveUris($comment) ?>
57  </div>
58  <?php endforeach ?>
59  </div>
60 
61  </div>
62  <?php endforeach ?>
63 </div>
$code
Definition: example_050.php:99
global $tpl
Definition: ilias.php:8
$comment
Definition: buildRTE.php:83