1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00
kanboard_ynh/sources/app/Controller/SubtaskConverterController.php
2016-07-23 14:11:39 +02:00

39 lines
1 KiB
PHP

<?php
namespace Kanboard\Controller;
/**
* Class SubtaskConverterController
*
* @package Kanboard\Controller
* @author Frederic Guillot
*/
class SubtaskConverterController extends BaseController
{
public function show()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask_converter/show', array(
'subtask' => $subtask,
'task' => $task,
)));
}
public function save()
{
$project = $this->getProject();
$subtask = $this->getSubtask();
$task_id = $this->subtaskModel->convertToTask($project['id'], $subtask['id']);
if ($task_id !== false) {
$this->flash->success(t('Subtask converted to task successfully.'));
} else {
$this->flash->failure(t('Unable to convert the subtask.'));
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('project_id' => $project['id'], 'task_id' => $task_id)), true);
}
}