guide.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. use yii\apidoc\templates\bootstrap\SideNavWidget;
  3. /* @var $this yii\web\View */
  4. /* @var $content string */
  5. /* @var $chapters array */
  6. if (isset($currentFile)) {
  7. foreach ($chapters as $chapter) {
  8. foreach ($chapter['content'] as $chContent) {
  9. if ($chContent['file'] == basename($currentFile)) {
  10. $guideHeadline = "{$chContent['headline']} - {$chapter['headline']}";
  11. }
  12. }
  13. }
  14. }
  15. $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php', isset($guideHeadline) ? ['guideHeadline' => $guideHeadline] : []); ?>
  16. <div class="row">
  17. <div class="col-md-2">
  18. <?php
  19. $nav = [];
  20. foreach ($chapters as $chapter) {
  21. $items = [];
  22. foreach($chapter['content'] as $chContent) {
  23. $items[] = [
  24. 'label' => $chContent['headline'],
  25. 'url' => $this->context->generateGuideUrl($chContent['file']),
  26. 'active' => isset($currentFile) && ($chContent['file'] == basename($currentFile)),
  27. ];
  28. }
  29. $nav[] = [
  30. 'label' => $chapter['headline'],
  31. // 'url' => $this->context->generateGuideUrl($file),
  32. 'items' => $items,
  33. ];
  34. } ?>
  35. <?= SideNavWidget::widget([
  36. 'id' => 'navigation',
  37. 'items' => $nav,
  38. 'view' => $this,
  39. ]) ?>
  40. </div>
  41. <div class="col-md-9 guide-content" role="main">
  42. <?= $content ?>
  43. <div class="toplink"><a href="#" class="h1" title="go to top"><span class="glyphicon glyphicon-arrow-up"></a></div>
  44. </div>
  45. </div>
  46. <?php $this->endContent(); ?>