summaryrefslogtreecommitdiff
path: root/app/Controller/ExternalTaskViewController.php
blob: 6719b6537008d1ba8ba5321eb7164ebab998c5c4 (plain)
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
<?php

namespace Kanboard\Controller;

use Kanboard\Core\ExternalTask\ExternalTaskException;

/**
 * Class ExternalTaskViewController
 *
 * @package Kanboard\Controller
 * @author  Frederic Guillot
 */
class ExternalTaskViewController extends BaseController
{
    public function show()
    {
        try {
            $task = $this->getTask();
            $taskProvider = $this->externalTaskManager->getProvider($task['external_provider']);
            $externalTask = $taskProvider->fetch($task['external_uri'], $task['project_id']);

            $this->response->html($this->template->render($taskProvider->getViewTemplate(), array(
                'task' => $task,
                'external_task' => $externalTask,
            )));
        } catch (ExternalTaskException $e) {
            $this->response->html('<div class="alert alert-error">'.$e->getMessage().'</div>');
        }
    }
}