109 lines
3.8 KiB
PHP
109 lines
3.8 KiB
PHP
<?php
|
|
/**
|
|
* The control file of kanban module of ZenTaoPMS.
|
|
*
|
|
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
|
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
|
* @author Yuchun Li <liyuchun@easycorp.ltd>
|
|
* @package kanban
|
|
* @version $Id: control.php 4460 2021-10-26 11:03:02Z chencongzhi520@gmail.com $
|
|
* @link https://www.zentao.net
|
|
*/
|
|
class kanban extends control
|
|
{
|
|
/**
|
|
* Set WIP.
|
|
*
|
|
* @param int $columnID
|
|
* @param int $executionID
|
|
* @access public
|
|
* @return void
|
|
*/
|
|
public function setWIP($columnID, $executionID = 0)
|
|
{
|
|
if($_POST)
|
|
{
|
|
$this->kanban->setWIP($columnID);
|
|
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
|
|
|
$this->loadModel('action')->create('kanbancolumn', $columnID, 'Edited', '', $executionID);
|
|
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
|
|
}
|
|
|
|
$this->app->loadLang('story');
|
|
|
|
$column = $this->kanban->getColumnById($columnID);
|
|
if(!$column) die(js::error($this->lang->notFound) . js::locate($this->createLink('execution', 'kanban', "executionID=$executionID")));
|
|
|
|
$status = zget($this->config->kanban->{$column->laneType . 'ColumnStatusList'}, $column->type);
|
|
$title = isset($column->parentName) ? $column->parentName . '/' . $column->name : $column->name;
|
|
|
|
$this->view->title = $title . $this->lang->colon . $this->lang->kanban->setWIP . '(' . $this->lang->kanban->WIP . ')';
|
|
$this->view->column = $column;
|
|
$this->view->status = $status;
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
* Set lane info.
|
|
*
|
|
* @param int $laneID
|
|
* @param int $executionID
|
|
* @access public
|
|
* @return void
|
|
*/
|
|
public function setLane($laneID, $executionID = 0)
|
|
{
|
|
if($_POST)
|
|
{
|
|
$this->kanban->setLane($laneID);
|
|
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
|
|
|
$this->loadModel('action')->create('kanbanlane', $laneID, 'Edited', '', $executionID);
|
|
|
|
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
|
|
}
|
|
|
|
$lane = $this->kanban->getLaneById($laneID);
|
|
if(!$lane) die(js::error($this->lang->notFound) . js::locate($this->createLink('execution', 'kanban', "executionID=$executionID")));
|
|
|
|
$this->view->title = zget($this->lang->kanban->laneTypeList, $lane->type) . $this->lang->colon . $this->lang->kanban->setLane;
|
|
$this->view->lane = $lane;
|
|
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
* Set lane column info.
|
|
*
|
|
* @param int $columnID
|
|
* @access public
|
|
* @return void
|
|
*/
|
|
public function setLaneColumn($columnID)
|
|
{
|
|
$column = $this->kanban->getColumnById($columnID);
|
|
|
|
if($_POST)
|
|
{
|
|
$params = fixer::input('post')->get();
|
|
$this->kanban->updateLaneColumn($columnID, $params);
|
|
if(dao::isError()) return $this->sendError(dao::getError());
|
|
|
|
$changes = common::createChanges($column, $params);
|
|
if($changes)
|
|
{
|
|
$actionID = $this->loadModel('action')->create('kanbancolumn', $columnID, 'Edited');
|
|
$this->action->logHistory($actionID, $changes);
|
|
}
|
|
|
|
return $this->sendSuccess(array('locate' => 'parent'));
|
|
}
|
|
|
|
$this->view->column = $column;
|
|
$this->view->title = $column->name . $this->lang->colon . $this->lang->kanban->setLaneColumn;
|
|
$this->display();
|
|
}
|
|
|
|
}
|