Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
KanbaniWebViewer/plugins/toc.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
42 lines (40 sloc)
1.79 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* This plugin adds Table of Contents (ToC) to each board. */ | |
$context->hooks->registerFirst("echo_boardHeader", function () { | |
?> | |
<a href="#toc" class="isle brd-toc-toggle" title="<?=$this("Table of Contents")?>"><?=$this("ToC")?></a> | |
<?php | |
}); | |
$context->hooks->register("echo_boardBars", function () { | |
?> | |
<ol class="brd-toc round" id="toc"> | |
<?php foreach ($this->lists as $list) {?> | |
<li class="<?=$list["visible"] ? "" : "filtered"?>"> | |
<a href="#<?=htmlspecialchars($list["list"]->id)?>"> | |
<b><?=htmlspecialchars($list["list"]->title)?></b> | |
<?=$this("(%s)", Kanbani\formatNumber(count($list["list"]->cards)))?> | |
</a> | |
<ol> | |
<?php foreach ($this->cards[$list["list"]] as $info) {?> | |
<?php $card = $info["card"]?> | |
<li class="<?=$info["visible"] ? "" : "filtered"?>" | |
data-kwv-toc="<?=htmlspecialchars($card->id)?>"> | |
<a href="#<?=htmlspecialchars($card->id)?>"> | |
<?=htmlspecialchars($card->title)?> | |
<?php if ($card->archived) {?> | |
<span class="isle brd-toc__label card-archived"><?=$this("Archived")?></span> | |
<?php }?> | |
<?php if ($card->due_time) {?> | |
<span class="isle brd-toc__label card-due card-due_over_<?=+($card->due_time / 1000 < time())?>"> | |
<?=htmlspecialchars(Kanbani\formatTime($this, $card->due_time / 1000))?> | |
</span> | |
<?php }?> | |
</a> | |
</li> | |
<?php }?> | |
</ol> | |
</li> | |
<?php }?> | |
</ol> | |
<?php | |
}); |