Finish task#3239 项目需求可以拖动排序,cost:4 left:0
This commit is contained in:
@@ -530,7 +530,7 @@ class project extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function story($projectID = 0, $orderBy = '', $type = 'byModule', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1)
|
||||
public function story($projectID = 0, $orderBy = 'order', $type = 'byModule', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1)
|
||||
{
|
||||
/* Load these models. */
|
||||
$this->loadModel('story');
|
||||
@@ -1991,6 +1991,32 @@ class project extends control
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Story sort.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function storySort($projectID)
|
||||
{
|
||||
$idList = explode(',', trim($this->post->storys, ','));
|
||||
$orderBy = $this->post->orderBy;
|
||||
|
||||
$stories = $this->dao->select('story,`order`')->from(TABLE_PROJECTSTORY)->alias('t1')
|
||||
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
|
||||
->where('t1.story')->in($idList)
|
||||
->andWhere('t1.project')->eq($projectID)
|
||||
->orderBy($orderBy)
|
||||
->fetchPairs('order', 'story');
|
||||
foreach($stories as $order => $id)
|
||||
{
|
||||
$newID = array_shift($idList);
|
||||
if($id == $newID) continue;
|
||||
$this->dao->update(TABLE_PROJECTSTORY)->set('`order`')->eq($order)->where('story')->eq($newID)->andWhere('project')->eq($projectID)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* All project.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user