+ add pager feature to project's stories.

* fix the error of back to list in view page.
This commit is contained in:
wangchunsheng
2009-10-27 07:30:19 +00:00
parent 87b500f1a4
commit 5ccf5f2c0c
2 changed files with 11 additions and 8 deletions

View File

@@ -93,14 +93,13 @@ class storyModel extends model
}
/* 获得某一个项目相关的所有需求列表。*/
function getProjectStories($project = 0)
function getProjectStories($projectID = 0, $orderBy='id|desc', $pager = null)
{
$project = (int)$project;
if($project == 0) return false;
$sql = "SELECT * FROM " . TABLE_PROJECTSTORY . " AS T1 LEFT JOIN " . TABLE_STORY . " AS T2 ON T1.story = T2.id
WHERE T1.project = '$project'";
$stmt = $this->dbh->query($sql);
return $stmt->fetchAll();
return $this->dao->select('t1.*, t2.*')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->where('t1.project')->eq((int)$projectID)
->orderBy($orderBy)
->page($pager)->fetchAll();
}
/* 获得某一个项目相关的需求id=>title的列表。*/

View File

@@ -168,7 +168,11 @@
<div class='a-center' style='font-size:16px; font-weight:bold'>
<?php
if(common::hasPriv('story', 'edit')) echo html::a($this->createLink('story', 'edit', "storyID=$story->id"), $lang->story->buttonEdit);
echo html::a($this->createLink('product', 'browse', "productID=$story->product&moduleID=$story->module"), $lang->story->buttonToList);
if(common::hasPriv('product', 'browse'))
{
if($app->session->storyList != '') echo html::a($app->session->storyList, $lang->story->buttonToList);
else echo html::a($this->createLink('product', 'browse', "productID=$story->product&moduleID=$story->module"), $lang->story->buttonToList);
}
?>
</div>
</fieldset>