1<?php
2class syntax_plugin_ac_action_tasks extends syntax_plugin_ac_action {
3    public function __construct($ac, $data) {
4        parent::__construct($ac);
5        list($project_id, $ticket_id) = $data;
6        $this->project_id = $project_id;
7        $this->ticket_id = $ticket_id;
8    }
9
10    public function exec() {
11        $details = $this->ac->get('projects/' . $this->project_id . '/tickets/' . $this->ticket_id);
12        if (count($details->tasks) === 0) {
13            return '';
14        }
15        $output = '<ul>';
16        foreach($details->tasks as $task) {
17            if ($task->completed_on) {
18                continue;
19            }
20            $output .= '<li><div class="li">' . $this->ac->objToString($task) . '</div></li>' . DOKU_LF;
21        }
22        $output .= '</ul>';
23
24        return $output;
25    }
26}
27