Lexer->addSpecialPattern('\{\{kanban>.*?\}\}', $mode, 'plugin_kanban');
}
public function handle($match, $state, $pos, Doku_Handler $handler) {
return [substr($match, 9, -2)];
}
public function render($mode, Doku_Renderer $renderer, $data) {
if ($mode != 'xhtml') return false;
global $conf;
//$mydata = str_split("||",$data);
list($boardName) = $data;
//echo $boardName;//debugging line
//list($boardName) = $mydata[0];
//list($boardList) = $mydata[1];
list($var1, $var2) = explode("+", $boardName); //added - 5-8-2026
//Change the variable back to boardName
$boardName = $var1;//added - 5-8-2026
// Path to individual card files: data/kanban/[boardName]/*.json
// $kanbanDir = $conf['savedir'] . '/kanban/' . $boardName . '/'; //WORKS!!
$kanbanDir = $conf['savedir'] . '/kanban/' . $boardName . '/'; //added - 5-8-2026
// Dynamically create the directory if it doesn't exist
if (!is_dir($kanbanDir)) io_makeFileDir($kanbanDir . 'placeholder.txt');
$renderer->doc .= '
';
// $columns = ['Projects', 'WIP', 'On Hold', 'Done']; // WORKS!!
// echo $var2;
$headers = explode(",",$var2); //added - 5-8-2026
$outpea = [];//added - 5-8-2026
$thankee = count($headers);//added - 5-8-2026
for($x=0;$x<$thankee;$x++){//added - 5-8-2026
if($headers[$x] && $headers[$x] != "" && !is_null($headers[$x])){//added - 5-8-2026
$outpea[$x] = $headers[$x];//added - 5-8-2026
}else{//added - 5-8-2026
continue;//added - 5-8-2026
}//added - 5-8-2026
}//added - 5-8-2026
$columns = $outpea;//added - 5-8-2026
$colVal=0;//added - 5-8-2026
// Load all .json files in the board directory
$savedCards = [];
foreach (glob($kanbanDir . "*.json") as $file) {
$card = json_decode(io_readFile($file), true);
if ($card) $savedCards[] = $card;
}
foreach ($columns as $col) {
$id = strtolower(str_replace(' ', '-', $col));
$renderer->doc .= '
';
$renderer->doc .= '
' . hsc($col) . '
';
$renderer->doc .= '
';
foreach ($savedCards as $card) {
if ($card['column'] === $id) {
$renderer->doc .= $this->_renderCardHtml($card);
}
}
if($colVal!==0){//added - 5-8-2026
$renderer->doc .= '
';//added - 5-8-2026
}else{//added - 5-8-2026
$renderer->doc .= '
';
//$renderer->doc .= ' ';//added - 5-8-2026
}//added - 5-8-2026
$colVal = ($colVal + 1);//added - 5-8-2026
}
$renderer->doc .= 'My name goes here
';
return true;
}
private function _renderCardHtml($card) {
$currNote = hsc($card['note']);
$imp = hsc($card['importance'] ?? 'medium');
if(hsc($card['checked']) !== "true"){
$dat = "";
}else{
$dat = "checked";
}
$fullNotes = '';
$notes=hsc($card['note']);
$notif = explode("+",$notes);
array_map('trim', $notif);
foreach($notif as $note){
if($note == ""){
continue;
}else{
$fullNotes = $fullNotes . "+ " . $note . "
";
}
}
//return the card data only if the card has not been checked complete
if($dat != "checked"){
return ''
. '
'
. '
'.hsc($card['name']).'Content
'
. '
'.hsc($card['desc'] ?? '').'
'
. '
'
. '
' . $fullNotes . '
';
}
}
}