File: RoutingPanel.panel.phtml

package info (click to toggle)
php-nette 2.4-20160731-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,208 kB
  • ctags: 7,552
  • sloc: php: 31,410; makefile: 6
file content (74 lines) | stat: -rw-r--r-- 3,449 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php

namespace Nette\Bridges\ApplicationTracy;

use Nette;
use Nette\Application\UI\Presenter;
use Tracy;
use Tracy\Dumper;

?>
<style class="tracy-debug">#tracy-debug .nette-RoutingPanel table{font:9pt/1.5 Consolas,monospace}#tracy-debug .nette-RoutingPanel .yes td{background:#BDE678!important}#tracy-debug .nette-RoutingPanel .may td{background:#C1D3FF!important}#tracy-debug .nette-RoutingPanel pre,#tracy-debug .nette-RoutingPanel code{display:inline;background:transparent}</style>

<div class="nette-RoutingPanel">
<h1>
<?php if (empty($request)): ?>
	no route
<?php else: ?>
	<?= htmlSpecialChars($request->getPresenterName() . ':' . (isset($request->parameters[Presenter::ACTION_KEY]) ? $request->parameters[Presenter::ACTION_KEY] : Presenter::DEFAULT_ACTION) . (isset($request->parameters[Presenter::SIGNAL_KEY]) ? " {$request->parameters[Presenter::SIGNAL_KEY]}!" : ''), ENT_NOQUOTES, 'UTF-8') ?>
<?php endif ?>
</h1>

<div class="tracy-inner">
<?php if (empty($routers)): ?>
	<p>No routers defined.</p>

<?php else: ?>
	<table>
	<thead>
	<tr>
		<th></th>
		<th>Mask / Class</th>
		<th>Defaults</th>
		<?php if ($hasModule): ?><th>Module</th><?php endif ?>
		<th>Matched as</th>
	</tr>
	</thead>

	<tbody>
	<?php foreach ($routers as $router): ?>
	<tr class="<?= $router['matched'] ?>">
		<td><?= $router['matched'] === 'yes' ? '✓' : ($router['matched'] === 'may' ? '≈' : '') ?></td>

		<td><code title="<?= htmlSpecialChars($router['class'], ENT_QUOTES, 'UTF-8') ?>"><?= htmlSpecialChars(isset($router['mask']) ? $router['mask'] : $router['class'], ENT_NOQUOTES, 'UTF-8') ?></code></td>

		<td><code>
		<?php foreach ($router['defaults'] as $key => $value): ?>
			<?= htmlSpecialChars($key, ENT_IGNORE, 'UTF-8'), "&nbsp;=&nbsp;", is_string($value) ? htmlSpecialChars($value, ENT_IGNORE, 'UTF-8') . '<br />' : Dumper::toHtml($value, [Dumper::COLLAPSE => TRUE, Dumper::LIVE => TRUE]) ?>
		<?php endforeach ?>
		</code></td>

		<?php if ($hasModule): ?><td><code><?= htmlSpecialChars($router['module'], ENT_NOQUOTES, 'UTF-8') ?></code></td><?php endif ?>

		<td><?php if ($router['request']): ?><code>
		<?php $params = $router['request']->getParameters(); ?>
		<strong><?= htmlSpecialChars($router['request']->getPresenterName() . ':' . (isset($params[Presenter::ACTION_KEY]) ? $params[Presenter::ACTION_KEY] : Presenter::DEFAULT_ACTION), ENT_NOQUOTES, 'UTF-8') ?></strong><br />
		<?php unset($params[Presenter::ACTION_KEY]) ?>
		<?php foreach ($params as $key => $value): ?>
			<?= htmlSpecialChars($key, ENT_IGNORE, 'UTF-8'), "&nbsp;=&nbsp;", is_string($value) ? htmlSpecialChars($value, ENT_IGNORE, 'UTF-8') . '<br />' : Dumper::toHtml($value, [Dumper::COLLAPSE => TRUE, Dumper::LIVE => TRUE]) ?>
		<?php endforeach ?>
		</code><?php endif ?></td>
	</tr>
	<?php endforeach ?>
	</tbody>
	</table>
<?php endif ?>

	<p><code><?= htmlSpecialChars($method, ENT_IGNORE, 'UTF-8') ?></code>
	<code><?= htmlSpecialChars($url->getBaseUrl(), ENT_IGNORE, 'UTF-8') ?><span style="background:#eee; white-space:nowrap"><?= htmlSpecialChars($url->getRelativeUrl(), ENT_IGNORE, 'UTF-8') ?></span></code></p>

	<?php if ($source): ?>
	<p><a href="<?= htmlSpecialChars(Tracy\Helpers::editorUri($source->getFileName(), $source->getStartLine()), ENT_QUOTES, 'UTF-8') ?>"><?= $source instanceof \ReflectionClass ? $source->getName() : $source->getDeclaringClass()->getName() . '::' . $source->getName() . '()' ?></a></p>
	<?php endif ?>
</div>
</div>