| Server IP : 185.252.147.100 / Your IP : 216.73.216.43 Web Server : nginx/1.27.3 System : Linux mitrofanov.ru 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : mitr ( 1000) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/html/kanboard/app/Controller/ |
Upload File : |
<?php
namespace Kanboard\Controller;
/**
* Task Status controller
*
* @package Kanboard\Controller
* @author Frederic Guillot
*/
class TaskStatusController extends BaseController
{
/**
* Close a task
*
* @access public
*/
public function close()
{
$this->changeStatus('close', 'task_status/close', t('Task closed successfully.'), t('Unable to close this task.'));
}
/**
* Open a task
*
* @access public
*/
public function open()
{
$this->changeStatus('open', 'task_status/open', t('Task opened successfully.'), t('Unable to open this task.'));
}
/**
* Common method to change status
*
* @access private
* @param string $method
* @param string $template
* @param string $success_message
* @param string $failure_message
*/
private function changeStatus($method, $template, $success_message, $failure_message)
{
$task = $this->getTask();
if ($this->request->getStringParam('confirmation') === 'yes') {
$this->checkCSRFParam();
if ($this->taskStatusModel->$method($task['id'])) {
$this->flash->success($success_message);
} else {
$this->flash->failure($failure_message);
}
$this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'])), true);
} else {
$this->response->html($this->template->render($template, array(
'task' => $task,
)));
}
}
}