summaryrefslogtreecommitdiff
path: root/app/Controller/ExternalTaskViewController.php
blob: 18bc15c15cecc5dc0d1e043922dbb1abb0de90d8 (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']);

            $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>');
        }
    }
}