* kanban: refactor getSpaceById().
This commit is contained in:
@@ -373,7 +373,7 @@ class kanban extends control
|
||||
$this->view->regions = $regions;
|
||||
$this->view->kanbanList = $this->kanban->getKanbanData($kanbanID, $regionID == 'all' ? '' : array($regionID));
|
||||
$this->view->regionID = $regionID;
|
||||
$this->view->pageToolbar = $this->kanban->getHeaderActions($kanban);
|
||||
$this->view->pageToolbar = $this->kanban->getPageToolBar($kanban);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
+6
-40
@@ -2874,13 +2874,14 @@ class kanbanModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get kanban headerActions.
|
||||
* 获取看板右上角的工具栏。
|
||||
* Get kanban pageToolBar.
|
||||
*
|
||||
* @param object $kanban
|
||||
* @access public
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
public function getHeaderActions($kanban)
|
||||
public function getPageToolBar(object $kanban)
|
||||
{
|
||||
$actions = '';
|
||||
$actions .= "<a href='javascript:$(\"#kanbanList\").fullscreen();' id='fullScreenBtn' class='toolbar-item ghost btn btn-default'><i class='icon icon-fullscreen'></i> {$this->lang->kanban->fullScreen}</a>";
|
||||
@@ -3027,42 +3028,6 @@ class kanbanModel extends model
|
||||
$this->dao->update(TABLE_KANBANCARD)->set('`color`')->eq('#' . $color)->where('id')->eq($cardID)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset order of lane.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param int $type
|
||||
* @param int $groupBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function resetLaneOrder($executionID, $type, $groupBy)
|
||||
{
|
||||
$lanes = $this->dao->select('id,extra')->from(TABLE_KANBANLANE)
|
||||
->where('execution')->eq($executionID)
|
||||
->andWhere('type')->eq($type)
|
||||
->andWhere('groupBy')->eq($groupBy)
|
||||
->orderBy('extra_asc')
|
||||
->fetchPairs();
|
||||
|
||||
$laneOrder = 5;
|
||||
$noExtra = 0;
|
||||
|
||||
foreach($lanes as $laneID => $extra)
|
||||
{
|
||||
if(!$extra)
|
||||
{
|
||||
$noExtra = $laneID;
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_KANBANLANE)->set('order')->eq($laneOrder)->where('id')->eq($laneID)->exec();
|
||||
$laneOrder += 5;
|
||||
}
|
||||
|
||||
if($noExtra) $this->dao->update(TABLE_KANBANLANE)->set('order')->eq($laneOrder)->where('id')->eq($noExtra)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* 归档看板列。
|
||||
* Archive a column.
|
||||
@@ -3254,13 +3219,14 @@ class kanbanModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取看板空间。
|
||||
* Get space by id.
|
||||
*
|
||||
* @param int $spaceID
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getSpaceById($spaceID): object
|
||||
public function getSpaceById(int $spaceID)
|
||||
{
|
||||
$space = $this->dao->findById($spaceID)->from(TABLE_KANBANSPACE)->fetch();
|
||||
if($space) $space = $this->loadModel('file')->replaceImgURL($space, 'desc');
|
||||
|
||||
@@ -4,18 +4,40 @@ include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/kanban.class.php';
|
||||
su('admin');
|
||||
|
||||
zdTable('kanbanspace')->gen(5);
|
||||
|
||||
/**
|
||||
|
||||
title=测试 kanbanModel->getSpaceById();
|
||||
timeout=0
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试查询空间1信息 >> 协作空间1,cooperation,po15,active
|
||||
测试查询空间2信息 >> 私有空间2,private,po16,active
|
||||
测试查询空间3信息 >> 公共空间3,public,po17,active
|
||||
测试查询空间4信息 >> 协作空间4,cooperation,po18,active
|
||||
测试查询空间5信息 >> 私有空间5,private,po19,active
|
||||
测试查询不存在的空间信息 >> 0
|
||||
- 测试查询空间1信息
|
||||
- 属性name @协作空间1
|
||||
- 属性type @cooperation
|
||||
- 属性owner @po15
|
||||
- 属性status @active
|
||||
- 测试查询空间2信息
|
||||
- 属性name @私有空间2
|
||||
- 属性type @private
|
||||
- 属性owner @po16
|
||||
- 属性status @active
|
||||
- 测试查询空间3信息
|
||||
- 属性name @公共空间3
|
||||
- 属性type @public
|
||||
- 属性owner @po17
|
||||
- 属性status @active
|
||||
- 测试查询空间4信息
|
||||
- 属性name @协作空间4
|
||||
- 属性type @cooperation
|
||||
- 属性owner @po18
|
||||
- 属性status @active
|
||||
- 测试查询空间5信息
|
||||
- 属性name @私有空间5
|
||||
- 属性type @private
|
||||
- 属性owner @po19
|
||||
- 属性status @active
|
||||
- 测试查询不存在的空间信息 @0
|
||||
|
||||
*/
|
||||
$spaceIDList = array('1', '2', '3', '4', '5', '10001');
|
||||
@@ -27,4 +49,4 @@ r($kanban->getSpaceByIdTest($spaceIDList[1])) && p('name,type,owner,status') &&
|
||||
r($kanban->getSpaceByIdTest($spaceIDList[2])) && p('name,type,owner,status') && e('公共空间3,public,po17,active'); // 测试查询空间3信息
|
||||
r($kanban->getSpaceByIdTest($spaceIDList[3])) && p('name,type,owner,status') && e('协作空间4,cooperation,po18,active'); // 测试查询空间4信息
|
||||
r($kanban->getSpaceByIdTest($spaceIDList[4])) && p('name,type,owner,status') && e('私有空间5,private,po19,active'); // 测试查询空间5信息
|
||||
r($kanban->getSpaceByIdTest($spaceIDList[5])) && p('name,type,owner,status') && e('0'); // 测试查询不存在的空间信息
|
||||
r($kanban->getSpaceByIdTest($spaceIDList[5])) && p('') && e('0'); // 测试查询不存在的空间信息
|
||||
Reference in New Issue
Block a user